#include <collection.h>
This class is experimental.
Note that the generic interface here only works with pointers, not with the actual objects themselves. This is important, because it avoids the problem of I/O for an object with private copy and assigment operators. For basic types (bool, char, double, int, etc.), some additional add() and get() functions are defined.
Definition at line 1607 of file collection.h.
Public Member Functions | |
io_tlate () | |
Create an I/O class for type object . | |
io_tlate (const char *t) | |
Create an I/O class for type object only if another object of type t is not yet present. | |
template<> | |
int | input (cinput *co, in_file_format *ins, bool *dp) |
template<> | |
int | output (coutput *co, out_file_format *outs, bool *dp) |
template<> | |
const char * | type () |
Return the type of an object. | |
template<> | |
int | input (cinput *co, in_file_format *ins, char *dp) |
template<> | |
int | output (coutput *co, out_file_format *outs, char *dp) |
template<> | |
const char * | type () |
Return the type of an object. | |
template<> | |
int | input (cinput *co, in_file_format *ins, double *dp) |
template<> | |
int | output (coutput *co, out_file_format *outs, double *dp) |
template<> | |
const char * | type () |
Return the type of an object. | |
template<> | |
int | input (cinput *co, in_file_format *ins, int *dp) |
template<> | |
int | output (coutput *co, out_file_format *outs, int *dp) |
template<> | |
const char * | type () |
Return the type of an object. | |
template<> | |
int | input (cinput *co, in_file_format *ins, unsigned long int *dp) |
template<> | |
int | output (coutput *co, out_file_format *outs, unsigned long int *dp) |
template<> | |
const char * | type () |
Return the type of an object. | |
template<> | |
int | input (cinput *co, in_file_format *ins, std::string *dp) |
template<> | |
int | output (coutput *co, out_file_format *outs, std::string *dp) |
template<> | |
const char * | type () |
Return the type of an object. | |
template<> | |
int | input (cinput *co, o2scl::in_file_format *ins, table *ta) |
template<> | |
int | output (coutput *co, o2scl::out_file_format *outs, table *at) |
template<> | |
const char * | type () |
Return the type of an object. | |
template<> | |
int | input (cinput *co, in_file_format *ins, gsl_series *gs) |
template<> | |
int | output (coutput *co, out_file_format *outs, gsl_series *gs) |
template<> | |
const char * | type () |
Return the type of an object. | |
Functions to be overloaded | |
virtual const char * | type () |
The name of the type to be processed. | |
virtual int | input (cinput *cin, in_file_format *ins, object *op) |
Method for reading an object from ins . | |
virtual int | output (coutput *cout, out_file_format *outs, object *op) |
Method for writing an object to outs . | |
Functions to be overloaded for static data | |
These functions should be overloaded in all descendants of io_tlate which control I/O for classes which contain static data. | |
virtual bool | has_static_data () |
true if the object contains static I/O data | |
virtual int | stat_input (cinput *cin, in_file_format *ins, object *op) |
Method for reading static data for an object from ins . | |
virtual int | stat_output (coutput *cout, out_file_format *outs, object *op) |
Method for writing static data for an object to outs . | |
Input functions | |
virtual int | object_in (cinput *cin, in_file_format *ins, object *op, std::string &name) |
Read an object from ins . | |
virtual int | object_in (cinput *cin, in_file_format *ins, object *op, int sz, std::string &name) |
Read an array of objects from ins . | |
virtual int | object_in (cinput *cin, in_file_format *ins, object **op, int sz, int sz2, std::string &name) |
Read a 2-d array of objects from ins . | |
template<size_t N> | |
int | object_in (cinput *co, in_file_format *ins, object op[][N], int sz, std::string &name) |
Create memory for a 2-d array of objects and read it from ins . | |
virtual int | object_in_mem (cinput *cin, in_file_format *ins, object *&op, std::string &name) |
Create memory for an object and read it from ins . | |
virtual int | object_in_mem (cinput *cin, in_file_format *ins, object *&op, int &sz, std::string &name) |
Create memory for an object and read it from ins . | |
virtual int | object_in_mem (cinput *cin, in_file_format *ins, object **&op, int &sz, int &sz2, std::string &name) |
Create memory for an object and read it from ins . | |
template<size_t N> | |
int | object_in_mem (cinput *co, in_file_format *ins, object op[][N], int &sz, std::string &name) |
Create memory for a 2-d array of objects and read it from ins . | |
Output functions | |
virtual int | object_out (coutput *cout, out_file_format *outs, object *op, int sz=0, std::string name="") |
Output an object (or an array of objects) to outs . | |
virtual int | object_out (coutput *cout, out_file_format *outs, object **op, int sz, int sz2, std::string name="") |
Output an object (or an array of objects) to outs . | |
template<size_t N> | |
int | object_out (coutput *cout, out_file_format *outs, object op[][N], int sz, std::string name="") |
Output a 2-d array of objects to outs . | |
Memory allocation | |
virtual int | mem_alloc (object *&op) |
Create memory for an object. | |
virtual int | mem_alloc_arr (object *&op, int sz) |
Create memory for an object. | |
virtual int | mem_alloc_2darr (object **&op, int sz, int sz2) |
Create memory for an object. | |
Add and get objects from a collection | |
int | add (collection &coll, std::string name, object *op, int sz=0, bool overwrt=true, bool owner=false) |
Add an object(s) to a collection. | |
int | add_2darray (collection &coll, std::string name, object **op, int sz, int sz2, bool overwrt=true, bool owner=false) |
Add an object(s) to a collection. | |
Other functions | |
virtual int | mem_free (object *op) |
Free the memory associated with an object. | |
virtual int | mem_free_arr (object *op) |
Free the memory associated with an array of objects. | |
virtual int | mem_free_2darr (object **op, int sz) |
Free the memory associated with a 2-d array of objects. | |
Protected Member Functions | |
virtual int | object_in_void (cinput *cin, in_file_format *ins, void *op, std::string &name) |
Desc. | |
virtual int | object_in_void (cinput *cin, in_file_format *ins, void *op, int sz, std::string &name) |
Desc. | |
virtual int | object_in_void (cinput *cin, in_file_format *ins, void *op, int sz, int sz2, std::string &name) |
Desc. | |
virtual int | object_in_mem_void (cinput *cin, in_file_format *ins, void *&vp, std::string &name) |
Desc. | |
virtual int | object_in_mem_void (cinput *cin, in_file_format *ins, void *&vp, int &sz, std::string &name) |
Desc. | |
virtual int | object_in_mem_void (cinput *cin, in_file_format *ins, void *&vp, int &sz, int &sz2, std::string &name) |
Desc. | |
virtual int | object_out_void (coutput *cout, out_file_format *outs, void *op, int sz=0, int sz2=0, std::string name="") |
Desc. | |
virtual int | stat_in_noobj (cinput *cin, in_file_format *ins) |
Desc. | |
virtual int | stat_out_noobj (coutput *cout, out_file_format *outs) |
Desc. | |
int | in_wrapper (cinput *cin, in_file_format *ins, void *&vp) |
Desc. | |
int | in_wrapper (cinput *cin, in_file_format *ins, void *&vp, int &sz) |
Desc. | |
int | in_wrapper (cinput *cin, in_file_format *ins, void *&vp, int &sz, int &sz2) |
Desc. | |
int | out_wrapper (coutput *cout, out_file_format *outs, void *vp, int sz, int sz2) |
Desc. | |
virtual int | remove (void *vp) |
Remove the memory for an object. | |
virtual int | remove_arr (void *vp) |
Remove the memory for an array of objects. | |
virtual int | remove_2darr (void *vp, int sz) |
Remove the memory for a 2-dimensional array of objects. | |
virtual int | stat_in_wrapper (cinput *cin, in_file_format *ins, void *vp) |
Static input for an object. | |
virtual int | stat_out_wrapper (coutput *cout, out_file_format *outs, void *vp) |
Static output for an object. |
int object_in_mem | ( | cinput * | co, | |
in_file_format * | ins, | |||
object | op[][N], | |||
int & | sz, | |||
std::string & | name | |||
) | [inline] |
Create memory for a 2-d array of objects and read it from ins
.
Note that you must specify in advance the size N
.
Definition at line 2014 of file collection.h.
virtual int stat_input | ( | cinput * | cin, | |
in_file_format * | ins, | |||
object * | op | |||
) | [inline, virtual] |
Method for reading static data for an object from ins
.
One must be careful about objects which set the static data in their constructors. An object is automatically created in order to read its static data. This means that if the static data is set in the constructor, then possibly useful information will be overwritten through the creation of this temporary object.
If one needs to set static data in the constructor of a singleton object, then the create() and remove() functions should be empty and a separate pointer to the singleton should be provided instead of void *vp.
This is only used if has_static_data() returns true;
Definition at line 1680 of file collection.h.
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page