ifw-ccf 5.0.2
Loading...
Searching...
No Matches
nameMapping.hpp
Go to the documentation of this file.
1
5#ifndef CCF_COMMON_NAME_MAPPING_HPP_H_
6#define CCF_COMMON_NAME_MAPPING_HPP_H_
7
8#include <ifw/fnd/defs/dataType.hpp>
9
11#include <ifw/ccf/common/db.hpp>
12
13
14namespace ifw::ccf::common {
15
25 public:
26
32 std::string m_default_value;
33 ifw::fnd::datatype::DataType m_data_type;
34 };
35
38
40 virtual void Load(const std::string& name_mapping);
41
44 void AddNameMapping(const std::string& primary_name,
45 const std::string& secondary_name);
46
48 bool HasNameMapping(const std::string& name) const;
49
53 std::vector<std::string> GetPossibleNames(const std::string& name) const;
54
57 const std::string& GetPrimaryName(const std::string& secondary_name,
58 const bool tolerant = true) const;
59
62 std::string GetSecondaryName(const std::string& primary_name,
63 const bool tolerant = true) const;
64
66 const std::map<std::string, std::string>& GetPrimaryToSecondaryMap() const;
67
69 const std::map<std::string, std::string>& GetSecondaryToPrimaryMap() const;
70
72 std::string ToString() const;
73
75 ParameterProperty GetParameterProperty(const std::string& secondary_name) const;
76
77 private:
78 std::string m_mapping_file;
79 std::map<std::string, std::string> m_prim_to_sec_name_map;
80 std::map<std::string, std::string> m_sec_to_prim_name_map;
81 std::map<std::string, ParameterProperty> m_sec_to_default;
82 };
83
84}
85
86#endif // CCF_COMMON_NAME_MAPPING_HPP_H_
Class to be used as parent all CCF classes.
Definition base.hpp:120
Implements a name mapping service, based on a Name Mapping File to be loaded and installed.
Definition nameMapping.hpp:24
bool HasNameMapping(const std::string &name) const
Return true if a mapping is defined for the given parameter.
Definition nameMapping.cpp:101
const std::map< std::string, std::string > & GetPrimaryToSecondaryMap() const
Return the reference to the Primary to Secondary name map.
Definition nameMapping.cpp:154
~NameMapping()
Definition nameMapping.cpp:18
std::string ToString() const
Generate a sumamry string status of the object.
Definition nameMapping.cpp:113
const std::map< std::string, std::string > & GetSecondaryToPrimaryMap() const
Return the reference to the Secondary to Primary name map.
Definition nameMapping.cpp:159
void AddNameMapping(const std::string &primary_name, const std::string &secondary_name)
Definition nameMapping.cpp:59
virtual void Load(const std::string &name_mapping)
Load the given Name Mapping.
Definition nameMapping.cpp:22
std::vector< std::string > GetPossibleNames(const std::string &name) const
Return various possible names based on the name given as input.
Definition nameMapping.cpp:85
std::string GetSecondaryName(const std::string &primary_name, const bool tolerant=true) const
Definition nameMapping.cpp:123
const std::string & GetPrimaryName(const std::string &secondary_name, const bool tolerant=true) const
Definition nameMapping.cpp:140
ParameterProperty GetParameterProperty(const std::string &secondary_name) const
Return the property of a command low level name, default to {UNDEFINED, String}.
Definition nameMapping.cpp:164
NameMapping()
Definition nameMapping.cpp:14
Definition appBase.cpp:9
std::string m_default_value
Definition nameMapping.hpp:32
ifw::fnd::datatype::DataType m_data_type
Definition nameMapping.hpp:33