Library: RemotingNG
Package: Serialization
Header: Poco/RemotingNG/Deserializer.h
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.
Direct Base Classes: SerializerBase
All Base Classes: SerializerBase
Known Derived Classes: BinaryDeserializer, Poco::UPnP::GENA::Deserializer, Poco::UPnP::SOAP::Deserializer
Member Functions: deserialize, deserializeMessageBegin, deserializeMessageEnd, deserializeNullableBegin, deserializeNullableEnd, deserializeSequenceBegin, deserializeSequenceEnd, deserializeStructBegin, deserializeStructEnd, findMessage, setup, setupImpl
Inherited Functions: clearProperties, getProperty, hasProperty, popProperty, pushAttribute, pushProperty, reset, resetImpl
Deserializer();
Creates a Deserializer.
virtual ~Deserializer();
Destroys the Deserializer.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
Poco::Int8 & value
) = 0;
Deserialize an Int8.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
Poco::UInt8 & value
) = 0;
Deserialize an UInt8.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
Poco::Int16 & value
) = 0;
Deserialize an Int16.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
Poco::UInt16 & value
) = 0;
Deserialize an UInt16.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
Poco::Int32 & value
) = 0;
Deserialize an Int32.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
Poco::UInt32 & value
) = 0;
Deserialize an UInt32.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
long & value
) = 0;
Deserialize a long.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
unsigned long & value
) = 0;
Deserialize an unsigned long.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
float & value
) = 0;
Deserialize a float.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
double & value
) = 0;
Deserialize a double.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
bool & value
) = 0;
Deserialize a boolean.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
char & value
) = 0;
Deserialize a single character.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
std::string & value
) = 0;
Deserialize a std::string.
virtual bool deserialize(
const std::string & name,
bool isMandatory,
std::vector < char > & value
) = 0;
Deserializes raw binary data.
virtual void deserializeMessageBegin(
const std::string & name,
SerializerBase::MessageType type
) = 0;
Begin deserialization of a message.
virtual void deserializeMessageEnd(
const std::string & name,
SerializerBase::MessageType type
) = 0;
End deserialization of a message.
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.
virtual void deserializeNullableEnd(
const std::string & name
) = 0;
End deserialization of a Nullable or pointer which may be NULL.
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.
virtual void deserializeSequenceEnd(
const std::string & name
) = 0;
End deserialization of a vector or other sequence.
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.
virtual void deserializeStructEnd(
const std::string & name
) = 0;
End deserialization of a complex (structured) object.
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.
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.
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.