MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
cleanup.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef int(* mbdyn_cleanup_f )(void *)
 

Functions

int mbdyn_cleanup_register (mbdyn_cleanup_f handler, void ***datapp)
 
int mbdyn_cleanup (void)
 
void mbdyn_cleanup_destroy (void)
 

Typedef Documentation

typedef int(* mbdyn_cleanup_f)(void *)

Definition at line 39 of file cleanup.h.

Function Documentation

int mbdyn_cleanup ( void  )

Definition at line 77 of file cleanup.cc.

References c, cleanup::data, and cleanup::handler.

Referenced by main().

78 {
79  while (!c.empty()) {
80  cleanup *p = c.top();
81 
82  pedantic_cout("mbdyn_cleanup: " << (void *)p->handler << ":" << (void *)p->data << std::endl);
83 
84  p->handler(p->data);
85  c.pop();
86  delete p;
87  }
88 
89  return 0;
90 }
mbdyn_cleanup_f handler
Definition: cleanup.cc:40
static std::stack< cleanup * > c
Definition: cleanup.cc:59
void * data
Definition: cleanup.cc:41
void mbdyn_cleanup_destroy ( void  )

Definition at line 93 of file cleanup.cc.

References c.

Referenced by main().

94 {
95  while (!c.empty()) {
96  cleanup *p = c.top();
97  c.pop();
98  delete p;
99  }
100 }
static std::stack< cleanup * > c
Definition: cleanup.cc:59
int mbdyn_cleanup_register ( mbdyn_cleanup_f  handler,
void ***  datapp 
)

Definition at line 62 of file cleanup.cc.

References c, and cleanup::data.

Referenced by DataManager::DataManager().

63 {
64 
65  pedantic_cout("mbdyn_cleanup_register: " << (void *)handler << ":" << (void *)datapp << std::endl);
66 
67  cleanup *p = new cleanup(handler);
68  if (datapp != 0) {
69  *datapp = &p->data;
70  }
71  c.push(p);
72 
73  return 0;
74 }
static std::stack< cleanup * > c
Definition: cleanup.cc:59
void * data
Definition: cleanup.cc:41