Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
PLMD::Plumed Class Reference

C++ wrapper for plumed. More...

#include <Plumed.h>

Public Member Functions

 Plumed ()
 Constructor. More...
 
 Plumed (const char *c)
 Clone a Plumed object from a FORTRAN char* handler. More...
 
 Plumed (plumed p)
 Clone a Plumed object from a C plumed structure. More...
 
 operator plumed () const
 Retrieve the C plumed structure for this object. More...
 
void toFortran (char *c) const
 Retrieve a FORTRAN handler for this object. More...
 
void cmd (const char *key, const void *val=NULL)
 Send a command to this plumed object. More...
 
virtual ~Plumed ()
 Destructor. More...
 

Static Public Member Functions

static bool installed ()
 Check if plumed is installed (for runtime binding) More...
 
static bool ginitialized ()
 Check if global-plumed has been initialized. More...
 
static void gcreate ()
 Initialize global-plumed. More...
 
static void gcmd (const char *key, const void *val)
 Send a command to global-plumed. More...
 
static void gfinalize ()
 Finalize global-plumed. More...
 
static Plumed global ()
 Returns the Plumed global object. More...
 

Private Member Functions

 Plumed (const Plumed &)
 Copy constructor is disabled (private and unimplemented) The problem here is that after copying it will not be clear who is going to finalize the corresponding plumed structure. More...
 
Plumedoperator= (const Plumed &)
 Assignment operator is disabled (private and unimplemented) The problem here is that after copying it will not be clear who is going to finalize the corresponding plumed structure. More...
 

Private Attributes

plumed main
 C structure. More...
 
bool reference
 keeps track if the object was created from scratch using the defaults destructor (reference=false) or if it was imported from C or FORTRAN (reference=true). More...
 

Detailed Description

C++ wrapper for plumed.

This class provides a C++ interface to PLUMED.

Constructor & Destructor Documentation

PLMD::Plumed::Plumed ( )
inline

Constructor.

Note
Performs the same task a plumed_create()
PLMD::Plumed::Plumed ( const char *  c)
inline

Clone a Plumed object from a FORTRAN char* handler.

Parameters
cThe FORTRAN handler (a char[32]).
Attention
The Plumed object created in this manner will not finalize the corresponding plumed structure. It is expected that the FORTRAN code calls plumed_c_finalize for it
PLMD::Plumed::Plumed ( plumed  p)
inline

Clone a Plumed object from a C plumed structure.

Parameters
pThe C plumed structure.
Attention
The Plumed object created in this manner will not finalize the corresponding plumed structure. It is expected that the C code calls plumed_finalize for it
PLMD::Plumed::Plumed ( const Plumed )
private

Copy constructor is disabled (private and unimplemented) The problem here is that after copying it will not be clear who is going to finalize the corresponding plumed structure.

PLMD::Plumed::~Plumed ( )
inlinevirtual

Destructor.

Destructor is virtual so as to allow correct inheritance from Plumed object. To avoid linking problems with g++, I specify "inline" also here (in principle it should be enough to specify it down in the definition of the function, but for some reason that I do not understand g++ does not inline it properly in that case and complains when Plumed.h is included but Plumed.o is not linked. Anyway, the way it is done here seems to work properly).

Member Function Documentation

void PLMD::Plumed::cmd ( const char *  key,
const void *  val = NULL 
)
inline

Send a command to this plumed object.

Parameters
keyThe name of the command to be executed
valThe argument. It is declared as const to allow calls like p.cmd("A","B"), but for some choice of key it can change the content
Note
Equivalent to plumed_cmd()
void PLMD::Plumed::gcmd ( const char *  key,
const void *  val 
)
inlinestatic

Send a command to global-plumed.

Parameters
keyThe name of the command to be executed
valThe argument. It is declared as const to allow calls like gcmd("A","B"), but for some choice of key it can change the content
Note
Equivalent to plumed_gcmd()
void PLMD::Plumed::gcreate ( )
inlinestatic

Initialize global-plumed.

Note
Equivalent to plumed_gcreate()
void PLMD::Plumed::gfinalize ( )
inlinestatic

Finalize global-plumed.

bool PLMD::Plumed::ginitialized ( )
inlinestatic

Check if global-plumed has been initialized.

Returns
true if global plumed object (see global()) is initialized (i.e. if gcreate() has been called), false otherwise.
Note
Equivalent to plumed_ginitialized() but returns a bool
Plumed PLMD::Plumed::global ( )
inlinestatic

Returns the Plumed global object.

Returns
The Plumed global object
bool PLMD::Plumed::installed ( )
inlinestatic

Check if plumed is installed (for runtime binding)

Returns
true if plumed is installed, false otherwise
Note
Equivalent to plumed_installed() but returns a bool
PLMD::Plumed::operator plumed ( ) const
inline

Retrieve the C plumed structure for this object.

Plumed& PLMD::Plumed::operator= ( const Plumed )
private

Assignment operator is disabled (private and unimplemented) The problem here is that after copying it will not be clear who is going to finalize the corresponding plumed structure.

void PLMD::Plumed::toFortran ( char *  c) const
inline

Retrieve a FORTRAN handler for this object.

Parameters
cThe FORTRAN handler (a char[32]).

Member Data Documentation

plumed PLMD::Plumed::main
private

C structure.

bool PLMD::Plumed::reference
private

keeps track if the object was created from scratch using the defaults destructor (reference=false) or if it was imported from C or FORTRAN (reference=true).

In the latter case, the plumed_finalize() method is not called when destructing the object, since it is expected to be finalized in the C/FORTRAN code


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