# class SignallingEngine | Main signalling component holder. More...
Full name | `TelEngine::SignallingEngine`
Definition | `#include <libs/ysig/yatesig.h>`
Inherits | TelEngine::DebugEnabler [public ], TelEngine::Mutex [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- SignallingEngine (const char* name = "signalling")
- virtual ~SignallingEngine ()
- void insert (SignallingComponent* component)
- void remove (SignallingComponent* component)
- bool remove (const String& name)
- SignallingComponent* find (const String& name)
- SignallingComponent* find (const String& name, const String& type, const SignallingComponent* start = 0)
- SignallingComponent* build (const String& type, NamedList& params, bool init = false, bool ref = true)
- bool control (NamedList& params)
- bool find (const SignallingComponent* component)
- void notify (SignallingComponent* component, NamedList notifs)
- bool start (const char* name = "Sig Engine", Thread::Priority prio = Thread::Normal, unsigned long usec = 0)
- void stop ()
- inline void setNotifier (SignallingNotifier* notifier)
- inline void removeNotifier (SignallingNotifier* notifier)
- Thread* thread () const
- unsigned long tickSleep (unsigned long usec = 1000000)
- inline unsigned long tickDefault () const

#### Public Static Methods

- static SignallingEngine* self (bool create = false)
- static inline long maxLockWait ()
- static void maxLockWait (long maxWait)
- static template inline void destruct (Obj*& obj)

#### Protected Methods

- virtual unsigned long timerTick (const Time& when)

#### Protected Members

- ObjList m_components

## Detailed Description

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

SignallingEngine (const char* name = "signalling") | ### SignallingEngine

Constructor of an empty engine

Parameters:

name | The debug name of this engine

~SignallingEngine () | ### ~SignallingEngine

[virtual]

Destructor, removes all components

SignallingEngine* self (bool create = false) | ### self

[static]

Get a pointer to the first (and usually only) instance created

Parameters:

create | Create the instance if it doesn't exist

Returns: Pointer to first engine, NULL if not created

void insert (SignallingComponent* component) | ### insert

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

Parameters:

component | Pointer to component to insert in engine

void remove (SignallingComponent* component) | ### remove

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

Parameters:

component | Pointer to component to remove from engine

bool remove (const String& name) | ### remove

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

SignallingComponent* find (const String& name) | ### find

Retrieve 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

SignallingComponent* find (const String& name, const String& type, const SignallingComponent* start = 0) | ### find

Retrieve 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* build (const String& type, NamedList& params, bool init = false, bool ref = true) | ### build

Retrieve 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
ref | True to add a reference when returning existing component

Returns: Pointer to component found or created, NULL on failure

bool control (NamedList& params) | ### control

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

bool find (const SignallingComponent* component) | ### find

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

void notify (SignallingComponent* component, NamedList notifs) | ### notify

Handle notifications from a SignallingComponent

Parameters:

component | The SignallingComponent from which the notifications were received
notifs | The notifications sent by this SignallingComponent

bool start (const char* name = "Sig Engine", Thread::Priority prio = Thread::Normal, unsigned long usec = 0) | ### start

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 () | ### stop

Stops and destroys the worker thread if running

inline void setNotifier (SignallingNotifier* notifier) | ### setNotifier

Add to this engine a notifier object

Parameters:

notifier | The SignallingNotifier object to be added to the engine

inline void removeNotifier (SignallingNotifier* notifier) | ### removeNotifier

Remove from this engine a notifier object

Parameters:

notifier | The SignallingNotifier object to be removed from the engine

Thread* thread () | ### thread

[const]

Return a pointer to the worker thread

Returns: Pointer to running worker thread or NULL

unsigned long tickSleep (unsigned long usec = 1000000) | ### tickSleep

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

inline unsigned long tickDefault () | ### tickDefault

[const]

Get the default engine tick sleep time in microseconds

Returns: Default timer sleep in usec

inline long maxLockWait () | ### maxLockWait

[static]

Get the maximum time we should spend acquiring a non-critical Mutex

Returns: Maximum non-critical lock wait in usec, -1 to wait forever

void maxLockWait (long maxWait) | ### maxLockWait

[static]

Set the maximum time we should spend acquiring a non-critical Mutex

Parameters:

maxWait | New maximum non-critical lock wait in usec, negative to wait forever

template inline void destruct (Obj*& obj) | ### destruct

[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

unsigned long timerTick (const Time& when) | ### timerTick

[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

ObjList m_components | ### m_components

[protected]

Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.