pion::platform::Vocabulary Class Reference

#include <Vocabulary.hpp>

List of all members.


Detailed Description

Vocabulary: maps URI identifiers and numeric references to Term information

Definition at line 38 of file Vocabulary.hpp.

Public Types

typedef unsigned long TermRef
 data type for numeric term references
typedef boost::shared_ptr<
Term
TermPtr
 data type for a pointer to a Term object
 TYPE_NULL = 0
 NULL or undefined type.
 TYPE_INT8
 8-bit, signed integer (uses boost::int32_t)
 TYPE_UINT8
 8-bit, unsigned integer (uses boost::uint32_t)
 TYPE_INT16
 16-bit, signed integer (uses boost::int32_t)
 TYPE_UINT16
 16-bit, unsigned integer (uses boost::uint32_t)
 TYPE_INT32
 32-bit, signed integer (uses boost::int32_t)
 TYPE_UINT32
 32-bit, unsigned integer (uses boost::uint32_t)
 TYPE_INT64
 64-bit, signed integer (uses boost::int64_t)
 TYPE_UINT64
 64-bit, unsigned integer (uses boost::uint64_t)
 TYPE_FLOAT
 floating point number (uses float)
 TYPE_DOUBLE
 large floating point number (uses double)
 TYPE_LONG_DOUBLE
 very large floating point number (uses long double)
 TYPE_SHORT_STRING
 variable-length string up to 255 bytes
 TYPE_STRING
 variable-length string up to 65535 bytes
 TYPE_LONG_STRING
 variable-length string up to 2^32-1 bytes
 TYPE_DATE_TIME
 represents a specific date and/or time using term_format
 TYPE_DATE
 represents a specific date using term_format
 TYPE_TIME
 represents a specific time of day using term_format
 TYPE_CHAR
 fixed-length string of size term_size
 TYPE_BLOB
 BLOB; like longstring, but may contain NULLs.
 TYPE_ZBLOB
 ZBLOB; like BLOB except, that it gets compressed in/out a DB.
 TYPE_OBJECT
 object is currently reserved for Event Types
enum  DataType {
  TYPE_NULL = 0, TYPE_INT8, TYPE_UINT8, TYPE_INT16,
  TYPE_UINT16, TYPE_INT32, TYPE_UINT32, TYPE_INT64,
  TYPE_UINT64, TYPE_FLOAT, TYPE_DOUBLE, TYPE_LONG_DOUBLE,
  TYPE_SHORT_STRING, TYPE_STRING, TYPE_LONG_STRING, TYPE_DATE_TIME,
  TYPE_DATE, TYPE_TIME, TYPE_CHAR, TYPE_BLOB,
  TYPE_ZBLOB, TYPE_OBJECT
}
 data type for the type of data that a term represents More...

Public Member Functions

 ~Vocabulary ()
 public destructor: not virtual, should not be extended
 Vocabulary (void)
 constructs a new Vocabulary instance
 Vocabulary (const Vocabulary &v)
 (copy) constructs a new Vocabulary instance
size_t size (void) const
 returns the number of Terms that are defined within the Vocabulary
const Termoperator[] (const TermRef &term_ref) const
TermRef findTerm (const std::string &term_id) const
const TermfindTerm (const TermRef &term_ref) const
TermRef addTerm (const Term &t)
void removeTerm (const std::string &term_id)
void updateTerm (const Term &t)
void refreshTerm (Term &t) const
const Vocabularyoperator+= (const Vocabulary &v)

Static Public Member Functions

static DataType parseDataType (std::string str)
static std::string getDataTypeAsString (const DataType type)

Static Public Attributes

static const TermRef UNDEFINED_TERM_REF = 0
 null term reference constant (0)

Classes

class  DuplicateTermException
 exception thrown if you try to add a duplicate Term More...
class  EmptyTermIdException
 exception thrown if you try to add a term with an empty identifier More...
struct  Term
 data type for vocabulary terms More...
class  TermNoLongerDefinedException
 exception thrown by refreshTerm() if a Term in use is no longer defined More...
class  TermNotFoundException
 exception thrown if there is a problem finding a Term More...
class  UnknownDataTypeException
 exception thrown if the DataType is not recognized More...


Member Enumeration Documentation

enum pion::platform::Vocabulary::DataType

data type for the type of data that a term represents

Enumerator:
TYPE_NULL  NULL or undefined type.
TYPE_INT8  8-bit, signed integer (uses boost::int32_t)
TYPE_UINT8  8-bit, unsigned integer (uses boost::uint32_t)
TYPE_INT16  16-bit, signed integer (uses boost::int32_t)
TYPE_UINT16  16-bit, unsigned integer (uses boost::uint32_t)
TYPE_INT32  32-bit, signed integer (uses boost::int32_t)
TYPE_UINT32  32-bit, unsigned integer (uses boost::uint32_t)
TYPE_INT64  64-bit, signed integer (uses boost::int64_t)
TYPE_UINT64  64-bit, unsigned integer (uses boost::uint64_t)
TYPE_FLOAT  floating point number (uses float)
TYPE_DOUBLE  large floating point number (uses double)
TYPE_LONG_DOUBLE  very large floating point number (uses long double)
TYPE_SHORT_STRING  variable-length string up to 255 bytes
TYPE_STRING  variable-length string up to 65535 bytes
TYPE_LONG_STRING  variable-length string up to 2^32-1 bytes
TYPE_DATE_TIME  represents a specific date and/or time using term_format
TYPE_DATE  represents a specific date using term_format
TYPE_TIME  represents a specific time of day using term_format
TYPE_CHAR  fixed-length string of size term_size
TYPE_BLOB  BLOB; like longstring, but may contain NULLs.
TYPE_ZBLOB  ZBLOB; like BLOB except, that it gets compressed in/out a DB.
TYPE_OBJECT  object is currently reserved for Event Types

Definition at line 49 of file Vocabulary.hpp.


Member Function Documentation

Vocabulary::TermRef pion::platform::Vocabulary::addTerm ( const Term t  ) 

adds a new Term if it has not yet been defined

Parameters:
t the Term to identify or define
Returns:
const TermRef& the reference number assigned to the new Term

Definition at line 51 of file Vocabulary.cpp.

References pion::platform::Vocabulary::Term::term_comment, pion::platform::Vocabulary::Term::term_format, pion::platform::Vocabulary::Term::term_id, pion::platform::Vocabulary::Term::term_size, pion::platform::Vocabulary::Term::term_type, and TYPE_CHAR.

Referenced by pion::platform::VocabularyConfig::addTerm(), pion::platform::VocabularyConfig::bind(), pion::platform::VocabularyConfig::openConfigFile(), operator+=(), and updateTerm().

const Term& pion::platform::Vocabulary::findTerm ( const TermRef term_ref  )  const [inline]

returns the Term, identified with the TermRef

Parameters:
term_ref term_ref of the Term to be found
Returns:
const Term& the full term

Definition at line 199 of file Vocabulary.hpp.

TermRef pion::platform::Vocabulary::findTerm ( const std::string &  term_id  )  const [inline]

returns the numeric Term identifier for a Term

Parameters:
term_id unique identifier for the Term
Returns:
const TermRef& the numeric reference assigned to the Term

Definition at line 185 of file Vocabulary.hpp.

Referenced by refreshTerm(), pion::platform::RuleChain::setConfig(), pion::platform::Protocol::setConfig(), pion::platform::DatabaseInserter::setConfig(), pion::platform::Codec::setConfig(), pion::plugins::TransformReactor::setConfig(), pion::plugins::FissionReactor::setConfig(), pion::plugins::XMLCodec::setConfig(), pion::plugins::LogCodec::setConfig(), pion::plugins::JSONCodec::setConfig(), pion::platform::TransformAssignTerm::TransformAssignTerm(), pion::platform::TransformJoinTerm::TransformJoinTerm(), pion::platform::TransformLookup::TransformLookup(), pion::platform::TransformRegex::TransformRegex(), pion::platform::TransformRules::TransformRules(), pion::platform::TransformSplitTerm::TransformSplitTerm(), pion::platform::TransformURLDecode::TransformURLDecode(), pion::platform::TransformURLEncode::TransformURLEncode(), pion::plugins::PythonReactor::updateTerms(), and pion::platform::VocabularyManager::writeTermConfigXML().

std::string pion::platform::Vocabulary::getDataTypeAsString ( const DataType  type  )  [static]

returns a string that represents a particular data type

Parameters:
type the data type to get a string for
Returns:
std::string a temporary string object that represents the data type

Definition at line 211 of file Vocabulary.cpp.

References TYPE_BLOB, TYPE_CHAR, TYPE_DATE, TYPE_DATE_TIME, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_LONG_DOUBLE, TYPE_LONG_STRING, TYPE_NULL, TYPE_OBJECT, TYPE_SHORT_STRING, TYPE_STRING, TYPE_TIME, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, TYPE_UINT8, and TYPE_ZBLOB.

Referenced by pion::platform::VocabularyConfig::updateTerm(), and pion::platform::VocabularyConfig::writeTermConfigXML().

const Vocabulary & pion::platform::Vocabulary::operator+= ( const Vocabulary v  ) 

Incorporates all the data from another Vocabulary into this one

Parameters:
v the Vocabulary object copy data from
Returns:
const Vocabulary& reference to this Vocabulary object

Definition at line 144 of file Vocabulary.cpp.

References addTerm(), m_num_terms, m_ref_map, and UNDEFINED_TERM_REF.

Referenced by Vocabulary().

const Term& pion::platform::Vocabulary::operator[] ( const TermRef term_ref  )  const [inline]

returns a reference to the definition for a particular Term

Parameters:
term_ref reference number assigned to the Term
Returns:
const Term& reference to the Term's definition

Definition at line 174 of file Vocabulary.hpp.

Vocabulary::DataType pion::platform::Vocabulary::parseDataType ( std::string  str  )  [static]

parses data type from a string

Parameters:
str the string to parse
Returns:
DataType the type matching the parsed string

Definition at line 156 of file Vocabulary.cpp.

References TYPE_BLOB, TYPE_CHAR, TYPE_DATE, TYPE_DATE_TIME, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_LONG_DOUBLE, TYPE_LONG_STRING, TYPE_NULL, TYPE_OBJECT, TYPE_SHORT_STRING, TYPE_STRING, TYPE_TIME, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, TYPE_UINT8, and TYPE_ZBLOB.

Referenced by pion::platform::VocabularyConfig::parseTermConfig(), and pion::platform::Database::readConfigDetails().

void pion::platform::Vocabulary::refreshTerm ( Term t  )  const

refresh a Term copy after Vocabulary was updated

Parameters:
t the Term to refresh (t.term_id is used to find the updated Term)

Definition at line 131 of file Vocabulary.cpp.

References findTerm(), pion::platform::Vocabulary::Term::term_id, and UNDEFINED_TERM_REF.

Referenced by pion::platform::Comparison::updateVocabulary(), pion::plugins::FissionReactor::updateVocabulary(), pion::plugins::XMLCodec::updateVocabulary(), pion::plugins::LogCodec::updateVocabulary(), and pion::plugins::JSONCodec::updateVocabulary().

void pion::platform::Vocabulary::removeTerm ( const std::string &  term_id  ) 

removes a Term from the Vocabulary (use with caution!!!)

Parameters:
term_id unique identifier for the Term to remove

Definition at line 80 of file Vocabulary.cpp.

References UNDEFINED_TERM_REF.

Referenced by pion::platform::VocabularyConfig::bind(), and pion::platform::VocabularyConfig::removeTerm().

void pion::platform::Vocabulary::updateTerm ( const Term t  ) 

update the settings for a Term

Parameters:
t the Term to update (t.term_id is used to find the Term to change)

Definition at line 100 of file Vocabulary.cpp.

References addTerm(), pion::platform::Vocabulary::Term::term_comment, pion::platform::Vocabulary::Term::term_format, pion::platform::Vocabulary::Term::term_id, pion::platform::Vocabulary::Term::term_size, and pion::platform::Vocabulary::Term::term_type.

Referenced by pion::platform::VocabularyConfig::bind(), and pion::platform::VocabularyConfig::updateTerm().


The documentation for this class was generated from the following files:
Generated on Wed Apr 13 16:38:36 2011 for pion-platform by  doxygen 1.4.7