INOS
CINOSQueue Class Reference
Inheritance diagram for CINOSQueue:

Public Types

enum  { eFlgOverflowCheck = 0x00000001 , eFlgOverflowFatal = 0x00000002 , eFlgAccess = 0x00000004 , eFlgUnique = 0x00000008 }
 Queue flags.
 

Public Member Functions

 CINOSQueue (const char *apName, uint32 auNumber, uint32 auSize)
 Create a queue with the given name. See also Queue.
 
virtual ~CINOSQueue ()
 Destroy queue.
 
uint32 Put (void *aData, uint32 aTimeout=0xFFFFFFFF, uint32 auFlags=0)
 Put data to queue and wait for max. auTimeout usec if queue full.
 
uint32 Get (void *aData, uint32 aTimeout=0xFFFFFFFF)
 Get data from queue and wait for max. auTimeout usec if queue empty.
 
void Inquiry (void *aData, uint32 &aCountOfElements)
 Gets the first element without removing it from the queue. Moreover, aCountOfElements returns the number of elements currently stored in the queue.
 
bool InquiryAt (void *aData, uint32 auIndex)
 Gets the element at auIndex (starting from 0..numberOfElementsInQueue) without removing it from the queue.
 
void Flush ()
 Flush the queue.
 
bool Empty ()
 Get queue state.
 
uint32 GetNumber ()
 Get number of queue entries.
 
const uint32 GetSize () const
 Return size of one queue entry.
 
const uint32 GetMaxNumber () const
 Return maximum number of entries.
 
const uint32 * GetAdrNumber () const
 Return address of entries counter.
 
const uint64GetAdrCount () const
 Return address of overall counter.
 
void SetFlag (uint32 auFlag)
 Set queue flag(s)
 
void ClrFlag (uint32 auFlag)
 Clear queue flag(s)
 
uint32 BeginAccess ()
 BeginAccess Needs to be called before Access.
 
bool Access (void *&ptrData, uint32 auIndex)
 Access Try to gain access to the data at a given index. The call needs to be embraced by calls of uint32 msr=BeginAccess and EndAccess(msr).
 
void EndAccess (uint32 msr)
 EndAccess Needs to be called after Access.
 
- Public Member Functions inherited from CINOSSync
 CINOSSync (const char *aName=0, uint32 aInitialCount=0, bool aManual=false)
 
virtual ~CINOSSync ()
 Destroy sync object.
 
virtual const charGetName ()
 Get name of sync object.
 
virtual uint32 Wait (uint32 aTimeout=0xFFFFFFFF)
 wait for signaled state for max. aTimeout usec
 
virtual void Signal ()
 Put object into the signaled state.
 
virtual void SignalEx (CINOSTaskExMsg *apMsg, uint32 auRplId, uint32 auAppError)
 
virtual bool MsgEvent (CINOSTaskExMsg *apMsg)
 
virtual void Reset ()
 Reset object state.
 
volatile uint32 * GetLockAdr ()
 Return pointer to core locking structure.
 
virtual bool UsesPolling () const
 
bool IsSame (CINOSSync *i_pSync)
 
int operator< (const CINOSSync &aSync) const
 
int operator== (const CINOSSync &aSync) const
 
int operator< (const char *aName) const
 
int operator== (const char *aName) const
 

Protected Member Functions

 DECLARE_DYNAMIC (CINOSQueue)
 
- Protected Member Functions inherited from CINOSSync
virtual bool Signaled (CINOSSync *&aChild)
 
virtual CINOSSyncNode * GetNode ()
 
virtual void SetNode (CINOSSyncNode *aNode)
 
void SignalAndUnlock (uint32 auMsr)
 Put object into the signaled state and release the core lock.
 

Protected Attributes

voidpBegin
 pointer to begin of queue buffer
 
voidpEnd
 pointer to end of queue buffer
 
voidpPut
 pointer to actual put block
 
voidpGet
 pointer to actual get block
 
uint32 mNumber
 actual number of blocks in queue
 
uint32 mSize
 size of block in queue
 
uint32 mMaxNumber
 maximum number of blocks in queue
 
uint32 mQueueFlags
 queue flags
 
CINOSSemaphorepSemaphore
 semaphore to handle the number of queue entries
 
uint64 mCount
 overall put count
 
- Protected Attributes inherited from CINOSSync
const charm_pName
 name of sync object
 
uint32 m_uCount
 signaled count of object
 
bool m_bManual
 manual object yes/no
 
tTaskId m_idFstWaiting
 id of first task waiting for the sync object
 
tTaskId m_idLstWaiting
 id of last task waiting for the sync object
 
SINOSCoreLock m_Lock
 core lock
 
CINOSSyncNode * m_pNode
 pointer to object node (if any)
 

Constructor & Destructor Documentation

◆ CINOSQueue()

CINOSQueue::CINOSQueue ( const char apName,
uint32  auNumber,
uint32  auSize 
)

Create a queue with the given name. See also Queue.

Parameters
apNameName of the queue
auNumberRequested number of queue entries
auSizeSize [bytes] of each queue entry

Member Function Documentation

◆ Access()

bool CINOSQueue::Access ( void *&  ptrData,
uint32  auIndex 
)

Access Try to gain access to the data at a given index. The call needs to be embraced by calls of uint32 msr=BeginAccess and EndAccess(msr).

Parameters
ptrData[out]Will receive a pointer to the data item at index auIndex upon suscess of the function, or NULL otherwise.
auIndexZero-based index of the data item to access.
Returns
Whether a valid pointer to the data could be retrieved.

◆ BeginAccess()

uint32 CINOSQueue::BeginAccess ( )

BeginAccess Needs to be called before Access.

Returns
msr that needs to be passed to the later call of EndAccess

◆ ClrFlag()

void CINOSQueue::ClrFlag ( uint32  auFlag)
inline

Clear queue flag(s)

Parameters
auFlagPattern of flags to be set

◆ Empty()

bool CINOSQueue::Empty ( )

Get queue state.

Returns
true if queue is empty

◆ EndAccess()

void CINOSQueue::EndAccess ( uint32  msr)

EndAccess Needs to be called after Access.

Parameters
msrThe value returned by the previous call of BeginAccess

◆ Get()

uint32 CINOSQueue::Get ( void aData,
uint32  aTimeout = 0xFFFFFFFF 
)

Get data from queue and wait for max. auTimeout usec if queue empty.

Parameters
apDataPointer to where to put the result
auTimeoutmax. time to wait if queue is empty or forever if used INOS_WAIT_FOREVER. The unit of the time is [usec] (microseconds). Set auTimeout == 100000 for example if you want to wait for max. 100ms

◆ GetAdrCount()

const uint64 * CINOSQueue::GetAdrCount ( ) const
inline

Return address of overall counter.

Returns
Address of internal overall counter

◆ GetAdrNumber()

const uint32 * CINOSQueue::GetAdrNumber ( ) const
inline

Return address of entries counter.

Returns
Address of internal entries counter

◆ GetMaxNumber()

const uint32 CINOSQueue::GetMaxNumber ( ) const
inline

Return maximum number of entries.

Returns
Configured maximum queue entries.

◆ GetNumber()

uint32 CINOSQueue::GetNumber ( )

Get number of queue entries.

Returns
the number of entries

◆ GetSize()

const uint32 CINOSQueue::GetSize ( ) const
inline

Return size of one queue entry.

Returns
Size of one entry in bytes.

◆ Inquiry()

void CINOSQueue::Inquiry ( void aData,
uint32 &  aCountOfElements 
)

Gets the first element without removing it from the queue. Moreover, aCountOfElements returns the number of elements currently stored in the queue.

Parameters
[in]apDataPointer to where to put the result
[out]aCountOfElementsReturns the number of elements currently stored in the queue

◆ InquiryAt()

bool CINOSQueue::InquiryAt ( void aData,
uint32  auIndex 
)

Gets the element at auIndex (starting from 0..numberOfElementsInQueue) without removing it from the queue.

Parameters
apDataPointer to where to put the result
auIndexThe n-th element (starting at 0) that should be returned. It is allowed to pass a value higher than available elements in the queue. It's even allowed to pass a number higher than the maximum elements that the queue could contain (GetSize()).
Returns
true if an element was found at auIndex and therefore aData points to valid data, or false if no element was found at auIndex and aData has therefore not been altered and is invalid/undefined.

◆ Put()

uint32 CINOSQueue::Put ( void aData,
uint32  aTimeout = 0xFFFFFFFF,
uint32  auFlags = 0 
)

Put data to queue and wait for max. auTimeout usec if queue full.

Parameters
apDataPointer to data to put into queue
auTimeoutmax. time to wait if queue is full or forever if used INOS_WAIT_FOREVER. The unit of the time is [usec] (microseconds). Set auTimeout == 100000 for example if you want to wait for max. 100ms
Returns
the time spent waiting, or 0 on timeout

◆ SetFlag()

void CINOSQueue::SetFlag ( uint32  auFlag)
inline

Set queue flag(s)

Parameters
auFlagPattern of flags to be set

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