pion::plugins::XMLCodec Class Reference

#include <XMLCodec.hpp>

Inherits pion::platform::Codec.

List of all members.


Detailed Description

XMLCodec: used to encode and decode Events using XML (Work in progress...)

Definition at line 41 of file XMLCodec.hpp.

Public Types

typedef boost::shared_ptr<
XMLField
XMLFieldPtr
 data type for a shared pointer to a XMLField object
typedef PION_HASH_MAP< std::string,
XMLFieldPtr, PION_HASH_STRING > 
FieldMap
 data type that maps field names to Terms
typedef std::vector< XMLFieldPtrCurrentFormat
 an ordered list of the fields in the current configuration

Public Member Functions

 XMLCodec (void)
 constructs a new XMLCodec object
virtual ~XMLCodec ()
 virtual destructor: this class is meant to be extended
virtual const std::string & getContentType (void) const
 returns an HTTP content type that is used by this Codec
virtual pion::platform::CodecPtr clone (void) const
virtual void write (std::ostream &out, const pion::platform::Event &e)
virtual void finish (std::ostream &out)
virtual bool read (std::istream &in, pion::platform::Event &e)
virtual void setConfig (const pion::platform::Vocabulary &v, const xmlNodePtr config_ptr)
virtual void updateVocabulary (const pion::platform::Vocabulary &v)
void reset (void)
 resets the configuration for this Codec

Classes

class  EmptyFieldException
 exception thrown if the Codec configuration includes an empty field name More...
class  EmptyTermException
 exception thrown if the Codec configuration does not define a term in a field mapping More...
struct  XMLField
 data type used to configure the formatting of Vocabulary Terms More...


Member Function Documentation

CodecPtr pion::plugins::XMLCodec::clone ( void   )  const [virtual]

clones the codec, returning a pointer to the cloned copy

Returns:
CodecPtr pointer to the cloned copy of the codec

Implements pion::platform::Codec.

Definition at line 47 of file XMLCodec.cpp.

References XMLCodec().

void pion::plugins::XMLCodec::finish ( std::ostream &  out  )  [virtual]

writes the XML closing tag to an output stream

Parameters:
out the output stream to which the tag will be written

Implements pion::platform::Codec.

Definition at line 186 of file XMLCodec.cpp.

bool pion::plugins::XMLCodec::read ( std::istream &  in,
pion::platform::Event e 
) [virtual]

reads an Event from an input stream

Parameters:
in the input stream to read the Event from
e the Event read, if any; null if error
Returns:
true if successful, false otherwise

Implements pion::platform::Codec.

Definition at line 228 of file XMLCodec.cpp.

References pion::platform::BasicEvent< CharType, AllocType >::clear(), pion::platform::Codec::getEventType(), pion::platform::BasicEvent< CharType, AllocType >::getType(), pion::platform::BasicEvent< CharType, AllocType >::setBigInt(), pion::platform::BasicEvent< CharType, AllocType >::setDateTime(), pion::platform::BasicEvent< CharType, AllocType >::setDouble(), pion::platform::BasicEvent< CharType, AllocType >::setFloat(), pion::platform::BasicEvent< CharType, AllocType >::setInt(), pion::platform::BasicEvent< CharType, AllocType >::setLongDouble(), pion::platform::BasicEvent< CharType, AllocType >::setString(), pion::platform::BasicEvent< CharType, AllocType >::setUBigInt(), pion::platform::BasicEvent< CharType, AllocType >::setUInt(), pion::platform::Vocabulary::Term::term_ref, pion::platform::Vocabulary::Term::term_size, pion::platform::Vocabulary::Term::term_type, pion::platform::Vocabulary::TYPE_BLOB, pion::platform::Vocabulary::TYPE_CHAR, pion::platform::Vocabulary::TYPE_DATE, pion::platform::Vocabulary::TYPE_DATE_TIME, pion::platform::Vocabulary::TYPE_DOUBLE, pion::platform::Vocabulary::TYPE_FLOAT, pion::platform::Vocabulary::TYPE_INT16, pion::platform::Vocabulary::TYPE_INT32, pion::platform::Vocabulary::TYPE_INT64, pion::platform::Vocabulary::TYPE_INT8, pion::platform::Vocabulary::TYPE_LONG_DOUBLE, pion::platform::Vocabulary::TYPE_LONG_STRING, pion::platform::Vocabulary::TYPE_NULL, pion::platform::Vocabulary::TYPE_OBJECT, pion::platform::Vocabulary::TYPE_SHORT_STRING, pion::platform::Vocabulary::TYPE_STRING, pion::platform::Vocabulary::TYPE_TIME, pion::platform::Vocabulary::TYPE_UINT16, pion::platform::Vocabulary::TYPE_UINT32, pion::platform::Vocabulary::TYPE_UINT64, pion::platform::Vocabulary::TYPE_UINT8, and pion::platform::Vocabulary::TYPE_ZBLOB.

void pion::plugins::XMLCodec::setConfig ( const pion::platform::Vocabulary v,
const xmlNodePtr  config_ptr 
) [virtual]

sets configuration parameters for this Codec

Parameters:
v the Vocabulary that this Codec will use to describe Terms
config_ptr pointer to a list of XML nodes containing Codec configuration parameters

Reimplemented from pion::platform::Codec.

Definition at line 444 of file XMLCodec.cpp.

References pion::platform::Vocabulary::findTerm(), pion::platform::PlatformPlugin::getId(), and reset().

void pion::plugins::XMLCodec::updateVocabulary ( const pion::platform::Vocabulary v  )  [virtual]

this updates the Vocabulary information used by this Codec; it should be called whenever the global Vocabulary is updated

Parameters:
v the Vocabulary that this Codec will use to describe Terms

Copy Term data over from the updated Vocabulary.

Reimplemented from pion::platform::Codec.

Definition at line 507 of file XMLCodec.cpp.

References pion::platform::Vocabulary::refreshTerm(), pion::platform::Vocabulary::TYPE_DATE, pion::platform::Vocabulary::TYPE_DATE_TIME, and pion::platform::Vocabulary::TYPE_TIME.

void pion::plugins::XMLCodec::write ( std::ostream &  out,
const pion::platform::Event e 
) [virtual]

writes an Event to an output stream

Parameters:
out the output stream to which the Event will be written
e the Event to write to the output stream

Implements pion::platform::Codec.

Definition at line 61 of file XMLCodec.cpp.

References pion::platform::BasicEvent< CharType, AllocType >::equal_range(), pion::platform::Vocabulary::TYPE_BLOB, pion::platform::Vocabulary::TYPE_CHAR, pion::platform::Vocabulary::TYPE_DATE, pion::platform::Vocabulary::TYPE_DATE_TIME, pion::platform::Vocabulary::TYPE_DOUBLE, pion::platform::Vocabulary::TYPE_FLOAT, pion::platform::Vocabulary::TYPE_INT16, pion::platform::Vocabulary::TYPE_INT32, pion::platform::Vocabulary::TYPE_INT64, pion::platform::Vocabulary::TYPE_INT8, pion::platform::Vocabulary::TYPE_LONG_DOUBLE, pion::platform::Vocabulary::TYPE_LONG_STRING, pion::platform::Vocabulary::TYPE_NULL, pion::platform::Vocabulary::TYPE_OBJECT, pion::platform::Vocabulary::TYPE_SHORT_STRING, pion::platform::Vocabulary::TYPE_STRING, pion::platform::Vocabulary::TYPE_TIME, pion::platform::Vocabulary::TYPE_UINT16, pion::platform::Vocabulary::TYPE_UINT32, pion::platform::Vocabulary::TYPE_UINT64, pion::platform::Vocabulary::TYPE_UINT8, and pion::platform::Vocabulary::TYPE_ZBLOB.


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