CCompoundRWRegistry Class Reference
[Application Registry]

Search Toolkit Book for CCompoundRWRegistry

#include <ncbireg.hpp>

Inheritance diagram for CCompoundRWRegistry:

Inheritance graph
[legend]
Collaboration diagram for CCompoundRWRegistry:

Collaboration graph
[legend]
List of all members.

Detailed Description

CCompoundRWRegistry --.

Writeable compound registry.

Compound registry whose top layer is a two-layer registry; all writes go to the two-layer registry.

Definition at line 651 of file ncbireg.hpp.

Public Types

typedef int TPriority
 Not restricted to ePriority_*.
enum  EPriority { ePriority_MinUser = CCompoundRegistry::ePriority_Min, ePriority_Default = CCompoundRegistry::ePriority_Default, ePriority_MaxUser = CCompoundRegistry::ePriority_Max - 0x10000, ePriority_Reserved }
 Priority for sub-registries; entries in higher-priority sub-registries take precedence over (identically named) entries in lower-priority ones. More...

Public Member Functions

 CCompoundRWRegistry (TFlags m_Flags=0)
 Constructor.
 ~CCompoundRWRegistry ()
 Destructor.
TPriority GetCoreCutoff (void) const
 Subregistries whose priority is less than the core cutoff (ePriority_Reserved by default) will be ignored for fJustCore operations, such as Write by default.
void SetCoreCutoff (TPriority prio)
void Add (const IRegistry &reg, TPriority prio=ePriority_Default, const string &name=kEmptyStr)
 Non-empty names must be unique within each compound registry, but there is no limit to the number of anonymous sub-registries.
void Remove (const IRegistry &reg)
 Remove sub-registry "reg".
CConstRef< IRegistryFindByName (const string &name) const
 Return a pointer to the sub-registry with the given name, or NULL if not found.
CConstRef< IRegistryFindByContents (const string &section, const string &entry=kEmptyStr, TFlags flags=0) const
 Return a pointer to the highest-priority sub-registry with a section named SECTION containing (if ENTRY is non-empty) an entry named ENTRY, or NULL if not found.
bool LoadBaseRegistries (TFlags flags=0, intmetareg_flags=0)
 Load any base registries listed in [NCBI].Inherits; returns true if able to load at least one, false otherwise.

Static Public Attributes

static const char * sm_MainRegName = ".main"
 Predefined subregistry's name.
static const char * sm_BaseRegNamePrefix = ".base:"
 Prefix for any base registries' names.

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)
IRWRegistryx_Read (CNcbiIstream &is, TFlags flags)
 Most implementations should not override this, but CNcbiRegistry must, to handle some special cases properly.
void x_Add (const IRegistry &reg, TPriority prio=ePriority_Default, const string &name=kEmptyStr)
 Add an internal high-priority subregistry.

Private Types

typedef map< string, TFlagsTClearedEntries

Private Attributes

TClearedEntries m_ClearedEntries
CRef< CTwoLayerRegistrym_MainRegistry
CRef< CCompoundRegistrym_AllRegistries
set< string > m_BaseRegNames
TFlags m_Flags


Member Typedef Documentation

typedef map<string, TFlags> CCompoundRWRegistry::TClearedEntries [private]
 

Definition at line 737 of file ncbireg.hpp.

typedef int CCompoundRWRegistry::TPriority
 

Not restricted to ePriority_*.

Definition at line 669 of file ncbireg.hpp.


Member Enumeration Documentation

enum CCompoundRWRegistry::EPriority
 

Priority for sub-registries; entries in higher-priority sub-registries take precedence over (identically named) entries in lower-priority ones.

Ties are broken arbitrarily.

Enumerator:
ePriority_MinUser 
ePriority_Default 
ePriority_MaxUser 
ePriority_Reserved  Everything greater is for internal use.

Definition at line 663 of file ncbireg.hpp.


Constructor & Destructor Documentation

CCompoundRWRegistry::CCompoundRWRegistry TFlags  m_Flags = 0  ) 
 

Constructor.

Definition at line 1484 of file ncbireg.cpp.

References CCompoundRegistry::ePriority_Max, m_MainRegistry, sm_MainRegName, and x_Add().

Referenced by CNcbiRegistry::x_Init().

CCompoundRWRegistry::~CCompoundRWRegistry  ) 
 

Destructor.

Definition at line 1494 of file ncbireg.cpp.


Member Function Documentation

void CCompoundRWRegistry::Add const IRegistry reg,
TPriority  prio = ePriority_Default,
const string &  name = kEmptyStr
 

Non-empty names must be unique within each compound registry, but there is no limit to the number of anonymous sub-registries.

Sub-registries themselves may not (directly) appear more than once.

Definition at line 1511 of file ncbireg.cpp.

References NCBI_THROW2.

CConstRef< IRegistry > CCompoundRWRegistry::FindByContents const string &  section,
const string &  entry = kEmptyStr,
TFlags  flags = 0
const
 

Return a pointer to the highest-priority sub-registry with a section named SECTION containing (if ENTRY is non-empty) an entry named ENTRY, or NULL if not found.

Definition at line 1545 of file ncbireg.cpp.

References m_AllRegistries.

CConstRef< IRegistry > CCompoundRWRegistry::FindByName const string &  name  )  const
 

Return a pointer to the sub-registry with the given name, or NULL if not found.

Definition at line 1539 of file ncbireg.cpp.

References m_AllRegistries.

Referenced by LoadBaseRegistries(), x_Clear(), and CNcbiRegistry::x_Read().

CCompoundRWRegistry::TPriority CCompoundRWRegistry::GetCoreCutoff void   )  const
 

Subregistries whose priority is less than the core cutoff (ePriority_Reserved by default) will be ignored for fJustCore operations, such as Write by default.

Definition at line 1499 of file ncbireg.cpp.

References m_AllRegistries.

Referenced by x_Enumerate().

bool CCompoundRWRegistry::LoadBaseRegistries TFlags  flags = 0,
intmetareg_flags  = 0
 

Load any base registries listed in [NCBI].Inherits; returns true if able to load at least one, false otherwise.

Definition at line 1553 of file ncbireg.cpp.

References _TRACE, FindByName(), IRegistry::fJustCore, m_MainRegistry, CNcbiRegistry::sm_FileRegName, and NStr::Split().

Referenced by x_Read(), and CNcbiRegistry::x_Read().

void CCompoundRWRegistry::Remove const IRegistry reg  ) 
 

Remove sub-registry "reg".

Throw an exception if "reg" is not a (direct) sub-registry.

Definition at line 1527 of file ncbireg.cpp.

References CRef< C, Locker >::GetPointer(), m_MainRegistry, and NCBI_THROW2.

Referenced by x_Clear().

void CCompoundRWRegistry::SetCoreCutoff TPriority  prio  ) 
 

Definition at line 1505 of file ncbireg.cpp.

References m_AllRegistries.

void CCompoundRWRegistry::x_Add const IRegistry reg,
TPriority  prio = ePriority_Default,
const string &  name = kEmptyStr
[protected]
 

Add an internal high-priority subregistry.

Definition at line 1770 of file ncbireg.cpp.

References m_AllRegistries.

Referenced by CCompoundRWRegistry(), and CNcbiRegistry::x_Init().

void CCompoundRWRegistry::x_ChildLockAction FLockAction  action  )  [protected]
 

Definition at line 1703 of file ncbireg.cpp.

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

Called locked, like the virtual methods inherited from IRegistry.

Implements IRWRegistry.

Reimplemented in CNcbiRegistry.

Definition at line 1709 of file ncbireg.cpp.

References set< Key, Compare >::clear(), FindByName(), ITERATE, m_BaseRegNames, m_MainRegistry, Remove(), and sm_BaseRegNamePrefix.

Referenced by CNcbiRegistry::x_Clear().

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

Definition at line 1609 of file ncbireg.cpp.

References CRef< C, Locker >::Empty(), and m_AllRegistries.

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

Definition at line 1674 of file ncbireg.cpp.

References map_checker< Container >::end(), map_checker< Container >::find(), IRegistry::fJustCore, GetCoreCutoff(), set< Key, Compare >::insert(), ITERATE, m_AllRegistries, m_ClearedEntries, REVERSE_ITERATE, and s_FlatKey().

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

Definition at line 1632 of file ncbireg.cpp.

References map_checker< Container >::end(), map_checker< Container >::find(), IRegistry::fJustCore, kEmptyStr, m_ClearedEntries, and s_FlatKey().

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

Definition at line 1666 of file ncbireg.cpp.

References m_AllRegistries.

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

Definition at line 1648 of file ncbireg.cpp.

References map_checker< Container >::end(), map_checker< Container >::find(), IRegistry::fJustCore, m_ClearedEntries, and s_FlatKey().

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

Definition at line 1615 of file ncbireg.cpp.

References m_AllRegistries.

IRWRegistry * CCompoundRWRegistry::x_Read CNcbiIstream is,
TFlags  flags
[protected, virtual]
 

Most implementations should not override this, but CNcbiRegistry must, to handle some special cases properly.

Reimplemented from IRWRegistry.

Reimplemented in CNcbiRegistry.

Definition at line 1756 of file ncbireg.cpp.

References IRegistry::Empty(), IRegistry::fOverride, IRegistry::fPersistent, LoadBaseRegistries(), and IRWRegistry::x_Read().

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

Implements IRWRegistry.

Definition at line 1720 of file ncbireg.cpp.

References _TRACE, IRegistry::fLayerFlags, IRegistry::fPersistent, IRegistry::Get(), IRegistry::HasEntry(), m_ClearedEntries, m_MainRegistry, and s_FlatKey().

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

Implements IRWRegistry.

Definition at line 1748 of file ncbireg.cpp.

References m_MainRegistry.

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

Definition at line 1621 of file ncbireg.cpp.

References m_AllRegistries, and m_MainRegistry.


Member Data Documentation

CRef<CCompoundRegistry> CCompoundRWRegistry::m_AllRegistries [private]
 

Definition at line 741 of file ncbireg.hpp.

Referenced by FindByContents(), FindByName(), GetCoreCutoff(), SetCoreCutoff(), x_Add(), x_Empty(), x_Enumerate(), x_GetComment(), x_Modified(), and x_SetModifiedFlag().

set<string> CCompoundRWRegistry::m_BaseRegNames [private]
 

Definition at line 742 of file ncbireg.hpp.

Referenced by x_Clear().

TClearedEntries CCompoundRWRegistry::m_ClearedEntries [private]
 

Definition at line 739 of file ncbireg.hpp.

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

TFlags CCompoundRWRegistry::m_Flags [private]
 

Reimplemented in CNcbiRegistry.

Definition at line 743 of file ncbireg.hpp.

CRef<CTwoLayerRegistry> CCompoundRWRegistry::m_MainRegistry [private]
 

Definition at line 740 of file ncbireg.hpp.

Referenced by CCompoundRWRegistry(), LoadBaseRegistries(), Remove(), x_Clear(), x_Set(), x_SetComment(), and x_SetModifiedFlag().

const char * CCompoundRWRegistry::sm_BaseRegNamePrefix = ".base:" [static]
 

Prefix for any base registries' names.

Definition at line 707 of file ncbireg.hpp.

Referenced by x_Clear().

const char * CCompoundRWRegistry::sm_MainRegName = ".main" [static]
 

Predefined subregistry's name.

Definition at line 705 of file ncbireg.hpp.

Referenced by CCompoundRWRegistry(), and CNcbiRegistry::x_Read().


The documentation for this class was generated from the following files:
Generated on Mon Dec 7 10:51:39 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:22:52 2009 by modify_doxy.py rev. 173732