Ocean
Loading...
Searching...
No Matches
Ocean::Network::Streaming Class Reference

This class is the base class for all streaming objects. More...

#include <Streaming.h>

Inheritance diagram for Ocean::Network::Streaming:

Public Types

enum  State { STATE_START , STATE_PAUSE , STATE_STOP , STATE_TYPE_CHANGED }
 Definition of different streaming states. More...
 
typedef MessageQueue::Id SessionId
 Definition of a session id.
 

Public Member Functions

const std::string & name () const
 Returns the name of this streaming object.
 
const std::string & description () const
 Returns the description of this streaming object.
 
double responseTimeout () const
 Returns the timeout value the streaming object waits for response messages.
 
virtual bool setName (const std::string &name)
 Sets the name of this streaming object.
 
virtual bool setDescription (const std::string &description)
 Sets the description of this streaming object.
 
bool setResponseTimeout (const double timeout)
 Sets the timeout value the streaming object waits for response messages.
 

Protected Member Functions

 Streaming ()
 Creates a new streaming object.
 
 Streaming (const Streaming &streaming)=delete
 Disabled copy constructor.
 
virtual ~Streaming ()=default
 Destructs an object.
 
bool parse (const unsigned char *data, const size_t size, bool &isResponse, std::string &message, std::string &value, SessionId &sessionId)
 Parses a command or a response.
 
Streamingoperator= (const Streaming &streaming)=delete
 Disabled copy operator.
 

Static Protected Member Functions

static const std::string & connectCommand ()
 Definition of a connect command.
 
static const std::string & connectResponseP ()
 Definition of a positive connect response.
 
static const std::string & connectResponseN ()
 Definition of a negative connect response.
 
static const std::string & disconnectCommand ()
 Definition of a disconnect command.
 
static const std::string & disconnectResponseP ()
 Definition of a positive disconnect response.
 
static const std::string & disconnectResponseN ()
 Definition of a negative disconnect response.
 
static const std::string & channelSelectCommand ()
 Definition of a channel select command.
 
static const std::string & channelSelectResponseP ()
 Definition of a positive channel select response.
 
static const std::string & channelSelectResponseN ()
 Definition of a negative channel select response.
 
static const std::string & startCommand ()
 Definition of a start command.
 
static const std::string & startResponseP ()
 Definition of a positiv start response.
 
static const std::string & startResponseN ()
 Definition fo a negative start response.
 
static const std::string & pauseCommand ()
 Definition of a pause command.
 
static const std::string & pauseResponseP ()
 Definition of a positive pause response.
 
static const std::string & pauseResponseN ()
 Definition of a negative pause response.
 
static const std::string & stopCommand ()
 Definition of a stop command.
 
static const std::string & stopResponseP ()
 Definition of a positive stop response.
 
static const std::string & stopResponseN ()
 Definition of a negative stop response.
 
static const std::string & clientPortCommand ()
 Definition of a client port command.
 
static const std::string & clientPortResponseP ()
 Definition of a positive client port response.
 
static const std::string & clientPortResponseN ()
 Definition of a negative client port response.
 
static const std::string & serverPortCommand ()
 Definition of a server port command.
 
static const std::string & serverPortResponseP ()
 Definition of a positive server port response.
 
static const std::string & serverPortResponseN ()
 Definition of a negative server port response.
 
static const std::string & channelRequestCommand ()
 Definition of a channel request command.
 
static const std::string & channelRequestResponseP ()
 Definition of a positive channel request response.
 
static const std::string & channelRequestResponseN ()
 Definition of a negative channel request response.
 
static const std::string & changedDataTypeCommand ()
 Definition of a changed data type command.
 
static const std::string & changedDataTypeResponseP ()
 Definition of a positive changed data type request.
 
static const std::string & changedDataTypeResponseN ()
 Definition of a negative change data type request.
 
static const std::string & dataTypeRequestCommand ()
 Definition of a data type request command.
 
static const std::string & dataTypeRequestResponseP ()
 Definition of a positive data type request response.
 
static const std::string & dataTypeRequestResponseN ()
 Definition of a negative data type request response.
 
static std::string createCommand (const std::string &command, const SessionId sessionId)
 Creates a new command message.
 
static std::string createCommand (const std::string &command, const std::string &value, const SessionId sessionId)
 Creates a new command message with a value.
 
static std::string createResponse (const std::string &response, const SessionId sessionId)
 Creates a new response message.
 
static std::string createResponse (const std::string &response, const std::string &value, const SessionId sessionId)
 Creates a new response message with a value.
 

Protected Attributes

std::string name_
 Name of this streaming object.
 
std::string description_
 Description of this streaming object.
 
double responseTimeout_ = 2.0
 Timeout value for response messages.
 
MessageQueue messageQueue_ = MessageQueue(100)
 Message queue.
 

Detailed Description

This class is the base class for all streaming objects.

Member Typedef Documentation

◆ SessionId

Definition of a session id.

Member Enumeration Documentation

◆ State

Definition of different streaming states.

Enumerator
STATE_START 

Start state.

STATE_PAUSE 

Pause state.

STATE_STOP 

Stop state.

STATE_TYPE_CHANGED 

Type change state.

Constructor & Destructor Documentation

◆ Streaming() [1/2]

Ocean::Network::Streaming::Streaming ( )
protected

Creates a new streaming object.

◆ Streaming() [2/2]

Ocean::Network::Streaming::Streaming ( const Streaming streaming)
protecteddelete

Disabled copy constructor.

Parameters
streamingObject which would be copied

◆ ~Streaming()

virtual Ocean::Network::Streaming::~Streaming ( )
protectedvirtualdefault

Destructs an object.

Member Function Documentation

◆ changedDataTypeCommand()

static const std::string & Ocean::Network::Streaming::changedDataTypeCommand ( )
staticprotected

Definition of a changed data type command.

◆ changedDataTypeResponseN()

static const std::string & Ocean::Network::Streaming::changedDataTypeResponseN ( )
staticprotected

Definition of a negative change data type request.

◆ changedDataTypeResponseP()

static const std::string & Ocean::Network::Streaming::changedDataTypeResponseP ( )
staticprotected

Definition of a positive changed data type request.

◆ channelRequestCommand()

static const std::string & Ocean::Network::Streaming::channelRequestCommand ( )
staticprotected

Definition of a channel request command.

◆ channelRequestResponseN()

static const std::string & Ocean::Network::Streaming::channelRequestResponseN ( )
staticprotected

Definition of a negative channel request response.

◆ channelRequestResponseP()

static const std::string & Ocean::Network::Streaming::channelRequestResponseP ( )
staticprotected

Definition of a positive channel request response.

◆ channelSelectCommand()

static const std::string & Ocean::Network::Streaming::channelSelectCommand ( )
staticprotected

Definition of a channel select command.

◆ channelSelectResponseN()

static const std::string & Ocean::Network::Streaming::channelSelectResponseN ( )
staticprotected

Definition of a negative channel select response.

◆ channelSelectResponseP()

static const std::string & Ocean::Network::Streaming::channelSelectResponseP ( )
staticprotected

Definition of a positive channel select response.

◆ clientPortCommand()

static const std::string & Ocean::Network::Streaming::clientPortCommand ( )
staticprotected

Definition of a client port command.

◆ clientPortResponseN()

static const std::string & Ocean::Network::Streaming::clientPortResponseN ( )
staticprotected

Definition of a negative client port response.

◆ clientPortResponseP()

static const std::string & Ocean::Network::Streaming::clientPortResponseP ( )
staticprotected

Definition of a positive client port response.

◆ connectCommand()

static const std::string & Ocean::Network::Streaming::connectCommand ( )
staticprotected

Definition of a connect command.

◆ connectResponseN()

static const std::string & Ocean::Network::Streaming::connectResponseN ( )
staticprotected

Definition of a negative connect response.

◆ connectResponseP()

static const std::string & Ocean::Network::Streaming::connectResponseP ( )
staticprotected

Definition of a positive connect response.

◆ createCommand() [1/2]

static std::string Ocean::Network::Streaming::createCommand ( const std::string &  command,
const SessionId  sessionId 
)
staticprotected

Creates a new command message.

Parameters
commandThe command
sessionIdUnique session id connected to this command
Returns
Command message

◆ createCommand() [2/2]

static std::string Ocean::Network::Streaming::createCommand ( const std::string &  command,
const std::string &  value,
const SessionId  sessionId 
)
staticprotected

Creates a new command message with a value.

Parameters
commandThe command
valueCommand value
sessionIdUnique session id connected to this command
Returns
Command message

◆ createResponse() [1/2]

static std::string Ocean::Network::Streaming::createResponse ( const std::string &  response,
const SessionId  sessionId 
)
staticprotected

Creates a new response message.

Parameters
responseThe response
sessionIdUnique session id connected to this response
Returns
Response message

◆ createResponse() [2/2]

static std::string Ocean::Network::Streaming::createResponse ( const std::string &  response,
const std::string &  value,
const SessionId  sessionId 
)
staticprotected

Creates a new response message with a value.

Parameters
responseThe response
valueResponse value
sessionIdUnique session id connected to this response
Returns
Response message

◆ dataTypeRequestCommand()

static const std::string & Ocean::Network::Streaming::dataTypeRequestCommand ( )
staticprotected

Definition of a data type request command.

◆ dataTypeRequestResponseN()

static const std::string & Ocean::Network::Streaming::dataTypeRequestResponseN ( )
staticprotected

Definition of a negative data type request response.

◆ dataTypeRequestResponseP()

static const std::string & Ocean::Network::Streaming::dataTypeRequestResponseP ( )
staticprotected

Definition of a positive data type request response.

◆ description()

const std::string & Ocean::Network::Streaming::description ( ) const
inline

Returns the description of this streaming object.

Returns
Streaming object description

◆ disconnectCommand()

static const std::string & Ocean::Network::Streaming::disconnectCommand ( )
staticprotected

Definition of a disconnect command.

◆ disconnectResponseN()

static const std::string & Ocean::Network::Streaming::disconnectResponseN ( )
staticprotected

Definition of a negative disconnect response.

◆ disconnectResponseP()

static const std::string & Ocean::Network::Streaming::disconnectResponseP ( )
staticprotected

Definition of a positive disconnect response.

◆ name()

const std::string & Ocean::Network::Streaming::name ( ) const
inline

Returns the name of this streaming object.

Returns
Streaming object name

◆ operator=()

Streaming & Ocean::Network::Streaming::operator= ( const Streaming streaming)
protecteddelete

Disabled copy operator.

Parameters
streamingObject which would be copied

◆ parse()

bool Ocean::Network::Streaming::parse ( const unsigned char *  data,
const size_t  size,
bool &  isResponse,
std::string &  message,
std::string &  value,
SessionId sessionId 
)
protected

Parses a command or a response.

Parameters
dataThe data to parse, must be valid
sizeThe size of the data to parse in bytes
isResponseTrue, if the parse string was a command, a response otherwise
messageCommand or response message
valueOptional command or response value
sessionIdUnique session id
Returns
True, if succeeded

◆ pauseCommand()

static const std::string & Ocean::Network::Streaming::pauseCommand ( )
staticprotected

Definition of a pause command.

◆ pauseResponseN()

static const std::string & Ocean::Network::Streaming::pauseResponseN ( )
staticprotected

Definition of a negative pause response.

◆ pauseResponseP()

static const std::string & Ocean::Network::Streaming::pauseResponseP ( )
staticprotected

Definition of a positive pause response.

◆ responseTimeout()

double Ocean::Network::Streaming::responseTimeout ( ) const
inline

Returns the timeout value the streaming object waits for response messages.

Returns
timeout The timeout value in seconds

◆ serverPortCommand()

static const std::string & Ocean::Network::Streaming::serverPortCommand ( )
staticprotected

Definition of a server port command.

◆ serverPortResponseN()

static const std::string & Ocean::Network::Streaming::serverPortResponseN ( )
staticprotected

Definition of a negative server port response.

◆ serverPortResponseP()

static const std::string & Ocean::Network::Streaming::serverPortResponseP ( )
staticprotected

Definition of a positive server port response.

◆ setDescription()

virtual bool Ocean::Network::Streaming::setDescription ( const std::string &  description)
virtual

Sets the description of this streaming object.

Parameters
descriptionStreaming object description to set
Returns
True, if succeeded

◆ setName()

virtual bool Ocean::Network::Streaming::setName ( const std::string &  name)
virtual

Sets the name of this streaming object.

Parameters
nameStreaming object name to set
Returns
True, if succeeded

◆ setResponseTimeout()

bool Ocean::Network::Streaming::setResponseTimeout ( const double  timeout)

Sets the timeout value the streaming object waits for response messages.

Parameters
timeoutThe timeout value in seconds
Returns
True, if succeeded

◆ startCommand()

static const std::string & Ocean::Network::Streaming::startCommand ( )
staticprotected

Definition of a start command.

◆ startResponseN()

static const std::string & Ocean::Network::Streaming::startResponseN ( )
staticprotected

Definition fo a negative start response.

◆ startResponseP()

static const std::string & Ocean::Network::Streaming::startResponseP ( )
staticprotected

Definition of a positiv start response.

◆ stopCommand()

static const std::string & Ocean::Network::Streaming::stopCommand ( )
staticprotected

Definition of a stop command.

◆ stopResponseN()

static const std::string & Ocean::Network::Streaming::stopResponseN ( )
staticprotected

Definition of a negative stop response.

◆ stopResponseP()

static const std::string & Ocean::Network::Streaming::stopResponseP ( )
staticprotected

Definition of a positive stop response.

Field Documentation

◆ description_

std::string Ocean::Network::Streaming::description_
protected

Description of this streaming object.

◆ messageQueue_

MessageQueue Ocean::Network::Streaming::messageQueue_ = MessageQueue(100)
protected

Message queue.

◆ name_

std::string Ocean::Network::Streaming::name_
protected

Name of this streaming object.

◆ responseTimeout_

double Ocean::Network::Streaming::responseTimeout_ = 2.0
protected

Timeout value for response messages.


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