Game Development Reference
In-Depth Information
PAUSED, // initialized but paused
// Dead processes
SUCCEEDED, // completed successfully
FAILED,
// failed to complete
ABORTED,
// aborted; may not have started
};
private:
State m_state; // the current state of the process
StrongProcessPtr m_pChild; // the child process, if any
public:
// construction
Process(void);
virtual
˜
Process(void);
protected:
// interface; these functions should be overridden by the subclass as needed
virtual void VOnInit(void) { m_state = RUNNING; }
virtual void VOnUpdate(unsigned long deltaMs) = 0;
virtual void VOnSuccess(void) { }
virtual void VOnFail(void) { }
virtual void VOnAbort(void) { }
public:
// Functions for ending the process.
inline void Succeed(void);
inline void Fail(void);
// pause
inline void Pause(void);
inline void UnPause(void);
// accessors
State GetState(void) const { return m_state; }
bool IsAlive(void) const {return (m_state == RUNNING || m_state == PAUSED);}
bool IsDead(void) const
{
return (m_state == SUCCEEDED || m_state == FAILED || m_state == ABORTED);
}
bool IsRemoved(void) const { return (m_state == REMOVED); }
bool IsPaused(void) const { return m_state == PAUSED; }
// child functions
inline void AttachChild(StrongProcessPtr pChild);
StrongProcessPtr RemoveChild(void); // releases ownership of the child
StrongProcessPtr PeekChild(void) { return m_pChild; } // doesn
t release
// ownership of child
'
Search WWH ::




Custom Search