#include <GcPseudoNew.h>
Inheritance diagram for GcPseudoNew:
Public Methods | |
GcPseudoNew (void *libFunPtr) | |
Constructor. It takes a void funtion pointer as returned e.g. by dlsym(). More... | |
virtual | ~GcPseudoNew () |
Destructor. Removes all objects created by calling create() method. More... | |
virtual T * | create () |
Private Methods | |
GcPseudoNew (GcPseudoNew &oldG) | |
GcPseudoNew (GcPseudoNew &oldG, void *libFunPtr) | |
GcPseudoNew (const GcPseudoNew &oldG, void *libFunPtr) | |
void | operator= (GcPseudoNew &oldG) |
Private Attributes | |
AIDA_STD::vector< T * > | instances |
class aParticle; if (1) { int i,nParticles=1000; // Declare a GcPseudoNew class returning an instance of type aParticle // The GcPseudoNew object will garbage collect dynamic objects. GcPseudoNew <aParticle> myPseudoNew (testLibMaker.lookUp("makeNew")); // Check we really looked up the function if (myPseudoNew.isValid()) { for (i=0;i<nParticles;i++) // Create a new instance of the class (dynamic memory) aParticle *myParticle = myPseudoNew.create(); } } // myPseudoNew goes of of scope. All particles are destroyed
Definition at line 46 of file GcPseudoNew.h.
|
Definition at line 49 of file GcPseudoNew.h. |
|
Definition at line 52 of file GcPseudoNew.h. References instances. |
|
Copy constructor & assignment operators are private: the object can't be passed by value. Definition at line 71 of file GcPseudoNew.h. |
|
Definition at line 72 of file GcPseudoNew.h. |
|
Definition at line 74 of file GcPseudoNew.h. |
|
Create a new instance of the class by calling the pseudo constructor. The object is saved in a vector for later garbage collection. Reimplemented from PseudoNew. Definition at line 61 of file GcPseudoNew.h. References instances, and PseudoNew::newMethodPtr. |
|
Definition at line 76 of file GcPseudoNew.h. |
|
Definition at line 67 of file GcPseudoNew.h. Referenced by create, and ~GcPseudoNew. |