ifw-ccf 4.0.0
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 <ccf/common/base.hpp>
9#include <ccf/common/db.hpp>
10
11namespace ccf::common {
12
21 class NameMapping: public ccf::Base {
22 public:
25
27 virtual void Load(const std::string& name_mapping);
28
31 void AddNameMapping(const std::string& primary_name,
32 const std::string& secondary_name);
33
35 bool HasNameMapping(const std::string& name) const;
36
40 std::vector<std::string> GetPossibleNames(const std::string& name) const;
41
44 const std::string& GetPrimaryName(const std::string& secondary_name,
45 const bool tolerant = true) const;
46
49 std::string GetSecondaryName(const std::string& primary_name,
50 const bool tolerant = true) const;
51
53 const std::map<std::string, std::string>& GetPrimaryToSecondaryMap() const;
54
56 const std::map<std::string, std::string>& GetSecondaryToPrimaryMap() const;
57
59 std::string ToString() const;
60
61 private:
62 std::string m_mapping_file;
63 std::map<std::string, std::string> m_prim_to_sec_name_map;
64 std::map<std::string, std::string> m_sec_to_prim_name_map;
65 };
66
67}
68
69#endif // CCF_COMMON_NAME_MAPPING_HPP_H_
Class to be used as parent all CCF classes.
Definition: base.hpp:107
Implements a name mapping service, based on a Name Mapping File to be loaded and installed.
Definition: nameMapping.hpp:21
const std::map< std::string, std::string > & GetPrimaryToSecondaryMap() const
Return the reference to the Primary to Secondary name map.
Definition: nameMapping.cpp:140
virtual void Load(const std::string &name_mapping)
Load the given Name Mapping.
Definition: nameMapping.cpp:21
std::string GetSecondaryName(const std::string &primary_name, const bool tolerant=true) const
Definition: nameMapping.cpp:109
void AddNameMapping(const std::string &primary_name, const std::string &secondary_name)
Definition: nameMapping.cpp:58
const std::string & GetPrimaryName(const std::string &secondary_name, const bool tolerant=true) const
Definition: nameMapping.cpp:126
const std::map< std::string, std::string > & GetSecondaryToPrimaryMap() const
Return the reference to the Secondary to Primary name map.
Definition: nameMapping.cpp:145
NameMapping()
Definition: nameMapping.cpp:13
std::vector< std::string > GetPossibleNames(const std::string &name) const
Return various possible names based on the name given as input.
Definition: nameMapping.cpp:71
~NameMapping()
Definition: nameMapping.cpp:17
std::string ToString() const
Generate a sumamry string status of the object.
Definition: nameMapping.cpp:99
bool HasNameMapping(const std::string &name) const
Return true if a mapping is defined for the given parameter.
Definition: nameMapping.cpp:87
Definition: appBase.cpp:8