Public Attributes | List of all members
plumed_error Struct Reference

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...
 
const char * what
 message More...
 
char * what_buffer
 the buffer containing the message to be deallocated More...
 

Detailed Description

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, and functions manipulating it are defined as inline/static functions.

Member Data Documentation

◆ code

int plumed_error::code

code used for translating messages

◆ error_code

int plumed_error::error_code

error code for system_error

◆ what

const char* plumed_error::what

message

◆ what_buffer

char* plumed_error::what_buffer

the buffer containing the message to be deallocated


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