io_base Class Reference

I/O base class. More...

#include <collection.h>

Inheritance diagram for io_base:

collection io_tlate io_tlate< table3d > io_type_info io_vtlate bool_io_type char_io_type double_io_type int_io_type long_io_type string_io_type word_io_type

Detailed Description

This class is experimental.

This class is necessary so that the collection method source code and the io_base method source code doesn't have to go in header files.

Todo:
Should the remove() functions be moved to class collection?

Definition at line 127 of file collection.h.


Public Member Functions

 io_base (int sw=0)
 Create a new I/O object.
 io_base (const char *t)
 Create a new object only if an I/O object for type t is not yet present.
Functions to be overloaded in descendants of io_base
virtual const char * type ()
 Return the type of an object.
virtual bool has_static_data ()
 If true, then the object contains static data.
Functions useful for in in() and out()
virtual int pointer_in (cinput *co, in_file_format *ins, void **pp, std::string &stype)
 Input a pointer.
virtual int pointer_out (coutput *co, out_file_format *outs, void *ptr, std::string stype)
 Output an object to outs of type stype.

Protected Member Functions

virtual int stat_in_noobj (cinput *co, in_file_format *ins)
 Automatically create an object for stat_in.
virtual int stat_out_noobj (coutput *co, out_file_format *outs)
 Automatically create an object for stat_out.
virtual int in_wrapper (cinput *co, in_file_format *ins, void *&vp)
 Allocate memory and input an object.
virtual int in_wrapper (cinput *co, in_file_format *ins, void *&vp, int &sz)
 Allocate memory and input an array of objects.
virtual int in_wrapper (cinput *co, in_file_format *ins, void *&vp, int &sz, int &sz2)
 Allocate memory and input a 2-d array of objects.
virtual int out_wrapper (coutput *co, out_file_format *outs, void *vp, int sz, int sz2)
 Internal function to output an object (or an array or 2-d array).
virtual int object_in_void (cinput *cin, in_file_format *ins, void *op, std::string &name)
 Input an object (no memory allocation).
virtual int object_in_void (cinput *cin, in_file_format *ins, void *op, int sz, std::string &name)
 Input an array of objects (no memory allocation).
virtual int object_in_void (cinput *cin, in_file_format *ins, void *op, int sz, int sz2, std::string &name)
 Input a 2-d array of objects (no memory allocation).
virtual int object_in_mem_void (cinput *cin, in_file_format *ins, void *&op, std::string &name)
 Input an object (no memory allocation).
virtual int object_in_mem_void (cinput *cin, in_file_format *ins, void *&op, int &sz, std::string &name)
 Input an array of objects (no memory allocation).
virtual int object_in_mem_void (cinput *cin, in_file_format *ins, void *&op, int &sz, int &sz2, std::string &name)
 Input a 2-d array of objects (no memory allocation).
virtual int object_out_void (coutput *cout, out_file_format *outs, void *op, int sz, int sz2, std::string name="")
 Output an object, an array of objects, or a 2-d array of objects.
Functions to remove the memory that was allocated for an object
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.

Protected Attributes

int sw_store
 Store the value of sw given in the constructor so that we know if we need to remove the type in the destructor.

Static Protected Attributes

static class io_manageriom
 A pointer to the type manager.
static int objs_count
 A count of the number of objects.

Constructor & Destructor Documentation

io_base ( int  sw = 0  ) 

If sw is different from zero, then the type will not be added to the io_manager. This is useful if you want an object to be its own I/O class, in which case you may want to make sure that the io_manager only tries to add the type once. There is no need to have an I/O object for every instance of a particular type.


Member Function Documentation

virtual int pointer_out ( coutput co,
out_file_format outs,
void *  ptr,
std::string  stype 
) [virtual]

This is useful for to output a pointer to an object in the out() or stat_out() functions for a class. The data for the object which is pointed to is separate from the object and is only referred to once if more than one objects point to it.


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

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page