OpenDDS::DCPS::GuidConverter Class Reference

Conversion processing and value testing utilities for RTPS GUID_t types. More...

#include <GuidConverter.h>

Inheritance diagram for OpenDDS::DCPS::GuidConverter:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::GuidConverter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GuidConverter (const GUID_t &guid)
 Construct from a GUID_t.
virtual ~GuidConverter ()
 Virtual destructor (this is a base class).
long checksum () const
 Calculate the CRC32 checksum.
long vendorId () const
 Extract the VendorId value.
long entityId () const
 Extract the EntityId value.
long entityKey () const
 Extract the EntityKey value.
EntityKind entityKind () const
 Extract the EntityKind value.
bool isBuiltinDomainEntity () const
 Returns true if the GUID represents a builtin type domain entity.
bool isUserDomainEntity () const
 Returns true if the GUID represents a user defined type domain entity.
bool isWriter () const
 Returns true if the GUID represents a writer entity.
bool isReader () const
 Returns true if the GUID represents a reader entity.
bool isTopic () const
 Returns true if the GUID represents a topic entity.
 operator OPENDDS_STRING () const
 Convert to diagnostic string.
OPENDDS_STRING uniqueId () const

Protected Attributes

const GUID_t guid_

Detailed Description

Conversion processing and value testing utilities for RTPS GUID_t types.

This class encapsulates the conversion of a GUID_t value to and from other types used within OpenDDS. This class handles opaque GUID_t values only. For specific access, the appropriate subclass must instead be used.

Since the GUID_t type is formed of octets in network order, we do all processing byte by byte to avoid any endian issues.

Currently the GUID_t is mapped from various internal values. These mappings are:

byte structure reference content ---- --------------------- -------------------------- 0 GUID_t.guidPrefix[ 0] == VendorId_t == 0x01 for OCI (used for OpenDDS) 1 GUID_t.guidPrefix[ 1] == VendorId_t == 0x03 for OCI (used for OpenDDS) 2 GUID_t.guidPrefix[ 2] == 0x00 3 GUID_t.guidPrefix[ 3] == 0x00

4 GUID_t.guidPrefix[ 4] == <private> (MS byte) 5 GUID_t.guidPrefix[ 5] == <private> 6 GUID_t.guidPrefix[ 6] == <private> 7 GUID_t.guidPrefix[ 7] == <private> (LS byte)

8 GUID_t.guidPrefix[ 8] == <private> (MS byte) 9 GUID_t.guidPrefix[ 9] == <private> 10 GUID_t.guidPrefix[10] == <private> 11 GUID_t.guidPrefix[11] == <private> (LS byte)

12 GUID_t.entityId.entityKey[ 0] == entity id[0] (MS byte) 13 GUID_t.entityId.entityKey[ 1] == entity id[1] 14 GUID_t.entityId.entityKey[ 2] == entity id[2] (LS byte) 15 GUID_t.entityId.entityKind == entity kind

Definition at line 65 of file GuidConverter.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::GuidConverter::GuidConverter ( const GUID_t guid  ) 

Construct from a GUID_t.

Definition at line 21 of file GuidConverter.cpp.

00022   : guid_(guid)
00023 {}

OpenDDS::DCPS::GuidConverter::~GuidConverter (  )  [virtual]

Virtual destructor (this is a base class).

Definition at line 25 of file GuidConverter.cpp.

00026 {}


Member Function Documentation

long OpenDDS::DCPS::GuidConverter::checksum (  )  const

Calculate the CRC32 checksum.

Definition at line 29 of file GuidConverter.cpp.

References ACE::crc32(), and guid_.

Referenced by operator OPENDDS_STRING().

00030 {
00031   return ACE::crc32(reinterpret_cast<const void*>(&guid_), sizeof(guid_));
00032 }

Here is the call graph for this function:

Here is the caller graph for this function:

long OpenDDS::DCPS::GuidConverter::entityId (  )  const

Extract the EntityId value.

Definition at line 42 of file GuidConverter.cpp.

References OpenDDS::DCPS::GUID_t::entityId, entityKey(), OpenDDS::DCPS::EntityId_t::entityKind, and guid_.

00043 {
00044   return entityKey() << 8
00045          | guid_.entityId.entityKind;
00046 }

Here is the call graph for this function:

long OpenDDS::DCPS::GuidConverter::entityKey (  )  const

Extract the EntityKey value.

Definition at line 49 of file GuidConverter.cpp.

References OpenDDS::DCPS::GUID_t::entityId, OpenDDS::DCPS::EntityId_t::entityKey, and guid_.

Referenced by TAO_DDS_DCPSInfo_i::add_publication(), TAO_DDS_DCPSInfo_i::add_subscription(), TAO_DDS_DCPSInfo_i::add_topic(), and entityId().

00050 {
00051   return guid_.entityId.entityKey[0] << 16
00052          | guid_.entityId.entityKey[1] << 8
00053          | guid_.entityId.entityKey[2];
00054 }

Here is the caller graph for this function:

EntityKind OpenDDS::DCPS::GuidConverter::entityKind (  )  const

Extract the EntityKind value.

Definition at line 57 of file GuidConverter.cpp.

References OpenDDS::DCPS::GUID_t::entityId, OpenDDS::DCPS::EntityId_t::entityKind, OpenDDS::DCPS::ENTITYKIND_BUILTIN_PARTICIPANT, OpenDDS::DCPS::ENTITYKIND_BUILTIN_READER_NO_KEY, OpenDDS::DCPS::ENTITYKIND_BUILTIN_READER_WITH_KEY, OpenDDS::DCPS::ENTITYKIND_BUILTIN_TOPIC, OpenDDS::DCPS::ENTITYKIND_BUILTIN_UNKNOWN, OpenDDS::DCPS::ENTITYKIND_BUILTIN_WRITER_NO_KEY, OpenDDS::DCPS::ENTITYKIND_BUILTIN_WRITER_WITH_KEY, OpenDDS::DCPS::ENTITYKIND_OPENDDS_NIL_WRITER, OpenDDS::DCPS::ENTITYKIND_OPENDDS_PUBLISHER, OpenDDS::DCPS::ENTITYKIND_OPENDDS_SUBSCRIBER, OpenDDS::DCPS::ENTITYKIND_OPENDDS_TOPIC, OpenDDS::DCPS::ENTITYKIND_OPENDDS_USER, OpenDDS::DCPS::ENTITYKIND_USER_READER_NO_KEY, OpenDDS::DCPS::ENTITYKIND_USER_READER_WITH_KEY, OpenDDS::DCPS::ENTITYKIND_USER_UNKNOWN, OpenDDS::DCPS::ENTITYKIND_USER_WRITER_NO_KEY, OpenDDS::DCPS::ENTITYKIND_USER_WRITER_WITH_KEY, guid_, OpenDDS::DCPS::KIND_BUILTIN_READER, OpenDDS::DCPS::KIND_BUILTIN_TOPIC, OpenDDS::DCPS::KIND_BUILTIN_WRITER, OpenDDS::DCPS::KIND_PARTICIPANT, OpenDDS::DCPS::KIND_PUBLISHER, OpenDDS::DCPS::KIND_READER, OpenDDS::DCPS::KIND_SUBSCRIBER, OpenDDS::DCPS::KIND_TOPIC, OpenDDS::DCPS::KIND_UNKNOWN, OpenDDS::DCPS::KIND_USER, and OpenDDS::DCPS::KIND_WRITER.

Referenced by OpenDDS::DCPS::DomainParticipantImpl::get_discovered_participant_data(), OpenDDS::DCPS::DomainParticipantImpl::get_discovered_participants(), isReader(), isTopic(), and isWriter().

00058 {
00059   switch (guid_.entityId.entityKind) {
00060   case ENTITYKIND_OPENDDS_TOPIC:
00061     return KIND_TOPIC;
00062 
00063   case ENTITYKIND_BUILTIN_TOPIC:
00064     return KIND_BUILTIN_TOPIC;
00065 
00066   case ENTITYKIND_USER_READER_NO_KEY:
00067   case ENTITYKIND_USER_READER_WITH_KEY:
00068     return KIND_READER;
00069 
00070   case ENTITYKIND_USER_WRITER_NO_KEY:
00071   case ENTITYKIND_USER_WRITER_WITH_KEY:
00072   case ENTITYKIND_OPENDDS_NIL_WRITER:
00073     return KIND_WRITER;
00074 
00075   case ENTITYKIND_BUILTIN_READER_NO_KEY:
00076   case ENTITYKIND_BUILTIN_READER_WITH_KEY:
00077     return KIND_BUILTIN_READER;
00078 
00079   case ENTITYKIND_BUILTIN_WRITER_NO_KEY:
00080   case ENTITYKIND_BUILTIN_WRITER_WITH_KEY:
00081     return KIND_BUILTIN_WRITER;
00082 
00083   case ENTITYKIND_BUILTIN_PARTICIPANT:
00084     return KIND_PARTICIPANT;
00085 
00086   case ENTITYKIND_OPENDDS_PUBLISHER:
00087     return KIND_PUBLISHER;
00088 
00089   case ENTITYKIND_OPENDDS_SUBSCRIBER:
00090     return KIND_SUBSCRIBER;
00091 
00092   case ENTITYKIND_OPENDDS_USER:
00093     return KIND_USER;
00094 
00095   case ENTITYKIND_USER_UNKNOWN:
00096   case ENTITYKIND_BUILTIN_UNKNOWN:
00097   default:
00098     return KIND_UNKNOWN;
00099   }
00100 }

Here is the caller graph for this function:

bool OpenDDS::DCPS::GuidConverter::isBuiltinDomainEntity (  )  const
bool OpenDDS::DCPS::GuidConverter::isReader (  )  const

Returns true if the GUID represents a reader entity.

Definition at line 140 of file GuidConverter.cpp.

References entityKind(), OpenDDS::DCPS::KIND_BUILTIN_READER, and OpenDDS::DCPS::KIND_READER.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::associated(), OpenDDS::DCPS::RtpsUdpDataLink::check_handshake_complete(), and OpenDDS::DCPS::RtpsUdpDataLink::release_reservations_i().

00141 {
00142   EntityKind kind = entityKind();
00143   return kind == KIND_READER || kind == KIND_BUILTIN_READER;
00144 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool OpenDDS::DCPS::GuidConverter::isTopic (  )  const

Returns true if the GUID represents a topic entity.

Definition at line 146 of file GuidConverter.cpp.

References entityKind(), OpenDDS::DCPS::KIND_BUILTIN_TOPIC, and OpenDDS::DCPS::KIND_TOPIC.

Referenced by OpenDDS::DCPS::DomainParticipantImpl::get_discovered_topic_data(), and OpenDDS::DCPS::DomainParticipantImpl::get_discovered_topics().

00147 {
00148   EntityKind kind = entityKind();
00149   return kind == KIND_TOPIC || kind == KIND_BUILTIN_TOPIC;
00150 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool OpenDDS::DCPS::GuidConverter::isUserDomainEntity (  )  const

Returns true if the GUID represents a user defined type domain entity.

Definition at line 118 of file GuidConverter.cpp.

References OpenDDS::DCPS::GUID_t::entityId, OpenDDS::DCPS::EntityId_t::entityKind, OpenDDS::DCPS::ENTITYKIND_OPENDDS_TOPIC, OpenDDS::DCPS::ENTITYKIND_USER_READER_NO_KEY, OpenDDS::DCPS::ENTITYKIND_USER_READER_WITH_KEY, OpenDDS::DCPS::ENTITYKIND_USER_WRITER_NO_KEY, OpenDDS::DCPS::ENTITYKIND_USER_WRITER_WITH_KEY, and guid_.

00119 {
00120   switch (guid_.entityId.entityKind) {
00121 
00122   case ENTITYKIND_USER_READER_NO_KEY:
00123   case ENTITYKIND_USER_READER_WITH_KEY:
00124   case ENTITYKIND_USER_WRITER_NO_KEY:
00125   case ENTITYKIND_USER_WRITER_WITH_KEY:
00126   case ENTITYKIND_OPENDDS_TOPIC:
00127     return true;
00128 
00129   default:
00130     return false;
00131   }
00132 }

bool OpenDDS::DCPS::GuidConverter::isWriter (  )  const

Returns true if the GUID represents a writer entity.

Definition at line 134 of file GuidConverter.cpp.

References entityKind(), OpenDDS::DCPS::KIND_BUILTIN_WRITER, and OpenDDS::DCPS::KIND_WRITER.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::associated(), OpenDDS::DCPS::RtpsUdpDataLink::check_handshake_complete(), and OpenDDS::DCPS::RtpsUdpDataLink::release_reservations_i().

00135 {
00136   EntityKind kind = entityKind();
00137   return kind == KIND_WRITER || kind == KIND_BUILTIN_WRITER;
00138 }

Here is the call graph for this function:

Here is the caller graph for this function:

OpenDDS::DCPS::GuidConverter::operator OPENDDS_STRING (  )  const

Convert to diagnostic string.

Definition at line 152 of file GuidConverter.cpp.

References checksum(), guid_, OPENDDS_STRING, OpenDDS::DCPS::to_dds_string(), and OpenDDS::DCPS::to_string().

00153 {
00154   OPENDDS_STRING ret(to_string(guid_));
00155   ret += "(";
00156   ret += to_dds_string((unsigned long) checksum(), true);
00157   ret += ")";
00158   return ret;
00159 }

Here is the call graph for this function:

OPENDDS_STRING OpenDDS::DCPS::GuidConverter::uniqueId (  )  const

Definition at line 189 of file GuidConverter.cpp.

References guid_, OpenDDS::DCPS::GUID_t::guidPrefix, and ACE_OS::snprintf().

00190 {
00191   char id[64];
00192   ACE_OS::snprintf(id, sizeof id,
00193           "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
00194           guid_.guidPrefix[ 0],
00195           guid_.guidPrefix[ 1],
00196           guid_.guidPrefix[ 2],
00197           guid_.guidPrefix[ 3],
00198           guid_.guidPrefix[ 4],
00199           guid_.guidPrefix[ 5],
00200           guid_.guidPrefix[ 6],
00201           guid_.guidPrefix[ 7],
00202           guid_.guidPrefix[ 8],
00203           guid_.guidPrefix[ 9],
00204           guid_.guidPrefix[10],
00205           guid_.guidPrefix[11]);
00206   return id;
00207 }

Here is the call graph for this function:

long OpenDDS::DCPS::GuidConverter::vendorId (  )  const

Extract the VendorId value.

Definition at line 35 of file GuidConverter.cpp.

References guid_, and OpenDDS::DCPS::GUID_t::guidPrefix.

00036 {
00037   return guid_.guidPrefix[0] << 8
00038          | guid_.guidPrefix[1];
00039 }


Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1