Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
RobotRaconteur::RobotRaconteurNodeSetup Class Reference

Setup a node using specified options and manage node lifecycle. More...

#include <NodeSetup.h>

Inheritance diagram for RobotRaconteur::RobotRaconteurNodeSetup:
RobotRaconteur::ClientNodeSetup RobotRaconteur::SecureServerNodeSetup RobotRaconteur::ServerNodeSetup

Public Member Functions

 RobotRaconteurNodeSetup (const boost::shared_ptr< RobotRaconteurNode > &node, const std::vector< boost::shared_ptr< ServiceFactory > > &service_types, const std::string &node_name, uint16_t tcp_port, uint32_t flags)
 Construct a new RobotRaconteurNodeSetup with node, NodeName TCP port, and flags.
 RobotRaconteurNodeSetup (const boost::shared_ptr< RobotRaconteurNode > &node, const std::vector< boost::shared_ptr< ServiceFactory > > &service_types, const std::string &node_name, uint16_t tcp_port, uint32_t flags, uint32_t allowed_overrides, int argc, char *argv[])
 Construct a new RobotRaconteurNodeSetup with node, NodeName TCP port, flags, and command line options.
 RobotRaconteurNodeSetup (const boost::shared_ptr< RobotRaconteurNode > &node, const std::vector< boost::shared_ptr< ServiceFactory > > &service_types, const std::string &node_name, uint16_t tcp_port, uint32_t flags, uint32_t allowed_overrides, const std::vector< std::string > &args)
 Construct a new RobotRaconteurNodeSetup with node, NodeName TCP port, flags, and command line options.
 RobotRaconteurNodeSetup (const boost::shared_ptr< RobotRaconteurNode > &node, const std::vector< boost::shared_ptr< ServiceFactory > > &service_types, const boost::shared_ptr< CommandLineConfigParser > &config)
 Construct a new RobotRaconteurNodeSetup with node, NodeName TCP port, and command line parser object.
boost::shared_ptr< LocalTransportGetLocalTransport ()
 Get the LocalTransport.
boost::shared_ptr< TcpTransportGetTcpTransport ()
 Get the TcpTransport.
boost::shared_ptr< HardwareTransportGetHardwareTransport ()
 Get the HardwareTransport.
boost::shared_ptr< IntraTransportGetIntraTransport ()
 Get the IntraTransport.
boost::shared_ptr< CommandLineConfigParserGetCommandLineConfig ()
 Get the command line config parser object used to configure node.
void ReleaseNode ()
 Release the node from lifecycle management.

Detailed Description

Setup a node using specified options and manage node lifecycle.

RobotRaconteurNodeSetup and its subclasses ClientNodeSetup, ServerNodeSetup, and SecureServerNodeSetup are designed to help configure nodes and manage node lifecycles. The node setup classes use RAII to configure the node on construction, and call RobotRaconteurNode::Shutdown() when the instance is destroyed. The node setup can be created on the stack of main() for fully automatic lifecycle management, or stored as a class instance variable in a shared_ptr to be destroyed when the node is no longer needed.

The node setup classes execute the following operations to configure the node:

  1. Set log level and tap options from flags, command line options, or environmental variables
  2. Register specified service factory types
  3. Initialize transports using flags specified in flags or from command line options
  4. Configure timeouts

See Command Line Options for more information on available command line options.

Logging level is configured using the environmental variable ROBOTRACONTEUR_LOG_LEVEL or the command line option --robotraconteur-log-level. See logging.md for more information.

See taps.md for more information on using taps.

The node setup classes optionally initialize LocalTransport, TcpTransport, HardwareTransport, and/or IntraTransport. transports.md for more information.

The LocalTransport::StartServerAsNodeName() or LocalTransport::StartClientAsNodeName() are used to load the NodeID. See LocalTransport for more information on this procedure.

Constructor & Destructor Documentation

◆ RobotRaconteurNodeSetup() [1/4]

RobotRaconteur::RobotRaconteurNodeSetup::RobotRaconteurNodeSetup ( const boost::shared_ptr< RobotRaconteurNode > & node,
const std::vector< boost::shared_ptr< ServiceFactory > > & service_types,
const std::string & node_name,
uint16_t tcp_port,
uint32_t flags )

Construct a new RobotRaconteurNodeSetup with node, NodeName TCP port, and flags.

Construct node setup and configure the specified node. Use this overload if no command line options are provided.

service_types may be ROBOTRACONTEUR_SERVICE_TYPES if "robotraconteur_generated.h" is included.

tcp_port is ignored if RobotRaconteurNodeSetupFlags_TCP_TRANSPORT_START_SERVER is not set in flags

Parameters
nodeThe node to configure and manage lifecycle
service_typesThe service types to register.
node_nameThe NodeName
tcp_portThe port to listen for incoming TCP clients
flagsThe configuration flags

◆ RobotRaconteurNodeSetup() [2/4]

RobotRaconteur::RobotRaconteurNodeSetup::RobotRaconteurNodeSetup ( const boost::shared_ptr< RobotRaconteurNode > & node,
const std::vector< boost::shared_ptr< ServiceFactory > > & service_types,
const std::string & node_name,
uint16_t tcp_port,
uint32_t flags,
uint32_t allowed_overrides,
int argc,
char * argv[] )

Construct a new RobotRaconteurNodeSetup with node, NodeName TCP port, flags, and command line options.

Construct node setup and configure the specified node. Use this overload if command line options are provided.

service_types may be ROBOTRACONTEUR_SERVICE_TYPES if "robotraconteur_generated.h" is included.

tcp_port is ignored if RobotRaconteurNodeSetupFlags_TCP_TRANSPORT_START_SERVER is not set in flags or using command line options

Parameters
nodeThe node to configure and manage lifecycle
service_typesThe service types to register.
node_nameThe NodeName
tcp_portThe port to listen for incoming TCP clients
flagsThe configuration flags
allowed_overridesThe allowed override flags
argcThe number of command line arguments in argv vector
argvThe command line argument vector

◆ RobotRaconteurNodeSetup() [3/4]

RobotRaconteur::RobotRaconteurNodeSetup::RobotRaconteurNodeSetup ( const boost::shared_ptr< RobotRaconteurNode > & node,
const std::vector< boost::shared_ptr< ServiceFactory > > & service_types,
const std::string & node_name,
uint16_t tcp_port,
uint32_t flags,
uint32_t allowed_overrides,
const std::vector< std::string > & args )

Construct a new RobotRaconteurNodeSetup with node, NodeName TCP port, flags, and command line options.

Construct node setup and configure the specified node. Use this overload if command line options are provided.

service_types may be ROBOTRACONTEUR_SERVICE_TYPES if "robotraconteur_generated.h" is included.

tcp_port is ignored if RobotRaconteurNodeSetupFlags_TCP_TRANSPORT_START_SERVER is not set in flags or using command line options

Parameters
nodeThe node to configure and manage lifecycle
service_typesThe service types to register.
node_nameThe NodeName
tcp_portThe port to listen for incoming TCP clients
flagsThe configuration flags
allowed_overridesThe allowed override flags
argsThe command line arguments as an STL vector

◆ RobotRaconteurNodeSetup() [4/4]

RobotRaconteur::RobotRaconteurNodeSetup::RobotRaconteurNodeSetup ( const boost::shared_ptr< RobotRaconteurNode > & node,
const std::vector< boost::shared_ptr< ServiceFactory > > & service_types,
const boost::shared_ptr< CommandLineConfigParser > & config )

Construct a new RobotRaconteurNodeSetup with node, NodeName TCP port, and command line parser object.

Construct node setup and configure the specified node. Use this overload if command line options parser object is used.

service_types may be ROBOTRACONTEUR_SERVICE_TYPES if "robotraconteur_generated.h" is included.

tcp_port is ignored if RobotRaconteurNodeSetupFlags_TCP_TRANSPORT_START_SERVER is not set in flags or using command line options

CommandLineConfigParser must be fully executed by calling CommandLineConfigParser::ParseCommandLine() or CommandLineConfigParser::AcceptParsedResult()

Parameters
nodeThe node to configure and manage lifecycle
service_typesThe service types to register.
node_nameThe NodeName
tcp_portThe port to listen for incoming TCP clients
configThe command line config parser object

Member Function Documentation

◆ GetCommandLineConfig()

boost::shared_ptr< CommandLineConfigParser > RobotRaconteur::RobotRaconteurNodeSetup::GetCommandLineConfig ( )

Get the command line config parser object used to configure node.

Returns
RR_SHARED_PTR<CommandLineConfigParser> The command line config parser

◆ GetHardwareTransport()

boost::shared_ptr< HardwareTransport > RobotRaconteur::RobotRaconteurNodeSetup::GetHardwareTransport ( )

Get the HardwareTransport.

Will be null if HardwareTransport is not specified in flags

Note: Hardware transport is not enabled by default

Returns
RR_SHARED_PTR<HardwareTransport> The HardwareTransport object

◆ GetIntraTransport()

boost::shared_ptr< IntraTransport > RobotRaconteur::RobotRaconteurNodeSetup::GetIntraTransport ( )

Get the IntraTransport.

Will be null if IntraTransport is not specified in flags

Returns
RR_SHARED_PTR<IntraTransport> The IntraTransport object

◆ GetLocalTransport()

boost::shared_ptr< LocalTransport > RobotRaconteur::RobotRaconteurNodeSetup::GetLocalTransport ( )

Get the LocalTransport.

Will be null if LocalTransport is not specified in flags

Returns
RR_SHARED_PTR<LocalTransport> The LocalTransport object

◆ GetTcpTransport()

boost::shared_ptr< TcpTransport > RobotRaconteur::RobotRaconteurNodeSetup::GetTcpTransport ( )

Get the TcpTransport.

Will be null if TcpTransport is not specified in flags

Returns
RR_SHARED_PTR<TcpTransport> The TcpTransport object

◆ ReleaseNode()

void RobotRaconteur::RobotRaconteurNodeSetup::ReleaseNode ( )

Release the node from lifecycle management.

If called, RobotRaconteurNode::Shutdown() will not be called when the node setup instance is destroyed


The documentation for this class was generated from the following file: