AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::codec::ThriftCodec< P > Struct Template Reference

#include <thrift.hpp>

Inheritance diagram for anch::codec::ThriftCodec< P >:
Collaboration diagram for anch::codec::ThriftCodec< P >:

Static Public Member Functions

static std::string_view mediaType () noexcept
template<anch::codec::ThriftStruct T>
static void serialize (const T &value, std::ostream &out)
template<anch::codec::ThriftStruct T>
static void deserialize (T &value, std::istream &input, anch::codec::Side side)

Detailed Description

template<anch::codec::ThriftProtocol P>
struct anch::codec::ThriftCodec< P >

Thrift codec for structures generated by thrift –gen cpp , with a protocol: use ThriftBinary , ThriftCompact or ThriftJson . Invalid structures raise std::invalid_argument ( 400 on server side).

api.post("/pets", [](anch::rest::Body<pets::Pet> pet) { return save(*pet); })
.consumes<anch::codec::ThriftBinary>().produces<anch::codec::ThriftBinary>();
Template Parameters
Pthe protocol
Author
Vincent Lachenal
Since
0.2

Member Function Documentation

◆ deserialize()

void anch::codec::ThriftCodec< P >::deserialize ( T & value,
std::istream & input,
anch::codec::Side side )
static

Read structure (body size is bounded by maxBodySize )

Parameters
valuethe structure to fill
inputthe input stream
sidethe side
Exceptions
std::invalid_argumentwhen structure is invalid
ContentTooLargewhen body is larger than maxBodySize

◆ mediaType()

std::string_view anch::codec::ThriftCodec< P >::mediaType ( )
staticnoexcept

Media type

Returns
the protocol media type

◆ serialize()

void anch::codec::ThriftCodec< P >::serialize ( const T & value,
std::ostream & out )
static

Write structure

Parameters
valuethe structure
outthe output stream

The documentation for this struct was generated from the following file: