All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | Private Types | Static Private Member Functions | List of all members
YAML::convert< std::shared_ptr< SurgSim::Framework::Component > > Struct Template Reference

Specialization of YAML::convert for std::shared_ptr<Component>, use this for to read in a component written by the convert<SurgSim::Framework::Component> converter, or a reference to a component written by this converter. More...

#include <SurgSim/Framework/FrameworkConvert.h>

Static Public Member Functions

static Node encode (const std::shared_ptr< SurgSim::Framework::Component > rhs)
 
static bool decode (const Node &node, std::shared_ptr< SurgSim::Framework::Component > &rhs)
 

Private Types

typedef std::unordered_map
< std::string, std::shared_ptr
< SurgSim::Framework::Component > > 
RegistryType
 

Static Private Member Functions

static RegistryTypegetRegistry ()
 

Detailed Description

template<>
struct YAML::convert< std::shared_ptr< SurgSim::Framework::Component > >

Specialization of YAML::convert for std::shared_ptr<Component>, use this for to read in a component written by the convert<SurgSim::Framework::Component> converter, or a reference to a component written by this converter.

This specialization, is slightly asymmetric, on encode it will only encode a components name, id and className. When decoding this conversion will check whether a component with the same id has already been encountered. If no a new instance will be created and stored in a local Registry. If yes, the entry from the registry will be returned, this makes sure that all references to the same id will use the correct, copy of the smart pointer. Additionally this class contains a class factory that can be used to generate the class from its name.

Member Typedef Documentation

typedef std::unordered_map<std::string, std::shared_ptr<SurgSim::Framework::Component> > YAML::convert< std::shared_ptr< SurgSim::Framework::Component > >::RegistryType
private

Member Function Documentation

bool YAML::convert< std::shared_ptr< SurgSim::Framework::Component > >::decode ( const Node &  node,
std::shared_ptr< SurgSim::Framework::Component > &  rhs 
)
static
Node YAML::convert< std::shared_ptr< SurgSim::Framework::Component > >::encode ( const std::shared_ptr< SurgSim::Framework::Component rhs)
static
convert< std::shared_ptr< SurgSim::Framework::Component > >::RegistryType & YAML::convert< std::shared_ptr< SurgSim::Framework::Component > >::getRegistry ( )
staticprivate
Returns
The static registry for shared instances

The documentation for this struct was generated from the following files: