Fawkes API  Fawkes Development Version
fawkes::SharedMemory::SharedMemoryIterator Class Reference

Shared Memory iterator. More...

#include <>>

Public Member Functions

 SharedMemoryIterator ()
 Constructor. More...
 
 SharedMemoryIterator (const SharedMemoryIterator &shmit)
 Copy constructor. More...
 
 SharedMemoryIterator (std::list< SharedMemoryRegistry::SharedMemID > ids, SharedMemoryHeader *header)
 Constructor. More...
 
 ~SharedMemoryIterator ()
 Destructor. More...
 
SharedMemoryIteratoroperator++ ()
 Prefix increment. More...
 
SharedMemoryIterator operator++ (int inc)
 Postfix increment operator. More...
 
SharedMemoryIteratoroperator+ (unsigned int i)
 Advance by i steps. More...
 
SharedMemoryIteratoroperator+= (unsigned int i)
 Advance by i steps. More...
 
bool operator== (const SharedMemoryIterator &s) const
 Check iterators for equality. More...
 
bool operator!= (const SharedMemoryIterator &s) const
 Check iterators for inequality. More...
 
const SharedMemoryHeaderoperator* () const
 Get SharedMemoryHeader. More...
 
SharedMemoryIteratoroperator= (const SharedMemoryIterator &shmit)
 Make this instance point to the same segment as shmit. More...
 
const char * magic_token () const
 Get magic token. More...
 
int shmid () const
 Get shared memory ID. More...
 
int semaphore () const
 Get semaphore. More...
 
size_t segmsize () const
 Get segment size. More...
 
size_t segmnattch () const
 Get number of attached parties. More...
 
void * databuf () const
 Get pointer to data buffer. More...
 

Detailed Description

Shared Memory iterator.

This iterator is used to iterate over shared memory segments which satisfy some criterion. Use SharedMemory::find() and SharedMemory::list() to get the iterator.

Author
Tim Niemueller

Definition at line 114 of file shm.h.

Constructor & Destructor Documentation

◆ SharedMemoryIterator() [1/3]

fawkes::SharedMemory::SharedMemoryIterator::SharedMemoryIterator ( )

Constructor.

Constructs invalid iterator.

Definition at line 1270 of file shm.cpp.

◆ SharedMemoryIterator() [2/3]

fawkes::SharedMemory::SharedMemoryIterator::SharedMemoryIterator ( const SharedMemoryIterator shmit)

Copy constructor.

Parameters
shmitshared memory iterator to copy

Definition at line 1285 of file shm.cpp.

References fawkes::SharedMemory::attach(), and fawkes::SharedMemoryHeader::clone().

◆ SharedMemoryIterator() [3/3]

fawkes::SharedMemory::SharedMemoryIterator::SharedMemoryIterator ( std::list< SharedMemoryRegistry::SharedMemID ids,
SharedMemoryHeader header 
)

Constructor.

Parameters
idsThe IDs of the shared memory segments to iterate over
headershared memory header

Definition at line 1319 of file shm.cpp.

References fawkes::SharedMemoryHeader::clone().

◆ ~SharedMemoryIterator()

fawkes::SharedMemory::SharedMemoryIterator::~SharedMemoryIterator ( )

Destructor.

Definition at line 1337 of file shm.cpp.

Member Function Documentation

◆ databuf()

void * fawkes::SharedMemory::SharedMemoryIterator::databuf ( ) const

Get pointer to data buffer.

Returns
data buffer

Definition at line 1616 of file shm.cpp.

Referenced by fawkes::SharedMemory::erase(), fawkes::SharedMemory::erase_orphaned(), and fawkes::SharedMemory::list().

◆ magic_token()

const char * fawkes::SharedMemory::SharedMemoryIterator::magic_token ( ) const

Get magic token.

Returns
magic token.

Definition at line 1562 of file shm.cpp.

◆ operator!=()

bool fawkes::SharedMemory::SharedMemoryIterator::operator!= ( const SharedMemoryIterator s) const

Check iterators for inequality.

Parameters
siterator to compare to
Returns
true if iteraters point to the same shared memory segment, false otherwise

Definition at line 1509 of file shm.cpp.

◆ operator*()

const SharedMemoryHeader * fawkes::SharedMemory::SharedMemoryIterator::operator* ( ) const

Get SharedMemoryHeader.

Returns
shared memory header

Definition at line 1519 of file shm.cpp.

◆ operator+()

SharedMemory::SharedMemoryIterator & fawkes::SharedMemory::SharedMemoryIterator::operator+ ( unsigned int  i)

Advance by i steps.

Parameters
inumber of (matching) segments to advance.
Returns
reference to this after advancing

Definition at line 1470 of file shm.cpp.

◆ operator++() [1/2]

SharedMemory::SharedMemoryIterator & fawkes::SharedMemory::SharedMemoryIterator::operator++ ( )

Prefix increment.

Returns
reference to this instance

Definition at line 1404 of file shm.cpp.

References fawkes::SharedMemory::attach(), fawkes::SharedMemory::MagicTokenSize, and fawkes::SharedMemory::SharedMemory_header_t::semaphore.

◆ operator++() [2/2]

SharedMemory::SharedMemoryIterator fawkes::SharedMemory::SharedMemoryIterator::operator++ ( int  inc)

Postfix increment operator.

Parameters
incignored
Returns
instance before advancing to the next shared memory segment

Definition at line 1457 of file shm.cpp.

◆ operator+=()

SharedMemory::SharedMemoryIterator & fawkes::SharedMemory::SharedMemoryIterator::operator+= ( unsigned int  i)

Advance by i steps.

Parameters
inumber of (matching) segments to advance.
Returns
reference to this after advancing

Definition at line 1484 of file shm.cpp.

◆ operator=()

SharedMemory::SharedMemoryIterator & fawkes::SharedMemory::SharedMemoryIterator::operator= ( const SharedMemoryIterator shmit)

Make this instance point to the same segment as shmit.

Parameters
shmitshared memory iterator
Returns
reference to this instance

Definition at line 1530 of file shm.cpp.

References fawkes::SharedMemory::attach(), and fawkes::SharedMemoryHeader::clone().

◆ operator==()

bool fawkes::SharedMemory::SharedMemoryIterator::operator== ( const SharedMemoryIterator s) const

Check iterators for equality.

Parameters
siterator to compare to
Returns
true if iterators point to the same shared memory segment, false otherwise

Definition at line 1498 of file shm.cpp.

◆ segmnattch()

size_t fawkes::SharedMemory::SharedMemoryIterator::segmnattch ( ) const

Get number of attached parties.

Returns
number of attached parties

Definition at line 1606 of file shm.cpp.

Referenced by fawkes::SharedMemory::erase_orphaned().

◆ segmsize()

size_t fawkes::SharedMemory::SharedMemoryIterator::segmsize ( ) const

Get segment size.

Returns
segment size

Definition at line 1596 of file shm.cpp.

Referenced by fawkes::SharedMemory::erase(), fawkes::SharedMemory::erase_orphaned(), and fawkes::SharedMemory::list().

◆ semaphore()

int fawkes::SharedMemory::SharedMemoryIterator::semaphore ( ) const

Get semaphore.

Returns
semaphore

Definition at line 1586 of file shm.cpp.

Referenced by fawkes::SharedMemory::erase(), fawkes::SharedMemory::erase_orphaned(), and fawkes::SharedMemory::list().

◆ shmid()

int fawkes::SharedMemory::SharedMemoryIterator::shmid ( ) const

Get shared memory ID.

Returns
shared memory ID

Definition at line 1576 of file shm.cpp.

Referenced by fawkes::SharedMemory::erase(), fawkes::SharedMemory::erase_orphaned(), and fawkes::SharedMemory::list().


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