#include <codec.hpp>
Codec which serializes T values.
A codec is a type with static functions:
mediaType() : the media type it handlesserialize(const T&, std::ostream&) : write valuedeserialize(T&, std::istream&) : read value (Deserializer ). Errors are reported with exceptions.Codecs can also have richer functions (one serialize / deserialize form is enough), which are used when they are defined (see anch::codec::contentTypeOf , anch::codec::serialize and anch::codec::deserialize ):
contentType(const T&) -> MediaType : content type of the serialized value, computed before serialization (a multipart codec adds its boundary parameter) ;serialize(const T&, std::ostream&, anch::codec::Side) or serialize(const T&, std::ostream&, const anch::codec::MediaType&, anch::codec::Side) : the media type is the one returned by contentType() ;deserialize(T&, std::istream&, anch::codec::Side) or deserialize(T&, std::istream&, const anch::codec::MediaType&, anch::codec::Side) : the media type is the content type of the read value, with its parameters ( charset , boundary , ...).anch-rest client also uses stream(const T&, const anch::codec::MediaType&, anch::codec::Side) -> anch::rest::BodyStream when it is defined: it sends the stream instead of serializing the value in memory.
| C | the codec type |
| T | the value type |