pianod2
multisource multiuser scriptable networked music player
Public Member Functions | Static Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
Football::Connection Class Reference

C++ Connection wrapper. More...

#include <football.h>

Inheritance diagram for Football::Connection:
Inheritance graph
[legend]
Collaboration diagram for Football::Connection:
Collaboration graph
[legend]

Public Member Functions

ServiceBaseservice (void) const
 Get a connection's parent service. More...
 
virtual ~Connection () override
 
virtual ssize_t conditional_print (bool(*callback)(FB_CONNECTION *), const std::string &message) override
 Send a message to some output queues depending on the callback function return value. More...
 
bool transfer (ServiceBase *service, bool invokeNewConnectionHandler=false)
 Transfer a connection to another service. More...
 
void close (void)
 Initiate connection closure. More...
 
void acceptInput (bool mode)
 Control acceptance of input. More...
 
virtual void newConnection (const FB_EVENT *event)
 Invoked when a new connection has arrived/greeted. More...
 
virtual void connectionClose (const FB_EVENT *event)
 Invoked when a connection is closing. More...
 
virtual void inputReceived (const FB_EVENT *event)
 Invoked when a completed message is received. More...
 
- Public Member Functions inherited from Football::Thingie
virtual ~Thingie ()
 
ssize_t print (const std::string &message)
 Add a string to the output queues. More...
 
ssize_t conditional_broadcast (bool(*callback)(FB_CONNECTION *), const std::string &message)
 Send a message to some output queues depending on the callback function return value. More...
 
ssize_t printf (const char *format,...)
 Add messages to output queues. More...
 
ssize_t vprintf (const char *format, va_list parameters)
 
ssize_t bprintf (const char *format,...)
 
ssize_t bvprintf (const char *format, va_list parameters)
 
ssize_t cbprintf (bool(*callback)(FB_CONNECTION *), const char *format,...)
 
ssize_t cbvprintf (bool(*callback)(FB_CONNECTION *), const char *format, va_list parameters)
 
virtual std::streamsize xsputn (const char_type *data, std::streamsize count) override
 
virtual int_type overflow (int_type c) override
 

Static Protected Member Functions

static ConnectiontryGetFromOld (FB_CONNECTION *connection)
 

Private Member Functions

virtual void * myThingie (void) const final
 
int argvIndex (const char *itemname) const
 
void setConnection (FB_CONNECTION *conn)
 

Static Private Member Functions

static ConnectiongetFromOld (FB_CONNECTION *connection)
 

Private Attributes

FB_CONNECTIONconnection = nullptr
 Pointer to underlying Football connection. More...
 
int argname_capacity = 0
 

Friends

class Iterator
 
class ServiceBase
 
class Arena
 

Additional Inherited Members

Detailed Description

C++ Connection wrapper.

Constructor & Destructor Documentation

◆ ~Connection()

Football::Connection::~Connection ( )
overridevirtual

Member Function Documentation

◆ acceptInput()

void Football::Connection::acceptInput ( bool  mode)

Control acceptance of input.

Parameters
modeIf true, enables input. If false, the connection is ignored; received input will be queued and received when input is again enabled.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ argvIndex()

int Football::Connection::argvIndex ( const char *  itemname) const
private

◆ close()

void Football::Connection::close ( void  )

Initiate connection closure.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ conditional_print()

ssize_t Football::Connection::conditional_print ( bool(*)(FB_CONNECTION *)  callback,
const std::string &  message 
)
overridevirtual

Send a message to some output queues depending on the callback function return value.

Parameters
callbackA callback function accepting FB_CONNECTION * that returns true to broadcast to, false to skip.
messageThe message to put on the output queue.

Implements Football::Thingie.

Here is the call graph for this function:

◆ connectionClose()

void Football::Connection::connectionClose ( const FB_EVENT event)
virtual

Invoked when a connection is closing.

Corresponds to FB_EVENT_CLOSE event. This is the last notification/event for a connection before it closes.

Parameters
eventClosing connection details.

Reimplemented in PianodConnection.

Here is the caller graph for this function:

◆ getFromOld()

Connection * Football::Connection::getFromOld ( FB_CONNECTION connection)
staticprivate

Find the C++ connection object from the old-style C connection. If there isn't one yet, create it one.

Parameters
connectionThe Football standard C connection structure.
Returns
The C++ connection object.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ inputReceived()

void Football::Connection::inputReceived ( const FB_EVENT event)
virtual

Invoked when a completed message is received.

Corresponds to FB_EVENT_INPUT event.

Parameters
eventDetails of the message received.

Reimplemented in PianodConnection.

Here is the caller graph for this function:

◆ myThingie()

virtual void* Football::Connection::myThingie ( void  ) const
inlinefinalprivatevirtual

Implements Football::Thingie.

◆ newConnection()

void Football::Connection::newConnection ( const FB_EVENT event)
virtual

Invoked when a new connection has arrived/greeted.

Corresponds to FB_EVENT_CONNECT.

Parameters
eventThe new connection details, or a nullptr for transferred connections.

Reimplemented in PianodConnection.

Here is the caller graph for this function:

◆ service()

ServiceBase * Football::Connection::service ( void  ) const

Get a connection's parent service.

Returns
The C++ service object for the connection.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setConnection()

void Football::Connection::setConnection ( FB_CONNECTION conn)
inlineprivate

◆ transfer()

bool Football::Connection::transfer ( ServiceBase newservice,
bool  invokeNewConnectionHandler = false 
)

Transfer a connection to another service.

Parameters
newserviceThe service to transfer to.
invokeNewConnectionHandlerIf true, the newConnection handler is invoked with a nullptr.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tryGetFromOld()

static Connection* Football::Connection::tryGetFromOld ( FB_CONNECTION connection)
inlinestaticprotected

Try to retrieve the C++ connection object from the old-style C connection.

Parameters
connectionThe Football standard C connection structure.
Returns
The C++ connection object, or NULL if there is none.
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ Arena

friend class Arena
friend

◆ Iterator

friend class Iterator
friend

◆ ServiceBase

friend class ServiceBase
friend

Member Data Documentation

◆ argname_capacity

int Football::Connection::argname_capacity = 0
private

◆ connection

FB_CONNECTION* Football::Connection::connection = nullptr
private

Pointer to underlying Football connection.


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