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>`

## Public Types

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

## 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)
static RegistryType & | getRegistry ()

## 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

## RegistryType

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

## Member Function Documentation

## decode()

bool YAML::convert< std::shared_ptr< SurgSim::Framework::Component > >::decode | ( | const Node & | node,
|  | std::shared_ptr< SurgSim::Framework::Component > & | rhs
| ) |  |

static

## encode()

Node YAML::convert< std::shared_ptr< SurgSim::Framework::Component > >::encode | ( | const std::shared_ptr< SurgSim::Framework::Component > | rhs | ) |

static

## getRegistry()

convert< std::shared_ptr< SurgSim::Framework::Component > >::RegistryType & YAML::convert< std::shared_ptr< SurgSim::Framework::Component > >::getRegistry | ( |  | ) |

static

Returns
  The static registry for shared instances

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

- SurgSim/Framework/FrameworkConvert.h
- SurgSim/Framework/FrameworkConvert.cpp