CEnvironmentRegistry Class Reference
[Application Registry]

Search Toolkit Book for CEnvironmentRegistry

#include <env_reg.hpp>

Inheritance diagram for CEnvironmentRegistry:

Inheritance graph
[legend]
Collaboration diagram for CEnvironmentRegistry:

Collaboration graph
[legend]
List of all members.

Detailed Description

CEnvironmentRegistry --.

Adapts CNcbiEnvironment to act like a registry. Leaves all caching of values to CNcbiEnvironment, and does not support comments. Always transient, though making it the persistent side of a CTwoLayerRegistry can mask that.

Uses customizable mappers between environment variable names and registry section/name pairs; see below for details.

Definition at line 86 of file env_reg.hpp.

Public Types

typedef int TPriority
 Not restricted to ePriority_*.
enum  EPriority { ePriority_Min = kMin_Int, ePriority_Default = 0, ePriority_Max = kMax_Int }

Public Member Functions

 CEnvironmentRegistry (TFlags flags=0)
 Constructors.
 CEnvironmentRegistry (CNcbiEnvironment &env, EOwnership own=eNoOwnership, TFlags flags=0)
 ~CEnvironmentRegistry ()
 Destructor.
void AddMapper (const IEnvRegMapper &mapper, TPriority prio=ePriority_Default)
void RemoveMapper (const IEnvRegMapper &mapper)

Protected Member Functions

bool x_Empty (TFlags flags) const
bool x_Modified (TFlags flags) const
void x_SetModifiedFlag (bool modified, TFlags flags)
const string & x_Get (const string &section, const string &name, TFlags flags) const
bool x_HasEntry (const string &section, const string &name, TFlags flags) const
const string & x_GetComment (const string &section, const string &name, TFlags flags) const
void x_Enumerate (const string &section, list< string > &entries, TFlags flags) const
void x_ChildLockAction (FLockAction action)
void x_Clear (TFlags flags)
 Called locked, like the virtual methods inherited from IRegistry.
bool x_Set (const string &section, const string &name, const string &value, TFlags flags, const string &comment)
bool x_SetComment (const string &comment, const string &section, const string &name, TFlags flags)

Private Types

typedef multimap< TPriority,
CConstRef< IEnvRegMapper > > 
TPriorityMap

Private Member Functions

 CEnvironmentRegistry (const CEnvironmentRegistry &)
 Copying prohibited.

Private Attributes

AutoPtr< CNcbiEnvironmentm_Env
TPriorityMap m_PriorityMap
bool m_Modified
 only tracks mods made through this.
TFlags m_Flags


Member Typedef Documentation

typedef int CEnvironmentRegistry::TPriority
 

Not restricted to ePriority_*.

Definition at line 102 of file env_reg.hpp.

typedef multimap<TPriority, CConstRef<IEnvRegMapper> > CEnvironmentRegistry::TPriorityMap [private]
 

Definition at line 133 of file env_reg.hpp.


Member Enumeration Documentation

enum CEnvironmentRegistry::EPriority
 

Enumerator:
ePriority_Min 
ePriority_Default 
ePriority_Max 

Definition at line 97 of file env_reg.hpp.


Constructor & Destructor Documentation

CEnvironmentRegistry::CEnvironmentRegistry TFlags  flags = 0  ) 
 

Constructors.

Definition at line 47 of file env_reg.cpp.

References AddMapper().

CEnvironmentRegistry::CEnvironmentRegistry CNcbiEnvironment env,
EOwnership  own = eNoOwnership,
TFlags  flags = 0
 

Definition at line 55 of file env_reg.cpp.

References AddMapper().

CEnvironmentRegistry::~CEnvironmentRegistry  ) 
 

Destructor.

Definition at line 63 of file env_reg.cpp.

CEnvironmentRegistry::CEnvironmentRegistry const CEnvironmentRegistry  )  [inline, private]
 

Copying prohibited.

Definition at line 131 of file env_reg.hpp.


Member Function Documentation

void CEnvironmentRegistry::AddMapper const IEnvRegMapper mapper,
TPriority  prio = ePriority_Default
 

Definition at line 68 of file env_reg.cpp.

References multimap_checker< Container >::insert(), and m_PriorityMap.

Referenced by CEnvironmentRegistry().

void CEnvironmentRegistry::RemoveMapper const IEnvRegMapper mapper  ) 
 

Definition at line 76 of file env_reg.cpp.

References multimap_checker< Container >::erase(), m_PriorityMap, NCBI_THROW2, and NON_CONST_ITERATE.

void CEnvironmentRegistry::x_ChildLockAction FLockAction  action  )  [protected]
 

Definition at line 191 of file env_reg.cpp.

void CEnvironmentRegistry::x_Clear TFlags  flags  )  [protected, virtual]
 

Called locked, like the virtual methods inherited from IRegistry.

Implements IRWRegistry.

Definition at line 196 of file env_reg.cpp.

References IRegistry::fTransient.

bool CEnvironmentRegistry::x_Empty TFlags  flags  )  const [protected]
 

Definition at line 90 of file env_reg.cpp.

References ITERATE, m_Env, and m_PriorityMap.

void CEnvironmentRegistry::x_Enumerate const string &  section,
list< string > &  entries,
TFlags  flags
const [protected]
 

Definition at line 159 of file env_reg.cpp.

References IRegistry::fTransient, ITERATE, m_Env, and m_PriorityMap.

const string & CEnvironmentRegistry::x_Get const string &  section,
const string &  name,
TFlags  flags
const [protected]
 

Definition at line 121 of file env_reg.cpp.

References IRegistry::fCaseFlags, IRegistry::fCountCleared, IRegistry::fPersistent, IRegistry::fTPFlags, kEmptyStr, m_Env, m_Flags, m_PriorityMap, REVERSE_ITERATE, and NStr::ToUpper().

Referenced by x_HasEntry().

const string & CEnvironmentRegistry::x_GetComment const string &  section,
const string &  name,
TFlags  flags
const [protected]
 

Definition at line 152 of file env_reg.cpp.

References kEmptyStr.

bool CEnvironmentRegistry::x_HasEntry const string &  section,
const string &  name,
TFlags  flags
const [protected]
 

Definition at line 144 of file env_reg.cpp.

References kEmptyStr, and x_Get().

bool CEnvironmentRegistry::x_Modified TFlags  flags  )  const [protected]
 

Definition at line 107 of file env_reg.cpp.

References IRegistry::fTransient, and m_Modified.

bool CEnvironmentRegistry::x_Set const string &  section,
const string &  name,
const string &  value,
TFlags  flags,
const string &  comment
[protected, virtual]
 

Implements IRWRegistry.

Definition at line 204 of file env_reg.cpp.

References IRegistry::fCaseFlags, m_Env, m_Flags, m_PriorityMap, IRWRegistry::MaybeSet(), REVERSE_ITERATE, and NStr::ToUpper().

bool CEnvironmentRegistry::x_SetComment const string &  comment,
const string &  section,
const string &  name,
TFlags  flags
[protected, virtual]
 

Implements IRWRegistry.

Definition at line 233 of file env_reg.cpp.

References ERR_POST_X.

void CEnvironmentRegistry::x_SetModifiedFlag bool  modified,
TFlags  flags
[protected]
 

Definition at line 113 of file env_reg.cpp.

References IRegistry::fTransient, and m_Modified.


Member Data Documentation

AutoPtr<CNcbiEnvironment> CEnvironmentRegistry::m_Env [private]
 

Definition at line 135 of file env_reg.hpp.

Referenced by x_Empty(), x_Enumerate(), x_Get(), and x_Set().

TFlags CEnvironmentRegistry::m_Flags [private]
 

Definition at line 138 of file env_reg.hpp.

Referenced by x_Get(), and x_Set().

bool CEnvironmentRegistry::m_Modified [private]
 

only tracks mods made through this.

Definition at line 137 of file env_reg.hpp.

Referenced by x_Modified(), and x_SetModifiedFlag().

TPriorityMap CEnvironmentRegistry::m_PriorityMap [private]
 

Definition at line 136 of file env_reg.hpp.

Referenced by AddMapper(), RemoveMapper(), x_Empty(), x_Enumerate(), x_Get(), and x_Set().


The documentation for this class was generated from the following files:
Generated on Mon Dec 7 11:27:45 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:23:03 2009 by modify_doxy.py rev. 173732