Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

gadget::ProxyFactory Class Reference

Object used for creating proxies. More...

#include <ProxyFactory.h>

List of all members.

Public Methods

void registerProxy (ProxyConstructorBase *constructor)
bool recognizeProxy (jccl::ConfigElementPtr element)
 Queries if the factory knows about the given proxy. More...

ProxyloadProxy (jccl::ConfigElementPtr element)
 Loads the specified proxy. More...


Detailed Description

Object used for creating proxies.

Note:
Singleton

Definition at line 111 of file ProxyFactory.h.


Member Function Documentation

void gadget::ProxyFactory::registerProxy ProxyConstructorBase   constructor
 

Definition at line 88 of file ProxyFactory.cpp.

References gadgetDBG_INPUT_MGR.

00089 {
00090    mConstructors.push_back(constructor);     // Add the constructor to the list
00091    vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_CONFIG_LVL)
00092       << "gadget::ProxyFactory: Constructor registered for: "
00093       << std::setiosflags(std::ios::right) << std::setw(25)
00094       << std::setfill(' ') << constructor->getElementType()
00095       << std::resetiosflags(std::ios::right)
00096       //<< "   :" << (void*)constructor
00097       << " type: " << typeid(*constructor).name() << std::endl
00098       << vprDEBUG_FLUSH;
00099 }

bool gadget::ProxyFactory::recognizeProxy jccl::ConfigElementPtr    element
 

Queries if the factory knows about the given proxy.

Precondition:
element != NULL, element is a valid config element.
Parameters:
element  The element we are requesting about knowledge to create.
Returns:
true if the factory knows how to create the proxy; false if not.

Definition at line 103 of file ProxyFactory.cpp.

Referenced by loadProxy.

00104 {
00105    return ! (findConstructor(element) == -1);
00106 }

Proxy * gadget::ProxyFactory::loadProxy jccl::ConfigElementPtr    element
 

Loads the specified proxy.

Precondition:
recognizeDevice(element) == true.
Parameters:
element  The specification of the proxy to load.
Returns:
NULL is returned if the proxy failed to load. Otherwise, a pointer to the loaded proxy is returned.

Definition at line 111 of file ProxyFactory.cpp.

References gadgetDBG_INPUT_MGR, and recognizeProxy.

00112 {
00113    vprASSERT(recognizeProxy(element));
00114 
00115    int index = findConstructor(element);
00116 
00117    Proxy* new_proxy;
00118    ProxyConstructorBase* constructor = mConstructors[index];
00119 
00120    vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL)
00121       << "vjProxyFactory::loadProxy: Loading proxy: "
00122       << element->getID() << "  with: "
00123       << typeid(*constructor).name() << std::endl << vprDEBUG_FLUSH;
00124    new_proxy = constructor->createProxy(element);
00125    return new_proxy;
00126 }


The documentation for this class was generated from the following files:
Generated on Sun May 2 14:26:53 2004 for Gadgeteer by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002