Poco::RemotingNG

class SerializerBase

File Information

Library: RemotingNG
Package: Serialization
Header: Poco/RemotingNG/SerializerBase.h

Description

SerializerBase is the common base class for Serializer and Deserializer.

This class provides common definitions and member functions for Serializer and Deserializer classes, most importantly properties management.

Properties allow a TypeSerializer or other classes using a Serializer or Deserializer to send additional (meta-)information to the Serializer (or Deserializer), for example XML namespace information for XML elements.

Properties are managed in a stacks -- a separate stack is maintained for every property identified by a name. Users of Serializer and Deserializer classes can push property values onto a stack before serializing a certain object or message, and pop properties from the stack when serialization is completed.

Inheritance

Known Derived Classes: Poco::RemotingNG::REST::Deserializer, Poco::RemotingNG::REST::JSONDeserializer, Poco::RemotingNG::REST::PathDeserializer, Poco::RemotingNG::REST::RawSerializer, Poco::RemotingNG::SOAP::Deserializer, Poco::RemotingNG::REST::FormDeserializer, Poco::RemotingNG::REST::HeaderSerializer, Poco::RemotingNG::REST::RawDeserializer, Poco::RemotingNG::SOAP::Serializer, Poco::RemotingNG::REST::ScalarSerializer, Serializer, Poco::RemotingNG::REST::FormSerializer, Poco::RemotingNG::REST::Serializer, BinarySerializer, BinaryDeserializer, Poco::RemotingNG::JSONRPC::Deserializer, Poco::RemotingNG::REST::PathSerializer, Deserializer, Poco::RemotingNG::JSONRPC::Serializer, Poco::RemotingNG::REST::JSONSerializer, Poco::RemotingNG::REST::HeaderDeserializer, Poco::RemotingNG::REST::ScalarDeserializer

Member Summary

Member Functions: clearProperties, getProperty, hasProperty, popProperty, pushProperty, reset, resetImpl

Enumerations

MessageType

MESSAGE_REQUEST

MESSAGE_REPLY

MESSAGE_EVENT

MESSAGE_EVENT_REPLY

MESSAGE_FAULT

Constructors

SerializerBase protected

SerializerBase();

Creates a Serializer.

Destructor

~SerializerBase protected virtual

virtual ~SerializerBase();

Destroys the Serializer.

Member Functions

getProperty

const std::string & getProperty(
    const std::string & name
) const;

Gets the property with the given name from its stack.

Throws an exception if the stack is empty.

getProperty

const std::string & getProperty(
    const std::string & name,
    const std::string & deflt
) const;

Gets the property with the given name from its stack. Returns the default value if the stack is empty.

Warning: Since this method may return a const reference to the default value, the caller must make sure not to pass a temporary object as default value.

hasProperty

bool hasProperty(
    const std::string & name
) const;

Returns true if a property with the given name exists.

popProperty

void popProperty(
    const std::string & name
);

Pops a property value from its stack.

Throws an exception if the property stack is empty or does not exist.

pushProperty

void pushProperty(
    const std::string & name,
    const std::string & value
);

Pushes a property value onto the stack for the property with the given name.

reset inline

void reset();

Resets the Serializer or Deserializer to a clean state.

clearProperties protected

void clearProperties();

Clears all properties.

resetImpl protected virtual

virtual void resetImpl() = 0;

Resets the serializer. Must be implemented by subclasses.

Variables

PROP_ACTION static

static const std::string PROP_ACTION;

PROP_CONSUMES static

static const std::string PROP_CONSUMES;

PROP_CONTENT_TYPE static

static const std::string PROP_CONTENT_TYPE;

PROP_FAULT static

static const std::string PROP_FAULT;

PROP_FORMAT static

static const std::string PROP_FORMAT;

PROP_HEADER static

static const std::string PROP_HEADER;

PROP_LENGTH static

static const std::string PROP_LENGTH;

PROP_LOCATION static

static const std::string PROP_LOCATION;

PROP_NAMESPACE static

static const std::string PROP_NAMESPACE;

PROP_PATH static

static const std::string PROP_PATH;

PROP_PRODUCES static

static const std::string PROP_PRODUCES;

PROP_REPLY static

static const std::string PROP_REPLY;

PROP_REQUEST static

static const std::string PROP_REQUEST;

PROP_XSDTYPE static

static const std::string PROP_XSDTYPE;

RETURN_PARAM static

static const std::string RETURN_PARAM;

The element name used to serialize a function's return value.