Atlas  0.7.0
Networking protocol for the Worldforge system.
Atlas::Message::DecoderBase Class Referenceabstract

#include <DecoderBase.h>

Inheritance diagram for Atlas::Message::DecoderBase:
Collaboration diagram for Atlas::Message::DecoderBase:

Public Member Functions

void streamBegin () override
 
void streamMessage () override
 
void streamEnd () override
 
void mapMapItem (std::string name) override
 
void mapListItem (std::string name) override
 
void mapIntItem (std::string name, std::int64_t) override
 
void mapFloatItem (std::string name, double) override
 
void mapStringItem (std::string name, std::string) override
 
void mapNoneItem (std::string name) override
 
void mapEnd () override
 
void listMapItem () override
 
void listListItem () override
 
void listIntItem (std::int64_t) override
 
void listFloatItem (double) override
 
void listStringItem (std::string) override
 
void listNoneItem () override
 
void listEnd () override
 

Protected Types

enum  State { STATE_STREAM, STATE_MAP, STATE_LIST }
 Our current decoding state. More...
 

Protected Member Functions

virtual void messageArrived (MapType obj)=0
 Override this - called when an object was received. More...
 

Protected Attributes

std::stack< Statem_state
 The state stack. More...
 
std::stack< MapType > m_maps
 The map stack. More...
 
std::stack< ListType > m_lists
 The list stack. More...
 
std::stack< std::string > m_names
 Names for maps and lists. More...
 

Detailed Description

Base class for decoders that take Atlas::Message::Object.

This class is passed to a codec as receiver bridge. It decodes a stream into Message::Object objects, and after completion calls the abstract messageArrived() method. This is to be overridden by base classes, which might, for instance, provide an object queue or a callback method for arrived messages.

See also
Atlas::Bridge
Atlas::Codec
Object
Author
Stefanus Du Toit sdt@g.nosp@m.mx.n.nosp@m.et

Definition at line 40 of file DecoderBase.h.

Member Enumeration Documentation

Our current decoding state.

Definition at line 71 of file DecoderBase.h.

Member Function Documentation

void Atlas::Message::DecoderBase::listEnd ( )
overridevirtual

Ends the currently streamed list.

Implements Atlas::Bridge.

Definition at line 167 of file DecoderBase.cpp.

References m_lists, m_maps, m_names, and m_state.

void Atlas::Message::DecoderBase::listFloatItem ( double  )
overridevirtual

Adds a float to the currently streamed list.

Implements Atlas::Bridge.

Definition at line 148 of file DecoderBase.cpp.

References m_lists.

void Atlas::Message::DecoderBase::listIntItem ( std::int64_t  )
overridevirtual

Adds an integer to the currently streamed list.

Implements Atlas::Bridge.

Definition at line 141 of file DecoderBase.cpp.

References m_lists.

void Atlas::Message::DecoderBase::listListItem ( )
overridevirtual

Starts a list object in the currently streamed list.

Implements Atlas::Bridge.

Definition at line 134 of file DecoderBase.cpp.

References m_lists, and m_state.

void Atlas::Message::DecoderBase::listMapItem ( )
overridevirtual

Starts a map object in the currently streamed list.

Implements Atlas::Bridge.

Definition at line 127 of file DecoderBase.cpp.

References m_maps, and m_state.

void Atlas::Message::DecoderBase::listNoneItem ( )
overridevirtual

Adds an empty item to the currently streamed list.

Implements Atlas::Bridge.

Definition at line 161 of file DecoderBase.cpp.

References m_lists.

void Atlas::Message::DecoderBase::listStringItem ( std::string  )
overridevirtual

Adds a string to the currently streamed list.

Implements Atlas::Bridge.

Definition at line 154 of file DecoderBase.cpp.

References m_lists.

void Atlas::Message::DecoderBase::mapEnd ( )
overridevirtual

Ends the currently streamed map.

Implements Atlas::Bridge.

Definition at line 88 of file DecoderBase.cpp.

References m_lists, m_maps, m_names, m_state, and Atlas::Objects::ObjectsDecoder::messageArrived().

void Atlas::Message::DecoderBase::mapFloatItem ( std::string  name,
double   
)
overridevirtual

Adds a float to the currently streamed map.

Implements Atlas::Bridge.

Definition at line 68 of file DecoderBase.cpp.

References m_maps.

void Atlas::Message::DecoderBase::mapIntItem ( std::string  name,
std::int64_t   
)
overridevirtual

Adds an integer to the currently streamed map.

Implements Atlas::Bridge.

Definition at line 61 of file DecoderBase.cpp.

References m_maps.

void Atlas::Message::DecoderBase::mapListItem ( std::string  name)
overridevirtual

Starts a list object to the currently streamed map.

Implements Atlas::Bridge.

Definition at line 53 of file DecoderBase.cpp.

References m_lists, m_names, and m_state.

void Atlas::Message::DecoderBase::mapMapItem ( std::string  name)
overridevirtual

Starts a map object to the currently streamed map.

Implements Atlas::Bridge.

Definition at line 45 of file DecoderBase.cpp.

References m_maps, m_names, and m_state.

void Atlas::Message::DecoderBase::mapNoneItem ( std::string  name)
overridevirtual

Adds a none item to the currently streamed map.

Implements Atlas::Bridge.

Definition at line 82 of file DecoderBase.cpp.

References m_maps.

void Atlas::Message::DecoderBase::mapStringItem ( std::string  name,
std::string   
)
overridevirtual

Adds a string to the currently streamed map.

Implements Atlas::Bridge.

Definition at line 75 of file DecoderBase.cpp.

References m_maps.

virtual void Atlas::Message::DecoderBase::messageArrived ( MapType  obj)
protectedpure virtual

Override this - called when an object was received.

Implemented in Atlas::Message::QueuedDecoder, and Atlas::Objects::ObjectsDecoder.

void Atlas::Message::DecoderBase::streamBegin ( )
overridevirtual

Begin an Atlas stream.

Implements Atlas::Bridge.

Definition at line 25 of file DecoderBase.cpp.

References m_state.

void Atlas::Message::DecoderBase::streamEnd ( )
overridevirtual

Ends the Atlas stream.

Implements Atlas::Bridge.

Definition at line 38 of file DecoderBase.cpp.

References m_state.

void Atlas::Message::DecoderBase::streamMessage ( )
overridevirtual

Start a message in an Atlas stream.

Implements Atlas::Bridge.

Definition at line 31 of file DecoderBase.cpp.

References m_maps, and m_state.

Member Data Documentation

std::stack<ListType> Atlas::Message::DecoderBase::m_lists
protected

The list stack.

Definition at line 82 of file DecoderBase.h.

Referenced by listEnd(), listFloatItem(), listIntItem(), listListItem(), listNoneItem(), listStringItem(), mapEnd(), and mapListItem().

std::stack<MapType> Atlas::Message::DecoderBase::m_maps
protected
std::stack<std::string> Atlas::Message::DecoderBase::m_names
protected

Names for maps and lists.

Definition at line 84 of file DecoderBase.h.

Referenced by listEnd(), mapEnd(), mapListItem(), and mapMapItem().

std::stack<State> Atlas::Message::DecoderBase::m_state
protected

The state stack.

Definition at line 78 of file DecoderBase.h.

Referenced by listEnd(), listListItem(), listMapItem(), mapEnd(), mapListItem(), mapMapItem(), streamBegin(), streamEnd(), and streamMessage().


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