SockIt
Public Member Functions

Event Class Reference

#include <Event.h>

Inheritance diagram for Event:
TcpEvent UdpEvent

List of all members.

Public Member Functions

 Event ()
virtual ~Event ()
virtual void send (const string &data)=0
virtual void send_bytes (const vector< byte > &bytes)=0
virtual string read () const =0
virtual FB::VariantList read_bytes () const =0
virtual string get_host ()=0
virtual unsigned short get_port ()=0
 FB_JSAPI_EVENT (error, 1,(const string &))

Detailed Description

Generic interface used to reply to data on some connection from Javascript.

Definition at line 29 of file Event.h.


Constructor & Destructor Documentation

Event::Event ( )

Constructor that register the Javascript API for event objects

Definition at line 10 of file Event.cpp.

References get_host(), get_port(), read(), read_bytes(), send(), and send_bytes().

{
    // Expose these methods to the Javascript
    registerMethod("send", make_method(this, &Event::send));
    registerMethod("sendBytes", make_method(this, &Event::send_bytes));
    registerMethod("read", make_method(this, &Event::read));
    registerMethod("readBytes", make_method(this, &Event::read_bytes));
    registerMethod("getHost", make_method(this, &Event::get_host));
    registerMethod("getPort", make_method(this, &Event::get_port));
}
Event::~Event ( ) [virtual]

Deconstructs a event object

Definition at line 22 of file Event.cpp.

{
    // Nothing to do here
}

Member Function Documentation

Event::FB_JSAPI_EVENT ( error  ,
,
(const string &)   
)

The javascript event fired when an error occurs, which sends the error message when fired.

virtual string Event::get_host ( ) [pure virtual]

Get the address, or hostname of the remote endpoint for this event.

Returns:
The hostname of the remote endpoint for this event.

Implemented in TcpEvent, and UdpEvent.

Referenced by Event().

virtual unsigned short Event::get_port ( ) [pure virtual]

Get the port associated with the remote endpoint of this event.

Returns:
port The port associated with the remote endpoint of this event.

Implemented in TcpEvent, and UdpEvent.

Referenced by Event().

virtual string Event::read ( ) const [pure virtual]

Reads the string data that belongs to this event.

Returns:
The string data received when this event was fired

Implemented in TcpEvent, and UdpEvent.

Referenced by Event().

virtual FB::VariantList Event::read_bytes ( ) const [pure virtual]

Reads the byte data that belongs to this event

Returns:
The byte data received when this event was fired

Implemented in TcpEvent, and UdpEvent.

Referenced by Event().

virtual void Event::send ( const string &  data) [pure virtual]

Reply on this Event's connection with some data.

Parameters:
dataThe data to send

Implemented in TcpEvent, and UdpEvent.

Referenced by Event().

virtual void Event::send_bytes ( const vector< byte > &  bytes) [pure virtual]

Reply on this Event's connection with some data, given as bytes.

Parameters:
bytesThe bytes of data with which to reply

Implemented in TcpEvent, and UdpEvent.

Referenced by Event().


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Friends Defines