42 #ifndef CORE_PERSISTENT_H
43 #define CORE_PERSISTENT_H 1
45 #include <boost/utility/enable_if.hpp>
46 #include <boost/type_traits/is_base_of.hpp>
50 #include <boost/shared_ptr.hpp>
68 const std::string& parent,
127 virtual void emit_pointer(
int& have_data,
int& pointer_id);
130 const std::string& filename,
char* hdr,
131 const char* type,
int& version,
int& endian);
133 virtual void reset_post_header() = 0;
139 virtual std::string peek_class();
140 virtual int begin_class(
const std::string&
name,
int current_version);
141 virtual void end_class();
142 virtual void begin_cheap_delim();
143 virtual void end_cheap_delim();
145 virtual void io(
bool&);
146 virtual void io(
char&) = 0;
147 virtual void io(
signed char&) = 0;
148 virtual void io(
unsigned char&) = 0;
149 virtual void io(
short&) = 0;
150 virtual void io(
unsigned short&) = 0;
151 virtual void io(
int&) = 0;
152 virtual void io(
unsigned int&) = 0;
153 virtual void io(
long&) = 0;
154 virtual void io(
unsigned long&) = 0;
155 virtual void io(
long long&) = 0;
156 virtual void io(
unsigned long long&) = 0;
157 virtual void io(
double&) = 0;
158 virtual void io(
float&) = 0;
159 virtual void io(std::string& str) = 0;
160 virtual bool eof() {
return false; }
174 virtual bool block_io(
void*,
size_t,
size_t) {
return false; }
181 const std::string& type,
200 static bool is_base_of(
const std::string& parent,
const std::string& type);
202 static void add_class(
const std::string& type,
203 const std::string& parent,
208 static void add_mesh_class(
const std::string& type,
213 static void add_field_class(
const std::string& type,
221 typedef std::map<std::string, PersistentTypeIDPtr> MapStringPersistentID;
222 static MapStringPersistentID* persistent_table_;
225 static void initialize();
250 void Pio(
Piostream& stream, boost::shared_ptr<T>&
data,
typename boost::enable_if<
typename boost::is_base_of<Persistent, T>::type>* = 0)
254 stream.
io(trep, T::type_id);
257 data.reset(static_cast<T*>(trep));
265 if (!stream.
block_io(data,
sizeof(T), sz))
272 template <
typename Size>
275 long long temp =
static_cast<long long>(
size);
280 template <
typename Index>
283 long long temp =
static_cast<long long>(index);
void disable_pointer_hashing()
Definition: Persistent.h:176
PiostreamPtr auto_ostream(const std::string &filename, const std::string &type, LoggerHandle pr)
Definition: Persistent.cc:478
void set_backwards_compat_id(bool p)
Definition: Persistent.h:170
virtual bool block_io(void *, size_t, size_t)
Definition: Persistent.h:174
bool reading() const
Definition: Persistent.h:164
boost::shared_ptr< LegacyLoggerInterface > LoggerHandle
Definition: LoggerFwd.h:42
bool backwards_compat_id() const
Definition: Persistent.h:169
virtual bool supports_block_io()
Definition: Persistent.h:171
Core::Logging::LoggerHandle reporter_
Definition: Persistent.h:124
virtual void io(bool &)
Definition: Persistent.cc:193
Definition: Persistent.h:89
int current_pointer_id
Definition: Persistent.h:119
std::map< Persistent *, int > MapPersistentInt
Definition: Persistent.h:92
Definition: Persistent.h:187
std::map< int, Persistent * > MapIntPersistent
Definition: Persistent.h:93
Direction
Definition: Persistent.h:95
#define SCISHARE
Definition: share.h:39
bool writing() const
Definition: Persistent.h:165
Utility for specifying data invariants (Assertions)
virtual void begin_cheap_delim()
Definition: Persistent.cc:183
Persistent *(* PersistentMaker0)()
Definition: Persistent.h:62
bool err
Definition: Persistent.h:113
string dir
Definition: eab.py:5
bool error() const
Definition: Persistent.h:166
virtual void io(Piostream &)
Definition: Persistent.cc:205
Direction dir
Definition: Persistent.h:111
PiostreamPtr auto_istream(const std::string &filename, LoggerHandle pr)
Definition: Persistent.cc:394
PersistentMaker0 maker
Definition: Persistent.h:74
boost::shared_ptr< Piostream > PiostreamPtr
Definition: Persistent.h:80
const char * name[]
Definition: BoostGraphExampleTests.cc:87
Definition: Persistent.h:101
std::string peekname_
Definition: Persistent.h:122
void Pio_index(Piostream &stream, index_type *data, size_type size)
Definition: Persistent.cc:606
long long size_type
Definition: Types.h:40
dictionary data
Definition: eabLatVolData.py:11
std::string type
Definition: Persistent.h:72
int version() const
Definition: Persistent.h:168
virtual void end_cheap_delim()
Definition: Persistent.cc:188
bool backwards_compat_id_
Definition: Persistent.h:125
virtual bool eof()
Definition: Persistent.h:160
std::string parent
Definition: Persistent.h:73
MapIntPersistent * inpointers
Definition: Persistent.h:117
bool have_peekname_
Definition: Persistent.h:121
bool disable_pointer_hashing_
Definition: Persistent.h:126
void Pio(Piostream &stream, Array1< T > &array)
Definition: Array1.h:65
long long index_type
Definition: Types.h:39
void flag_error()
Definition: Persistent.h:106
Definition: Persistent.h:96
boost::shared_ptr< PersistentTypeID > PersistentTypeIDPtr
Definition: Persistent.h:79
Definition: Persistent.h:64
std::string file_name
Definition: Persistent.h:135
static const int PERSISTENT_VERSION
Definition: Persistent.h:105
int version_
Definition: Persistent.h:112
Endian
Definition: Persistent.h:100
void Pio_size(Piostream &stream, Size &size)
Definition: Persistent.h:273
int file_endian
Definition: Persistent.h:114
std::string basename(const std::string &path)
Remove directory name.
Definition: StringUtil.h:128
MapPersistentInt * outpointers
Definition: Persistent.h:116
int size
Definition: eabLatVolData.py:2