Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AutoCloser< T1, T2 > Class Template Reference

Automatically close open files, datasets, etc. More...

Collaboration diagram for AutoCloser< T1, T2 >:

Public Member Functions

 AutoCloser (T1 id, T2(*f)(T1))
 
 ~AutoCloser ()
 
 AutoCloser (int fn, const std::string &eh)
 
 ~AutoCloser ()
 
 AutoCloser (int fn)
 
 ~AutoCloser ()
 

Private Attributes

T1 m_id
 
T2(* m_close )(T1)
 
int m_fn
 
const std::string & errorhandle
 

Detailed Description

template<typename T1, typename T2 = T1>
class AutoCloser< T1, T2 >

Automatically close open files, datasets, etc.

Automatically close a CGNS file.

Parameters
idThe file id.
fThe function used to close the file.

This class closes a CGNS file automatically when it goes out of scope.

Definition at line 179 of file Rocin.C.

Constructor & Destructor Documentation

AutoCloser ( T1  id,
T2(*)(T1)  f 
)
inline

Definition at line 182 of file Rocin.C.

182 : m_id(id), m_close(f) {}
T2(* m_close)(T1)
Definition: Rocin.C:186
T1 m_id
Definition: Rocin.C:185
~AutoCloser ( )
inline

Definition at line 183 of file Rocin.C.

References AutoCloser< T1, T2 >::m_close, and AutoCloser< T1, T2 >::m_id.

183 { m_close(m_id); }
T2(* m_close)(T1)
Definition: Rocin.C:186
T1 m_id
Definition: Rocin.C:185
AutoCloser ( int  fn,
const std::string &  eh 
)
inline

Definition at line 125 of file Rocout_cgns.C.

126  : m_fn(fn), errorhandle(eh) {}
const std::string & errorhandle
Definition: Rocout_cgns.C:131
~AutoCloser ( )
inline

Definition at line 127 of file Rocout_cgns.C.

References CG_CHECK, and AutoCloser< T1, T2 >::m_fn.

127 { CG_CHECK(cg_close, (m_fn)); }
#define CG_CHECK(routine, args)
Perform CGNS error-checking.
Definition: Rocout_cgns.C:68
AutoCloser ( int  fn)
inline

Definition at line 57 of file ghostbuster.C.

58  : m_fn(fn) {}
~AutoCloser ( )
inline

Definition at line 59 of file ghostbuster.C.

59 { cg_close(m_fn); }

Member Data Documentation

const std::string& errorhandle
private

Definition at line 131 of file Rocout_cgns.C.

T2(* m_close)(T1)
private

Definition at line 186 of file Rocin.C.

Referenced by AutoCloser< T1, T2 >::~AutoCloser().

int m_fn
private

Definition at line 130 of file Rocout_cgns.C.

Referenced by AutoCloser< T1, T2 >::~AutoCloser().

T1 m_id
private

Definition at line 185 of file Rocin.C.

Referenced by AutoCloser< T1, T2 >::~AutoCloser().


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