#include <Component.h>
|
| | Component ()=default |
| |
| | Component (const std::string &filename) |
| | Constructor of the component from a file.
|
| |
| | Component (const std::string &name, dataUnMap dataDump) |
| | Constructor of the component from its name and data.
|
| |
| void | copy (std::shared_ptr< Component > component) |
| | Copy the information of the given component in the current one.
|
| |
| const std::string & | getName () |
| | Return the component's name.
|
| |
| const std::string & | getType (const std::string &name) |
| | Return a string with the type of the given data (or "" if the data doesn't exist).
|
| |
| std::vector< std::string > | getNames () |
| | Return a vector with the names of every data from this component.
|
| |
| const dataUnMap & | getRawData () |
| | Return a const reference of the component's data structure.
|
| |
| void | toString (std::ostream &stream) |
| | Append to the given stream a serialized version of the data.
|
| |
| template<typename Type> |
| Type | get (const std::string &name) |
| | Return the value of the data from its name and type.
|
| |
| template<typename Type> |
| void | set (const std::string &name, Type value) |
| | Set the value of the desired data with the given value.
|
| |
| void | add (const std::string &name, const std::string &type) |
| | Add a new data to the component.
|
| |
|
| std::string | componentName |
| | The name of the component.
|
| |
| dataUnMap | dataMap |
| | Link the data's name to the pair <type, value> in an unordered_map.
|
| |
| std::mutex | mtx |
| | Lock used by the components, let them the possibility to be used in thread.
|
| |
◆ Component() [1/3]
◆ Component() [2/3]
| Component::Component |
( |
const std::string & | filename | ) |
|
Constructor of the component from a file.
- Parameters
-
| filename | Full path towards the component's file. |
◆ Component() [3/3]
| Component::Component |
( |
const std::string & | name, |
|
|
dataUnMap | dataDump ) |
Constructor of the component from its name and data.
- Parameters
-
| name | Name of the component. |
| data | Data of the component. |
- See also
- dataUnMap
◆ add()
| void Component::add |
( |
const std::string & | name, |
|
|
const std::string & | type ) |
Add a new data to the component.
Convert automatically the serialized type to the real data.
The data is set with the default value of the given type.
- Parameters
-
| name | Data's name. |
| type | Serialized version of the data's type. |
◆ copy()
| void Component::copy |
( |
std::shared_ptr< Component > | component | ) |
|
Copy the information of the given component in the current one.
Easy way to clone a component's data towards a new one.
- Parameters
-
| component | A shared_ptr towards the component you want as the model. |
◆ get()
template<typename Type>
| Type Component::get |
( |
const std::string & | name | ) |
|
|
inline |
Return the value of the data from its name and type.
That's a generic function.
- Warning
- It's on you to give the right type when you call this method.
- Parameters
-
◆ getName()
| const std::string & Component::getName |
( |
| ) |
|
Return the component's name.
◆ getNames()
| std::vector< std::string > Component::getNames |
( |
| ) |
|
Return a vector with the names of every data from this component.
◆ getRawData()
Return a const reference of the component's data structure.
Can be used for serialization of the data or to make a copy of the component.
◆ getType()
| const std::string & Component::getType |
( |
const std::string & | name | ) |
|
Return a string with the type of the given data (or "" if the data doesn't exist).
- Parameters
-
◆ set()
template<typename Type>
| void Component::set |
( |
const std::string & | name, |
|
|
Type | value ) |
|
inline |
Set the value of the desired data with the given value.
That's a generic function.
- Parameters
-
| name | Data's name. |
| value | Data's value. |
◆ toString()
| void Component::toString |
( |
std::ostream & | stream | ) |
|
Append to the given stream a serialized version of the data.
Useful for debugging or logging.
- Parameters
-
| stream | The stream on which the informations should be append. |
◆ componentName
| std::string Component::componentName |
|
protected |
The name of the component.
◆ dataMap
Link the data's name to the pair <type, value> in an unordered_map.
◆ mtx
| std::mutex Component::mtx |
|
protected |
Lock used by the components, let them the possibility to be used in thread.
The documentation for this class was generated from the following file:
- C:/Users/thoma/GitProjects/TailorMade/TailorMade/include/Component.h