ClearSilver::ClearSilverNode Class Reference

ClearSilver C API HDF dataset node. More...

#include <ClearSilverNode.h>

List of all members.

Public Types

typedef _hdf HDF
 ClearSilver C dataset.
typedef _attr HDF_ATTR

Public Member Functions

void swap (ClearSilverNode &) throw ()
 Swap contents with another object.
void sort (ClearSilverNodeComparator::Ptr)
 Sort the children.
Constructors and assignment operators
 ClearSilverNode ()
 ClearSilverNode (HDF *)
 Construct the root node of an HDF dataset.
 ClearSilverNode (const ClearSilverNode &)
 Copy constructor.
 ~ClearSilverNode () throw ()
 Destructor.
ClearSilverNodeoperator= (const ClearSilverNode &n)
 Assignment operator.
ClearSilverNodeoperator= (const char *value)
 Assign a new value to an HDF node.
ClearSilverNodeoperator= (const std::string &)
 Assign a new value to an HDF node.
ClearSilverNodeoperator= (int)
 Assign a new value to an HDF node.
ClearSilverNodeoperator= (bool)
 Assign a new value to an HDF node.
STL inspectors
bool empty () const
 Is this node empty?
Conversions
 operator bool () const
 Is this node valid?
Node accessors
std::string name () const
 Return the name (i.e., the last path component) of the node.
std::string value () const
 Return the value of the node.
Tree traversers
These functions provide direct access to elements of the ClearSilver C API dataset node structure.

HDFget () const
 Access the node structure directly.
ClearSilverNode top () const
 Access the top (root) node of the dataset.
ClearSilverNode next () const
 Access the next node at the same nesting depth.
ClearSilverNode child () const
 Access the child node of the current one.
HDF_ATTRattr () const
 Access the attribute list of the current node.
HDF dataset operations
These functions directly encapsulate the corresponding functions from the ClearSilver C API.

std::string get_value (const std::string &key, const std::string &default_value) const
void set_value (const std::string &key, const std::string &value)
void set_value (const std::string &key, int value)
void set_value (const std::string &key, unsigned int value)
void set_value (const std::string &key, bool value)
ClearSilverNode get_node (const std::string &)
ClearSilverNode get_obj (const std::string &) const
ClearSilverNode get_child (const std::string &) const
void remove_tree ()
void remove_tree (const std::string &)
void read_file (const std::string &)
void write_file (const std::string &) const
void dump (const std::string &) const
void copy (const std::string &, const ClearSilverNode &)
 Deep copy.

Static Public Member Functions

static bool & debug ()
 Access the debug flag.
Boolean constants
These string values represent the boolean constants "true" and "false" within the dataset. This simplifies, for example, the comparison of node values expected to represent boolean values with a consistent set of contants.

static std::string Boolean (bool)
 A standard string representing the appropriate boolean value.
static std::string True ()
 A standard string representing a true boolean value.
static std::string False ()
 A standard string representing a false boolean value.

Friends

bool operator== (const ClearSilverNode &, const ClearSilverNode &)
 Equality comparison operator.


Detailed Description

ClearSilver C API HDF dataset node.

This class encapsulates the interface to a ClearSilver HDF dataset node. Essentially, it provides a C++ interface to the ClearSilver C API for HDF nodes. It is not intended as a primary interface to a ClearSilver dataset; rather, it provides an implementation used by the primary interfaces ConstHDF and HDF.

Additionally, this class performs no memory management. It is assumed that this object points to valid ClearSilver HDF dataset nodes managed by some other class, for example a RootNode object.

Definition at line 68 of file ClearSilverNode.h.


Constructor & Destructor Documentation

ClearSilver::ClearSilverNode::ClearSilverNode HDF  )  [explicit]
 

Construct the root node of an HDF dataset.

If a ClearSilverNode owns the HDF dataset node, it is responsible for memory management of the entire dataset. Consequently, there should be only a single such node corresponding to each dataset. The primary dataset classes ConstHDF and HDF maintain this through a boost::shared_ptr<ClearSilverNode>, which ensures that a single copy of the root node is shared among all copies of the dataset.

Definition at line 65 of file ClearSilverNode.cc.


Member Function Documentation

void ClearSilver::ClearSilverNode::copy const std::string ,
const ClearSilverNode
 

Deep copy.

This function copies the tree rooted at a specific node to the named node beneath the current node. Note that the contents of a symbolic link, not the link, are copied.

Referenced by ClearSilver::HDF::copy().

bool & ClearSilver::ClearSilverNode::debug  )  [static]
 

Access the debug flag.

If the debug flag is true, syslog(3) messages with priority LOG_DEBUG will be logged.

Definition at line 581 of file ClearSilverNode.cc.

Referenced by attr(), child(), name(), next(), operator=(), top(), and value().

ClearSilver::ClearSilverNode & ClearSilver::ClearSilverNode::operator= bool   ) 
 

Assign a new value to an HDF node.

This method replaces the value of a node with a string version of its argument. Specifically, the value returned by the Boolean() method replaces the value of the node.

Definition at line 136 of file ClearSilverNode.cc.

References False(), operator=(), and True().

ClearSilver::ClearSilverNode & ClearSilver::ClearSilverNode::operator= int   ) 
 

Assign a new value to an HDF node.

This method replaces the value of a node with its argument.

Definition at line 121 of file ClearSilverNode.cc.

References std::basic_string< _CharT, _Traits, _Alloc >::c_str(), debug(), and ClearSilver::ConstHDFNode::name().

ClearSilverNode& ClearSilver::ClearSilverNode::operator= const std::string  ) 
 

Assign a new value to an HDF node.

This method replaces the value of a node with its argument.

Bug:
Because the underlying ClearSilver C API provides no function analagous to assignment, the implementation of this method relies on the internals of the C data structures.

ClearSilver::ClearSilverNode & ClearSilver::ClearSilverNode::operator= const char *  value  ) 
 

Assign a new value to an HDF node.

This method replaces the value of a node with its argument.

Definition at line 84 of file ClearSilverNode.cc.

References operator=().


The documentation for this class was generated from the following files:
Generated on Tue May 16 14:50:54 2006 for ClearSilver C++ Library by  doxygen 1.4.5