Poco::RemotingNG

class Deserializer

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

Description

The Deserializer interface for transports.

Implementations of the Deserializer interface must handle deserialization of various message types (request, response, events), as well as basic types. Deserialization of complex types is implemented by providing specializations of the TypeDeserializer class template.

Note that deserialize*() methods will generally return a bool and have a bool parameter isMandatory. These methods will return true if the respective element or value has been found and deserialized. If the element or value has not been found and isMandatory is true, an exception will be thrown. If isMandatory is false, false will be returned and the value will not be changed.

Inheritance

Direct Base Classes: SerializerBase

All Base Classes: SerializerBase

Known Derived Classes: BinaryDeserializer, Poco::UPnP::GENA::Deserializer, Poco::UPnP::SOAP::Deserializer

Member Summary

Member Functions: deserialize, deserializeMessageBegin, deserializeMessageEnd, deserializeNullableBegin, deserializeNullableEnd, deserializeSequenceBegin, deserializeSequenceEnd, deserializeStructBegin, deserializeStructEnd, findMessage, setup, setupImpl

Inherited Functions: clearProperties, getProperty, hasProperty, popProperty, pushAttribute, pushProperty, reset, resetImpl

Constructors

Deserializer

Deserializer();

Creates a Deserializer.

Destructor

~Deserializer virtual

virtual ~Deserializer();

Destroys the Deserializer.

Member Functions

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    Poco::Int8 & value
) = 0;

Deserialize an Int8.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    Poco::UInt8 & value
) = 0;

Deserialize an UInt8.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    Poco::Int16 & value
) = 0;

Deserialize an Int16.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    Poco::UInt16 & value
) = 0;

Deserialize an UInt16.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    Poco::Int32 & value
) = 0;

Deserialize an Int32.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    Poco::UInt32 & value
) = 0;

Deserialize an UInt32.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    long & value
) = 0;

Deserialize a long.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    unsigned long & value
) = 0;

Deserialize an unsigned long.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    float & value
) = 0;

Deserialize a float.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    double & value
) = 0;

Deserialize a double.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    bool & value
) = 0;

Deserialize a boolean.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    char & value
) = 0;

Deserialize a single character.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    std::string & value
) = 0;

Deserialize a std::string.

deserialize virtual

virtual bool deserialize(
    const std::string & name,
    bool isMandatory,
    std::vector < char > & value
) = 0;

Deserializes raw binary data.

deserializeMessageBegin virtual

virtual void deserializeMessageBegin(
    const std::string & name,
    SerializerBase::MessageType type
) = 0;

Begin deserialization of a message.

deserializeMessageEnd virtual

virtual void deserializeMessageEnd(
    const std::string & name,
    SerializerBase::MessageType type
) = 0;

End deserialization of a message.

deserializeNullableBegin virtual

virtual bool deserializeNullableBegin(
    const std::string & name,
    bool isMandatory,
    bool & isNull
) = 0;

Begin deserialization of a Nullable or pointer which may be NULL.

Returns true if the element with the given name was found. If the element was not found and isMandatory is true, an exception may be thrown (depending on whether the serialization format can distinguish between a NULL and a missing value). IsNull will be set accordingly.

Note that if this method returns false, deserializeNullableEnd() will not be called.

deserializeNullableEnd virtual

virtual void deserializeNullableEnd(
    const std::string & name
) = 0;

End deserialization of a Nullable or pointer which may be NULL.

deserializeSequenceBegin virtual

virtual bool deserializeSequenceBegin(
    const std::string & name,
    bool isMandatory,
    Poco::UInt32 & lengthHint
) = 0;

Begin deserialization of a vector or other sequence.

Returns true if the element with the given name was found. If the element was not found and isMandatory is true, an exception may be thrown (depending on whether the serialization format can distinguish between an empty and a missing sequence).

Note that if this method returns false, deserializeVectorBegin() will not be called. If sizeHint is greater than 0, it will be used to reserve space in the result vector.

deserializeSequenceEnd virtual

virtual void deserializeSequenceEnd(
    const std::string & name
) = 0;

End deserialization of a vector or other sequence.

deserializeStructBegin virtual

virtual bool deserializeStructBegin(
    const std::string & name,
    bool isMandatory
) = 0;

Begin deserialization of a complex (structured) object.

Returns true if the element with the given name was found. If the element was not found and isMandatory is true, an exception will be thrown.

Note that if this method returns false, deserializeComplexTypeEnd() will not be called.

deserializeStructEnd virtual

virtual void deserializeStructEnd(
    const std::string & name
) = 0;

End deserialization of a complex (structured) object.

findMessage virtual

virtual SerializerBase::MessageType findMessage(
    std::string & name
) = 0;

Reads from the stream until the message has been found. Returns the type of the message and the name of the found message, unless the message is a fault message. In this case, deserialize the fault message and throw an appropriate exception.

Used on the skeleton side to deserialize incoming requests. Will not be called by a Proxy when deserializing a reply.

The name returned by this method must be passed to deserializeMessageBegin().

This method must be implemented in such a way that it can be called multiple times in succession, until deserializeMessageBegin() is called.

setup inline

void setup(
    std::istream & istr
);

Set up the Deserializer for reading from the given input stream.

This must be called before any of the deserialize*() methods.

setupImpl protected virtual

virtual void setupImpl(
    std::istream & inStream
) = 0;

Set up the Deserializer for reading from the given input stream.

It is guaranteed that reset was called prior to calling this method so the Serializer is in a clean state.