sipxportlib  Version 3.3
Public Member Functions | List of all members
PluginIterator Class Reference

#include <PluginHooks.h>

Public Member Functions

 PluginIterator (const PluginHooks &pluginHooks)
 Create an iterator that returns each instance managed by a PluginHooks object. More...
 
 ~PluginIterator ()
 
Pluginnext (UtlString *name=NULL)
 Advance to and return the next plugin. More...
 

Detailed Description

PluginIterator is used to obtain a sequence of Plugin objects to be invoked.

The calling program gets the plugin objects by creating a PluginIterator over a Plugin object and then calling the PluginIterator::next method to get each instance of the Plugin (and optionally, its instance name).

The PluginIterator always returns the configured Plugin objects in lexical order by the instance name; this allows the configuration to control the order in which they are invoked.

Plugin libraries can implement any calling interface that's needed (a program that uses the Plugin mechanism should create a base class that extends Plugin to specify the interface).

A typical usage would look like:

PluginIterator actions(ActionEventHooks);
YourPluginClass* action;
while(action = static_cast<YourPluginClass*>(actions.next()))
{
action->invokeMethod();
}

Constructor & Destructor Documentation

PluginIterator ( const PluginHooks pluginHooks)

Create an iterator that returns each instance managed by a PluginHooks object.

Member Function Documentation

Plugin * next ( UtlString name = NULL)

Advance to and return the next plugin.

No meaning should be attached to Plugin names, so that order of plugin iteration can be controlled by the lexical order of plugin names.

Parameters
nameThe instance name string for the returned Plugin (for logging purposes). May be NULL if the caller does not need the name.