#include <CeylanProtocolServer.h>
Public Types | |
enum | TextOutputFormat { rawText, html } |
Defines what text output formats for TextDisplayable instances are available. More... | |
Public Member Functions | |
ProtocolServer (Marshaller &marshaller) | |
Constructs a new protocol server. | |
virtual | ~ProtocolServer () throw () |
Virtual destructor. | |
virtual bool | notifyDataAvailability ()=0 |
Reacts on data arrival, performs any work needed, and sends back an answer to the client if needed. | |
virtual bool | isShutdownRequested () const |
Tells whether the underlying communication system (for example a network server) is expected to shutdown, once this instance of protocol exchange is over. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const |
Returns a user-friendly description of the state of this object. | |
Static Public Member Functions | |
static const std::string | ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high) |
Returns a user-friendly description of this list of pointers to text displayable instances. | |
static TextOutputFormat | GetOutputFormat () |
Returns the current overall text format to be used by TextDisplayable instances. | |
static void | SetOutputFormat (TextOutputFormat newOutputFormat) |
Sets the current overall text format to be used by TextDisplayable instances. | |
Protected Member Functions | |
virtual void | askForShutdown () |
Records the fact that the protocol determined that the underlying medium should be stopped once the protocol exchange is terminated. | |
Protected Attributes | |
bool | _shutdownRequested |
Tells whether, when the protocol exchange will be terminated, the underlying medium should be stopped. | |
Marshaller * | _marshaller |
The marshaller that will be used to (de)serialize informations of this endpoint. | |
Static Protected Attributes | |
static TextOutputFormat | _OutputFormat = rawText |
The text format to be used currently by TextDisplayable instances. | |
Private Member Functions | |
ProtocolServer (const ProtocolServer &source) | |
Copy constructor made private to ensure that it will be never called. | |
ProtocolServer & | operator= (const ProtocolServer &source) |
Assignment operator made private to ensure that it will be never called. |
Such server handles requests sent by clients, and manages them in a remote-invocation-method maneer.
There marshaller hides to the protocol server the details of the underlying stream that will be used to transport protcolol informations : the marshaller will take care of the appropriate encoding/decoding on the behalf of this protocol server.
(see Marshaller::retrieveData)
Definition at line 76 of file CeylanProtocolServer.h.
enum Ceylan::TextDisplayable::TextOutputFormat [inherited] |
Defines what text output formats for TextDisplayable instances are available.
Definition at line 124 of file CeylanTextDisplayable.h.
ProtocolServer::ProtocolServer | ( | Marshaller & | marshaller | ) |
Constructs a new protocol server.
marshaller | the marshaller that will encode and/or decode data to/from the stream for the protocol to be serialized. As marshallers are per-connection object, the protocol endpoint takes ownership of it and will delete the marshaller when itself deleted. |
Definition at line 41 of file CeylanProtocolServer.cc.
ProtocolServer::~ProtocolServer | ( | ) | throw () [virtual] |
Ceylan::Middleware::ProtocolServer::ProtocolServer | ( | const ProtocolServer & | source | ) | [private] |
Copy constructor made private to ensure that it will be never called.
The compiler should complain whenever this undefined constructor is called, implicitly or not.
void ProtocolServer::askForShutdown | ( | ) | [protected, virtual] |
Records the fact that the protocol determined that the underlying medium should be stopped once the protocol exchange is terminated.
Definition at line 85 of file CeylanProtocolServer.cc.
References _shutdownRequested, and generalUtils::true.
TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat | ( | ) | [static, inherited] |
Returns the current overall text format to be used by TextDisplayable instances.
Definition at line 63 of file CeylanTextDisplayable.cc.
References Ceylan::TextDisplayable::_OutputFormat.
Referenced by Ceylan::formatStringList(), Ceylan::formatStringMap(), Ceylan::XML::XMLMarkup::toString(), Ceylan::Maths::Linear::Vector3::toString(), Ceylan::Maths::Linear::Vector2::toString(), Ceylan::Maths::Linear::Tripoint::toString(), Ceylan::Module::toString(), Ceylan::Maths::Linear::Matrix3::toString(), Ceylan::Maths::Linear::Matrix2::toString(), Ceylan::Maths::Linear::HomogeneousMatrix3::toString(), and Ceylan::Maths::Linear::Bipoint::toString().
bool ProtocolServer::isShutdownRequested | ( | ) | const [virtual] |
Tells whether the underlying communication system (for example a network server) is expected to shutdown, once this instance of protocol exchange is over.
Definition at line 57 of file CeylanProtocolServer.cc.
References _shutdownRequested.
Referenced by Ceylan::Network::MultiplexedProtocolBasedStreamServer::closeConnection(), and toString().
virtual bool Ceylan::Middleware::ProtocolServer::notifyDataAvailability | ( | ) | [pure virtual] |
Reacts on data arrival, performs any work needed, and sends back an answer to the client if needed.
This pure virtual method must be overriden by the user.
The marshaller can help writing a protocol exchange by taking care of lower-level decoding/encoding, and if the marshaller is buffered, one may use : _marshaller->retrieveData( expectedPDUSize) here, where expectedPDUSize is the size needed by this protocol server so that it can interpret the request. The retrieveData method returns the number of bytes ready to be decoded in the buffer of the marshaller. Therefore if this returned size is less than the minimum size requested by the server, then the protocol server can just return true and wait next notifications, until the read bytes accumulate in the buffer and the size it needs is reached.
ProtocolException | on failure. |
ProtocolServer& Ceylan::Middleware::ProtocolServer::operator= | ( | const ProtocolServer & | source | ) | [private] |
Assignment operator made private to ensure that it will be never called.
The compiler should complain whenever this undefined operator is called, implicitly or not.
void TextDisplayable::SetOutputFormat | ( | TextOutputFormat | newOutputFormat | ) | [static, inherited] |
Sets the current overall text format to be used by TextDisplayable instances.
newOutputFormat | the new output format. |
Definition at line 72 of file CeylanTextDisplayable.cc.
References Ceylan::TextDisplayable::_OutputFormat.
Referenced by Ceylan::Log::LogHolder::LogHolder().
const std::string TextDisplayable::ToString | ( | std::list< TextDisplayable * > | displayables, | |
Ceylan::VerbosityLevels | level = Ceylan::high | |||
) | [static, inherited] |
Returns a user-friendly description of this list of pointers to text displayable instances.
displayables | a list of pointers to TextDisplayable instances/ | |
level | the requested verbosity level. |
Definition at line 45 of file CeylanTextDisplayable.cc.
References Ceylan::formatStringList().
const string ProtocolServer::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [virtual] |
Returns a user-friendly description of the state of this object.
level | the requested verbosity level. |
Reimplemented from Ceylan::Middleware::ProtocolEndpoint.
Definition at line 66 of file CeylanProtocolServer.cc.
References isShutdownRequested().
Referenced by Ceylan::Network::AnonymousProtocolAwareStreamSocket::toString().
Marshaller* Ceylan::Middleware::ProtocolEndpoint::_marshaller [protected, inherited] |
The marshaller that will be used to (de)serialize informations of this endpoint.
Definition at line 146 of file CeylanProtocolEndpoint.h.
Referenced by Ceylan::Middleware::ProtocolEndpoint::toString(), and Ceylan::Middleware::ProtocolEndpoint::~ProtocolEndpoint().
TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited] |
The text format to be used currently by TextDisplayable instances.
Definition at line 158 of file CeylanTextDisplayable.h.
Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().
bool Ceylan::Middleware::ProtocolServer::_shutdownRequested [protected] |
Tells whether, when the protocol exchange will be terminated, the underlying medium should be stopped.
Definition at line 197 of file CeylanProtocolServer.h.
Referenced by askForShutdown(), and isShutdownRequested().