LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
rcsc::rcg::Serializer Class Referenceabstract

rcg data serializer interface class More...

#include <serializer.h>

Inheritance diagram for rcsc::rcg::Serializer:
Inheritance graph
[legend]
Collaboration diagram for rcsc::rcg::Serializer:
Collaboration graph
[legend]

Public Types

typedef std::shared_ptr< SerializerPtr
 rcg serializer pointer type
 
typedef Ptr(* Creator) ()
 rcg serializer creator function
 
typedef rcss::Factory< Creator, int > Creators
 creator function holder
 

Public Member Functions

virtual ~Serializer ()
 virtual destructor
 
virtual std::ostream & serializeHeader (std::ostream &os)=0
 write header More...
 
virtual std::ostream & serializeParam (std::ostream &os, const std::string &msg)=0
 write parameter message More...
 
virtual std::ostream & serialize (std::ostream &os, const server_params_t &param)=0
 write header More...
 
virtual std::ostream & serialize (std::ostream &os, const player_params_t &pparam)=0
 write header More...
 
virtual std::ostream & serialize (std::ostream &os, const player_type_t &type)=0
 write header More...
 
virtual std::ostream & serialize (std::ostream &os, const dispinfo_t &disp)=0
 write dispinfo_t. More...
 
virtual std::ostream & serialize (std::ostream &os, const showinfo_t &show)=0
 write showinfo_t. More...
 
virtual std::ostream & serialize (std::ostream &os, const showinfo_t2 &show2)=0
 write showinfo_t2. More...
 
virtual std::ostream & serialize (std::ostream &os, const short_showinfo_t2 &show2)=0
 write short_showinfo_t2. More...
 
virtual std::ostream & serialize (std::ostream &os, const msginfo_t &msg)=0
 write message info More...
 
virtual std::ostream & serialize (std::ostream &os, const Int16 board, const std::string &msg)=0
 write message info More...
 
virtual std::ostream & serialize (std::ostream &os, const drawinfo_t &draw)=0
 write drawinfo_t More...
 
virtual std::ostream & serialize (std::ostream &os, const char playmode)=0
 write playmode More...
 
virtual std::ostream & serialize (std::ostream &os, const team_t &team_l, const team_t &team_r)=0
 write team info More...
 
virtual std::ostream & serialize (std::ostream &os, const TeamT &team_l, const TeamT &team_r)=0
 write team info More...
 
virtual std::ostream & serialize (std::ostream &os, const ShowInfoT &show)=0
 write ShowInfoT More...
 
virtual std::ostream & serialize (std::ostream &os, const DispInfoT &disp)=0
 write DispInfoT More...
 

Static Public Member Functions

static Creatorscreators ()
 factory holder singleton More...
 
static Ptr create (const int version)
 create a suitable version serializer instance depending on the input version. More...
 

Protected Member Functions

 Serializer ()
 initialize member variables. constructor is accessible only from the derived classes.
 
std::ostream & serializeImpl (std::ostream &os, const int version)
 write header More...
 
std::ostream & serializeImpl (std::ostream &os, const server_params_t &param)
 write server param More...
 
std::ostream & serializeImpl (std::ostream &os, const player_params_t &pparam)
 write player param More...
 
std::ostream & serializeImpl (std::ostream &os, const player_type_t &type)
 write player type param More...
 
std::ostream & serializeImpl (std::ostream &os, const team_t &team_l, const team_t &team_r)
 write team info More...
 
std::ostream & serializeImpl (std::ostream &os, const char pmode)
 write playmode More...
 
std::ostream & serializeImpl (std::ostream &os, const PlayMode pmode)
 write playmode More...
 
std::ostream & serializeImpl (std::ostream &os, const dispinfo_t &disp)
 write dispinfo (version 1 protocol) More...
 
std::ostream & serializeImpl (std::ostream &os, const showinfo_t &show)
 write showinfo (version 2 protocol) More...
 
std::ostream & serializeImpl (std::ostream &os, const showinfo_t2 &show2)
 write showinfo_t2 (version 3 protocol). data is converted to short_showinfo_t2. More...
 
std::ostream & serializeImpl (std::ostream &os, const short_showinfo_t2 &show2)
 write short_showinfo (version 3 protocol) More...
 
std::ostream & serializeImpl (std::ostream &os, const msginfo_t &msg)
 write message info More...
 
std::ostream & serializeImpl (std::ostream &os, const drawinfo_t &draw)
 write draw info More...
 
std::ostream & serializeImpl (std::ostream &os, const dispinfo_t2 &disp2)
 write dispinfo_t2, but data is converted. More...
 

Protected Attributes

char M_playmode
 temporal playmode holder
 
TeamT M_teams [2]
 temporal team info holder
 

Detailed Description

rcg data serializer interface class

Member Function Documentation

◆ create()

static Ptr rcsc::rcg::Serializer::create ( const int  version)
static

create a suitable version serializer instance depending on the input version.

Parameters
versionrcg format version.
Returns
smart pointer to the rcg serializer instance

◆ creators()

static Creators & rcsc::rcg::Serializer::creators ( )
static

factory holder singleton

Returns
reference to the factory holder instance

◆ serialize() [1/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const char  playmode 
)
pure virtual

write playmode

Parameters
osreference to the output stream
playmodeplay mode variable
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [2/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const dispinfo_t disp 
)
pure virtual

write dispinfo_t.

Parameters
osreference to the output stream
dispnetwork byte order data
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [3/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const DispInfoT disp 
)
pure virtual

write DispInfoT

Parameters
osreference to the output stream
dispdata to be written
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [4/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const drawinfo_t draw 
)
pure virtual

write drawinfo_t

Parameters
osreference to the output stream
drawdrawinfo_t variable
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [5/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const Int16  board,
const std::string &  msg 
)
pure virtual

write message info

Parameters
osreference to the output stream
boardmessage board type
msgmessage string
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [6/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const msginfo_t msg 
)
pure virtual

write message info

Parameters
osreference to the output stream
msgmsginfo_t variable by network byte order
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [7/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const player_params_t pparam 
)
pure virtual

write header

Parameters
osreference to the output stream
pparamplayer_params_t variable by network byte order
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [8/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const player_type_t type 
)
pure virtual

write header

Parameters
osreference to the output stream
typeplayer_type_t variable by network byte order
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [9/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const server_params_t param 
)
pure virtual

write header

Parameters
osreference to the output stream
paramserver_params_t variable by network byte order
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [10/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const short_showinfo_t2 show2 
)
pure virtual

write short_showinfo_t2.

Parameters
osreference to the output stream
show2network byte order data
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [11/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const showinfo_t show 
)
pure virtual

write showinfo_t.

Parameters
osreference to the output stream
shownetwork byte order data
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [12/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const showinfo_t2 show2 
)
pure virtual

write showinfo_t2.

Parameters
osreference to the output stream
show2network byte order data
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [13/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const ShowInfoT show 
)
pure virtual

write ShowInfoT

Parameters
osreference to the output stream
showdata to be written
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, rcsc::rcg::SerializerV4, rcsc::rcg::SerializerV5, and rcsc::rcg::SerializerV6.

◆ serialize() [14/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const team_t team_l,
const team_t team_r 
)
pure virtual

write team info

Parameters
osreference to the output stream
team_lleft team variable
team_rright team variable
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serialize() [15/15]

virtual std::ostream & rcsc::rcg::Serializer::serialize ( std::ostream &  os,
const TeamT team_l,
const TeamT team_r 
)
pure virtual

write team info

Parameters
osreference to the output stream
team_lleft team variable
team_rright team variable
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.

◆ serializeHeader()

virtual std::ostream & rcsc::rcg::Serializer::serializeHeader ( std::ostream &  os)
pure virtual

write header

Parameters
osreference to the output stream
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, rcsc::rcg::SerializerV4, rcsc::rcg::SerializerV5, and rcsc::rcg::SerializerV6.

◆ serializeImpl() [1/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const char  pmode 
)
protected

write playmode

Parameters
osreference to the output stream
pmodeplaymode index
Returns
reference to the output stream

◆ serializeImpl() [2/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const dispinfo_t disp 
)
protected

write dispinfo (version 1 protocol)

Parameters
osreference to the output stream
dispserialized data
Returns
reference to the output stream

◆ serializeImpl() [3/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const dispinfo_t2 disp2 
)
protected

write dispinfo_t2, but data is converted.

Parameters
osreference to the output stream
disp2serialized data
Returns
reference to the output stream

◆ serializeImpl() [4/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const drawinfo_t draw 
)
protected

write draw info

Parameters
osreference to the output stream
drawserialized data
Returns
reference to the output stream

◆ serializeImpl() [5/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const int  version 
)
protected

write header

Parameters
osreference to the output stream
versionlog version
Returns
reference to the output stream

◆ serializeImpl() [6/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const msginfo_t msg 
)
protected

write message info

Parameters
osreference to the output stream
msgserialized data
Returns
reference to the output stream

◆ serializeImpl() [7/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const player_params_t pparam 
)
protected

write player param

Parameters
osreference to the output stream
pparamplyaer_params_t data
Returns
reference to the output stream

◆ serializeImpl() [8/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const player_type_t type 
)
protected

write player type param

Parameters
osreference to the output stream
typeplayer_type_t data
Returns
reference to the output stream

◆ serializeImpl() [9/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const PlayMode  pmode 
)
protected

write playmode

Parameters
osreference to the output stream
pmodeplaymode index
Returns
reference to the output stream

◆ serializeImpl() [10/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const server_params_t param 
)
protected

write server param

Parameters
osreference to the output stream
paramserver_params_t data
Returns
reference to the output stream

◆ serializeImpl() [11/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const short_showinfo_t2 show2 
)
protected

write short_showinfo (version 3 protocol)

Parameters
osreference to the output stream
show2serialized data
Returns
reference to the output stream

◆ serializeImpl() [12/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const showinfo_t show 
)
protected

write showinfo (version 2 protocol)

Parameters
osreference to the output stream
showserialized data
Returns
reference to the output stream

◆ serializeImpl() [13/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const showinfo_t2 show2 
)
protected

write showinfo_t2 (version 3 protocol). data is converted to short_showinfo_t2.

Parameters
osreference to the output stream
show2serialized data
Returns
reference to the output stream

◆ serializeImpl() [14/14]

std::ostream & rcsc::rcg::Serializer::serializeImpl ( std::ostream &  os,
const team_t team_l,
const team_t team_r 
)
protected

write team info

Parameters
osreference to the output stream
team_lleft team data
team_rright team data
Returns
reference to the output stream

◆ serializeParam()

virtual std::ostream & rcsc::rcg::Serializer::serializeParam ( std::ostream &  os,
const std::string &  msg 
)
pure virtual

write parameter message

Parameters
osreference to the output stream
msgserver parameter message
Returns
reference to the output stream

Implemented in rcsc::rcg::SerializerV1, rcsc::rcg::SerializerV2, rcsc::rcg::SerializerV3, and rcsc::rcg::SerializerV4.


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