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 (IN const std::string &s)
 hash_value_t::hash_value_t (IN smart_ptr< Datahash > &h)
 hash_value_t::hash_value_t (void) throw ()
void hash_value_t::clear (void) throw ()
void Datahash::insert (IN const char *key, IN const hash_value_t &hv)
void Datahash::insert (IN const std::string &key, IN const hash_value_t &hv)
 insert the given object at the given key value
void Datahash::insert (IN const char *key, IN const char *value)
void Datahash::insert (IN const char *key, IN smart_ptr< Datahash > &subHash)
int Datahash::count (IN const char *key) const throw ()
void Datahash::getIterator (OUT iterator_t &i) const throw ()
void Datahash::getIterator (IN const char *key, OUT iterator_t &i) const throw ()
const hash_value_tDatahash::getNextElementUnsafe (IO iterator_t &i, OUT std::string &key) const throw ()
const hash_value_tDatahash::getNextElementUnsafe (IO iterator_t &i) const throw ()
static smart_ptr< DatahashDatahash::create (void)
smart_ptr< DatahashreadHashFromStream (IN const char *key, IO 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 (IN const char *key_name) throw ()
 is the given key valid? there are restrictions on key formats
void validateHashKeyName (IN 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 (IN const Datahash *hash, IN const char *key, IN eDatahash_Flag flag=eDatahash_Required)
const char * getOptionalString (IN const Datahash *hash, IN const char *key, IN const char *default_value)
long getLong (IN const Datahash *hash, IN const char *key)
long getOptionalLong (IN const Datahash *hash, IN const char *key, IN long default_value)
double getDouble (IN const Datahash *hash, IN const char *key)
bool getBooleanValueFromString (IN const char *value)
bool getBoolean (IN const Datahash *hash, IN const char *key)
smart_ptr< DatahashgetSubhash (IN const Datahash *hash, IN const char *key_name, IN eDatahash_Flag flag=eDatahash_Required)
static short getShort (IN const Datahash *hash, IN const char *key)
static int getInt (IN const Datahash *hash, IN const char *key)
static byte_t getByte (IN const Datahash *hash, IN const char *key)
static float getFloat (IN const Datahash *hash, IN const char *key)
template<class T >
void setValue (IN Datahash *hash, IN const char *key_name, IN const T &t)
void setTimestampAsDateString (IN Datahash *hash, IN const char *key, long timestamp)
long getTimestampFromDateString (IN const Datahash *hash, IN const char *key)
void getStringValues (IN const Datahash *hash, IN const char *key, OUT VecString &vec)
smart_ptr< DatahashgetHashFromColonString (IN 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 ( IN 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 ( IN 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 ( IN const std::string &  s  )  [inherited]

Definition at line 101 of file datahash.cpp.

hash_value_t::hash_value_t ( IN 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 ( IN const char *  key,
IN const hash_value_t hv 
) [inline, inherited]

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

void Datahash::insert ( IN const std::string &  key,
IN 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 ( IN const char *  key,
IN const char *  value 
) [inline, inherited]

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

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

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

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

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

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

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

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

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

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

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

const hash_value_t* Datahash::getNextElementUnsafe ( IO 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.

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

Definition at line 186 of file datahash_text.cpp.

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

Definition at line 89 of file datahash_util.cpp.

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

Definition at line 110 of file datahash_util.cpp.

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

Definition at line 128 of file datahash_util.cpp.

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

Definition at line 143 of file datahash_util.cpp.

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

Definition at line 162 of file datahash_util.cpp.

bool getBooleanValueFromString ( IN const char *  value  ) 

Definition at line 177 of file datahash_util.cpp.

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

Definition at line 210 of file datahash_util.cpp.

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

Definition at line 225 of file datahash_util.cpp.

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

Definition at line 89 of file datahash_util.h.

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

Definition at line 92 of file datahash_util.h.

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

Definition at line 95 of file datahash_util.h.

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

Definition at line 98 of file datahash_util.h.

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

Definition at line 106 of file datahash_util.h.

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

Definition at line 265 of file datahash_util.cpp.

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

Definition at line 327 of file datahash_util.cpp.

smart_ptr<Datahash> getHashFromColonString ( IN 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.