OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::ArgCopier Class Reference

Define an argument copying functor. More...

Collaboration diagram for OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::ArgCopier:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Action { COPY, FILENAME, IDVALUE, IORVALUE }
 

Identify the action to take on the next argument.

More...

Public Member Functions

 ArgCopier (OpenDDS::Federator::Config *config)
 Construct with a target pointer array.
void operator() (ACE_TCHAR *arg)
 The Functor function operator.

Private Attributes

OpenDDS::Federator::Configconfig_
 The configuration object.
Action action_
 How to treat the next argument.

Detailed Description

Define an argument copying functor.

Definition at line 40 of file FederatorConfig.cpp.


Member Enumeration Documentation

Identify the action to take on the next argument.

Enumerator:
COPY 
FILENAME 
IDVALUE 
IORVALUE 

Definition at line 43 of file FederatorConfig.cpp.

00043 { COPY, FILENAME, IDVALUE, IORVALUE };


Constructor & Destructor Documentation

OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::ArgCopier::ArgCopier ( OpenDDS::Federator::Config config  ) 

Construct with a target pointer array.

Definition at line 59 of file FederatorConfig.cpp.

00060   : config_(config),
00061     action_(COPY)
00062 {
00063 
00064 } // namespace


Member Function Documentation

void OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::ArgCopier::operator() ( ACE_TCHAR arg  ) 

The Functor function operator.

Definition at line 67 of file FederatorConfig.cpp.

References action_, OpenDDS::Federator::Config::addArg(), ACE_OS::atoi(), config_, OpenDDS::Federator::Config::configFile(), COPY, OpenDDS::Federator::Config::FEDERATE_WITH_OPTION, OpenDDS::Federator::Config::federateIor(), OpenDDS::Federator::Config::federationId(), OpenDDS::Federator::Config::FEDERATOR_CONFIG_OPTION, OpenDDS::Federator::Config::FEDERATOR_ID_OPTION, FILENAME, TAO_DDS_DCPSFederationId::id(), IDVALUE, and IORVALUE.

00068 {
00069   // Search for command line arguments to process rather than copy.
00070   if (::OpenDDS::Federator::Config::FEDERATOR_CONFIG_OPTION == arg) {
00071     // Configuration file option, filename value is next arg.
00072     this->action_ = FILENAME;
00073     return;
00074 
00075   } else if (::OpenDDS::Federator::Config::FEDERATOR_ID_OPTION == arg) {
00076     // Federation Id option, Id value is next arg.
00077     this->action_ = IDVALUE;
00078     return;
00079 
00080   } else if (::OpenDDS::Federator::Config::FEDERATE_WITH_OPTION == arg) {
00081     // Federate with option, IOR is next arg.
00082     this->action_ = IORVALUE;
00083     return;
00084   }
00085 
00086   // Process unrecognized arguments and all values.
00087   switch (this->action_) {
00088   case FILENAME:
00089     // Store the configuration file name.
00090     this->config_->configFile(arg);
00091     break;
00092 
00093   case IDVALUE:
00094     // Capture the federation Id.
00095     this->config_->federationId().id(ACE_OS::atoi(arg));
00096     break;
00097 
00098   case IORVALUE:
00099     // Capture the IOR to federate with.
00100     this->config_->federateIor(arg);
00101     break;
00102 
00103   case COPY:
00104     // Copy other args verbatim.
00105     this->config_->addArg(arg);
00106     break;
00107   }
00108 
00109   this->action_ = COPY;
00110 }

Here is the call graph for this function:


Member Data Documentation

How to treat the next argument.

Definition at line 56 of file FederatorConfig.cpp.

Referenced by operator()().

The configuration object.

Definition at line 53 of file FederatorConfig.cpp.

Referenced by operator()().


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

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1