|
Robot Raconteur Core C++ Library
|
Class for type definitions. More...
#include <ServiceDefinition.h>
Public Member Functions | |
| TypeDefinition () | |
| Construct a new empty TypeDefinition. | |
| TypeDefinition (const boost::shared_ptr< MemberDefinition > &member) | |
| Construct a new empty TypeDefinition. | |
| virtual std::string | ToString () |
| Convert property definition to string. | |
| void | FromString (boost::string_ref s, const ServiceDefinitionParseInfo *parse_info=NULL) |
| Parse a type definition from string. | |
| void | Reset () |
| Clear all fields. | |
| void | CopyTo (TypeDefinition &def) const |
| Copy type definition to def. | |
| boost::shared_ptr< TypeDefinition > | Clone () const |
| Clones the type definition. | |
| void | Rename (boost::string_ref name) |
| Rename the type definition. | |
| void | RemoveContainers () |
| Removes containers from the type. | |
| void | RemoveArray () |
| Removes arrays from the type. | |
| void | QualifyTypeStringWithUsing () |
| Searches the service definition for a matching using declaration, and replaces type with qualified name. | |
| void | UnqualifyTypeStringWithUsing () |
| Searches the service definition for a matching using declaration, and replaces type with unqualified name. | |
| boost::shared_ptr< NamedTypeDefinition > | ResolveNamedType (const std::vector< boost::shared_ptr< ServiceDefinition > > &other_defs=std::vector< boost::shared_ptr< ServiceDefinition > >(), const boost::shared_ptr< RobotRaconteurNode > &node=boost::shared_ptr< RobotRaconteurNode >(), const boost::shared_ptr< RRObject > &client=boost::shared_ptr< RRObject >()) |
| Resolve the named type to a NamedTypeDefinition. | |
Static Public Member Functions | |
| static DataTypes | DataTypeFromString (boost::string_ref d) |
| Get the DataTypes type code from a string. | |
| static std::string | StringFromDataType (DataTypes d) |
| Convert a DataTypes type code to a string. | |
Public Attributes | |
| std::string | Name |
| The name of the type definition. | |
| DataTypes | Type |
| The type code of the type definition. | |
| std::string | TypeString |
| The type name used if Type is DataTypes_namedtype_t. | |
| DataTypes_ArrayTypes | ArrayType |
| The array type of the type definition. | |
| bool | ArrayVarLength |
| If true, array is variable length. If false, fixed length. | |
| std::vector< int32_t > | ArrayLength |
| The array length. | |
| DataTypes_ContainerTypes | ContainerType |
| The container type of the type definition. | |
| RR_WEAK_PTR< MemberDefinition > | member |
| The parent member of the type definition. | |
| ServiceDefinitionParseInfo | ParseInfo |
| Parsing diagnostic information. | |
Class for type definitions.
See service_definitions.md for more information
| RobotRaconteur::TypeDefinition::TypeDefinition | ( | const boost::shared_ptr< MemberDefinition > & | member | ) |
Construct a new empty TypeDefinition.
| member | The parent member definition |
| boost::shared_ptr< TypeDefinition > RobotRaconteur::TypeDefinition::Clone | ( | ) | const |
Clones the type definition.
| void RobotRaconteur::TypeDefinition::CopyTo | ( | TypeDefinition & | def | ) | const |
Copy type definition to def.
| def | The target type definition |
|
static |
| void RobotRaconteur::TypeDefinition::FromString | ( | boost::string_ref | s, |
| const ServiceDefinitionParseInfo * | parse_info = NULL ) |
Parse a type definition from string.
| s | The type definition as a string |
| parse_info | Parsing diagnostic information |
| void RobotRaconteur::TypeDefinition::QualifyTypeStringWithUsing | ( | ) |
Searches the service definition for a matching using declaration, and replaces type with qualified name.
member field must be a valid parent member. Service definition must be available by searching the parents of member.
| void RobotRaconteur::TypeDefinition::RemoveArray | ( | ) |
Removes arrays from the type.
Sets ArrayType to DataTypes_ArrayTypes_none
| void RobotRaconteur::TypeDefinition::RemoveContainers | ( | ) |
Removes containers from the type.
Sets ContainerType to DataTypes_ContainerTypes_none
| void RobotRaconteur::TypeDefinition::Rename | ( | boost::string_ref | name | ) |
Rename the type definition.
Updates the Name field
| name | The new name |
| boost::shared_ptr< NamedTypeDefinition > RobotRaconteur::TypeDefinition::ResolveNamedType | ( | const std::vector< boost::shared_ptr< ServiceDefinition > > & | other_defs = std::vector< boost::shared_ptr< ServiceDefinition > >(), |
| const boost::shared_ptr< RobotRaconteurNode > & | node = boost::shared_ptr< RobotRaconteurNode >(), | ||
| const boost::shared_ptr< RRObject > & | client = boost::shared_ptr< RRObject >() ) |
Resolve the named type to a NamedTypeDefinition.
Named types are user defined types that are declared in service definition files. Types that are not primitive types are named types. They have the type code DataTypes_namedtype_t when stored in TypeDefinition, and use the TypeString field to store the qualified or unqualified name. ResolveNamedType will search the service definition to find the matching NamedTypeDefinition. This will either have the subclass ServiceEntryDefinition or EnumDefinition.
ResolveNamedType searches the parent tree starting member, the service definitions specified in other_defs, the service types registered by the specified node, or the service types pulled by the specified client, in that order.
Failure will result in a ServiceDefinitionException being thrown.
| other_defs | Service definitions to search for type |
| node | Search service types registered in node |
| client | Search service types pulled by client |
|
static |
Convert a DataTypes type code to a string.
| d | The type code |
| void RobotRaconteur::TypeDefinition::UnqualifyTypeStringWithUsing | ( | ) |
Searches the service definition for a matching using declaration, and replaces type with unqualified name.
member field must be a valid parent member. Service definition must be available by searching the parents of member.
| std::string RobotRaconteur::TypeDefinition::Name |
The name of the type definition.
Used for parameter names