Small structure that is only defined locally to retrieve errors. More...
#include <Plumed.h>
Public Attributes | |
int | code |
code used for translating messages More... | |
int | error_code |
error code for system_error More... | |
struct plumed_error * | nested |
pointer to nested exception More... | |
const char * | what |
message More... | |
char * | what_buffer |
the buffer containing the message to be deallocated More... | |
Small structure that is only defined locally to retrieve errors.
It is supposed to be used in the C11/C++ plumed_cmd interface as follows:
plumed p; plumed_error error; p=plumed_create(); plumed_cmd(p,"setNatoms",10,&error); if(error.code) { fprintf(errors,"%d\n",error.code); plumed_error_finalize(error); // make sure the error object is finalized! } // if no error was raised (error.code==0), it is not necessary to call plumed_error_finalize. // but doing it is harmless // no need to initialize error, it is written in the plumed_cmd function plumed_cmd(p,"init",&error); if(error.code) { fprintf(errors,"%d\n",error.code); plumed_error_finalize(error); // make sure the error object is finalized! }
The layout of this structure is subject to change, thus all the functions manipulating it are defined as inline/static functions. In the future, we might reach some form of ABI stability, and these functions might be moved below to the implementation file.
Notice that there is a macro plumed_error() defined in the PLUMED source code (at tools/Exception.h). There is no conflict with this type since C preprocessor distinguishes macros and function-like macros.
int plumed_error::code |
code used for translating messages
int plumed_error::error_code |
error code for system_error
struct plumed_error* plumed_error::nested |
pointer to nested exception
const char* plumed_error::what |
message
char* plumed_error::what_buffer |
the buffer containing the message to be deallocated
Hosted by GitHub | 1.8.17 |