#include <JSONCodec.hpp>
Inherits pion::platform::Codec.
Definition at line 41 of file JSONCodec.hpp.
Public Types | |
|
typedef boost::shared_ptr< JSONField > | JSONFieldPtr |
| data type for a shared pointer to a JSONField object | |
|
typedef PION_HASH_MAP< std::string, JSONFieldPtr, PION_HASH_STRING > | FieldMap |
| data type that maps field names to Terms | |
| typedef std::vector< JSONFieldPtr > | CurrentFormat |
| an ordered list of the fields in the current configuration | |
|
typedef PION_HASH_MULTIMAP< pion::platform::Vocabulary::TermRef, std::string > | JSONObject |
| representation of a JSON object corresponding to an Event | |
|
typedef boost::shared_ptr< JSONObject > | JSONObjectPtr |
| data type for a shared pointer to a JSONObject object | |
| typedef std::queue< JSONObjectPtr > | JSONObjectQueue |
| queue of parsed JSONObjects | |
Public Member Functions | |
| JSONCodec (void) | |
| constructs a new JSONCodec object | |
| virtual | ~JSONCodec () |
| 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 | JSONField |
| data type used to configure the formatting of Vocabulary Terms More... | |
| CodecPtr pion::plugins::JSONCodec::clone | ( | void | ) | const [virtual] |
clones the codec, returning a pointer to the cloned copy
Implements pion::platform::Codec.
Definition at line 44 of file JSONCodec.cpp.
References JSONCodec().
| void pion::plugins::JSONCodec::finish | ( | std::ostream & | out | ) | [virtual] |
writes the JSON array end token ']' to an output stream and frees the JSON generator
| out | the output stream to which the token will be written |
Implements pion::platform::Codec.
Definition at line 155 of file JSONCodec.cpp.
| bool pion::plugins::JSONCodec::read | ( | std::istream & | in, | |
| pion::platform::Event & | e | |||
| ) | [virtual] |
reads an Event from an input stream
| in | the input stream to read the Event from | |
| e | the Event read, if any; null if error |
Implements pion::platform::Codec.
Definition at line 247 of file JSONCodec.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::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::JSONCodec::setConfig | ( | const pion::platform::Vocabulary & | v, | |
| const xmlNodePtr | config_ptr | |||
| ) | [virtual] |
sets configuration parameters for this Codec
| 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 390 of file JSONCodec.cpp.
References pion::platform::Vocabulary::findTerm(), pion::platform::PlatformPlugin::getId(), and reset().
| void pion::plugins::JSONCodec::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
| 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 443 of file JSONCodec.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::JSONCodec::write | ( | std::ostream & | out, | |
| const pion::platform::Event & | e | |||
| ) | [virtual] |
writes an Event to an output stream
| 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 56 of file JSONCodec.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.
1.4.7