OW_NAMESPACE::HDBHandle Class Reference

#include <OW_HDB.hpp>

Collaboration diagram for OW_NAMESPACE::HDBHandle:

Collaboration graph
[legend]
List of all members.

Public Types

typedef HDBHandleDataRef HDBHandle::* safe_bool

Public Member Functions

 HDBHandle (const HDBHandle &x)
 Create a new HDBHandle object from another (copy ctor).
 HDBHandle ()
HDBHandleoperator= (const HDBHandle &x)
 Assignment operator.
void flush ()
 Flush the underlying database and index files.
HDBNode getNode (const String &key)
 Get the HDBNode associated with a key.
HDBNode getParent (HDBNode &node)
 Get the HDBNode that is the parent of another HDBNode.
HDBNode getFirstChild (HDBNode &node)
 Get the HDBNode that is the first child of a given node.
HDBNode getLastChild (HDBNode &node)
 Get the HDBNode that is the last child of a given node.
HDBNode getNextSibling (HDBNode &node)
 Get the HDBNode that is the next sibling of a given node.
HDBNode getPrevSibling (HDBNode &node)
 Get the HDBNode that is the previous sibling of a given node.
HDBNode getFirstRoot ()
bool addRootNode (HDBNode &node)
 Add a node to the database that has no parent (root node).
bool addChild (HDBNode &parentNode, HDBNode &childNode)
 Add a node as a child to another node.
bool addChild (const String &parentKey, HDBNode &childNode)
 Add a node as a child to another node referenced by a given key.
bool removeNode (HDBNode &node)
 Remove a node and all of its' children.
bool removeNode (const String &key)
 Remove the node associated with a given key and all of its' children.
bool updateNode (HDBNode &node, Int32 dataLen, const unsigned char *data)
 Update the data associated with a node.
void turnFlagsOn (HDBNode &node, UInt32 flags)
 Turn the user defined flags on in this node.
void turnFlagsOff (HDBNode &node, UInt32 flags)
 Turn the user defined flags off in this node.
void setUserValue (Int32 value)
 Set the user value for this handle.
Int32 getUserValue () const
 operator safe_bool () const
bool operator! () const

Private Types

typedef IntrusiveReference<
HDBHandleData
HDBHandleDataRef

Private Member Functions

 HDBHandle (HDB *pdb, const File &file)
File getFile ()
HDBgetHDB ()
Int32 registerWrite ()
IndexEntry findFirstIndexEntry (const char *key=NULL)
IndexEntry findNextIndexEntry ()
IndexEntry findPrevIndexEntry ()
IndexEntry findIndexEntry (const char *key)
bool addIndexEntry (const char *key, Int32 offset)
bool removeIndexEntry (const char *key)
bool updateIndexEntry (const char *key, Int32 newOffset)

Private Attributes

HDBHandleDataRef m_pdata

Friends

class HDB
class HDBNode

Classes

struct  HDBHandleData

Detailed Description

Definition at line 55 of file OW_HDB.hpp.


Member Typedef Documentation

typedef IntrusiveReference<HDBHandleData> OW_NAMESPACE::HDBHandle::HDBHandleDataRef [private]
 

Definition at line 73 of file OW_HDB.hpp.

typedef HDBHandleDataRef HDBHandle::* OW_NAMESPACE::HDBHandle::safe_bool
 

Definition at line 221 of file OW_HDB.hpp.


Constructor & Destructor Documentation

OW_NAMESPACE::HDBHandle::HDBHandle const HDBHandle x  )  [inline]
 

Create a new HDBHandle object from another (copy ctor).

Parameters:
x The HDBHandle to make a copy of.

Definition at line 79 of file OW_HDB.hpp.

OW_NAMESPACE::HDBHandle::HDBHandle  ) 
 

Definition at line 568 of file OW_HDB.cpp.

OW_NAMESPACE::HDBHandle::HDBHandle HDB pdb,
const File file
[private]
 

Definition at line 573 of file OW_HDB.cpp.


Member Function Documentation

bool OW_NAMESPACE::HDBHandle::addChild const String parentKey,
HDBNode childNode
 

Add a node as a child to another node referenced by a given key.

Parameters:
parentKey The key to the parent node.
childNode The child node to add to the parentNode
Returns:
true if the child node was added to the parent. false if the parent does not exist.

Definition at line 744 of file OW_HDB.cpp.

References OW_NAMESPACE::String::empty().

bool OW_NAMESPACE::HDBHandle::addChild HDBNode parentNode,
HDBNode childNode
 

Add a node as a child to another node.

Parameters:
parentNode The node to add the child node to.
childNode The child node to add to parentNode.
Returns:
true if the child node was added to the parent. Otherwise false.
Exceptions:
HDBException 

Definition at line 717 of file OW_HDB.cpp.

References OW_NAMESPACE::HDBNode::getOffset(), and OW_THROW.

bool OW_NAMESPACE::HDBHandle::addIndexEntry const char *  key,
Int32  offset
[private]
 

Definition at line 877 of file OW_HDB.cpp.

References m_pdata.

bool OW_NAMESPACE::HDBHandle::addRootNode HDBNode node  ) 
 

Add a node to the database that has no parent (root node).

Parameters:
node The node to add as a root node to the database.
Returns:
true if the node was added to the database. Otherwise false.
Exceptions:
HDBException 

Definition at line 697 of file OW_HDB.cpp.

References OW_NAMESPACE::String::c_str(), OW_NAMESPACE::HDBNode::getKey(), OW_NAMESPACE::HDBNode::getOffset(), m_pdata, OW_THROW, and OW_NAMESPACE::HDBNode::write().

IndexEntry OW_NAMESPACE::HDBHandle::findFirstIndexEntry const char *  key = NULL  )  [private]
 

Definition at line 853 of file OW_HDB.cpp.

References m_pdata.

IndexEntry OW_NAMESPACE::HDBHandle::findIndexEntry const char *  key  )  [private]
 

Definition at line 871 of file OW_HDB.cpp.

References m_pdata.

IndexEntry OW_NAMESPACE::HDBHandle::findNextIndexEntry  )  [private]
 

Definition at line 859 of file OW_HDB.cpp.

References m_pdata.

IndexEntry OW_NAMESPACE::HDBHandle::findPrevIndexEntry  )  [private]
 

Definition at line 865 of file OW_HDB.cpp.

References m_pdata.

void OW_NAMESPACE::HDBHandle::flush  ) 
 

Flush the underlying database and index files.

Definition at line 586 of file OW_HDB.cpp.

References m_pdata.

File OW_NAMESPACE::HDBHandle::getFile  )  [inline, private]
 

Definition at line 231 of file OW_HDB.hpp.

HDBNode OW_NAMESPACE::HDBHandle::getFirstChild HDBNode node  ) 
 

Get the HDBNode that is the first child of a given node.

Parameters:
node The node to get the first child from.
Returns:
An HDBNode for the first child of node on success. Otherwise a NULL HDBNode if there are no children.
Exceptions:
HDBException 

Definition at line 633 of file OW_HDB.cpp.

References OW_NAMESPACE::HDBNode::getFirstChildOffset(), HDBNode, and OW_NAMESPACE::HDBNode::reload().

HDBNode OW_NAMESPACE::HDBHandle::getFirstRoot  ) 
 

Returns:
The first root node of the database if there is one. Othewise a NULL HDBNode.
Exceptions:
HDBException 

Definition at line 597 of file OW_HDB.cpp.

References HDBNode, and m_pdata.

HDB* OW_NAMESPACE::HDBHandle::getHDB  )  [inline, private]
 

Definition at line 232 of file OW_HDB.hpp.

HDBNode OW_NAMESPACE::HDBHandle::getLastChild HDBNode node  ) 
 

Get the HDBNode that is the last child of a given node.

Parameters:
node The node to get the last child from.
Returns:
An HDBNode for the last child of node on success. Otherwise a NULL HDBNode if there are no children.
Exceptions:
HDBException 

Definition at line 649 of file OW_HDB.cpp.

References OW_NAMESPACE::HDBNode::getLastChildOffset(), HDBNode, and OW_NAMESPACE::HDBNode::reload().

HDBNode OW_NAMESPACE::HDBHandle::getNextSibling HDBNode node  ) 
 

Get the HDBNode that is the next sibling of a given node.

Parameters:
node The node to get the next sibling from.
Returns:
An HDBNode for the next sibling of node on success. Otherwise a NULL HDBNode if there are no siblings.
Exceptions:
HDBException 

Definition at line 665 of file OW_HDB.cpp.

References OW_NAMESPACE::HDBNode::getNextSiblingOffset(), HDBNode, and OW_NAMESPACE::HDBNode::reload().

HDBNode OW_NAMESPACE::HDBHandle::getNode const String key  ) 
 

Get the HDBNode associated with a key.

Parameters:
key The key of the HDBNode to retrieve.
Returns:
The HDBNode associated with the key on success. Otherwise a NULL HDBNode if the node doesn't exist.
Exceptions:
HDBException 

Definition at line 607 of file OW_HDB.cpp.

References OW_NAMESPACE::String::c_str(), OW_NAMESPACE::String::empty(), and HDBNode.

HDBNode OW_NAMESPACE::HDBHandle::getParent HDBNode node  ) 
 

Get the HDBNode that is the parent of another HDBNode.

Parameters:
node The node to get the parent HDBNode for.
Returns:
The HDBNode that is the parent of the given node on success. Otherwise a NULL HDBNode if there is no parent.
Exceptions:
HDBException 

Definition at line 617 of file OW_HDB.cpp.

References OW_NAMESPACE::HDBNode::getParentOffset(), HDBNode, and OW_NAMESPACE::HDBNode::reload().

HDBNode OW_NAMESPACE::HDBHandle::getPrevSibling HDBNode node  ) 
 

Get the HDBNode that is the previous sibling of a given node.

Parameters:
node The node to get the previous sibling from.
Returns:
An HDBNode for the previous sibling of node on success. Otherwise a NULL HDBNode if there are no siblings.
Exceptions:
HDBException 

Definition at line 681 of file OW_HDB.cpp.

References OW_NAMESPACE::HDBNode::getPrevSiblingOffset(), HDBNode, and OW_NAMESPACE::HDBNode::reload().

Int32 OW_NAMESPACE::HDBHandle::getUserValue  )  const [inline]
 

Returns:
The user value for this HDBHandle object.
See also:
setUserValue

Definition at line 219 of file OW_HDB.hpp.

OW_NAMESPACE::HDBHandle::operator safe_bool  )  const [inline]
 

Returns:
true if the is a valid HDBHandle. Otherwise false.

Definition at line 225 of file OW_HDB.hpp.

References m_pdata.

bool OW_NAMESPACE::HDBHandle::operator!  )  const [inline]
 

Definition at line 227 of file OW_HDB.hpp.

HDBHandle& OW_NAMESPACE::HDBHandle::operator= const HDBHandle x  )  [inline]
 

Assignment operator.

Parameters:
x The HDBHandle to assign to this one.
Returns:
A reference to this HDBHandle

Definition at line 86 of file OW_HDB.hpp.

References m_pdata.

Int32 OW_NAMESPACE::HDBHandle::registerWrite  )  [private]
 

Definition at line 579 of file OW_HDB.cpp.

References m_pdata.

bool OW_NAMESPACE::HDBHandle::removeIndexEntry const char *  key  )  [private]
 

Definition at line 883 of file OW_HDB.cpp.

References m_pdata.

bool OW_NAMESPACE::HDBHandle::removeNode const String key  ) 
 

Remove the node associated with a given key and all of its' children.

Parameters:
key The key of the node to remove.
Returns:
true if the node was removed. Otherwise false.
Exceptions:
HDBException 

Definition at line 774 of file OW_HDB.cpp.

References OW_NAMESPACE::String::c_str(), and OW_NAMESPACE::String::empty().

bool OW_NAMESPACE::HDBHandle::removeNode HDBNode node  ) 
 

Remove a node and all of its' children.

Parameters:
node The node to remove.
Returns:
true if the node was removed. Otherwise false.
Exceptions:
HDBException 

Definition at line 759 of file OW_HDB.cpp.

References OW_NAMESPACE::HDBNode::getOffset(), OW_NAMESPACE::HDBNode::reload(), and OW_NAMESPACE::HDBNode::remove().

void OW_NAMESPACE::HDBHandle::setUserValue Int32  value  )  [inline]
 

Set the user value for this handle.

The user value is not used by the HDBHandle object. It allows the user to store any value for later retrieval. It is being used to help facilitate the caching of HDBHandle object.

Parameters:
value The new value for the user data field.

Definition at line 214 of file OW_HDB.hpp.

void OW_NAMESPACE::HDBHandle::turnFlagsOff HDBNode node,
UInt32  flags
 

Turn the user defined flags off in this node.

Parameters:
node The node to turn the flags off in
flags The flags to turn off in this node.

Definition at line 834 of file OW_HDB.cpp.

References OW_NAMESPACE::HDBNode::getOffset(), OW_NAMESPACE::HDBNode::reload(), and OW_NAMESPACE::HDBNode::turnFlagsOff().

void OW_NAMESPACE::HDBHandle::turnFlagsOn HDBNode node,
UInt32  flags
 

Turn the user defined flags on in this node.

Parameters:
node The node to turn the flags on in
flags The flags to turn on in this node.

Definition at line 815 of file OW_HDB.cpp.

References OW_NAMESPACE::HDBNode::getOffset(), OW_NAMESPACE::HDBNode::reload(), and OW_NAMESPACE::HDBNode::turnFlagsOn().

bool OW_NAMESPACE::HDBHandle::updateIndexEntry const char *  key,
Int32  newOffset
[private]
 

Definition at line 889 of file OW_HDB.cpp.

References m_pdata.

bool OW_NAMESPACE::HDBHandle::updateNode HDBNode node,
Int32  dataLen,
const unsigned char *  data
 

Update the data associated with a node.

Parameters:
node The node to update the data on.
dataLen The length of the data that will be associated with node.
data The data that will be associated with node.
Returns:
true if the update was successful. Otherwise false.
Exceptions:
HDBException 

Definition at line 790 of file OW_HDB.cpp.

References OW_NAMESPACE::HDBNode::getOffset(), OW_NAMESPACE::HDBNode::reload(), and OW_NAMESPACE::HDBNode::updateData().


Friends And Related Function Documentation

friend class HDB [friend]
 

Definition at line 241 of file OW_HDB.hpp.

friend class HDBNode [friend]
 

Definition at line 242 of file OW_HDB.hpp.

Referenced by getFirstChild(), getFirstRoot(), getLastChild(), getNextSibling(), getNode(), getParent(), and getPrevSibling().


Member Data Documentation

HDBHandleDataRef OW_NAMESPACE::HDBHandle::m_pdata [private]
 

Definition at line 249 of file OW_HDB.hpp.

Referenced by addIndexEntry(), addRootNode(), findFirstIndexEntry(), findIndexEntry(), findNextIndexEntry(), findPrevIndexEntry(), flush(), getFirstRoot(), operator safe_bool(), operator=(), registerWrite(), removeIndexEntry(), and updateIndexEntry().


The documentation for this class was generated from the following files:
Generated on Thu Feb 9 09:16:37 2006 for openwbem by  doxygen 1.4.6