#include "DcpsInfo_pch.h"
#include "dds/DCPS/debug.h"
#include "FederatorConfig.h"
#include "FederatorC.h"
#include "ace/Configuration.h"
#include "ace/Configuration_Import_Export.h"
#include "ace/Log_Priority.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_stdlib.h"
#include "ace/OS_NS_strings.h"
#include "ace/OS_NS_sys_time.h"
#include <algorithm>
#include "FederatorConfig.inl"
Include dependency graph for FederatorConfig.cpp:
Go to the source code of this file.
Namespaces | |
namespace | OpenDDS |
namespace | OpenDDS::Federator |
Functions | |
int | random_id () |
void | hash_endpoint (::CORBA::Long &hash, const char *const endpoint, const size_t len) |
void | hash_endpoints (::CORBA::Long &hash, const ACE_TCHAR *const endpoints_str) |
::CORBA::Long | hash_endpoints (int argc, ACE_TCHAR **argv) |
Variables | |
const ACE_TCHAR | FEDERATION_DOMAIN_KEY [] = ACE_TEXT("FederationDomain") |
const ACE_TCHAR | FEDERATION_ID_KEY [] = ACE_TEXT("FederationId") |
const ACE_TCHAR | FEDERATION_PORT_KEY [] = ACE_TEXT("FederationPort") |
OpenDDS::Federator::Config * | config_ |
The configuration object. | |
Action | action_ |
How to treat the next argument. |
void @101::hash_endpoint | ( | ::CORBA::Long & | hash, | |
const char *const | endpoint, | |||
const size_t | len | |||
) | [static] |
Definition at line 119 of file FederatorConfig.cpp.
Referenced by hash_endpoints().
00120 { 00121 std::string toprint(endpoint, len); 00122 if (len > 0) 00123 { 00124 for (size_t i = 0; i < len; i++) 00125 { 00126 hash = 31 * hash + endpoint[i]; 00127 } 00128 } 00129 }
::CORBA::Long @101::hash_endpoints | ( | int | argc, | |
ACE_TCHAR ** | argv | |||
) | [static] |
Definition at line 153 of file FederatorConfig.cpp.
References hash_endpoints(), and random_id().
00154 { 00155 ::CORBA::Long hash = 0; 00156 bool found = false; 00157 for (int i = 0; i < argc - 1; ++i) { 00158 if (ACE_OS::strncasecmp(argv[i], ACE_TEXT("-ORB"), ACE_OS::strlen(ACE_TEXT("-ORB"))) == 0 && 00159 (ACE_OS::strcasecmp(ACE_TEXT("-ORBEndpoint"), argv[i]) == 0 || 00160 ACE_OS::strcasecmp(ACE_TEXT("-ORBListenEndpoints"), argv[i]) == 0 || 00161 ACE_OS::strcasecmp(ACE_TEXT("-ORBLaneEndpoint"), argv[i]) == 0 || 00162 ACE_OS::strcasecmp(ACE_TEXT("-ORBLaneListenEndpoints"), argv[i]) == 0)) { 00163 const ACE_TCHAR* enpoints = argv[++i]; 00164 hash_endpoints(hash, enpoints); 00165 found = true; 00166 } 00167 } 00168 if (!found) { 00169 hash = random_id(); 00170 } 00171 return hash; 00172 }
void @101::hash_endpoints | ( | ::CORBA::Long & | hash, | |
const ACE_TCHAR *const | endpoints_str | |||
) | [static] |
Definition at line 139 of file FederatorConfig.cpp.
References hash_endpoint().
Referenced by hash_endpoints().
00140 { 00141 const ACE_TCHAR* delim = ACE_TEXT(";"); 00142 const size_t len = ACE_OS::strlen(endpoints_str); 00143 const ACE_TCHAR* curr = endpoints_str; 00144 while (curr < endpoints_str + len) { 00145 const ACE_TCHAR* next = ACE_OS::strstr(curr, delim); 00146 if (next == 0) 00147 next = endpoints_str + len; 00148 hash_endpoint(hash, curr, (next - curr)); 00149 curr = next + 1; 00150 } 00151 }
int @101::random_id | ( | ) | [static] |
Definition at line 110 of file FederatorConfig.cpp.
Referenced by hash_endpoints().
00111 { 00112 ACE_UINT64 msec; 00113 ACE_OS::gettimeofday().msec(msec); 00114 ACE_OS::srand((unsigned int)msec); 00115 const int r = ACE_OS::rand(); 00116 return r; 00117 }
Action action_ |
const ACE_TCHAR FEDERATION_DOMAIN_KEY[] = ACE_TEXT("FederationDomain") [static] |
Definition at line 29 of file FederatorConfig.cpp.
const ACE_TCHAR FEDERATION_ID_KEY[] = ACE_TEXT("FederationId") [static] |
Definition at line 32 of file FederatorConfig.cpp.
const ACE_TCHAR FEDERATION_PORT_KEY[] = ACE_TEXT("FederationPort") [static] |
Definition at line 35 of file FederatorConfig.cpp.