ICAROUS
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
larcfm::DataServer Class Reference

#include <DataServer.h>

Public Member Functions

void addTransmitter (const std::string &address, Transmitter *t)
 
TransmittergetTransmitter (const std::string &address) const
 
void removeTransmitter (const std::string &address)
 
void advertiseAll (const std::string &keyword)
 
void advertiseOne (const std::string &address, const std::string &keyword)
 
void update (const std::string &keyword, const std::string &data)
 
bool hasClients (const std::string &keyword) const
 
void updateGeneralStates (const std::vector< GeneralState > &p)
 
void updateGeneralStates (const std::vector< GeneralState > &p, const ParameterData &pd)
 
void updateGeneralPlans (const std::vector< GeneralPlan > &p)
 
void updateGeneralPlans (const std::vector< GeneralPlan > &p, const ParameterData &pd)
 
void updateParameters (const ParameterData &p)
 
void updateString (const std::string &s)
 
void updateString (const std::string &keyword, const std::string &s)
 

Private Attributes

std::map< std::string, Transmitter * > transmitters
 
std::string word
 

Detailed Description

This class represents a wrapper for a collection of Transmitter object that represents a server's behavior. The server takes updates to plan, state, and/or parameter information and parcels it out to its various Transmitter object. Each Transmitter is intended to handle a certain type of request (e.g. for plan information that is updated every second and sent over a socket) and handles distributing the information to its clients. The particulars of the transmission of data are handled by the provided Transmitters.

Known keywords: GeneralState, GeneralPlan, ParameterData, String

Member Function Documentation

◆ addTransmitter()

void larcfm::DataServer::addTransmitter ( const std::string &  address,
Transmitter t 
)

Add a transmitter at a given address that will listen for clients

Parameters
addressThis will replace any existing transmitter at this address.
tPointer to transmitter to be added. The destructor of this class will destroy all Transmitters included in it.

◆ advertiseAll()

void larcfm::DataServer::advertiseAll ( const std::string &  keyword)

Tell any clients that connect and ask what sort of data you provide. This propagates the same keyword to all current and future transmitters

Parameters
keyword

◆ advertiseOne()

void larcfm::DataServer::advertiseOne ( const std::string &  address,
const std::string &  keyword 
)

Associate a keyword with one particular Transmitter. This does not affect other Transmitters.

Parameters
address
keyword

◆ getTransmitter()

Transmitter * larcfm::DataServer::getTransmitter ( const std::string &  address) const

Return the transmitter associated with a given address. This will return null if no transmitter is associated with the given address. Note: The destructor of this class will destroy all Transmitters included in it.

Parameters
address
Returns
Pointer to Transmitter, or NULL, if none exists.

◆ hasClients()

bool larcfm::DataServer::hasClients ( const std::string &  keyword) const

Return true if this server has any clients looking for the given keyword

Parameters
keyword
Returns

◆ removeTransmitter()

void larcfm::DataServer::removeTransmitter ( const std::string &  address)

Delete the transmitter associated with an address, if there is one. This will destroy the Transmitter object.

Parameters
address

◆ update()

void larcfm::DataServer::update ( const std::string &  keyword,
const std::string &  data 
)

Transmit String with user-specified keyword

Parameters
keyword
data

◆ updateGeneralPlans()

void larcfm::DataServer::updateGeneralPlans ( const std::vector< GeneralPlan > &  p)

Transmit a set of plans

◆ updateGeneralStates()

void larcfm::DataServer::updateGeneralStates ( const std::vector< GeneralState > &  p)

Transmit a set of states

◆ updateParameters()

void larcfm::DataServer::updateParameters ( const ParameterData p)

Transmit a ParameterData object

◆ updateString() [1/2]

void larcfm::DataServer::updateString ( const std::string &  keyword,
const std::string &  s 
)

Transmit a string with some associated keyword

Parameters
keyword
s

◆ updateString() [2/2]

void larcfm::DataServer::updateString ( const std::string &  s)

Transmit a string


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