Yate
JBStreamSetList Class Reference

A list of stream sets. More...

#include <yatejabber.h>

Inheritance diagram for JBStreamSetList:
RefObject Mutex GenObject Lockable

Public Member Functions

 JBStreamSetList (JBEngine *engine, unsigned int max, unsigned int sleepMs, const char *name)
 
ObjListsets ()
 
virtual ~JBStreamSetList ()
 
unsigned int maxStreams () const
 
unsigned int streamCount () const
 
JBEngineengine () const
 
bool add (JBStream *client)
 
void remove (JBStream *client, bool delObj=true)
 
void stop (JBStreamSet *set=0, bool waitTerminate=true)
 
virtual const StringtoString () const
 
- Public Member Functions inherited from RefObject
 RefObject ()
 
virtual ~RefObject ()
 
virtual void * getObject (const String &name) const
 
virtual bool alive () const
 
bool ref ()
 
bool deref ()
 
int refcount () const
 
virtual void destruct ()
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual const StringtraceId () const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 
- Public Member Functions inherited from Mutex
 Mutex (bool recursive=false, const char *name=0)
 
 Mutex (const Mutex &original)
 
 ~Mutex ()
 
Mutexoperator= (const Mutex &original)
 
virtual bool lock (long maxwait=-1)
 
virtual bool unlock ()
 
virtual bool locked () const
 
const char * owner () const
 
bool recursive () const
 
- Public Member Functions inherited from Lockable
virtual ~Lockable ()
 
virtual bool check (long maxwait=-1)
 
virtual bool unlockAll ()
 

Protected Member Functions

virtual void destroyed ()
 
void remove (JBStreamSet *set)
 
virtual JBStreamSetbuild ()
 
- Protected Member Functions inherited from RefObject
virtual void zeroRefs ()
 
bool resurrect ()
 

Protected Attributes

JBEnginem_engine
 
String m_name
 
unsigned int m_max
 
unsigned int m_sleepMs
 
ObjList m_sets
 

Friends

class JBStreamSet
 

Additional Inherited Members

- Static Public Member Functions inherited from RefObject
static bool alive (const RefObject *obj)
 
static bool efficientIncDec ()
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 
- Static Public Member Functions inherited from Mutex
static int count ()
 
static int locks ()
 
static bool efficientTimedLock ()
 
- Static Public Member Functions inherited from Lockable
static void wait (unsigned long maxwait)
 
static unsigned long wait ()
 
static void startUsingNow ()
 
static void enableSafety (bool safe=true)
 
static bool safety ()
 

Detailed Description

A list of stream sets.

This class holds a list of stream sets. The purpose is to create a list of threads

Constructor & Destructor Documentation

◆ JBStreamSetList()

JBStreamSetList ( JBEngine * engine,
unsigned int max,
unsigned int sleepMs,
const char * name )

Constructor

Parameters
engineEngine owning this list
maxMaximum streams per set (0 for maximum possible)
sleepMsTime to sleep when idle
nameList name (for debugging purposes)

References engine().

Referenced by build().

◆ ~JBStreamSetList()

virtual ~JBStreamSetList ( )
virtual

Destructor

Member Function Documentation

◆ add()

bool add ( JBStream * client)

Add a stream to the list. Build a new set if there is no room in existing sets

Parameters
clientThe stream to add
Returns
True on success

◆ build()

virtual JBStreamSet * build ( )
protectedvirtual

Build a specialized stream set. Descendants must override this method

Returns
JBStreamSet pointer or 0

References JBStreamSetList().

◆ destroyed()

virtual void destroyed ( )
protectedvirtual

Stop all sets. Release memory

Reimplemented from RefObject.

◆ engine()

JBEngine * engine ( ) const
inline

Retrieve the engine owning this list

Returns
The engine owning this list

Referenced by JBStreamSetList().

◆ maxStreams()

unsigned int maxStreams ( ) const
inline

Retrieve the maximum number of streams per set

Returns
The maximum number of streams per set

◆ remove() [1/2]

void remove ( JBStream * client,
bool delObj = true )

Remove a stream from list

Parameters
clientThe stream to remove
delObjTrue to release the stream, false to remove it from list without releasing it

◆ remove() [2/2]

void remove ( JBStreamSet * set)
protected

Remove a set from list without deleting it

Parameters
setThe set to remove

◆ sets()

ObjList & sets ( )
inline

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

Returns
The stream set list

◆ stop()

void stop ( JBStreamSet * set = 0,
bool waitTerminate = true )

Stop one set or all sets

Parameters
setThe set to stop, 0 to stop all
waitTerminateTrue to wait for all streams to terminate

◆ streamCount()

unsigned int streamCount ( ) const
inline

Retrieve the number of streams in all sets

Returns
The number of streams in all sets

◆ toString()

virtual const String & toString ( ) const
virtual

Get the string representation of this list

Returns
The list name

Reimplemented from GenObject.


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