00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef DCPS_REPOIDCONVERTER_H 00009 #define DCPS_REPOIDCONVERTER_H 00010 00011 #include "dds/DdsDcpsInfrastructureC.h" 00012 #include "dds/DdsDcpsInfoUtilsC.h" 00013 00014 #include "GuidConverter.h" 00015 00016 #include "dcps_export.h" 00017 00018 namespace OpenDDS { 00019 00020 namespace Federator { 00021 // reproducing type created by dds/InfoRepo/Federator.idl 00022 typedef ::CORBA::Long RepoKey; 00023 } 00024 00025 namespace DCPS { 00026 typedef ::CORBA::Long ParticipantId; 00027 00028 /** 00029 * @class RepoIdConverter 00030 * 00031 * @brief Conversion processing and value testing utilities for 00032 DCPS Information Repository identifiers. 00033 * 00034 * This class encapsulates the conversion of a GUID_t value to and from 00035 * other types used within OpenDDS. This includes the ability to 00036 * create new RepoId values with a specific federation Id and Participant 00037 * instance handle as well as extracting the Instance handle for an 00038 * Entity from the RepoId value. Tests for Entity Kind as well as the 00039 * type (User v. Builtin) of Entity are also included. 00040 * 00041 * Currently the RepoId is a typedef for GUID_t. This class assumes 00042 * responsibility for insulating users from future change. 00043 * 00044 * Currently the RepoId is mapped from various internal values. 00045 * These mappings are: 00046 * 00047 * byte structure reference content 00048 * ---- --------------------- -------------------------- 00049 * 0 GUID_t.guidPrefix[ 0] == VendorId_t == 0x00 for OCI (used for OpenDDS) 00050 * 1 GUID_t.guidPrefix[ 1] == VendorId_t == 0x03 for OCI (used for OpenDDS) 00051 * 2 GUID_t.guidPrefix[ 2] == 0x00 00052 * 3 GUID_t.guidPrefix[ 3] == 0x00 00053 * 00054 * 4 GUID_t.guidPrefix[ 4] == federation id (MS byte) 00055 * 5 GUID_t.guidPrefix[ 5] == federation id 00056 * 6 GUID_t.guidPrefix[ 6] == federation id 00057 * 7 GUID_t.guidPrefix[ 7] == federation id (LS byte) 00058 * 00059 * 8 GUID_t.guidPrefix[ 8] == particpant id (MS byte) 00060 * 9 GUID_t.guidPrefix[ 9] == particpant id 00061 * 10 GUID_t.guidPrefix[10] == particpant id 00062 * 11 GUID_t.guidPrefix[11] == particpant id (LS byte) 00063 * 00064 * 12 GUID_t.entityId.entityKey[ 0] == entity id[0] (MS byte) 00065 * 13 GUID_t.entityId.entityKey[ 1] == entity id[1] 00066 * 14 GUID_t.entityId.entityKey[ 2] == entity id[2] (LS byte) 00067 * 15 GUID_t.entityId.entityKind == entity kind 00068 */ 00069 class OpenDDS_Dcps_Export RepoIdConverter : public GuidConverter { 00070 public: 00071 RepoIdConverter(const RepoId& repoId); 00072 00073 ~RepoIdConverter(); 00074 00075 OpenDDS::Federator::RepoKey federationId() const; 00076 00077 ParticipantId participantId() const; 00078 }; 00079 00080 } // namespace DCPS 00081 } // namespace OpenDDS 00082 00083 #endif /* DCPS_REPOIDCONVERTER_H */