SignallingEngine Class Reference

Main signalling component holder. More...

#include <yatesig.h>

Inheritance diagram for SignallingEngine:
DebugEnabler Mutex Lockable

List of all members.

Public Member Functions

 SignallingEngine (const char *name="signalling")
virtual ~SignallingEngine ()
void insert (SignallingComponent *component)
void remove (SignallingComponent *component)
bool remove (const String &name)
SignallingComponentfind (const String &name)
SignallingComponentfind (const String &name, const String &type, const SignallingComponent *start=0)
SignallingComponentbuild (const String &type, const NamedList &params, bool init=false)
bool control (NamedList &params)
bool find (const SignallingComponent *component)
bool start (const char *name="Sig Engine", Thread::Priority prio=Thread::Normal, unsigned long usec=0)
void stop ()
Threadthread () const
unsigned long tickSleep (unsigned long usec=1000000)
unsigned long tickDefault () const

Static Public Member Functions

template<class Obj >
static void destruct (Obj *&obj)

Protected Member Functions

virtual unsigned long timerTick (const Time &when)

Protected Attributes

ObjList m_components

Friends

class SignallingComponent
class SignallingThreadPrivate

Detailed Description

Main signalling component holder.

The engine is the center of all SS7 or ISDN applications. It is used as a base to build the protocol stack from components.


Constructor & Destructor Documentation

SignallingEngine ( const char *  name = "signalling"  ) 

Constructor of an empty engine

Parameters:
name The debug name of this engine
virtual ~SignallingEngine (  )  [virtual]

Destructor, removes all components


Member Function Documentation

SignallingComponent* build ( const String type,
const NamedList params,
bool  init = false 
)

Retrive and reference an existing component, create by factory if not present

Parameters:
type Class or base class of the component to find or create
params Name of component to find or create and creation parameters
init Set to true to initialize a newly created component
Returns:
Pointer to component found or created, NULL on failure
bool control ( NamedList params  ) 

Apply a control operation to all components in the engine

Parameters:
params The list of parameters to query or change
Returns:
True if the control operation was executed by at least one component
static void destruct ( Obj *&  obj  )  [inline, static]

Helper template used to remove a component descendant from its engine, destroy it and set the received pointer to 0

Parameters:
obj Reference to pointer (lvalue) to the object to remove and destroy

References TelEngine::destruct().

bool find ( const SignallingComponent component  ) 

Check if a component is in the engine's list

Parameters:
component Pointer to component to check
Returns:
True if the component is in the engine's list
SignallingComponent* find ( const String name,
const String type,
const SignallingComponent start = 0 
)

Retrive a component by name and class, lock the list while searching for it

Parameters:
name Name of the component to find, empty to find any of the type
type Class or base class of the component to find, empty to match any
start Component to start searching from, search all list if NULL
Returns:
Pointer to component found or NULL
SignallingComponent* find ( const String name  ) 

Retrive a component by name, lock the list while searching for it

Parameters:
name Name of the component to find
Returns:
Pointer to component found or NULL
void insert ( SignallingComponent component  ) 

Insert a component in the engine, lock the list while doing so

Parameters:
component Pointer to component to insert in engine
bool remove ( const String name  ) 

Remove and destroy a component from the engine by name

Parameters:
name Name of component to remove from engine
Returns:
True if a component was found and destroyed
void remove ( SignallingComponent component  ) 

Remove a component from the engine, lock the list while doing so

Parameters:
component Pointer to component to remove from engine
bool start ( const char *  name = "Sig Engine",
Thread::Priority  prio = Thread::Normal,
unsigned long  usec = 0 
)

Starts the worker thread that keeps components alive

Parameters:
name Static name of the thread
prio Thread's priority
usec How long to sleep between iterations in usec, 0 to use library default
Returns:
True if (already) started, false if an error occured
void stop (  ) 

Stops and destroys the worker thread if running

Thread* thread (  )  const

Return a pointer to the worker thread

Returns:
Pointer to running worker thread or NULL
unsigned long tickDefault (  )  const [inline]

Get the default engine tick sleep time in microseconds

Returns:
Default timer sleep in usec
unsigned long tickSleep ( unsigned long  usec = 1000000  ) 

Adjust (decrease only) the desired maximum time until next tick. Can be called only from within timerTick()

Parameters:
usec Desired time until next timerTick() call in usec
Returns:
Timer sleep in usec after applying the current change
virtual unsigned long timerTick ( const Time when  )  [protected, virtual]

Method called periodically by the worker thread to keep everything alive

Parameters:
when Time to use as computing base for events and timeouts
Returns:
Desired sleep (in usec) until thread's next tick interval

Member Data Documentation

ObjList m_components [protected]

The list of components managed by this engine


The documentation for this class was generated from the following file:
Generated on Thu Apr 8 18:19:44 2010 for Yate by  doxygen 1.6.3