xmsinterp  1.0
ThreadLoop.h
Go to the documentation of this file.
1 #pragma once
2 //------------------------------------------------------------------------------
7 //------------------------------------------------------------------------------
8 
9 //----- Included files ---------------------------------------------------------
10 #include <xmscore/misc/base_macros.h> // XM_DISALLOW_COPY_AND_ASSIGN
12 
13 //----- Forward declarations ---------------------------------------------------
14 
15 //----- Namespace declaration --------------------------------------------------
16 namespace xms
17 {
18 //----- Constants / Enumerations -----------------------------------------------
19 
20 //----- Structs / Classes ------------------------------------------------------
24 {
25 public:
26  ThreadLoop();
27  virtual ~ThreadLoop();
28 
29  void SetStartNumIterCnt(int a_startIdx, int a_numIter, int* a_cntPtr);
30  void DoWork();
31 
34  virtual BSHP<ThreadLoop> CreateForNewThread() = 0;
35 
36 protected:
37  int CurrIdx();
38 
39 private:
40  virtual void Worker() = 0;
41 
42  class impl;
43  BSHP<impl> m_p;
44 
46 };
47 //----- Function prototypes ----------------------------------------------------
48 
49 } // namespace xms
void DoWork()
Executes the work of the thread.
Definition: ThreadLoop.cpp:96
int CurrIdx()
Returns the current index of the thread.
Definition: ThreadLoop.cpp:89
virtual BSHP< ThreadLoop > CreateForNewThread()=0
Overridden by derived class.
XM_DISALLOW_COPY_AND_ASSIGN(ThreadLoop)
prevent compiler generated copy/assign
Thread worker class.
Definition: ThreadLoop.h:23
BSHP< impl > m_p
implementation class
Definition: ThreadLoop.h:42
Implementation of ThreadLoop.
Definition: ThreadLoop.cpp:34
void SetStartNumIterCnt(int a_startIdx, int a_numIter, int *a_cntPtr)
Sets up the thread worker.
Definition: ThreadLoop.cpp:79
virtual void Worker()=0
Overridden by derived class.