CFx SDK Documentation  2020SP3
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ThreadsCounter Class Reference

#include <ThreadsCounter.h>

Public Types

enum  ThreadAttributes {
  kNoAttributes = 0, kMtLoadingAttributes = (1 << 0), kMtRegenAttributes = (1 << 1), kStRegenAttributes = (1 << 2),
  kMtDisplayAttributes = (1 << 3), kMtModelerAttributes = (1 << 4), kAllAttributes = 0xFFFFFFFF
}
 

Public Member Functions

 operator bool () const
 
bool addReactor (ThreadsCounterReactor *pReactor)
 
bool removeReactor (ThreadsCounterReactor *pReactor)
 
bool hasReactor (ThreadsCounterReactor *pReactor) const
 
int nReactors () const
 
void setThreadPoolService (OdRxThreadPoolService *pService)
 
OdRxThreadPoolServicegetThreadPoolService ()
 
void increase (unsigned nThreads, const unsigned *aThreads, unsigned nThreadAttributes=ThreadsCounter::kNoAttributes)
 
void decrease (unsigned nThreads, const unsigned *aThreads)
 
void startThread ()
 
void stopThread ()
 
bool hasThread (unsigned nThreadId, unsigned *pThreadAttributes)
 
void setMainThreadFunc (ExecuteMainThreadFunc func)
 
ExecuteMainThreadFunc getMainThreadFunc ()
 

Protected Member Functions

 ThreadsCounter ()
 
 ~ThreadsCounter ()
 
void increaseProc (unsigned nThreads, const unsigned *aThreads, unsigned nThreadAttributes)
 
void decreaseProc (unsigned nThreads, const unsigned *aThreads)
 
void startThreadProc ()
 
void stopThreadProc ()
 
bool hasThreadProc (unsigned nThreadId, unsigned *pThreadAttributes)
 

Protected Attributes

OdRefCounter m_count
 
ExecuteMainThreadFunc m_mainThreadFunc
 
OdRxThreadPoolServicem_threadPool
 

Detailed Description

Corresponding C++ library: Root

<group Other_Classes>

Definition at line 155 of file ThreadsCounter.h.

Member Enumeration Documentation

◆ ThreadAttributes

Enumerator
kNoAttributes 
kMtLoadingAttributes 
kMtRegenAttributes 
kStRegenAttributes 
kMtDisplayAttributes 
kMtModelerAttributes 
kAllAttributes 

Definition at line 158 of file ThreadsCounter.h.

Constructor & Destructor Documentation

◆ ThreadsCounter()

ThreadsCounter::ThreadsCounter ( )
inlineprotected

Definition at line 170 of file ThreadsCounter.h.

◆ ~ThreadsCounter()

ThreadsCounter::~ThreadsCounter ( )
inlineprotected

Definition at line 174 of file ThreadsCounter.h.

Member Function Documentation

◆ addReactor()

bool ThreadsCounter::addReactor ( ThreadsCounterReactor pReactor)

Adds reactor into threads counter reactors chain.

Parameters
pReactor[in] Function to add into reactors chain.
Returns
Returns true if reactor added; returns false if reactor already available in chain.

◆ decrease()

void ThreadsCounter::decrease ( unsigned  nThreads,
const unsigned *  aThreads 
)
inline

Decrease execution threads count.

Parameters
nThreads[in] Count of threads in aThreads array.
aThreads[in] Thread ID's array.

Definition at line 230 of file ThreadsCounter.h.

◆ decreaseProc()

void ThreadsCounter::decreaseProc ( unsigned  nThreads,
const unsigned *  aThreads 
)
protected

◆ getMainThreadFunc()

ExecuteMainThreadFunc ThreadsCounter::getMainThreadFunc ( )
inline

Returns function for execution in the external main thread.

Definition at line 258 of file ThreadsCounter.h.

◆ getThreadPoolService()

OdRxThreadPoolService* ThreadsCounter::getThreadPoolService ( )
inline

Returns pointer for current OdRxThreadPoolService.

Definition at line 215 of file ThreadsCounter.h.

◆ hasReactor()

bool ThreadsCounter::hasReactor ( ThreadsCounterReactor pReactor) const

Checks whether reactor is available in threads counter reactors chain.

Parameters
pReactor[in] Reactor to check.

◆ hasThread()

bool ThreadsCounter::hasThread ( unsigned  nThreadId,
unsigned *  pThreadAttributes 
)
inline

Returns true if increase called for specified thread. Optionally returns thread attributes.

Parameters
nThreadId[in] Requested thread ID.
pThreadAttributes[out] If set takes requested thread attributes.

Definition at line 247 of file ThreadsCounter.h.

◆ hasThreadProc()

bool ThreadsCounter::hasThreadProc ( unsigned  nThreadId,
unsigned *  pThreadAttributes 
)
protected

◆ increase()

void ThreadsCounter::increase ( unsigned  nThreads,
const unsigned *  aThreads,
unsigned  nThreadAttributes = ThreadsCounter::kNoAttributes 
)
inline

Increase execution threads count.

Parameters
nThreads[in] Count of threads in aThreads array.
aThreads[in] Thread ID's array.
nThreadAttributes[in] Set of attributes for running threads.

Definition at line 223 of file ThreadsCounter.h.

◆ increaseProc()

void ThreadsCounter::increaseProc ( unsigned  nThreads,
const unsigned *  aThreads,
unsigned  nThreadAttributes 
)
protected

◆ nReactors()

int ThreadsCounter::nReactors ( ) const

Returns count of reactors in threads counter reactors chain.

◆ operator bool()

ThreadsCounter::operator bool ( ) const
inline

Returns true if ThreadsCounter has registered threads and Teigha works in multithreading mode.

Definition at line 179 of file ThreadsCounter.h.

◆ removeReactor()

bool ThreadsCounter::removeReactor ( ThreadsCounterReactor pReactor)

Removes reactor from threads counter reactors chain.

Parameters
pReactor[in] Reactor to remove from reactors chain.
Returns
Returns true if reactor removed; returns false if reactor isn't available in chain.

◆ setMainThreadFunc()

void ThreadsCounter::setMainThreadFunc ( ExecuteMainThreadFunc  func)
inline

Setup function for execution in the external main thread.

Parameters
func[in] Function for execution in the main thread.

Definition at line 254 of file ThreadsCounter.h.

◆ setThreadPoolService()

void ThreadsCounter::setThreadPoolService ( OdRxThreadPoolService pService)
inline

Save pointer for current OdRxThreadPoolService.

Parameters
pServices[in] OdRxThreadPoolService pointer.

Definition at line 211 of file ThreadsCounter.h.

◆ startThread()

void ThreadsCounter::startThread ( )
inline

Called when execution thread started.

Definition at line 236 of file ThreadsCounter.h.

◆ startThreadProc()

void ThreadsCounter::startThreadProc ( )
protected

◆ stopThread()

void ThreadsCounter::stopThread ( )
inline

Called when execution thread stopped.

Definition at line 240 of file ThreadsCounter.h.

◆ stopThreadProc()

void ThreadsCounter::stopThreadProc ( )
protected

Member Data Documentation

◆ m_count

OdRefCounter ThreadsCounter::m_count
protected

Definition at line 268 of file ThreadsCounter.h.

◆ m_mainThreadFunc

ExecuteMainThreadFunc ThreadsCounter::m_mainThreadFunc
protected

Definition at line 269 of file ThreadsCounter.h.

◆ m_threadPool

OdRxThreadPoolService* ThreadsCounter::m_threadPool
protected

Definition at line 270 of file ThreadsCounter.h.


The documentation for this class was generated from the following file: