Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

RegionRegistry< MAX_REGIONS, NAME_LEN > Class Template Reference

Keeps track of currently available shared memory regions. More...

#include <RegionRegistry.h>


Detailed Description

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
class RegionRegistry< MAX_REGIONS, NAME_LEN >

Keeps track of currently available shared memory regions.

Definition at line 16 of file RegionRegistry.h.

List of all members.

Classes

struct  entry
 Holds information regarding a shared memory region available for listening. More...

Public Types

typedef registry_t::index_t index_t
 shorthand for the index type used to reference regions

Public Member Functions

 RegionRegistry ()
 constructor
 ~RegionRegistry ()
 destructor
index_t findRegion (const std::string &name) const
 Searches for the region specified by name, returns end() if not found.
index_t registerRegion (const std::string &name, const RCRegion *region)
 Registers a region, returns the index of the region if successful, or end() if out of space or conflicting registration is found.
RCRegionregisterRegion (const std::string &name, size_t size)
 Creates and registers a new region of the specified size — if the region is already registered, the previous one is returned.
RCRegionoperator[] (index_t it) const
 Access a region by index.
void erase (index_t it)
 Erases the registration, but doesn't dereference the region (the registry doesn't claim references on the regions...).
index_t begin () const
 provides iteration through the entries, be sure to use next(), the index_t is not a 'proper' iterator (no ++ to increment)
index_t next (index_t it) const
 provides the index of the next entry
index_t end () const
 one-past-end marker

Static Public Attributes

static const unsigned int CAPACITY = MAX_REGIONS
 allows access to template parameters
static const unsigned int REGION_NAME_LEN = NAME_LEN
 allows access to template parameters

Protected Types

typedef ListMemBuf< entry,
MAX_REGIONS > 
registry_t
 type of the collection managing the regions

Protected Attributes

MutexLock
< ProcessID::NumProcesses > 
lock
 makes sure we only have one registration in progress at a time
registry_t avail
 collection of available memory regions

Member Typedef Documentation

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
typedef registry_t::index_t RegionRegistry< MAX_REGIONS, NAME_LEN >::index_t

shorthand for the index type used to reference regions

Definition at line 39 of file RegionRegistry.h.

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
typedef ListMemBuf<entry,MAX_REGIONS> RegionRegistry< MAX_REGIONS, NAME_LEN >::registry_t [protected]

type of the collection managing the regions

Definition at line 33 of file RegionRegistry.h.


Constructor & Destructor Documentation

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
RegionRegistry< MAX_REGIONS, NAME_LEN >::RegionRegistry (  ) 

constructor

Definition at line 42 of file RegionRegistry.h.

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
RegionRegistry< MAX_REGIONS, NAME_LEN >::~RegionRegistry (  ) 

destructor

Definition at line 45 of file RegionRegistry.h.


Member Function Documentation

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
index_t RegionRegistry< MAX_REGIONS, NAME_LEN >::begin (  )  const

provides iteration through the entries, be sure to use next(), the index_t is not a 'proper' iterator (no ++ to increment)

Definition at line 105 of file RegionRegistry.h.

Referenced by RegionRegistry< MAX_REGIONS, NAME_LEN >::findRegion().

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
index_t RegionRegistry< MAX_REGIONS, NAME_LEN >::end (  )  const
template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
void RegionRegistry< MAX_REGIONS, NAME_LEN >::erase ( index_t  it  ) 

Erases the registration, but doesn't dereference the region (the registry doesn't claim references on the regions...).

Definition at line 100 of file RegionRegistry.h.

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
index_t RegionRegistry< MAX_REGIONS, NAME_LEN >::findRegion ( const std::string &  name  )  const

Searches for the region specified by name, returns end() if not found.

Definition at line 51 of file RegionRegistry.h.

Referenced by RegionRegistry< MAX_REGIONS, NAME_LEN >::registerRegion().

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
index_t RegionRegistry< MAX_REGIONS, NAME_LEN >::next ( index_t  it  )  const

provides the index of the next entry

Definition at line 106 of file RegionRegistry.h.

Referenced by RegionRegistry< MAX_REGIONS, NAME_LEN >::findRegion().

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
RCRegion* RegionRegistry< MAX_REGIONS, NAME_LEN >::operator[] ( index_t  it  )  const

Access a region by index.

Definition at line 92 of file RegionRegistry.h.

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
RCRegion* RegionRegistry< MAX_REGIONS, NAME_LEN >::registerRegion ( const std::string &  name,
size_t  size 
)

Creates and registers a new region of the specified size — if the region is already registered, the previous one is returned.

No checking is done on the size of the region... if it was already registered as a different size, that is ignored.

Definition at line 77 of file RegionRegistry.h.

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
index_t RegionRegistry< MAX_REGIONS, NAME_LEN >::registerRegion ( const std::string &  name,
const RCRegion region 
)

Registers a region, returns the index of the region if successful, or end() if out of space or conflicting registration is found.

You can re-register the same region under the same name, it simply returns the same index again.

Definition at line 63 of file RegionRegistry.h.


Member Data Documentation

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
const unsigned int RegionRegistry< MAX_REGIONS, NAME_LEN >::CAPACITY = MAX_REGIONS [static]

allows access to template parameters

Definition at line 37 of file RegionRegistry.h.

template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
MutexLock<ProcessID::NumProcesses> RegionRegistry< MAX_REGIONS, NAME_LEN >::lock [mutable, protected]
template<unsigned int MAX_REGIONS, unsigned int NAME_LEN>
const unsigned int RegionRegistry< MAX_REGIONS, NAME_LEN >::REGION_NAME_LEN = NAME_LEN [static]

allows access to template parameters

Definition at line 38 of file RegionRegistry.h.


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:15 2016 by Doxygen 1.6.3