tufao  1.3.0
An asynchronous web framework for C++ built on top of Qt
Tufao::AbstractMessageSocket Class Referenceabstract

The Tufao::AbstractMessageSocket class represents a socket that sends and receives messages. More...

+ Inheritance diagram for Tufao::AbstractMessageSocket:
+ Collaboration diagram for Tufao::AbstractMessageSocket:

Public Slots

virtual void close ()=0
 This method should close the connection.
 
virtual bool sendMessage (const QByteArray &msg)=0
 This method should send a new message if the connection is open. More...
 

Signals

void connected ()
 This signal should be emitted when the connection is open. More...
 
void disconnected ()
 This signal should be emitted when the connection is closed or when fails to connect. More...
 
void newMessage (QByteArray msg)
 This signal should be emitted each time a new message is available. More...
 

Public Member Functions

 AbstractMessageSocket (QObject *parent=0)
 Constructs a Tufao::AbstractMessageSocket object. More...
 
bool isConnected () const
 Returns true if the connection is open.
 

Properties

bool connected
 

Detailed Description

The Tufao::AbstractMessageSocket class represents a socket that sends and receives messages.

Classes implementing Tufao::AbstractMessageSocket can provide several high level functionalities, such as:

  • Messages separation and interleaving
  • Messages compression
  • Authentication
  • Proxy or tunnel
  • ...

It's main purpose is to allow easily change the message exchange mechanism in algorithms that depends on message passing. You could use it, for example, to allow a class that provide a RPC mechanism to work on different connections types.

Since
0.2

Constructor & Destructor Documentation

Tufao::AbstractMessageSocket::AbstractMessageSocket ( QObject *  parent = 0)
explicit

Constructs a Tufao::AbstractMessageSocket object.

parent is passed to the QObject constructor.

Member Function Documentation

void Tufao::AbstractMessageSocket::connected ( )
signal

This signal should be emitted when the connection is open.

Note
This signal might be unsafe (read this: Safe signals)!

Unless you know what subclass of AbstractMessageSocket is being used AND this subclass explicitly documents the opposite (signal is safe), you should assume that this signal is unsafe.
void Tufao::AbstractMessageSocket::disconnected ( )
signal

This signal should be emitted when the connection is closed or when fails to connect.

Note
This signal might be unsafe (read this: Safe signals)!

Unless you know what subclass of AbstractMessageSocket is being used AND this subclass explicitly documents the opposite (signal is safe), you should assume that this signal is unsafe.
void Tufao::AbstractMessageSocket::newMessage ( QByteArray  msg)
signal

This signal should be emitted each time a new message is available.

Note
This signal might be unsafe (read this: Safe signals)!

Unless you know what subclass of AbstractMessageSocket is being used AND this subclass explicitly documents the opposite (signal is safe), you should assume that this signal is unsafe.
virtual bool Tufao::AbstractMessageSocket::sendMessage ( const QByteArray &  msg)
pure virtualslot

This method should send a new message if the connection is open.

The object should discard the message if the connection is closed, but it may implement a different behavior (and return true).

Returns
true if successful

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