ActiveLib
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
active::serialise::Transport Class Referenceabstract

#include <Transport.h>

Inheritance diagram for active::serialise::Transport:
Inheritance graph
[legend]

Public Types

using TimeFormat = std::optional<xml::XMLDateTime::Format>
 
using size_type = utility::Memory::size_type
 

Public Member Functions

 Transport (bool isUnknownNameSkipped=false, TimeFormat timeFormat=iso8601) noexcept
 
virtual ~Transport () noexcept
 
virtual void send (serialise::Cargo &&cargo, const serialise::Identity &identity, utility::BufferOut &&destination, bool isTabbed=false, bool isLineFeeds=false, bool isNameSpaces=true, bool isProlog=true) const =0
 
virtual void receive (serialise::Cargo &&cargo, const serialise::Identity &identity, utility::BufferIn &&source) const =0
 
TimeFormat getTimeFormat () const noexcept
 
size_type getLastRow () const noexcept
 
size_type getLastColumn () const noexcept
 
bool isUnknownNameSkipped () const noexcept
 
void setTimeFormat (TimeFormat format) noexcept
 
void setUnknownNameSkipped (bool state) noexcept
 

Protected Member Functions

void setLastRow (size_type row) const noexcept
 
void setLastColumn (size_type col) const noexcept
 

Detailed Description

Interface for objects that send/receive data in a serialised form

Constructor & Destructor Documentation

◆ Transport()

active::serialise::Transport::Transport ( bool isUnknownNameSkipped = false,
TimeFormat timeFormat = iso8601 )
inlinenoexcept

Default constructor

Parameters
isUnknownNameSkippedTrue if unknown tags should be skipped (false = stop parsing with an error)
timeFormatThe serialisation date/time format (nullopt = use the format specified in each outgoing item)
Here is the call graph for this function:

◆ ~Transport()

virtual active::serialise::Transport::~Transport ( )
inlinevirtualnoexcept

Destructor

Member Function Documentation

◆ getLastColumn()

size_type active::serialise::Transport::getLastColumn ( ) const
inlinenoexcept

Get the last received character column position of the data source (after calling receive, sfor error diagnostics)

Returns
The last column position received from the data source

◆ getLastRow()

size_type active::serialise::Transport::getLastRow ( ) const
inlinenoexcept

Get the last received character row position of the data source (after calling receive, for error diagnostics)

Returns
The last row position received from the data source

◆ getTimeFormat()

TimeFormat active::serialise::Transport::getTimeFormat ( ) const
inlinenoexcept

Set the preferred serialisation date/time format

Returns
The preferred date/time format

◆ isUnknownNameSkipped()

bool active::serialise::Transport::isUnknownNameSkipped ( ) const
inlinenoexcept

Determine if unknown names are skipped

Returns
True if unknown names are skipped
Here is the caller graph for this function:

◆ receive()

virtual void active::serialise::Transport::receive ( serialise::Cargo && cargo,
const serialise::Identity & identity,
utility::BufferIn && source ) const
pure virtual

Receive cargo from a serialised data source

Parameters
cargoThe cargo to receive the serialised data
identityThe cargo identity (name, optional namespace)
sourceThe data source (can be a wrapper for file, memory, string)
Exceptions
std::system_errorThrown on read errors, invalid encoding or parsing failure (e.g. ill-formed data)

Implemented in active::serialise::json::JSONTransport, and active::serialise::xml::XMLTransport.

◆ send()

virtual void active::serialise::Transport::send ( serialise::Cargo && cargo,
const serialise::Identity & identity,
utility::BufferOut && destination,
bool isTabbed = false,
bool isLineFeeds = false,
bool isNameSpaces = true,
bool isProlog = true ) const
pure virtual

Send serialised cargo to a specified destination

Parameters
cargoThe cargo to be serialised
identityThe cargo identity (name, optional namespace)
destinationThe destination buffer for the exported serialised data (can target file, memory, string)
isTabbedTrue to indent lines with tabs
isLineFeedsTrue to add line-feeds
isNameSpacesTrue to inclued namespaces (where specified)
isPrologTrue if an serialisation prolog should be written
Exceptions
std::system_errorThrown on write errors, serialisation failure (e.g. invalid names, missing inventory etc)

Implemented in active::serialise::json::JSONTransport, and active::serialise::xml::XMLTransport.

◆ setLastColumn()

void active::serialise::Transport::setLastColumn ( size_type col) const
inlineprotectednoexcept

Set the last received character column position of the data source

Parameters
colThe last column position received from the data source

◆ setLastRow()

void active::serialise::Transport::setLastRow ( size_type row) const
inlineprotectednoexcept

Set the last received character row position of the data source

Parameters
rowThe last row position received from the data source

◆ setTimeFormat()

void active::serialise::Transport::setTimeFormat ( TimeFormat format)
inlinenoexcept

Set the preferred date/time format for serialisation

Parameters
formatThe preferred date/time format (nullopt = use the format specified in each outgoing item)

◆ setUnknownNameSkipped()

void active::serialise::Transport::setUnknownNameSkipped ( bool state)
inlinenoexcept

Set whether unknown names are skipped

Parameters
stateTrue if unknown names are skipped

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