ifw-ccf  3.0.0-pre2
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 
10 namespace ccf::common {
11 
20  class NameMapping: public ccf::Base {
21  public:
22  NameMapping();
23  ~NameMapping();
24 
26  virtual void Load(const std::string& name_mapping);
27 
30  void AddNameMapping(const std::string& primary_name,
31  const std::string& secondary_name);
32 
34  bool HasNameMapping(const std::string& name) const;
35 
38  const std::string& GetPrimaryName(const std::string& secondary_name,
39  const bool tolerant = true) const;
40 
43  std::string GetSecondaryName(const std::string& primary_name,
44  const bool tolerant = true) const;
45 
47  const std::map<std::string, std::string>& GetPrimaryToSecondaryMap() const;
48 
50  const std::map<std::string, std::string>& GetSecondaryToPrimaryMap() const;
51 
53  std::string ToString() const;
54 
55  private:
56  std::string m_mapping_file;
57  std::map<std::string, std::string> m_prim_to_sec_name_map;
58  std::map<std::string, std::string> m_sec_to_prim_name_map;
59  };
60 
61 }
62 
63 #endif // CCF_COMMON_NAME_MAPPING_HPP_H_
Class to be used as parent all CCF classes.
Definition: base.hpp:151
Implements a name mapping service, based on a Name Mapping File to be loaded and installed.
Definition: nameMapping.hpp:20
const std::map< std::string, std::string > & GetPrimaryToSecondaryMap() const
Return the reference to the Primary to Secondary name map.
Definition: nameMapping.cpp:122
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:91
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:108
const std::map< std::string, std::string > & GetSecondaryToPrimaryMap() const
Return the reference to the Secondary to Primary name map.
Definition: nameMapping.cpp:127
NameMapping()
Definition: nameMapping.cpp:13
~NameMapping()
Definition: nameMapping.cpp:17
std::string ToString() const
Generate a sumamry string status of the object.
Definition: nameMapping.cpp:81
bool HasNameMapping(const std::string &name) const
Return true if a mapping is defined for the given parameter.
Definition: nameMapping.cpp:71
Definition: appBase.cpp:8