Yate
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
JBStreamSet Class Reference

A set of streams to be processed in an uniform way. More...

#include <yatejabber.h>

Inheritance diagram for JBStreamSet:
GenObject Mutex Lockable JBStreamSetProcessor JBStreamSetReceive

List of all members.

Public Member Functions

virtual ~JBStreamSet ()
ObjListclients ()
virtual bool add (JBStream *client)
virtual bool remove (JBStream *client, bool delObj=true)
unsigned int dropAll (const JabberID &local=JabberID::empty(), const JabberID &remote=JabberID::empty(), XMPPError::Type error=XMPPError::NoError, const char *reason=0)
void run ()
virtual bool start ()
virtual void stop ()

Protected Member Functions

 JBStreamSet (JBStreamSetList *owner)
virtual bool process (JBStream &stream)=0

Protected Attributes

bool m_changed
bool m_exiting
JBStreamSetListm_owner
ObjList m_clients

Friends

class JBStreamSetList

Detailed Description

A set of streams to be processed in an uniform way.

This class holds a set of streams to be processed in an uniform way. This is a base class for specialized stream list processors. Its process() method should be called in its own thread


Constructor & Destructor Documentation

virtual ~JBStreamSet ( ) [virtual]

Destructor. Delete the owned streams. Remove from owner

JBStreamSet ( JBStreamSetList owner) [protected]

Constructor

Parameters:
ownerThe list owning this set

Member Function Documentation

virtual bool add ( JBStream client) [virtual]

Add a stream to the set. The stream's reference counter will be increased. This method doesn't check if the stream is already added

Parameters:
clientThe stream to append
Returns:
True on success, false if there is no more room in this set
ObjList& clients ( ) [inline]

Retrieve the list of clients. Make sure the set is locked before calling this method

Returns:
The list of clients
unsigned int dropAll ( const JabberID local = JabberID::empty(),
const JabberID remote = JabberID::empty(),
XMPPError::Type  error = XMPPError::NoError,
const char *  reason = 0 
)

Terminate all streams matching local/remote jid

Parameters:
localOptional local jid to match
remoteOptional remote jid to match
errorOptional error to be sent to the client
reasonOptional error text to be sent to the client
Returns:
The number of streams terminated
virtual bool process ( JBStream stream) [protected, pure virtual]

This method is called from run() with the list unlocked and stream's reference counter increased. A specialized processor must implement this method

Parameters:
streamThe stream to process
Returns:
True if something was processed

Implemented in JBStreamSetReceive, and JBStreamSetProcessor.

virtual bool remove ( JBStream client,
bool  delObj = true 
) [virtual]

Remove a stream from set

Parameters:
clientThe stream to remove
delObjTrue to release the stream, false to remove it from list without releasing it
Returns:
True on success, false if not found
void run ( )

Process the list. Returns as soon as there are no more streams in the list

virtual bool start ( ) [virtual]

Start running

Returns:
True on success
virtual void stop ( ) [virtual]

Stop running


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