AnimatLab  2
Test
ThreadedModule.h
1 
7 #pragma once
8 
9 namespace AnimatSim
10 {
11  namespace Behavior
12  {
21  class ANIMAT_PORT ThreadedModule : public NeuralModule
22  {
23  protected:
26 
29 
32 
35 
38 
41 
44 
45  //Temporary if def to prevent this from showing up in ManagedAnimatTools. Will get rid of this
46  //once I get rid of that library.
47  #ifndef STD_DO_NOT_ADD_BOOST
48  boost::thread m_Thread;
50 
52  boost::interprocess::interprocess_mutex m_WaitForSetupMutex;
53 
55  boost::interprocess::interprocess_condition m_WaitForSetupCond;
56  #endif
57 
60 
61  virtual void StartThread();
62  virtual void ProcessThread();
63  virtual void ExitThread();
64  virtual void CloseThread();
65 
66  virtual void WaitWhilePaused();
67  virtual void WaitTillPaused();
68  virtual void WaitForThreadNotifyReady();
69  virtual void StartPause();
70  virtual void ExitPause();
71 
72  public:
73  ThreadedModule(void);
74  virtual ~ThreadedModule(void);
75 
76  static ThreadedModule *CastToDerived(AnimatBase *lpBase) {return static_cast<ThreadedModule*>(lpBase);}
77 
78  virtual void PauseThread(bool bVal);
79  virtual bool PauseThread();
80  virtual bool ThreadPaused();
81 
82  virtual float StepThreadDuration();
83 
84  virtual void SetupThread();
85  virtual void StepThread();
86  virtual void ShutdownThread();
87 
88  virtual float *GetDataPointer(const std::string &strDataType);
89  virtual void QueryProperties(CStdPtrArray<TypeProperty> &aryProperties);
90  };
91  }
92 }
boost::interprocess::interprocess_condition m_WaitForSetupCond
Condition used to determine when the IO is setup.
bool m_bWaitingForThreadNotify
Used to signal to the IO thread that we are waiting for their return signal.
Root namespace for the base simulation library for AnimatLab.
A Threaded neural module base class.
bool m_bPauseThread
Set to true to pause the thread processing. Set back to false to resume it.
bool m_bSetupStarted
Set to true once the thread begins its setup.
bool m_bThreadProcessing
True while the io thread processing loop is going on.
Animat base class.
Definition: AnimatBase.h:36
bool m_bStopThread
Flags the thread processing loop to exit.
boost::interprocess::interprocess_mutex m_WaitForSetupMutex
Mutex responsible for waiting until the IO is finished setting up.
bool m_bSetupComplete
Set to true once the thread is setup correctly.
bool m_bThreadPaused
Is set to true once the thread loop is paused.
float m_fltStepThreadDuration
The time it takes to perform a step of the IO for all parts in this control.