00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef FEDERATORCONFIG_H 00009 #define FEDERATORCONFIG_H 00010 00011 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00012 #pragma once 00013 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00014 00015 #include "federator_export.h" 00016 #include "FederationId.h" 00017 #include "FederatorC.h" 00018 00019 #include <string> 00020 00021 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00022 00023 namespace OpenDDS { 00024 namespace Federator { 00025 00026 typedef std::basic_string<ACE_TCHAR> tstring; 00027 00028 class OpenDDS_Federator_Export Config { 00029 public: 00030 /// Command line option specifying the configuration file. 00031 static const tstring FEDERATOR_CONFIG_OPTION; 00032 00033 /// Command line option specifying the federation Id value. 00034 static const tstring FEDERATOR_ID_OPTION; 00035 00036 /// Command line option specifying a repository to federate with. 00037 static const tstring FEDERATE_WITH_OPTION; 00038 00039 /// Default constructor. 00040 Config(int argc, ACE_TCHAR** argv); 00041 00042 virtual ~Config(); 00043 00044 /// Access the enhanced argv. 00045 int& argc(); 00046 int argc() const; 00047 00048 /// Access the enhanced argc. 00049 ACE_TCHAR**& argv(); 00050 ACE_TCHAR** argv() const; 00051 00052 /// Add an argument. 00053 void addArg(ACE_TCHAR* arg); 00054 00055 /// Federation Id value. 00056 TAO_DDS_DCPSFederationId& federationId(); 00057 const TAO_DDS_DCPSFederationId& federationId() const; 00058 00059 /// Federation Id value. 00060 void federationDomain(long domain); 00061 long federationDomain() const; 00062 00063 /// Federation Port value. 00064 void federationPort(short port); 00065 short federationPort() const; 00066 00067 /// Initial federation IOR value. 00068 void federateIor(const tstring& ior); 00069 tstring federateIor() const; 00070 00071 /// Configuration filename. 00072 void configFile(const tstring& file); 00073 tstring configFile() const; 00074 00075 private: 00076 /// Process a configuration file 00077 void processFile(); 00078 00079 /// Enhanced argc. 00080 int argc_; 00081 00082 /// Enhanced argv. 00083 ACE_TCHAR** argv_; 00084 00085 /// Configuration filename, if any. 00086 tstring configFile_; 00087 00088 /// Initial federation IOR, if any. 00089 tstring federateIor_; 00090 00091 /// Configured Federation Id value. 00092 TAO_DDS_DCPSFederationId federationId_; 00093 00094 /// Configured Federation Domain value. 00095 long federationDomain_; 00096 00097 /// Configured Federation Port value. 00098 short federationPort_; 00099 }; 00100 00101 } // namespace Federator 00102 } // namespace OpenDDS 00103 00104 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00105 00106 #if defined (__ACE_INLINE__) 00107 # include "FederatorConfig.inl" 00108 #endif /* __ACE_INLINE__ */ 00109 00110 #endif /* FEDERATORCONFIG_H */