CAFPlugin Class Reference

#include <CAFPlugin.h>

Inheritance diagram for CAFPlugin:

CAccessorFactory

List of all members.

Public Member Functions

CAccessormakeAccessor (const CXMLElement &) const
char * getName ()
 CAFPlugin (string, string, string)
 CAFPlugin (CAFPlugin &)
 ~CAFPlugin ()
bool isSane () const
void registerFactory (CAccessorFactoryContainer &outContainer)

Protected Attributes

void * mDlOpenHandle
string mName
CAccessor *(* mMakeAccessor )(const CXMLElement &)
char *(* mGetName )(void)
bool mIsSane


Detailed Description

Definition at line 41 of file CAFPlugin.h.


Constructor & Destructor Documentation

CAFPlugin::CAFPlugin ( string  inLibraryDirName,
string  inLibraryFileName,
string  inLibraryName 
)

opens the library and sets the make query etc. functions

makes the CAFPlugin. All it needs is:

Parameters:
inLibraryFileName the file name of the shared object to be treated

Definition at line 17 of file CAFPlugin.cc.

References mDlOpenHandle, mGetName, mIsSane, mMakeAccessor, and mName.

00019                               :
00020   mGetName(0),
00021   mMakeAccessor(0),
00022   mName("no name given"),
00023   mIsSane(0){
00024   
00025   const char* lError;
00026   string lLibraryPath=inLibraryDirName+"/"+inLibraryFileName;
00027   string lStringGetClassName(inLibraryName+"_getClassName");
00028   string lStringMakeAccessor(inLibraryName+"_makeAccessor");
00029 
00030   mDlOpenHandle = dlopen (lLibraryPath.c_str(), RTLD_LAZY);
00031   if (!mDlOpenHandle) {
00032     cerr << "Could not open library: " << endl
00033    << dlerror() << endl;
00034     //throw VEConfigurationError(dlerror());
00035     mIsSane=0;
00036   }else{
00037   
00038     mGetName = (typeof(mGetName))dlsym(mDlOpenHandle, 
00039                lStringGetClassName.c_str());
00040     if ((lError = dlerror()) != NULL)  {
00041       cerr << "Could not link to symbol " << lStringGetClassName << ":" << lError << endl;
00042     }else{
00043       mName=(*mGetName)();
00044       mMakeAccessor=(typeof(mMakeAccessor))dlsym(mDlOpenHandle,
00045              lStringMakeAccessor.c_str());
00046       if ((lError = dlerror()) != NULL)  {
00047   cerr << "Could not link to symbol " << lStringMakeAccessor << ":" << lError << endl;
00048       }else{
00049   mIsSane=1;
00050       }
00051     }
00052   }
00053 }

CAFPlugin::CAFPlugin ( CAFPlugin inPlugin  ) 

copy all the content

Definition at line 55 of file CAFPlugin.cc.

00055                                        :
00056   mGetName(inPlugin.mGetName),
00057   mMakeAccessor(inPlugin.mMakeAccessor),
00058   mName(inPlugin.mName){
00059 }

CAFPlugin::~CAFPlugin (  ) 

close the DlOpenHandle of the library

Definition at line 61 of file CAFPlugin.cc.

References mDlOpenHandle.

00061                      {
00062   if(mDlOpenHandle){
00063     dlclose(mDlOpenHandle);
00064   }
00065 }


Member Function Documentation

CAccessor * CAFPlugin::makeAccessor ( const CXMLElement inXMLElement  )  const

Add some register function here

the rest can stay the same makes a CAccessor object

makes a CAccessor object

Definition at line 6 of file CAFPlugin.cc.

References mMakeAccessor.

00006                                                                       {
00007   return (*mMakeAccessor)(inXMLElement);
00008 }

char * CAFPlugin::getName (  ) 

gets the name of the plugin

gets the name of the plugin

Definition at line 10 of file CAFPlugin.cc.

References mGetName.

Referenced by CAccessorFactoryContainer::configure(), and registerFactory().

00010                         {
00011   return (*mGetName)();
00012 };

bool CAFPlugin::isSane (  )  const

is this well constructed

Definition at line 67 of file CAFPlugin.cc.

References mIsSane.

Referenced by CAccessorFactoryContainer::configure().

00067                            {
00068   return mIsSane;
00069 }

void CAFPlugin::registerFactory ( CAccessorFactoryContainer outContainer  )  [virtual]

register the factory

Reimplemented from CAccessorFactory.

Definition at line 71 of file CAFPlugin.cc.

References getName(), and CAccessorFactoryContainer::registerFactory().

00071                                                                       {
00072   outContainer.registerFactory(this,
00073              getName());
00074 };


Member Data Documentation

void* CAFPlugin::mDlOpenHandle [protected]

the handle which enables us to open

Definition at line 44 of file CAFPlugin.h.

Referenced by CAFPlugin(), and ~CAFPlugin().

string CAFPlugin::mName [protected]

the name of the plugin

Reimplemented from CAccessorFactory.

Definition at line 46 of file CAFPlugin.h.

Referenced by CAFPlugin().

the function for making a CAccessor object

Referenced by CAFPlugin(), and makeAccessor().

char*(* CAFPlugin::mGetName)(void) [protected]

this function gives us the name of the plugin

Referenced by CAFPlugin(), and getName().

bool CAFPlugin::mIsSane [protected]

is this well constructed?

Definition at line 52 of file CAFPlugin.h.

Referenced by CAFPlugin(), and isSane().


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

Generated on Tue Jan 6 00:31:07 2009 for Gift by  doxygen 1.5.6