GlobalObjects
Loading...
Searching...
No Matches
glo::CommunicaterThread Class Reference

A CommunicaterThread accepts requests for its TableReaderInterface. More...

#include <GloCommunicaterThread.h>

Inheritance diagram for glo::CommunicaterThread:

Public Member Functions

 CommunicaterThread (SchemaInterface *pSchema, RealIndexPool *pRealIndexPool)
 
 ~CommunicaterThread ()
 
virtual void cancel () override
 
void clearMsgQueue ()
 
TableReaderInterfacegetReader () const
 
void takeOrder (OrderMsg *pOrderMsg)
 
- Public Member Functions inherited from eut::RepeatingThread
 RepeatingThread ()
 
virtual ~RepeatingThread ()
 
virtual void finishBreak ()
 
int getBreakCounter ()
 
bool isInExclusiveAccess () const
 
void setExclusiveAccess ()
 
void signalInput ()
 
virtual int start ()
 
RepeatingThread::STATUS status () const
 
virtual void takeABreak ()
 
bool testCancel ()
 
void unsetExclusiveAccess ()
 
void waitForInput ()
 

Protected Member Functions

void checkStored (OrderMsg *pOrderMsg)
 
void closeAllSet (OrderMsg *pOrderMsg)
 
void getAnyIndexedObjIdListFromAllSet (OrderMsg *pOrderMsg, IndexQueryBaseStruct *pGloIndexQueryBaseStruct)
 
void getIndexedObjIdListByComparingFromAllSet (OrderMsg *pOrderMsg)
 
void getIndexedObjIdListByRangeFromAllSet (OrderMsg *pOrderMsg)
 
void getIndexedObjIdListBySearchValueFromAllSet (OrderMsg *pOrderMsg)
 
void getObjectData (OrderMsg *pOrderMsg)
 
void getObjIdFromAllSet (OrderMsg *pOrderMsg)
 
void getRecord (OrderMsg *pOrderMsg)
 
void getSizeFromAllSet (OrderMsg *pOrderMsg)
 
void objIDInAllSet (OrderMsg *pOrderMsg)
 
void openAllSet (OrderMsg *pOrderMsg)
 
void removeIndexFilter (OrderMsg *pOrderMsg)
 
void setAnyIndexFilterInAllSet (OrderMsg *pOrderMsg, IndexQueryBaseStruct *pGloIndexQueryBaseStruct)
 
void setCurrentObjectInAllSet (OrderMsg *pOrderMsg)
 
void setIndexFilterByComparingInSet (OrderMsg *pOrderMsg)
 
void setIndexFilterByRangeInSet (OrderMsg *pOrderMsg)
 
void setIndexFilterBySearchValueInSet (OrderMsg *pOrderMsg)
 
void setPositionInAllSet (OrderMsg *pOrderMsg)
 
void transformIndexStrings (IndexQueryBaseStruct &rGloIndexQueryBaseStruct)
 
virtual void work () override
 
bool operator== (const CommunicaterThread &rT) const
 
bool operator!= (const CommunicaterThread &rT) const
 
- Protected Member Functions inherited from eut::RepeatingThread
ORDER getOrder ()
 
STATUS getStatus ()
 
void setStatus (STATUS eStatus)
 
void threadWork ()
 
void toOrder (ORDER eOrder)
 

Private Member Functions

 CommunicaterThread ()
 
 CommunicaterThread (const CommunicaterThread &)
 
CommunicaterThreadoperator= (const CommunicaterThread &)
 

Private Attributes

std::queue< OrderMsg * > m_MsgQueue
 
TableReaderInterfacem_pTableReader
 

Additional Inherited Members

- Public Types inherited from eut::RepeatingThread
enum  EuTHREADERROR { EuTHREAD_ERR_NO_THREAD = -10301 , EuTHREAD_ERR_THREAD_ALREADY_WORKING = -10302 , EuTHREAD_ERR_THREAD_BREAK_COUNT_LESS_THAN_ZERO = -10303 , EuTHREAD_ERR_UNKNOWN = -10400 }
 Error range = -10301 to -10400 More...
 
enum  ORDER { eUNDEFINED , eDO_WORK , eEXIT }
 
enum  STATUS {
  eAT_THE_START , eWORKING , ePAUSING , eENDING ,
  eCOMPLETED
}
 
- Public Attributes inherited from eut::RepeatingThread
std::string m_strDebugInfo
 

Detailed Description

A CommunicaterThread accepts requests for its TableReaderInterface.

Several TableReaderInterface's can therefore access a table in parallel (they don't break anything).

Used by the Manager and passed to the respective Manager::Receiver.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ CommunicaterThread() [1/3]

glo::CommunicaterThread::CommunicaterThread ( )
private

The standard constructor is not available.

◆ CommunicaterThread() [2/3]

glo::CommunicaterThread::CommunicaterThread ( SchemaInterface * pSchema,
RealIndexPool * pRealIndexPool )

Constructor with parameter passing.

Parameters
[in]pSchemaIs needed to instantiate a table reader.
[in]pRealIndexPoolIs needed to instantiate a table reader.
See also
TableReaderInterface
Exceptions
eut::ErrorNExceptionAn exception is thrown if an error occurs.

◆ ~CommunicaterThread()

glo::CommunicaterThread::~CommunicaterThread ( )

Destructor, the memory is cleared.

◆ CommunicaterThread() [3/3]

glo::CommunicaterThread::CommunicaterThread ( const CommunicaterThread & )
private

The copy constructor is not available.

Member Function Documentation

◆ cancel()

virtual void glo::CommunicaterThread::cancel ( )
overridevirtual

Clears the memory before the thread is terminated. Is called by the owning Manager::Receiver before destroying the thread.

Since virtual, this method cannot be called in the destructor.

Note
This method only exists when not compiled with POSIX threads (defined (__PTHREADS)).

Reimplemented from eut::RepeatingThread.

◆ checkStored()

void glo::CommunicaterThread::checkStored ( OrderMsg * pOrderMsg)
protected

Lets its table reader check whether a persistent object is stored in the database. The result of the query is stored in the request.

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
OrderMsg, TableReaderInterface::objIDInBase().

◆ clearMsgQueue()

void glo::CommunicaterThread::clearMsgQueue ( )

Empties the order queue.

◆ closeAllSet()

void glo::CommunicaterThread::closeAllSet ( OrderMsg * pOrderMsg)
protected

Lets its table reader destroy a representation of an AllSet. The result of the query is stored in the request.

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
OrderMsg, TableReaderInterface::closeAllSet().

◆ getAnyIndexedObjIdListFromAllSet()

void glo::CommunicaterThread::getAnyIndexedObjIdListFromAllSet ( OrderMsg * pOrderMsg,
IndexQueryBaseStruct * pGloIndexQueryBaseStruct )
protected

Help method for getIndexedObjIdListBySearchValueFromAllSet (...), getIndexedObjIdListByComparingFromAllSet (...) and getIndexedObjIdListByRangeFromAllSet (...).

Since the orders differ only in their order structure, this is evaluated here and the respective table reader methods are called.

Parameters
[in,out]pOrderMsgThe order with a structure derived from IndexQueryBaseStruct.
[in]pGloIndexQueryBaseStructBy casting on IndexQueryStruct, ComparisionIndexQueryStruct or RangeIndexQueryStruct the respective table reader methods are called.
See also
OrderMsg, TableReaderInterface::getIndexedObjIdListFromAllSet (...).

◆ getIndexedObjIdListByComparingFromAllSet()

void glo::CommunicaterThread::getIndexedObjIdListByComparingFromAllSet ( OrderMsg * pOrderMsg)
protected

Passes a read request for object IDs in an AllSet whose objects are indexed to its table reader via a compare request (in which the read result is stored).

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
ComparisionIndexQueryStruct, GloOrderMsgm, TableReaderInterface::getIndexedObjIdListFromAllSet (...).

◆ getIndexedObjIdListByRangeFromAllSet()

void glo::CommunicaterThread::getIndexedObjIdListByRangeFromAllSet ( OrderMsg * pOrderMsg)
protected

Passes a read request for object IDs in an AllSet whose objects are indexed to its table reader via a range search request (in which the read result is stored).

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
RangeIndexQueryStruct, GloOrderMsgm, TableReaderInterface::getIndexedObjIdListFromAllSet (...).

◆ getIndexedObjIdListBySearchValueFromAllSet()

void glo::CommunicaterThread::getIndexedObjIdListBySearchValueFromAllSet ( OrderMsg * pOrderMsg)
protected

Forwards a read request for object IDs in an AllSet whose objects are indexed to its table reader via a string search order (in which the read result is stored)

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
IndexQueryStruct, GloOrderMsgm, TableReaderInterface::getIndexedObjIdListFromAllSet (...).

◆ getObjectData()

void glo::CommunicaterThread::getObjectData ( OrderMsg * pOrderMsg)
protected

Forwards a read request for an object to its table reader via an order (in which the read result is stored).

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
OrderMsg, TableReaderInterface::getObjectData( Record*&, const ObjID&, ReaderInfo*, bool bInRecursion ).

◆ getObjIdFromAllSet()

void glo::CommunicaterThread::getObjIdFromAllSet ( OrderMsg * pOrderMsg)
protected

Forwards a read request for an object ID to its table reader via a request (in which the read result is stored)

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
GloOrderMsgm, TableReaderInterface::getObjIdFromAllSet (...), TableReaderInterface::getIndexedObjIdFromAllSet (...).

◆ getReader()

TableReaderInterface * glo::CommunicaterThread::getReader ( ) const

Returns pointers to its table reader.

Returns
The pointer to his table reader.
Attention
The supplied TableReaderInterface lives only as long as this object, the calling instance must not remove the supplied object from memory.

◆ getRecord()

void glo::CommunicaterThread::getRecord ( OrderMsg * pOrderMsg)
protected

Passes a read job for a record to its table reader via an order (in which the read result is stored).

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
OrderMsg, TableReaderInterface::getRecord( Record*&, const ObjID&, ReaderInfo* ).

◆ getSizeFromAllSet()

void glo::CommunicaterThread::getSizeFromAllSet ( OrderMsg * pOrderMsg)
protected

Lets the size request a representation of an AllSet from its table reader. The result of the query is stored in the order.

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
OrderMsg, TableReaderInterface::getSizeFromAllSet().

◆ objIDInAllSet()

void glo::CommunicaterThread::objIDInAllSet ( OrderMsg * pOrderMsg)
protected

Lets its table readers check whether a persistent object exists in the database. The result of the query is stored in the order.

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
OrderMsg, TableReaderInterface::objIDInAllSet().

◆ openAllSet()

void glo::CommunicaterThread::openAllSet ( OrderMsg * pOrderMsg)
protected

Lets its table reader instantiate a representation of an AllSet. The result of the query is stored in the request.

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
OrderMsg, TableReaderInterface::openAllSet().

◆ operator!=()

bool glo::CommunicaterThread::operator!= ( const CommunicaterThread & rT) const
protected

Comparison operator.

Parameters
[in]rTThe object to be compared with this one.

◆ operator=()

CommunicaterThread & glo::CommunicaterThread::operator= ( const CommunicaterThread & )
private

The assignment operator is not available.

◆ operator==()

bool glo::CommunicaterThread::operator== ( const CommunicaterThread & rT) const
protected

Comparison operator.

Parameters
[in]rTThe object to be compared with this one.

◆ removeIndexFilter()

void glo::CommunicaterThread::removeIndexFilter ( OrderMsg * pOrderMsg)
protected

Passes a filter removal request to an AllSet whose objects are indexed to its table reader.

This method is called in work() by evaluating the request.

Parameters
[in,out]pOrderMsgThe order with corresponding derived IndexQueryBaseStruct.
See also
GloOrderMsgm, TableReaderInterface::removeFilterInAllSet (...).

◆ setAnyIndexFilterInAllSet()

void glo::CommunicaterThread::setAnyIndexFilterInAllSet ( OrderMsg * pOrderMsg,
IndexQueryBaseStruct * pGloIndexQueryBaseStruct )
protected

Help method for setIndexFilterBySearchValueInSet (...), setIndexFilterByComparingInSet (...) and setIndexFilterByRangeInSet (...).

Since the orders differ only in their order structure, this is evaluated here and the respective table reader methods are called.

Parameters
[in,out]pOrderMsgThe order with a structure derived from IndexQueryBaseStruct.
[in]pGloIndexQueryBaseStructBy casting on IndexQueryStruct, ComparisionIndexQueryStruct or RangeIndexQueryStruct the respective table reader methods are called.
See also
GloOrderMsgm, TableReaderInterface::getIndexedObjIdListFromAllSet (...).

◆ setCurrentObjectInAllSet()

void glo::CommunicaterThread::setCurrentObjectInAllSet ( OrderMsg * pOrderMsg)
protected

In a representation of an AllSet, lets the table reader set the iterator there to a specific object. The result of the query is stored in the order.

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
OrderMsg, TableReaderInterface::setCurrentObjectInAllSet().

◆ setIndexFilterByComparingInSet()

void glo::CommunicaterThread::setIndexFilterByComparingInSet ( OrderMsg * pOrderMsg)
protected

Passes a filter request to an AllSet (whose objects are indexed) to its table reader.

This method is called in work() by evaluating the request.

Parameters
[in,out]pOrderMsgThe order with a ComparisionIndexQueryStruct.
See also
ComparisionIndexQueryStruct, GloOrderMsgm, TableReaderInterface::setFilterInAllSet (...).

◆ setIndexFilterByRangeInSet()

void glo::CommunicaterThread::setIndexFilterByRangeInSet ( OrderMsg * pOrderMsg)
protected

Passes a filter request to an AllSet (whose objects are indexed) to its table reader.

This method is called in work() by evaluating the request.

Parameters
[in,out]pOrderMsgThe order with a RangeIndexQueryStruct.
See also
RangeIndexQueryStruct, GloOrderMsgm, TableReaderInterface::setFilterInAllSet (...).

◆ setIndexFilterBySearchValueInSet()

void glo::CommunicaterThread::setIndexFilterBySearchValueInSet ( OrderMsg * pOrderMsg)
protected

Passes a filter request to an AllSet (whose objects are indexed) to its table reader.

This method is called in work() by evaluating the request.

Parameters
[in,out]pOrderMsgThe order with a IndexQueryStruct.
See also
IndexQueryStruct, OrderMsg, TableReaderInterface::setFilterInAllSet (...).

◆ setPositionInAllSet()

void glo::CommunicaterThread::setPositionInAllSet ( OrderMsg * pOrderMsg)
protected

Lets the table reader in a representation of an AllSet set set the iterator there to a certain position. The result of the query is stored in the order.

This method is called in work() by evaluating the order.

Parameters
[in,out]pOrderMsgThe order.
See also
OrderMsg, TableReaderInterface::setPositionInAllSet().

◆ takeOrder()

void glo::CommunicaterThread::takeOrder ( OrderMsg * pOrderMsg)

Accepts an order into its order queue. Sends a wake-up signal for the thread.

Parameters
[in]pOrderMsgThe order to be processed.
See also
signalInput()

◆ transformIndexStrings()

void glo::CommunicaterThread::transformIndexStrings ( IndexQueryBaseStruct & rGloIndexQueryBaseStruct)
protected

Help method for getAnyIndexedObjIdListFromAllSet (...), and setAnyIndexFilterInAllSet (...).

The above methods are passed one respectively two index strings via the passed IndexQueryBaseStruct. In this method, these are formatted as specified in the index specification. For example, if the index is not to be 'CaseSensitive' and the index is "aBc", this entry in the IndexQueryBaseStruct is changed to "ABC".

Parameters
[in]rGloIndexQueryBaseStructBy casting on IndexQueryStruct, ComparisionIndexQueryStruct or RangeIndexQueryStruct the respective index strings to be transformed are determined.

◆ work()

virtual void glo::CommunicaterThread::work ( )
overrideprotectedvirtual

This method is executed as a thread. The message queue is queried for requests (the system 'sleeps' until a message is placed in the queue) and after evaluating the request, a suitable method is called.

See also
waitForInput()

Implements eut::RepeatingThread.

Member Data Documentation

◆ m_MsgQueue

std::queue<OrderMsg *> glo::CommunicaterThread::m_MsgQueue
private

The request queue for this thread.

See also
work()

◆ m_pTableReader

TableReaderInterface* glo::CommunicaterThread::m_pTableReader
private

The table reader.


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