#include <PseudoNew.h>
Inheritance diagram for PseudoNew:
Public Methods | |
PseudoNew (void *libFunPtr) | |
Contructor. It takes a void funtion pointer as returned e.g. by dlsym(). More... | |
PseudoNew (void) | |
Default constructor. More... | |
virtual | ~PseudoNew () |
void | bind (void *libFunPtr) |
virtual T * | create () |
bool | isValid () |
Did we really find the pseudo constructor function in the library? More... | |
Protected Attributes | |
T *(* | newMethodPtr )() |
// declaration extern "C" { aTest *makeNew(); } // implementation aTest *makeNew() { return new shTest; }
class aTest; // Declare a pseudo new class which will return an instance of type aTest // The pseudo constructor function in the shared library is named makeNew PseudoNew <aTest> myPseudoNew (testLibMaker.lookUp("makeNew")); // Check we really looked up the function if (myPseudoNew.isValid()) { // Create a new instance of the class (dynamic memory) aTest *myTest = myPseudoNew.create(); // Call the method. Should return 1. cout << "Unit is: " << myTest->retUnit() << endl; // Don't forget to delete the object !!! delete myTest; }
Definition at line 44 of file PseudoNew.h.
|
Definition at line 47 of file PseudoNew.h. References newMethodPtr. |
|
Definition at line 51 of file PseudoNew.h. References newMethodPtr. |
|
Definition at line 54 of file PseudoNew.h. |
|
Binding method (used to initialize an instance created with the default constructor. It takes a void function pointer as returned e.g. by dlsym(). Definition at line 58 of file PseudoNew.h. References newMethodPtr. |
|
Create a new instance of the class by calling the pseudo contructor. The object will (very likely) be created in dynamic memory, thus the user is responsible for deletion. Reimplemented in GcPseudoNew. Definition at line 65 of file PseudoNew.h. |
|
Definition at line 69 of file PseudoNew.h. References newMethodPtr. |
|
Referenced by bind, GcPseudoNew::create, isValid, and PseudoNew. |