ifw-ccf  3.0.0-pre2
Public Member Functions | List of all members
ccf::common::NameMapping Class Reference

Implements a name mapping service, based on a Name Mapping File to be loaded and installed. More...

#include <nameMapping.hpp>

Inheritance diagram for ccf::common::NameMapping:
ccf::Base

Public Member Functions

 NameMapping ()
 
 ~NameMapping ()
 
virtual void Load (const std::string &name_mapping)
 Load the given Name Mapping. More...
 
void AddNameMapping (const std::string &primary_name, const std::string &secondary_name)
 
bool HasNameMapping (const std::string &name) const
 Return true if a mapping is defined for the given parameter. More...
 
const std::string & GetPrimaryName (const std::string &secondary_name, const bool tolerant=true) const
 
std::string GetSecondaryName (const std::string &primary_name, const bool tolerant=true) const
 
const std::map< std::string, std::string > & GetPrimaryToSecondaryMap () const
 Return the reference to the Primary to Secondary name map. More...
 
const std::map< std::string, std::string > & GetSecondaryToPrimaryMap () const
 Return the reference to the Secondary to Primary name map. More...
 
std::string ToString () const
 Generate a sumamry string status of the object. More...
 
- Public Member Functions inherited from ccf::Base
 Base ()
 
 ~Base ()
 
const std::string & GetClassName () const
 Return the allocated name of the class. More...
 
log4cplus::Logger & Loggger ()
 Return reference to logger used in this context. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ccf::Base
static ccf::mptk::ManagerMptk ()
 Return reference to internal MPTK instance (singleton). More...
 
static void SetLogLevel (const ccf::LogLevel log_level)
 Set the log level. More...
 
static ccf::LogLevel GetLogLevel ()
 Return the current CCF log level. More...
 
- Protected Member Functions inherited from ccf::Base
void SetClassName (const std::string &class_name)
 Set the name of the class in question. More...
 
void SetLogger (log4cplus::Logger &logger)
 Set reference to logger used in this context. More...
 
- Protected Attributes inherited from ccf::Base
log4cplus::Logger m_logger
 

Detailed Description

Implements a name mapping service, based on a Name Mapping File to be loaded and installed.

The class is used to handle mapping between Secondary and Primary Names. Could e.g. be mapping between a software internal name and the names at device level. The default format for Mapping Files is YAML defined as:

(primary name): (secondary name) ...

Constructor & Destructor Documentation

◆ NameMapping()

ccf::common::NameMapping::NameMapping ( )

◆ ~NameMapping()

ccf::common::NameMapping::~NameMapping ( )

Member Function Documentation

◆ AddNameMapping()

void ccf::common::NameMapping::AddNameMapping ( const std::string &  primary_name,
const std::string &  secondary_name 
)

Add a Name Mapping in the object. If "replace" is true, an existing mapping will be replaced silently.

◆ GetPrimaryName()

const std::string & ccf::common::NameMapping::GetPrimaryName ( const std::string &  secondary_name,
const bool  tolerant = true 
) const

Map the given Secondary Name into the corresponding Primary Name. If "tolerant" is true, if no mapping is found, the Secondary Name is returned as is.

◆ GetPrimaryToSecondaryMap()

const std::map< std::string, std::string > & ccf::common::NameMapping::GetPrimaryToSecondaryMap ( ) const

Return the reference to the Primary to Secondary name map.

◆ GetSecondaryName()

std::string ccf::common::NameMapping::GetSecondaryName ( const std::string &  primary_name,
const bool  tolerant = true 
) const

Map the given Primary Name into the corresponding Secondary Name. If "tolerant" is true, if no mapping is found, the Primary Name is returned as is.

◆ GetSecondaryToPrimaryMap()

const std::map< std::string, std::string > & ccf::common::NameMapping::GetSecondaryToPrimaryMap ( ) const

Return the reference to the Secondary to Primary name map.

◆ HasNameMapping()

bool ccf::common::NameMapping::HasNameMapping ( const std::string &  name) const

Return true if a mapping is defined for the given parameter.

◆ Load()

void ccf::common::NameMapping::Load ( const std::string &  name_mapping)
virtual

Load the given Name Mapping.

◆ ToString()

std::string ccf::common::NameMapping::ToString ( ) const

Generate a sumamry string status of the object.


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