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 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00019 00020 namespace OpenDDS { 00021 00022 namespace Federator { 00023 // reproducing type created by dds/InfoRepo/Federator.idl 00024 typedef ::CORBA::Long RepoKey; 00025 } 00026 00027 namespace DCPS { 00028 typedef ::CORBA::Long ParticipantId; 00029 00030 /** 00031 * @class RepoIdConverter 00032 * 00033 * @brief Conversion processing and value testing utilities for 00034 DCPS Information Repository identifiers. 00035 * 00036 * This class encapsulates the conversion of a GUID_t value to and from 00037 * other types used within OpenDDS. 00038 * 00039 * Currently the RepoId is a typedef for GUID_t. This class assumes 00040 * responsibility for insulating users from future change. 00041 * 00042 * Currently the RepoId is mapped from various internal values. 00043 * These mappings are: 00044 * 00045 * byte structure reference content 00046 * ---- --------------------- -------------------------- 00047 * 0 GUID_t.guidPrefix[ 0] == VendorId_t == 0x00 for OCI (used for OpenDDS) 00048 * 1 GUID_t.guidPrefix[ 1] == VendorId_t == 0x03 for OCI (used for OpenDDS) 00049 * 2 GUID_t.guidPrefix[ 2] == 0x00 00050 * 3 GUID_t.guidPrefix[ 3] == 0x00 00051 * 00052 * 4 GUID_t.guidPrefix[ 4] == federation id (MS byte) 00053 * 5 GUID_t.guidPrefix[ 5] == federation id 00054 * 6 GUID_t.guidPrefix[ 6] == federation id 00055 * 7 GUID_t.guidPrefix[ 7] == federation id (LS byte) 00056 * 00057 * 8 GUID_t.guidPrefix[ 8] == particpant id (MS byte) 00058 * 9 GUID_t.guidPrefix[ 9] == particpant id 00059 * 10 GUID_t.guidPrefix[10] == particpant id 00060 * 11 GUID_t.guidPrefix[11] == particpant id (LS byte) 00061 * 00062 * 12 GUID_t.entityId.entityKey[ 0] == entity id[0] (MS byte) 00063 * 13 GUID_t.entityId.entityKey[ 1] == entity id[1] 00064 * 14 GUID_t.entityId.entityKey[ 2] == entity id[2] (LS byte) 00065 * 15 GUID_t.entityId.entityKind == entity kind 00066 */ 00067 class OpenDDS_Dcps_Export RepoIdConverter : public GuidConverter { 00068 public: 00069 RepoIdConverter(const RepoId& repoId); 00070 00071 ~RepoIdConverter(); 00072 00073 /// Get the federeation id from the GUID 00074 OpenDDS::Federator::RepoKey federationId() const; 00075 00076 /// Get the participant id from the GUID 00077 ParticipantId participantId() const; 00078 }; 00079 00080 } // namespace DCPS 00081 } // namespace OpenDDS 00082 00083 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00084 00085 #endif /* DCPS_REPOIDCONVERTER_H */