OpenDDS  Snapshot(2023/04/28-20:55)
Public Types | Public Member Functions | Private Attributes | List of all members
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]

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. More...
 
void operator() (ACE_TCHAR *arg)
 The Functor function operator. More...
 

Private Attributes

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

Detailed Description

Define an argument copying functor.

Definition at line 40 of file FederatorConfig.cpp.

Member Enumeration Documentation

◆ Action

Constructor & Destructor Documentation

◆ ArgCopier()

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.

60  : config_(config),
61  action_(COPY)
62 {
63 
64 } // namespace
OpenDDS::Federator::Config * config_
The configuration object.
Action action_
How to treat the next argument.

Member Function Documentation

◆ operator()()

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.

68 {
69  // Search for command line arguments to process rather than copy.
71  // Configuration file option, filename value is next arg.
72  this->action_ = FILENAME;
73  return;
74 
76  // Federation Id option, Id value is next arg.
77  this->action_ = IDVALUE;
78  return;
79 
81  // Federate with option, IOR is next arg.
82  this->action_ = IORVALUE;
83  return;
84  }
85 
86  // Process unrecognized arguments and all values.
87  switch (this->action_) {
88  case FILENAME:
89  // Store the configuration file name.
90  this->config_->configFile(arg);
91  break;
92 
93  case IDVALUE:
94  // Capture the federation Id.
95  this->config_->federationId().id(ACE_OS::atoi(arg));
96  break;
97 
98  case IORVALUE:
99  // Capture the IOR to federate with.
100  this->config_->federateIor(arg);
101  break;
102 
103  case COPY:
104  // Copy other args verbatim.
105  this->config_->addArg(arg);
106  break;
107  }
108 
109  this->action_ = COPY;
110 }
OpenDDS::Federator::Config * config_
The configuration object.
void configFile(const tstring &file)
Configuration filename.
Action action_
How to treat the next argument.
void addArg(ACE_TCHAR *arg)
Add an argument.
static const tstring FEDERATOR_ID_OPTION
Command line option specifying the federation Id value.
TAO_DDS_DCPSFederationId & federationId()
Federation Id value.
static const tstring FEDERATOR_CONFIG_OPTION
Command line option specifying the configuration file.
void federateIor(const tstring &ior)
Initial federation IOR value.
int atoi(const char *s)
static const tstring FEDERATE_WITH_OPTION
Command line option specifying a repository to federate with.
void id(RepoKey fedId)

Member Data Documentation

◆ action_

Action OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::ArgCopier::action_
private

How to treat the next argument.

Definition at line 56 of file FederatorConfig.cpp.

Referenced by operator()().

◆ config_

OpenDDS::Federator::Config* OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::ArgCopier::config_
private

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: