Robot Raconteur Core C++ Library
Public Member Functions | Public Attributes | List of all members
RobotRaconteur::ServiceDefinition Class Reference

Class representing a service definition. More...

Inherits boost::enable_shared_from_this< ServiceDefinition >.

Public Member Functions

virtual std::string ToString ()
 Convert service definition to a string. More...
 
void FromString (boost::string_ref s, const ServiceDefinitionParseInfo *parse_info=NULL)
 Parses a service definition from a string. More...
 
void FromString (boost::string_ref s, std::vector< ServiceDefinitionParseException > &warnings, const ServiceDefinitionParseInfo *parse_info=NULL)
 Parses a service definition from a string with warnings. More...
 
virtual void ToStream (std::ostream &os) const
 Convert service definition to a text stream. More...
 
void FromStream (std::istream &is, const ServiceDefinitionParseInfo *parse_info=NULL)
 Parse a service definition from a stream. More...
 
void FromStream (std::istream &is, std::vector< ServiceDefinitionParseException > &warnings, const ServiceDefinitionParseInfo *parse_info=NULL)
 Parse a service definition from a stream with warnings. More...
 
void CheckVersion (const RobotRaconteurVersion &ver=RobotRaconteurVersion(0, 0)) const
 Check that the service definition does not require a newer version of Robot Raconteur. More...
 
 ServiceDefinition ()
 Construct a new empty ServiceDefinition. More...
 
void Reset ()
 Clear all fields.
 

Public Attributes

std::string Name
 The name of the service definition.
 
std::vector< boost::shared_ptr< ServiceEntryDefinition > > Structures
 The structures declared in the service definition.
 
std::vector< boost::shared_ptr< ServiceEntryDefinition > > Pods
 The pods declared in the service definition.
 
std::vector< boost::shared_ptr< ServiceEntryDefinition > > NamedArrays
 The named arrays declared in the service definition.
 
std::vector< boost::shared_ptr< ServiceEntryDefinition > > Objects
 The objects declared in the service definition.
 
std::vector< std::string > Options
 The options declared in the service definition (deprecated)
 
std::vector< std::string > Imports
 The names of service definitions imported by this service definition.
 
std::vector< boost::shared_ptr< UsingDefinition > > Using
 The using types declared in this service definition.
 
std::vector< boost::shared_ptr< ExceptionDefinition > > Exceptions
 The exceptions declared in this service definition.
 
std::vector< boost::shared_ptr< ConstantDefinition > > Constants
 The top level constants declared in the service definition.
 
std::vector< boost::shared_ptr< EnumDefinition > > Enums
 The enums declared in this service definition.
 
RobotRaconteurVersion StdVer
 The service definition standard version required by this service definition.
 
ServiceDefinitionParseInfo ParseInfo
 Parsing diagnostic information. More...
 
std::string DocString
 Top level documentation string for the service.
 

Detailed Description

Class representing a service definition.

Service definitions are used to specify user defined types. Service definition files are a form of Interface Definition Language (IDL) that can be parsed by this class to load the sure defined types. See service_definitions.md for more information on service definitions.

Use FromString() or FromStream() to parse a service definition. Use ToString() or ToStream() to convert the service definition to text.

Constructor & Destructor Documentation

◆ ServiceDefinition()

RobotRaconteur::ServiceDefinition::ServiceDefinition ( )

Construct a new empty ServiceDefinition.

Must be constructed with boost::make_shared<ServiceDefinition>()

Member Function Documentation

◆ CheckVersion()

void RobotRaconteur::ServiceDefinition::CheckVersion ( const RobotRaconteurVersion ver = RobotRaconteurVersion(0, 0)) const

Check that the service definition does not require a newer version of Robot Raconteur.

The stdver keyword can be declared in a service definition to require a greater or equal version of the Robot Raconteur library. CheckVersion() will compare the library version and throw an exception if the service definition requires a newer library version.

Parameters
verThe test Robot Raconteur version. If all zero (unspecified), uses current library version

◆ FromStream() [1/2]

void RobotRaconteur::ServiceDefinition::FromStream ( std::istream &  is,
const ServiceDefinitionParseInfo parse_info = NULL 
)

Parse a service definition from a stream.

Parses the stream specified in is. Stream text must be in the Service Definition IDL format.

Service definition must be verified using VerifyServiceDefinitions() after parsing

Parameters
isThe stream containing the service definition text
parse_infoParsing diagnostic information

◆ FromStream() [2/2]

void RobotRaconteur::ServiceDefinition::FromStream ( std::istream &  is,
std::vector< ServiceDefinitionParseException > &  warnings,
const ServiceDefinitionParseInfo parse_info = NULL 
)

Parse a service definition from a stream with warnings.

Parses the stream specified in is. Stream text must be in the Service Definition IDL format. Parse warnings will be added to the warnings parameter.

Service definition must be verified using VerifyServiceDefinitions() after parsing

Parameters
isThe stream containing the service definition text
warningsA vector to receive parse warnings
parse_infoParsing diagnostic information

◆ FromString() [1/2]

void RobotRaconteur::ServiceDefinition::FromString ( boost::string_ref  s,
const ServiceDefinitionParseInfo parse_info = NULL 
)

Parses a service definition from a string.

Parses the string specified in s. String must be in the Service Definition IDL format.

Service definition must be verified using VerifyServiceDefinitions() after parsing

Parameters
sThe service definition as a string
parse_infoParsing diagnostic information

◆ FromString() [2/2]

void RobotRaconteur::ServiceDefinition::FromString ( boost::string_ref  s,
std::vector< ServiceDefinitionParseException > &  warnings,
const ServiceDefinitionParseInfo parse_info = NULL 
)

Parses a service definition from a string with warnings.

Parses the string specified in s. String must be in the Service Definition IDL format. Parse warnings will be added to the warnings parameter.

Service definition must be verified using VerifyServiceDefinitions() after parsing

Parameters
sThe service definition as a string
warningsA vector to receive parse warnings
parse_infoParsing diagnostic information

◆ ToStream()

virtual void RobotRaconteur::ServiceDefinition::ToStream ( std::ostream &  os) const
virtual

Convert service definition to a text stream.

Writes service definition to a stream that can be stored as a file

Parameters
osThe stream to write the service definition to

◆ ToString()

virtual std::string RobotRaconteur::ServiceDefinition::ToString ( )
virtual

Convert service definition to a string.

Writes service definition to a string that can be stored as a file

Returns
std::string The service definition file as a string

Member Data Documentation

◆ ParseInfo

ServiceDefinitionParseInfo RobotRaconteur::ServiceDefinition::ParseInfo

Parsing diagnostic information.

The ParseInfo field is populated by the FromString() or FromStream() functions


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