Kernel Class Reference

#include <Kernel.h>

List of all members.

Public Member Functions

 Kernel ()
 ~Kernel ()
void reset ()
ProcId addProcess (Process *proc)
ProcId addProcessExec (Process *proc)
void removeProcess (Process *proc)
bool runProcesses ()
ProcessgetProcess (ProcId pid)
ProcId assignPID (Process *proc)
void setNextProcess (Process *proc)
ProcessgetRunningProcess () const
uint32 getNumProcesses (ObjId objid, uint16 processtype)
ProcessfindProcess (ObjId objid, uint16 processtype)
void killProcesses (ObjId objid, uint16 processtype, bool fail)
void killProcessesNotOfType (ObjId objid, uint16 processtype, bool fail)
ProcessIter getProcessBeginIterator ()
ProcessIter getProcessEndIterator ()
void kernelStats ()
void processTypes ()
void save (ODataSource *ods)
bool load (IDataSource *ids, uint32 version)
void pause ()
void unpause ()
bool isPaused () const
void setFrameByFrame (bool fbf)
bool isFrameByFrame () const
void addProcessLoader (std::string classname, ProcessLoadFunc func)
uint32 getFrameNum () const
 INTRINSIC (I_getNumProcesses)
 INTRINSIC (I_resetRef)

Static Public Member Functions

static Kernelget_instance ()
static void ConCmd_processTypes (const Console::ArgvType &argv)
static void ConCmd_listProcesses (const Console::ArgvType &argv)
static void ConCmd_processInfo (const Console::ArgvType &argv)
static void ConCmd_toggleFrameByFrame (const Console::ArgvType &argv)
static void ConCmd_advanceFrame (const Console::ArgvType &argv)

Private Member Functions

ProcessloadProcess (IDataSource *ids, uint32 version)

Private Attributes

std::list< Process * > processes
idManpIDs
std::list< Process * >::iterator current_process
std::map< std::string, ProcessLoadFuncprocessloaders
bool loading
uint32 framenum
unsigned int paused
bool framebyframe
Processrunningprocess

Static Private Attributes

static Kernelkernel = 0


Detailed Description

Definition at line 35 of file Kernel.h.


Constructor & Destructor Documentation

Kernel::Kernel (  ) 

Definition at line 34 of file Kernel.cpp.

References con, current_process, framebyframe, framenum, kernel, MM_INFO, paused, pIDs, Console::Print(), processes, and runningprocess.

Kernel::~Kernel (  ) 

Definition at line 48 of file Kernel.cpp.

References con, kernel, MM_INFO, pIDs, Console::Print(), and reset().


Member Function Documentation

ProcId Kernel::addProcess ( Process proc  ) 

Definition at line 88 of file Kernel.cpp.

References perr, Process::pid, processes, and setNextProcess().

Referenced by Object::callUsecode(), CurrentMap::createEggHatcher(), Gump::CreateNotifier(), Pentagram::AudioMixer::createProcesses(), Actor::cSetActivity(), Item::destroy(), MainActor::die(), Actor::die(), Actor::doAnim(), ActorAnimProcess::doHitSpecial(), ActorAnimProcess::doSpecial(), ContainerGump::DropItem(), MainActor::ensureGravityProcess(), Item::ensureGravityProcess(), Item::explode(), InverterProcess::invertScreen(), GUIApp::newGame(), GameMapGump::OnMouseClick(), Actor::receiveHit(), GUIApp::resetEngine(), LoiterProcess::run(), GrantPeaceProcess::run(), CombatProcess::run(), AvatarDeathProcess::run(), ActorBarkNotifyProcess::run(), CameraProcess::SetCameraProcess(), Actor::setInCombat(), U8Game::startInitialUsecode(), QuickAvatarMoverProcess::startMover(), ConApp::startup(), ActorAnimProcess::terminate(), and CombatProcess::waitForTarget().

ProcId Kernel::addProcessExec ( Process proc  ) 

add a process and run it immediately

Returns:
pid of process

Definition at line 110 of file Kernel.cpp.

References Process::flags, framenum, perr, Process::pid, Process::PROC_ACTIVE, processes, Process::run(), and runningprocess.

Referenced by UCMachine::execProcess().

void Kernel::addProcessLoader ( std::string  classname,
ProcessLoadFunc  func 
) [inline]

Definition at line 94 of file Kernel.h.

References processloaders.

Referenced by GUIApp::startup().

ProcId Kernel::assignPID ( Process proc  ) 

Definition at line 77 of file Kernel.cpp.

References idMan::getNewID(), loading, Process::pid, and pIDs.

Referenced by Process::Process().

void Kernel::ConCmd_advanceFrame ( const Console::ArgvType argv  )  [static]

"Kernel::advanceFrame" console command

Definition at line 331 of file Kernel.cpp.

References get_instance(), isFrameByFrame(), kernel, pout, and unpause().

Referenced by GUIApp::GUIApp(), and GUIApp::~GUIApp().

void Kernel::ConCmd_listProcesses ( const Console::ArgvType argv  )  [static]

"Kernel::listProcesses" console command

Definition at line 275 of file Kernel.cpp.

References get_instance(), kernel, pout, and processes.

Referenced by GUIApp::GUIApp(), and GUIApp::~GUIApp().

void Kernel::ConCmd_processInfo ( const Console::ArgvType argv  )  [static]

"Kernel::processInfo" console command

Definition at line 300 of file Kernel.cpp.

References Process::dumpInfo(), get_instance(), getProcess(), kernel, and pout.

Referenced by GUIApp::GUIApp(), and GUIApp::~GUIApp().

void Kernel::ConCmd_processTypes ( const Console::ArgvType argv  )  [static]

"Kernel::processTypes" console command

Definition at line 270 of file Kernel.cpp.

References get_instance(), and processTypes().

Referenced by GUIApp::GUIApp(), and GUIApp::~GUIApp().

void Kernel::ConCmd_toggleFrameByFrame ( const Console::ArgvType argv  )  [static]

"Kernel::toggleFrameByFrame" console command

Definition at line 319 of file Kernel.cpp.

References get_instance(), isFrameByFrame(), kernel, pause(), pout, setFrameByFrame(), and unpause().

Referenced by GUIApp::GUIApp(), and GUIApp::~GUIApp().

Process * Kernel::findProcess ( ObjId  objid,
uint16  processtype 
)

find a (any) process of the given objid, processtype

Definition at line 359 of file Kernel.cpp.

References processes.

Referenced by Actor::getCombatProcess().

static Kernel* Kernel::get_instance (  )  [inline, static]

Definition at line 40 of file Kernel.h.

References kernel.

Referenced by CurrentMap::addItem(), CurrentMap::addItemToEnd(), UCMachine::assignPointer(), Object::callUsecode(), CurrentMap::clear(), Object::clearObjId(), SliderGump::Close(), ModalGump::Close(), Item::collideMove(), ConCmd_advanceFrame(), GUIApp::ConCmd_engineStats(), ConCmd_listProcesses(), ConCmd_processInfo(), ConCmd_processTypes(), ConCmd_toggleFrameByFrame(), CurrentMap::createEggHatcher(), Gump::CreateNotifier(), Pentagram::AudioMixer::createProcesses(), Actor::cSetActivity(), UCMachine::dereferencePointer(), Item::destroy(), MainActor::die(), Actor::die(), Actor::doAnim(), ActorAnimProcess::doHitSpecial(), ActorAnimProcess::doSpecial(), ContainerGump::DropItem(), MainActor::ensureGravityProcess(), Item::ensureGravityProcess(), UCMachine::execProcess(), Item::explode(), Actor::getCombatProcess(), GUIApp::getGameTimeInSeconds(), GameMapGump::GetLocationOfItem(), Gump::GetNotifyProcess(), AvatarMoverProcess::handleNormalMode(), ActorAnimProcess::init(), ModalGump::InitGump(), InverterProcess::invertScreen(), AvatarMoverProcess::jump(), Actor::killAllButCombatProcesses(), Actor::killAllButFallAnims(), Item::leaveFastArea(), GUIApp::load(), GameMapGump::OnMouseClick(), GameMapGump::PaintThis(), ContainerGump::PaintThis(), Process::Process(), UCMachine::ptrToObject(), Actor::receiveHit(), GUIApp::resetEngine(), StartU8Process::run(), LoiterProcess::run(), GrantPeaceProcess::run(), CombatProcess::run(), BarkGump::Run(), AvatarMoverProcess::run(), AvatarDeathProcess::run(), ActorBarkNotifyProcess::run(), ActorAnimProcess::run(), GUIApp::save(), CameraProcess::SetCameraProcess(), Actor::setInCombat(), GUIApp::shutdownGame(), U8Game::startInitialUsecode(), QuickAvatarMoverProcess::startMover(), World::switchMap(), Process::terminate(), GravityProcess::terminate(), ActorAnimProcess::terminate(), QuickAvatarMoverProcess::terminateMover(), CombatProcess::turnToDirection(), AvatarMoverProcess::turnToDirection(), Process::waitFor(), CombatProcess::waitForTarget(), Process::wakeUp(), and CurrentMap::writeback().

uint32 Kernel::getFrameNum (  )  const [inline]

Definition at line 97 of file Kernel.h.

References framenum.

Referenced by ActorAnimProcess::init(), GUIApp::load(), GameMapGump::PaintThis(), ContainerGump::PaintThis(), GUIApp::resetEngine(), GUIApp::run(), ActorAnimProcess::run(), GUIApp::save(), GUIApp::shutdownGame(), and ActorAnimProcess::terminate().

uint32 Kernel::getNumProcesses ( ObjId  objid,
uint16  processtype 
)

Definition at line 340 of file Kernel.cpp.

References processes.

Referenced by ConApp::run().

Process * Kernel::getProcess ( ProcId  pid  ) 

Definition at line 240 of file Kernel.cpp.

References processes.

Referenced by CurrentMap::addItem(), CurrentMap::addItemToEnd(), UCMachine::assignPointer(), CurrentMap::clear(), SliderGump::Close(), Item::collideMove(), ConCmd_processInfo(), CurrentMap::createEggHatcher(), UCMachine::dereferencePointer(), MainActor::die(), Actor::die(), MainActor::ensureGravityProcess(), Item::ensureGravityProcess(), UCMachine::execProcess(), AvatarMoverProcess::handleNormalMode(), Item::leaveFastArea(), GUIApp::load(), UCMachine::ptrToObject(), Actor::receiveHit(), StartU8Process::run(), LoiterProcess::run(), Process::terminate(), GravityProcess::terminate(), QuickAvatarMoverProcess::terminateMover(), CombatProcess::turnToDirection(), AvatarMoverProcess::turnToDirection(), Process::waitFor(), CombatProcess::waitForTarget(), and CurrentMap::writeback().

ProcessIter Kernel::getProcessBeginIterator (  )  [inline]

get an iterator of the process list.

Definition at line 78 of file Kernel.h.

References processes.

Referenced by Actor::killAllButCombatProcesses(), and Actor::killAllButFallAnims().

ProcessIter Kernel::getProcessEndIterator (  )  [inline]

Definition at line 79 of file Kernel.h.

References processes.

Referenced by Actor::killAllButCombatProcesses(), and Actor::killAllButFallAnims().

Process* Kernel::getRunningProcess (  )  const [inline]

Definition at line 57 of file Kernel.h.

References runningprocess.

Kernel::INTRINSIC ( I_resetRef   ) 

Kernel::INTRINSIC ( I_getNumProcesses   ) 

bool Kernel::isFrameByFrame (  )  const [inline]

Definition at line 92 of file Kernel.h.

References framebyframe.

Referenced by ConCmd_advanceFrame(), and ConCmd_toggleFrameByFrame().

bool Kernel::isPaused (  )  const [inline]

Definition at line 89 of file Kernel.h.

References paused.

Referenced by GUIApp::run().

void Kernel::kernelStats (  ) 

Definition at line 250 of file Kernel.cpp.

References pout, and processes.

Referenced by GUIApp::ConCmd_engineStats().

void Kernel::killProcesses ( ObjId  objid,
uint16  processtype,
bool  fail 
)

kill (fail) processes of a certain object and/or of a certain type

Parameters:
objid the object, or 0 for any object (except objid 0)
type the type, or 6 for any type
fail if true, fail the processes instead of terminating them

Definition at line 379 of file Kernel.cpp.

References Process::PROC_TERM_DEFERRED, Process::PROC_TERMINATED, and processes.

Referenced by Object::clearObjId(), Actor::die(), Actor::setInCombat(), and GravityProcess::terminate().

void Kernel::killProcessesNotOfType ( ObjId  objid,
uint16  processtype,
bool  fail 
)

kill (fail) processes of a certain object and not of a certain type

Parameters:
objid the object, or 0 for any object (except objid 0)
type the type not to kill
fail if true, fail the processes instead of terminating them

Definition at line 398 of file Kernel.cpp.

References Process::PROC_TERM_DEFERRED, Process::PROC_TERMINATED, and processes.

Referenced by Actor::killAllButFallAnims(), and World::switchMap().

bool Kernel::load ( IDataSource ids,
uint32  version 
)

Definition at line 428 of file Kernel.cpp.

References framenum, idMan::load(), loadProcess(), pIDs, processes, and IDataSource::read4().

Referenced by GUIApp::loadGame().

Process * Kernel::loadProcess ( IDataSource ids,
uint32  version 
) [private]

Definition at line 445 of file Kernel.cpp.

References loading, perr, processloaders, IDataSource::read(), and IDataSource::read2().

Referenced by load().

void Kernel::pause (  )  [inline]

Definition at line 87 of file Kernel.h.

References paused.

Referenced by ConCmd_toggleFrameByFrame(), ModalGump::InitGump(), runProcesses(), and GUIApp::startDragging().

void Kernel::processTypes (  ) 

Definition at line 256 of file Kernel.cpp.

References pout, and processes.

Referenced by ConCmd_processTypes().

void Kernel::removeProcess ( Process proc  ) 

Definition at line 136 of file Kernel.cpp.

References idMan::clearID(), Process::flags, perr, Process::pid, pIDs, and processes.

void Kernel::reset (  ) 

Definition at line 58 of file Kernel.cpp.

References idMan::clearAll(), con, current_process, framebyframe, MM_INFO, paused, pIDs, Console::Print(), processes, and runningprocess.

Referenced by GUIApp::resetEngine(), GUIApp::shutdownGame(), and ~Kernel().

bool Kernel::runProcesses (  ) 

Definition at line 163 of file Kernel.cpp.

References idMan::clearID(), current_process, framebyframe, framenum, pause(), paused, perr, pIDs, Process::PROC_RUNPAUSED, Process::PROC_TERM_DEFERRED, Process::PROC_TERMINATED, processes, Process::run(), and runningprocess.

Referenced by GUIApp::run(), and ConApp::run().

void Kernel::save ( ODataSource ods  ) 

Definition at line 417 of file Kernel.cpp.

References framenum, pIDs, processes, idMan::save(), and ODataSource::write4().

Referenced by GUIApp::saveGame().

void Kernel::setFrameByFrame ( bool  fbf  )  [inline]

Definition at line 91 of file Kernel.h.

References framebyframe.

Referenced by ConCmd_toggleFrameByFrame().

void Kernel::setNextProcess ( Process proc  ) 

Definition at line 214 of file Kernel.cpp.

References current_process, Process::flags, Process::PROC_ACTIVE, and processes.

Referenced by addProcess(), and Process::wakeUp().

void Kernel::unpause (  )  [inline]

Definition at line 88 of file Kernel.h.

References paused.

Referenced by ModalGump::Close(), ConCmd_advanceFrame(), ConCmd_toggleFrameByFrame(), and GUIApp::stopDragging().


Member Data Documentation

std::list<Process*>::iterator Kernel::current_process [private]

Definition at line 119 of file Kernel.h.

Referenced by Kernel(), reset(), runProcesses(), and setNextProcess().

bool Kernel::framebyframe [private]

Definition at line 127 of file Kernel.h.

Referenced by isFrameByFrame(), Kernel(), reset(), runProcesses(), and setFrameByFrame().

uint32 Kernel::framenum [private]

Definition at line 125 of file Kernel.h.

Referenced by addProcessExec(), getFrameNum(), Kernel(), load(), runProcesses(), and save().

Kernel * Kernel::kernel = 0 [static, private]

Definition at line 131 of file Kernel.h.

Referenced by ConCmd_advanceFrame(), ConCmd_listProcesses(), ConCmd_processInfo(), ConCmd_toggleFrameByFrame(), get_instance(), Kernel(), QuickAvatarMoverProcess::terminateMover(), and ~Kernel().

bool Kernel::loading [private]

Definition at line 123 of file Kernel.h.

Referenced by assignPID(), and loadProcess().

unsigned int Kernel::paused [private]

Definition at line 126 of file Kernel.h.

Referenced by isPaused(), Kernel(), pause(), reset(), runProcesses(), and unpause().

idMan* Kernel::pIDs [private]

Definition at line 117 of file Kernel.h.

Referenced by assignPID(), Kernel(), load(), removeProcess(), reset(), runProcesses(), save(), and ~Kernel().

std::list<Process*> Kernel::processes [private]

Definition at line 116 of file Kernel.h.

Referenced by addProcess(), addProcessExec(), ConCmd_listProcesses(), findProcess(), getNumProcesses(), getProcess(), getProcessBeginIterator(), getProcessEndIterator(), Kernel(), kernelStats(), killProcesses(), killProcessesNotOfType(), load(), processTypes(), removeProcess(), reset(), runProcesses(), save(), and setNextProcess().

std::map<std::string, ProcessLoadFunc> Kernel::processloaders [private]

Definition at line 121 of file Kernel.h.

Referenced by addProcessLoader(), and loadProcess().

Process* Kernel::runningprocess [private]

Definition at line 129 of file Kernel.h.

Referenced by addProcessExec(), getRunningProcess(), Kernel(), reset(), and runProcesses().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:29:30 2007 for pentagram by  doxygen 1.4.7