Classes | Enumerator | Functions | Variables

Datahash API
[Datahash Libraries]

Datahash object plus supporting serialization/deserialization and other utilities. More...

Collaboration diagram for Datahash API:

Classes

struct  hash_value_t
class  Datahash
 Basic datahash object. More...

Functions

 hash_value_t::hash_value_t (const std::string &s)
 hash_value_t::hash_value_t (smart_ptr< Datahash > &h)
 hash_value_t::hash_value_t (void) throw ()
void hash_value_t::clear (void) throw ()
void Datahash::insert (const char *key, const hash_value_t &hv)
void Datahash::insert (const std::string &key, const hash_value_t &hv)
 insert the given object at the given key value
void Datahash::insert (const char *key, const char *value)
void Datahash::insert (const char *key, smart_ptr< Datahash > &subHash)
int Datahash::count (const char *key) const throw ()
void Datahash::getIterator (iterator_t &i) const throw ()
void Datahash::getIterator (const char *key, iterator_t &i) const throw ()
const hash_value_tDatahash::getNextElementUnsafe (iterator_t &i, std::string &key) const throw ()
const hash_value_tDatahash::getNextElementUnsafe (iterator_t &i) const throw ()
static smart_ptr< DatahashDatahash::create (void)
threadsafe_multimap
< std::string, hash_value_t > * 
Datahash::nonConst (void) const throw ()
smart_ptr< DatahashreadHashFromStream (const char *key, std::istream &stream)

Variables

eHashDataType hash_value_t::type
std::string hash_value_t::text
smart_ptr< Datahashhash_value_t::hash



enum  eHashDataType {
  eHashDataType_String = 1,
  eHashDataType_Hash = 2,
  eHashDataType_Invalid = 0
}
bool isValidHashKeyName (const char *key_name) throw ()
 is the given key valid? there are restrictions on key formats
void validateHashKeyName (const char *key_name)
 throw an exception if the given key is not valid



enum  eDatahash_Flag {
  eDatahash_Required = 1,
  eDatahash_Optional = 2,
  eDatahash_Invalid = 0
}
const char * getString (const Datahash *hash, const char *key, eDatahash_Flag flag=eDatahash_Required)
const char * getOptionalString (const Datahash *hash, const char *key, const char *default_value)
long getLong (const Datahash *hash, const char *key)
long getOptionalLong (const Datahash *hash, const char *key, long default_value)
double getDouble (const Datahash *hash, const char *key)
bool getBooleanValueFromString (const char *value)
bool getBoolean (const Datahash *hash, const char *key)
smart_ptr< DatahashgetSubhash (const Datahash *hash, const char *key_name, eDatahash_Flag flag=eDatahash_Required)
static short getShort (const Datahash *hash, const char *key)
static int getInt (const Datahash *hash, const char *key)
static byte_t getByte (const Datahash *hash, const char *key)
static float getFloat (const Datahash *hash, const char *key)
template<class T >
void setValue (Datahash *hash, const char *key_name, const T &t)
void setTimestampAsDateString (Datahash *hash, const char *key, long timestamp)
long getTimestampFromDateString (const Datahash *hash, const char *key)
void getStringValues (const Datahash *hash, const char *key, VecString &vec)
smart_ptr< DatahashgetHashFromColonString (const char *s)

Detailed Description

Datahash object plus supporting serialization/deserialization and other utilities.


Enumeration Type Documentation

Enumerator:
eHashDataType_String 

simple text string value

eHashDataType_Hash 

subhash

eHashDataType_Invalid 

Definition at line 67 of file lib/datahash/datahash.h.

Enumerator:
eDatahash_Required 

field is required

eDatahash_Optional 

optional field

eDatahash_Invalid 

Definition at line 57 of file datahash_util.h.


Function Documentation

bool isValidHashKeyName ( const char *  key_name  )  throw ()

is the given key valid? there are restrictions on key formats

Definition at line 145 of file datahash.cpp.

void validateHashKeyName ( const char *  key_name  ) 

throw an exception if the given key is not valid

Definition at line 182 of file datahash.cpp.

hash_value_t::hash_value_t ( const std::string &  s  )  [inherited]

Definition at line 101 of file datahash.cpp.

hash_value_t::hash_value_t ( smart_ptr< Datahash > &  h  )  [inherited]

Definition at line 112 of file datahash.cpp.

hash_value_t::hash_value_t ( void   )  throw () [inline, inherited]

Definition at line 84 of file lib/datahash/datahash.h.

void hash_value_t::clear ( void   )  throw () [inherited]

Definition at line 125 of file datahash.cpp.

void Datahash::insert ( const char *  key,
const hash_value_t hv 
) [inline, inherited]

Definition at line 112 of file lib/datahash/datahash.h.

void Datahash::insert ( const std::string &  key,
const hash_value_t t 
) [inline, inherited]

insert the given object at the given key value

Reimplemented from threadsafe_multimap< std::string, hash_value_t >.

Definition at line 117 of file lib/datahash/datahash.h.

void Datahash::insert ( const char *  key,
const char *  value 
) [inline, inherited]

Definition at line 123 of file lib/datahash/datahash.h.

void Datahash::insert ( const char *  key,
smart_ptr< Datahash > &  subHash 
) [inline, inherited]

Definition at line 130 of file lib/datahash/datahash.h.

int Datahash::count ( const char *  key  )  const throw () [inline, inherited]

Definition at line 138 of file lib/datahash/datahash.h.

void Datahash::getIterator ( iterator_t &  i  )  const throw () [inline, inherited]

Definition at line 142 of file lib/datahash/datahash.h.

void Datahash::getIterator ( const char *  key,
iterator_t &  i 
) const throw () [inline, inherited]

Definition at line 146 of file lib/datahash/datahash.h.

const hash_value_t* Datahash::getNextElementUnsafe ( iterator_t &  i,
std::string &  key 
) const throw () [inline, inherited]

Definition at line 150 of file lib/datahash/datahash.h.

const hash_value_t* Datahash::getNextElementUnsafe ( iterator_t &  i  )  const throw () [inline, inherited]

Definition at line 155 of file lib/datahash/datahash.h.

static smart_ptr<Datahash> Datahash::create ( void   )  [inline, static, inherited]

Definition at line 161 of file lib/datahash/datahash.h.

threadsafe_multimap<std::string, hash_value_t>* Datahash::nonConst ( void   )  const throw () [inline, private, inherited]

Definition at line 171 of file lib/datahash/datahash.h.

smart_ptr<Datahash> readHashFromStream ( const char *  key,
std::istream &  stream 
)

Definition at line 186 of file datahash_text.cpp.

const char* getString ( const Datahash hash,
const char *  key,
eDatahash_Flag  flag = eDatahash_Required 
)

Definition at line 89 of file datahash_util.cpp.

const char* getOptionalString ( const Datahash hash,
const char *  key,
const char *  default_value 
)

Definition at line 110 of file datahash_util.cpp.

long getLong ( const Datahash hash,
const char *  key 
)

Definition at line 128 of file datahash_util.cpp.

long getOptionalLong ( const Datahash hash,
const char *  key,
long  default_value 
)

Definition at line 143 of file datahash_util.cpp.

double getDouble ( const Datahash hash,
const char *  key 
)

Definition at line 162 of file datahash_util.cpp.

bool getBooleanValueFromString ( const char *  value  ) 

Definition at line 177 of file datahash_util.cpp.

bool getBoolean ( const Datahash hash,
const char *  key 
)

Definition at line 210 of file datahash_util.cpp.

smart_ptr<Datahash> getSubhash ( const Datahash hash,
const char *  key_name,
eDatahash_Flag  flag = eDatahash_Required 
)

Definition at line 225 of file datahash_util.cpp.

static short getShort ( const Datahash hash,
const char *  key 
) [inline, static]

Definition at line 89 of file datahash_util.h.

static int getInt ( const Datahash hash,
const char *  key 
) [inline, static]

Definition at line 92 of file datahash_util.h.

static byte_t getByte ( const Datahash hash,
const char *  key 
) [inline, static]

Definition at line 95 of file datahash_util.h.

static float getFloat ( const Datahash hash,
const char *  key 
) [inline, static]

Definition at line 98 of file datahash_util.h.

template<class T >
void setValue ( Datahash hash,
const char *  key_name,
const T &  t 
)

Definition at line 106 of file datahash_util.h.

void setTimestampAsDateString ( Datahash hash,
const char *  key,
long  timestamp 
)

Definition at line 246 of file datahash_util.cpp.

long getTimestampFromDateString ( const Datahash hash,
const char *  key 
)

Definition at line 265 of file datahash_util.cpp.

void getStringValues ( const Datahash hash,
const char *  key,
VecString vec 
)

Definition at line 327 of file datahash_util.cpp.

smart_ptr<Datahash> getHashFromColonString ( const char *  s  ) 

Definition at line 281 of file datahash_util.cpp.


Variable Documentation

Definition at line 89 of file lib/datahash/datahash.h.

std::string hash_value_t::text [inherited]

Definition at line 90 of file lib/datahash/datahash.h.

Definition at line 91 of file lib/datahash/datahash.h.