Robot Raconteur Core C++ Library
|
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. | |
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.
RobotRaconteur::ServiceDefinition::ServiceDefinition | ( | ) |
Construct a new empty ServiceDefinition.
Must be constructed with boost::make_shared<ServiceDefinition>()
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.
ver | The test Robot Raconteur version. If all zero (unspecified), uses current library version |
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
is | The stream containing the service definition text |
parse_info | Parsing diagnostic information |
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
is | The stream containing the service definition text |
warnings | A vector to receive parse warnings |
parse_info | Parsing diagnostic information |
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
s | The service definition as a string |
parse_info | Parsing diagnostic information |
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
s | The service definition as a string |
warnings | A vector to receive parse warnings |
parse_info | Parsing diagnostic information |
|
virtual |
Convert service definition to a text stream.
Writes service definition to a stream that can be stored as a file
os | The stream to write the service definition to |
|
virtual |
Convert service definition to a string.
Writes service definition to a string that can be stored as a file
ServiceDefinitionParseInfo RobotRaconteur::ServiceDefinition::ParseInfo |
Parsing diagnostic information.
The ParseInfo field is populated by the FromString() or FromStream() functions