dmlite::Extensible Struct Reference

Helpful typedef for KeyValue containers. More...

#include <extensible.h>

Inherited by dmlite::ExtendedStat, dmlite::GroupInfo, dmlite::Pool, dmlite::Replica, dmlite::SecurityCredentials, dmlite::SymLink, and dmlite::UserInfo.

List of all members.

Public Types

typedef DictType_::const_iterator const_iterator
 Iterators.

Public Member Functions

bool hasField (const std::string &key) const
 Returns true if there is a field name "key".
const boost::any & operator[] (const std::string &key) const throw (DmException)
boost::any & operator[] (const std::string &key)
bool operator== (const Extensible &) const
bool operator!= (const Extensible &) const
bool operator> (const Extensible &) const
bool operator< (const Extensible &) const
unsigned long size () const
 Number of elements inside this Extensible.
void clear ()
 Removes all the content.
void copy (const Extensible &s)
void erase (const std::string &)
 Removes an entry.
std::string serialize (void) const
 Serializes to JSON. In principle, it only supports POD.
void deserialize (const std::string &serial) throw (DmException)
 Deserializes from a JSON string.
std::vector< std::string > getKeys (void) const throw (DmException)
 Get all the keys available.
bool getBool (const std::string &key, bool defaultValue=false) const throw (DmException)
 Gets a boolean. May be able to perform some conversions.
long getLong (const std::string &key, long defaultValue=0) const throw (DmException)
 Gets an integer. May be able to perform some conversions.
unsigned long getUnsigned (const std::string &key, unsigned long defaultValue=0) const throw (DmException)
 Gets an unsigned integer. May be able to perform some conversions.
double getDouble (const std::string &key, double defaultValue=0) const throw (DmException)
 Gets a float. May be able to perform some conversions.
int64_t getS64 (const std::string &key, int64_t defaultValue=0) const throw (DmException)
 Gets a signed 64 bits type.
uint64_t getU64 (const std::string &key, uint64_t defaultValue=0) const throw (DmException)
 Gets an unsigned 64 bits type.
std::string getString (const std::string &key, const std::string &defaultValue="") const throw (DmException)
 Gets a string. May perform some conversions.
Extensible getExtensible (const std::string &key, const Extensible &defaultValue=Extensible()) const throw (DmException)
 Gets a nested dictionary.
std::vector< boost::any > getVector (const std::string &key, const std::vector< boost::any > &defaultValue=std::vector< boost::any >()) const throw (DmException)
 Gets an array.
const_iterator begin () const
const_iterator end () const

Static Public Member Functions

static bool anyToBoolean (const boost::any &any)
 Converts an any to a boolean, casting if needed.
static unsigned anyToUnsigned (const boost::any &any)
 Converts an any to an unsigned, casting if needed.
static long anyToLong (const boost::any &any)
 Converts an any to a long, casting if needed.
static double anyToDouble (const boost::any &any)
 Converts an any to a double, casting if needed.
static std::string anyToString (const boost::any &any)
 Converts an any to a string, casting if needed.
static int64_t anyToS64 (const boost::any &any)
 Converts an any to a int64_t.
static uint64_t anyToU64 (const boost::any &any)
 Converts an any to a uint64_t.

Private Types

typedef std::pair< std::string,
boost::any > 
EntryType_
typedef std::vector< EntryType_DictType_

Private Member Functions

void populate (const boost::property_tree::ptree &root)

Private Attributes

DictType_ dictionary_

Detailed Description

Helpful typedef for KeyValue containers.


Member Typedef Documentation

typedef DictType_::const_iterator dmlite::Extensible::const_iterator

Iterators.

typedef std::vector<EntryType_> dmlite::Extensible::DictType_ [private]
typedef std::pair<std::string, boost::any> dmlite::Extensible::EntryType_ [private]

Member Function Documentation

static bool dmlite::Extensible::anyToBoolean ( const boost::any &  any  )  [static]

Converts an any to a boolean, casting if needed.

static double dmlite::Extensible::anyToDouble ( const boost::any &  any  )  [static]

Converts an any to a double, casting if needed.

static long dmlite::Extensible::anyToLong ( const boost::any &  any  )  [static]

Converts an any to a long, casting if needed.

static int64_t dmlite::Extensible::anyToS64 ( const boost::any &  any  )  [static]

Converts an any to a int64_t.

static std::string dmlite::Extensible::anyToString ( const boost::any &  any  )  [static]

Converts an any to a string, casting if needed.

static uint64_t dmlite::Extensible::anyToU64 ( const boost::any &  any  )  [static]

Converts an any to a uint64_t.

static unsigned dmlite::Extensible::anyToUnsigned ( const boost::any &  any  )  [static]

Converts an any to an unsigned, casting if needed.

const_iterator dmlite::Extensible::begin ( void   )  const [inline]
void dmlite::Extensible::clear (  ) 

Removes all the content.

void dmlite::Extensible::copy ( const Extensible s  ) 

Copies the content from another Extensible Note: This will call clear first!

void dmlite::Extensible::deserialize ( const std::string &  serial  )  throw (DmException)

Deserializes from a JSON string.

const_iterator dmlite::Extensible::end (  )  const [inline]
void dmlite::Extensible::erase ( const std::string &   ) 

Removes an entry.

bool dmlite::Extensible::getBool ( const std::string &  key,
bool  defaultValue = false 
) const throw (DmException)

Gets a boolean. May be able to perform some conversions.

double dmlite::Extensible::getDouble ( const std::string &  key,
double  defaultValue = 0 
) const throw (DmException)

Gets a float. May be able to perform some conversions.

Extensible dmlite::Extensible::getExtensible ( const std::string &  key,
const Extensible defaultValue = Extensible() 
) const throw (DmException)

Gets a nested dictionary.

std::vector<std::string> dmlite::Extensible::getKeys ( void   )  const throw (DmException)

Get all the keys available.

long dmlite::Extensible::getLong ( const std::string &  key,
long  defaultValue = 0 
) const throw (DmException)

Gets an integer. May be able to perform some conversions.

int64_t dmlite::Extensible::getS64 ( const std::string &  key,
int64_t  defaultValue = 0 
) const throw (DmException)

Gets a signed 64 bits type.

std::string dmlite::Extensible::getString ( const std::string &  key,
const std::string &  defaultValue = "" 
) const throw (DmException)

Gets a string. May perform some conversions.

uint64_t dmlite::Extensible::getU64 ( const std::string &  key,
uint64_t  defaultValue = 0 
) const throw (DmException)

Gets an unsigned 64 bits type.

unsigned long dmlite::Extensible::getUnsigned ( const std::string &  key,
unsigned long  defaultValue = 0 
) const throw (DmException)

Gets an unsigned integer. May be able to perform some conversions.

std::vector<boost::any> dmlite::Extensible::getVector ( const std::string &  key,
const std::vector< boost::any > &  defaultValue = std::vector< boost::any >() 
) const throw (DmException)

Gets an array.

bool dmlite::Extensible::hasField ( const std::string &  key  )  const

Returns true if there is a field name "key".

bool dmlite::Extensible::operator!= ( const Extensible  )  const
bool dmlite::Extensible::operator< ( const Extensible  )  const
bool dmlite::Extensible::operator== ( const Extensible  )  const
bool dmlite::Extensible::operator> ( const Extensible  )  const
boost::any& dmlite::Extensible::operator[] ( const std::string &  key  ) 

Returns a modifiable reference to the value associated with "key". Will create the entry if it does not exist.

const boost::any& dmlite::Extensible::operator[] ( const std::string &  key  )  const throw (DmException)

Returns a reference to the value associated with "key". Will throw DmException(DM_INVALID_VALUE,...) when not found.

void dmlite::Extensible::populate ( const boost::property_tree::ptree &  root  )  [private]
std::string dmlite::Extensible::serialize ( void   )  const

Serializes to JSON. In principle, it only supports POD.

unsigned long dmlite::Extensible::size (  )  const

Number of elements inside this Extensible.


Member Data Documentation


The documentation for this struct was generated from the following file:

Generated on 18 Nov 2014 for dmlite by  doxygen 1.6.1