Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
kome::core::CommonParameterManager Class Reference

common parameter manager class More...

#include <CommonParameterManager.h>

Classes

struct  ParamInfo
 parameter info More...
 

Public Member Functions

 CommonParameterManager ()
 constructor
 
virtual ~CommonParameterManager ()
 destructor
 
int getNumberOfParameters ()
 gets the number of parameters variables More...
 
std::string getParameterName (unsigned int index)
 gets parameters variable name More...
 
void setParameter (std::string paramName, std::string paramValue, bool tempFlg)
 sets parameter More...
 
std::string getParameter (std::string paramName, std::string defaultName)
 gets parameter More...
 
bool isTemporaryParameter (unsigned int index)
 is temporary parameter More...
 

Static Public Member Functions

static CommonParameterManagergetInstance ()
 gets common parameter management object. More...
 

Protected Attributes

std::vector< ParamInfom_paramInfo
 

Detailed Description

common parameter manager class

Definition at line 25 of file CommonParameterManager.h.

Member Function Documentation

static CommonParameterManager & kome::core::CommonParameterManager::getInstance ( )
static

gets common parameter management object.

Returns
common parameter object. (This is the only object.)

Definition at line 122 of file CommonParameterManager.cpp.

122  {
123  // create object (This is the only object.)
124  static CommonParameterManager mgr;
125 
126  return mgr;
127 }
common parameter manager class
int kome::core::CommonParameterManager::getNumberOfParameters ( )

gets the number of parameters variables

Returns
the number of parameters variables

Definition at line 43 of file CommonParameterManager.cpp.

43  {
44  return m_paramInfo.size();
45 }
std::string kome::core::CommonParameterManager::getParameter ( std::string  paramName,
std::string  defaultName 
)

gets parameter

Parameters
[in]paramNameparameters name
[in]defaultNameparameters default name
Returns
parameter value (If the parameter info doesn't have value for specified name or value is empty, this method returns defaultName.)

Definition at line 98 of file CommonParameterManager.cpp.

98  {
99  std::string str = defaultName;
100  for( unsigned int i=0; i < m_paramInfo.size(); i++ ){
101  if( paramName.compare( m_paramInfo[i].paramName ) == 0 ){
102  if( !m_paramInfo[i].paramValue.empty() ){
103  str = m_paramInfo[i].paramValue;
104  }
105  break;
106  }
107  }
108 
109  return str;
110 }
std::string kome::core::CommonParameterManager::getParameterName ( unsigned int  index)

gets parameters variable name

Parameters
[in]indexparameters variable index
Returns
parameter name (If the index is illegal, this method returns NULL.)

Definition at line 48 of file CommonParameterManager.cpp.

48  {
49  if( index >= m_paramInfo.size() ) {
50  return NULL;
51  }
52 
53  return m_paramInfo[ index ].paramName;
54 }
#define NULL
Definition: CoreMacros.h:18
bool kome::core::CommonParameterManager::isTemporaryParameter ( unsigned int  index)

is temporary parameter

Parameters
[in]indexparameters variable index
Returns
true:is temporary parameter / false:in not temporary parameter

Definition at line 113 of file CommonParameterManager.cpp.

113  {
114  if( index >= m_paramInfo.size() ) {
115  return true;
116  }
117 
118  return m_paramInfo[ index ].tempFlg;
119 }
void kome::core::CommonParameterManager::setParameter ( std::string  paramName,
std::string  paramValue,
bool  tempFlg 
)

sets parameter

Parameters
[in]paramNameparameters name
[in]paramValueparameters value
[in]tempFlgtemporary parameter flag

Definition at line 57 of file CommonParameterManager.cpp.

57  {
58  for( unsigned int i=0; i < m_paramInfo.size(); i++ ){
59  if( paramName.compare( m_paramInfo[i].paramName ) == 0 ){
60  return;
61  }
62  }
63 
64  ParamInfo info;
65  info.paramName = paramName;
66  info.paramValue = paramValue;
67  info.tempFlg = tempFlg;
68 
69  m_paramInfo.push_back( info );
70 
71  if( !tempFlg ){
72  setIniString( paramName, paramValue );
73  }
74 }

Member Data Documentation

std::vector< ParamInfo > kome::core::CommonParameterManager::m_paramInfo
protected

parameters info

Definition at line 52 of file CommonParameterManager.h.


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