AceSmartSoft API Documentation
Public Member Functions | List of all members
SmartACE::SmartCVwithMemory Class Reference

#include <smartCondVar.hh>

Public Member Functions

 SmartCVwithMemory ()
 constructor More...
 
 ~SmartCVwithMemory ()
 destructor More...
 
 SmartCVwithMemory (const SmartCVwithMemory &)
 copy constructor More...
 
SmartCVwithMemoryoperator= (const SmartCVwithMemory &)
 copy assignment More...
 
void blockingUser (const bool)
 
void blockingPattern (const bool)
 
void blockingComponent (const bool)
 
void signal ()
 
Smart::StatusCode wait (const SmartTimeValue &timeout=SmartTimeValue::zero)
 
void reset ()
 

Detailed Description

Condition variable with memory

The condition variable is used to avoid active waiting. It memorizes whether the condition variable has been signalled since the last wait. It is used within the queryPattern to memorize whether an answer has been received for the pending request.

Using this condition variable makes sure that no signal and therefore no answer is missed. One otherwise would eventually block infinitely on a condition variable waiting for the next signal which will never be given since each request has exactly one response.

Condition variable discriminates between blockingPattern and blockingUser. Both can enforce non-blocking. The pattern uses the non-blocking mode to abort blocking waits when getting disconnected for example. The user can enforce non-blocking mode to abort blocking waits to for example continue with processing without awaiting the answer.

One could also implement a counting blocking indicator with acquire/release member functions. It is however less error prone from the user view not to be forced to have a matching number of acquire/release calls and we therefore implemented separate flags for the pattern internal use and the user.

Signalling this condition variable sets the signalled flag. The wait() member function returns immediately with SMART_OK in case the signalled flag is set and consumes it. If it has not been signalled so far, it checks the blocking flags. It returns immediately with SMART_CANCELLED in case of at least one flag enforces non-blocking mode. Otherwise, it waits for either a signal or for being cancelled.

Constructor & Destructor Documentation

◆ SmartCVwithMemory() [1/2]

SmartACE::SmartCVwithMemory::SmartCVwithMemory ( )

constructor

◆ ~SmartCVwithMemory()

SmartACE::SmartCVwithMemory::~SmartCVwithMemory ( )

destructor

◆ SmartCVwithMemory() [2/2]

SmartACE::SmartCVwithMemory::SmartCVwithMemory ( const SmartCVwithMemory )

copy constructor

Member Function Documentation

◆ blockingComponent()

void SmartACE::SmartCVwithMemory::blockingComponent ( const bool  )

◆ blockingPattern()

void SmartACE::SmartCVwithMemory::blockingPattern ( const bool  )

◆ blockingUser()

void SmartACE::SmartCVwithMemory::blockingUser ( const bool  )

◆ operator=()

SmartCVwithMemory& SmartACE::SmartCVwithMemory::operator= ( const SmartCVwithMemory )

copy assignment

◆ reset()

void SmartACE::SmartCVwithMemory::reset ( )

◆ signal()

void SmartACE::SmartCVwithMemory::signal ( )

◆ wait()

Smart::StatusCode SmartACE::SmartCVwithMemory::wait ( const SmartTimeValue timeout = SmartTimeValue::zero)

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