GuidGenerator Class Reference

Create GUID values for use within DDS. More...

#include <GuidGenerator.h>

List of all members.

Public Member Functions

 GuidGenerator (long federation, long participant=0, OpenDDS::DCPS::EntityKind kind=OpenDDS::DCPS::KIND_PARTICIPANT)
 construct with at least a FederationId value.
virtual ~GuidGenerator ()
 Virtual destructor.
OpenDDS::DCPS::GUID_t next ()
 Obtain the next GUID value.
void last (long key)

Private Attributes

OpenDDS::DCPS::EntityKind kind_
 Type of Entity to generate GUID values for.
long federation_
 Unique identifier for the repository.
long participant_
 Unique identifier for the DomainParticipant.
long lastKey_
 Unique value for the EntityKey.
CORBA::Octet kindCode_
 Cached entityKind encoded value.


Detailed Description

Create GUID values for use within DDS.

Internal to the OpenDDS repository, the Repository Identifiers that uniquely identify all DDS Entities within the service managed by this (and other federated) repositories consist of GUID values.

These GUID (Global Unique IDentifiers?) values are based on the RTPS specification (formal/08-04-09) GUID values. They use the same structure. The VendorId value is applied in the first 2 bytes of the prefix. The remainder of the Participant Id value is composed of the OpenDDS specific Federation Id value (the identifier of the repository where the Entity was created) and a DomainParticipant identifier within that repository. In addition to the standard EntityKind values, the EntityKind byte has an added value of ENTITYKIND_OPENDDS_TOPIC allowed to permit the use of GUID values for Topic entities as well. This is an OpenDDS specific extension.

The EntityKey field is used to distinguish Topics, Publications and Subscriptions within a single Participant. Each of these is within its own number (address) space. The EntityKind byte will ensure that identical EntityKey values of these different types will not conflict in the final GUID value.

Values are generated using the specified FederationId and DomainParticipant identifiers. The EntityKey for a type is incremented each time a value is generated.

The ability to reset the last used value is provided to allow the reloading of Entities from persistent storage without inducing conflicts with newly created Entities. This is a simplistic mechanism and requires that all information from the persistent storage be processed *prior* to any new Entities being created within the repository. After this processing is complete, the last used value should be reset to ensure that any new values will not conflict with the restored values.

NOTE: This mechanism does not work well for values that have wrapped around the 24 bit EntityKey space. It is possible to extend the current mapping to overflow into the two '0' bytes (2 and 3) with the Key value number (address) space to increase the possible unique identifiers if this becomes an issue. Doing that would alleviate the need to manage an arena of Key values.

Even though each Domain could have a separate GUID (address) space, since we do not currently include the domain value within the GUID mapping, all domains within a repository will use the same generator instance to ensure no conflicting GUID values. This will restrict the total number of DomainParticipants within *all* domains of a repository to be within the 32 bit (2**32) DomainParticipant address space. It is likely that other limits will be exceeded before this one is approached.

The current mapping of meanings to the GUID component values is:

Content: | VendorId| 0 | 0 | FederationId | DomainParticpant | EntityKey |Kind| GUID_t bytes: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | GuidPrefix_t GUID_t.guidPrefix bytes: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | EntityId_t GUID_t.entityId bytes: | 0 | 1 | 2 | 3 | EntityKey_t GUID_t.entityId.entityKey bytes: | 0 | 1 | 2 |

Where the VendorId value used for OpenDDS is the one for Object Computing, Inc. == 0x03.


Constructor & Destructor Documentation

GuidGenerator::GuidGenerator ( long  federation,
long  participant = 0,
OpenDDS::DCPS::EntityKind  kind = OpenDDS::DCPS::KIND_PARTICIPANT 
)

construct with at least a FederationId value.

Parameters:
federation identifier for the repository.
participant identifier for the participant.
kind type of Entities to generate Id values for.
Returns:
GUID_t generated unique identifier value.
If the kind is KIND_PARTICIPANT then the generator will generate Participant GUID values. Otherwise it will generate the specified type of Entity values within the specified Participant.

GuidGenerator::~GuidGenerator (  )  [virtual]

Virtual destructor.


Member Function Documentation

void GuidGenerator::last ( long  key  ) 

Set the minimum of the last key (or participant) value used.

Parameters:
key the smallest value that the last generated key can be
If the supplied key value is larger than the actual last generated key value, the new key value replaces the old one.

OpenDDS::DCPS::GUID_t GuidGenerator::next (  ) 

Obtain the next GUID value.


Member Data Documentation

long GuidGenerator::federation_ [private]

Unique identifier for the repository.

OpenDDS::DCPS::EntityKind GuidGenerator::kind_ [private]

Type of Entity to generate GUID values for.

CORBA::Octet GuidGenerator::kindCode_ [private]

Cached entityKind encoded value.

long GuidGenerator::lastKey_ [private]

Unique value for the EntityKey.

long GuidGenerator::participant_ [private]

Unique identifier for the DomainParticipant.


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 09:37:22 2008 for OpenDDS by  doxygen 1.4.7