Go to the documentation of this file.
23 #ifndef GINAC_ARCHIVE_H
24 #define GINAC_ARCHIVE_H
108 bool find_bool(
const std::string &name,
bool &ret,
unsigned index = 0)
const;
112 bool find_unsigned(
const std::string &name,
unsigned &ret,
unsigned index = 0)
const;
116 bool find_string(
const std::string &name, std::string &ret,
unsigned index = 0)
const;
126 archive_node_cit_range
find_property_range(
const std::string &name1,
const std::string &name2)
const;
130 bool find_ex(
const std::string &name,
ex &ret,
lst &sym_lst,
unsigned index = 0)
const;
150 void printraw(std::ostream &os)
const;
166 typedef basic* (*synthesize_func)();
219 #define GINAC_DECLARE_UNARCHIVER(classname) \
220 class classname ## _unarchiver \
222 static int usecount; \
224 static GiNaC::basic* create(); \
225 classname ## _unarchiver(); \
226 ~ classname ## _unarchiver(); \
228 static classname ## _unarchiver classname ## _unarchiver_instance
230 #define GINAC_BIND_UNARCHIVER(classname) \
231 classname ## _unarchiver::classname ## _unarchiver() \
233 static GiNaC::unarchive_table_t table; \
234 if (usecount++ == 0) { \
235 table.insert(std::string(#classname), \
236 &(classname ## _unarchiver::create)); \
239 GiNaC::basic* classname ## _unarchiver::create() \
241 return new classname(); \
243 classname ## _unarchiver::~ classname ## _unarchiver() { } \
244 int classname ## _unarchiver::usecount = 0
290 ex unarchive_ex(
const lst &sym_lst, std::string &name,
unsigned index = 0)
const;
305 void printraw(std::ostream &os)
const;
329 mutable std::vector<std::string>
atoms;
333 typedef std::map<std::string, archive_atom>::const_iterator
inv_at_cit;
337 mutable std::map<ex, archive_node_id, ex_is_less>
exprtable;
346 #endif // ndef GINAC_ARCHIVE_H
bool find_bool(const std::string &name, bool &ret, unsigned index=0) const
Retrieve property of type "bool" from node.
property_type type
Data type of property.
archive_node(archive &ar)
void archive_ex(const ex &e, const char *name)
Archive an expression.
property_type type
Data type of property.
bool find_unsigned(const std::string &name, unsigned &ret, unsigned index=0) const
Retrieve property of type "unsigned" from node.
archive_node_cit_range find_property_range(const std::string &name1, const std::string &name2) const
Find a range of locations in the vector of properties.
archive_node_cit find_first(const std::string &name) const
Find the location in the vector of properties of the first/last property with a given name.
bool has_same_ex_as(const archive_node &other) const
Check if the archive_node stores the same expression as another archive_node.
void add_string(const std::string &name, const std::string &value)
Add property of type "string" to node.
void clear()
Clear all archived expressions.
const archive_node & get_top_node(unsigned index=0) const
Return reference to top node of an expression specified by index.
void forget()
Delete cached unarchived expressions from node (for debugging).
archive(const ex &e)
Construct archive from expression using the default name "ex".
Archived property (data type, name and associated data)
std::vector< std::string > atoms
Vector of atomized strings (using a vector allows faster unarchiving).
void add_ex(const std::string &name, const ex &value)
Add property of type "ex" to node.
synthesize_func find(const std::string &classname) const
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
ex unarchive(lst &sym_lst) const
Convert archive node to GiNaC expression.
bool find_ex(const std::string &name, ex &ret, lst &sym_lst, unsigned index=0) const
Retrieve property of type "ex" from node.
basic *(* synthesize_func)()
static unarchive_table_t unarch_table_instance
unsigned num_expressions() const
Return number of archived expressions.
std::ostream & operator<<(std::ostream &os, const archive_node &n)
Write archive_node to binary data stream.
const archive_node & find_ex_node(const std::string &name, unsigned index=0) const
Retrieve property of type "ex" from node, returning the node of the sub-expression.
archive & a
Reference to the archive to which this node belongs.
ex e
The cached unarchived representation of this node (if any).
archive_atom name
Name of property.
ex unarchive_ex(const lst &sym_lst, const char *name) const
Retrieve expression from archive by name.
void printraw(std::ostream &os) const
Output archive_node to stream in ugly raw format (for debugging).
Lightweight wrapper for GiNaC's symbolic objects.
std::vector< property_info > propinfovector
void add_unsigned(const std::string &name, unsigned value)
Add property of type "unsigned int" to node.
archive_atom atomize(const std::string &s) const
Atomize a string (i.e.
archive(const ex &e, const char *n)
Construct archive from expression using the specified name.
archive_node_cit find_last(const std::string &name) const
void printraw(std::ostream &os) const
Print archive to stream in ugly raw format (for debugging).
const std::string & unatomize(archive_atom id) const
Unatomize a string (i.e.
std::vector< property > props
Vector of stored properties.
unsigned count
Number of occurrences.
Interface to GiNaC's light-weight expression handles.
archived_ex(archive_atom n, archive_node_id node)
bool has_expression
Flag indicating whether a cached unarchived representation of this node exists.
void get_properties(propinfovector &v) const
Return vector of properties stored in node.
std::vector< archived_ex > exprs
Vector of archived expression descriptors.
std::vector< property >::const_iterator archive_node_cit
archive_atom name
Name of expression.
property(archive_atom n, property_type t, unsigned v)
std::map< std::string, archive_atom > inverse_atoms
unsigned archive_atom
Numerical ID value to refer to a string.
friend std::istream & operator>>(std::istream &is, archive &ar)
Read archive from binary data stream.
std::map< std::string, synthesize_func > unarchive_map_t
const archive_node & operator=(const archive_node &other)
Assignment operator of archive_node.
friend std::ostream & operator<<(std::ostream &os, const archive &ar)
Write archive to binary data stream.
Wrapper template for making GiNaC classes out of STL containers.
std::istream & operator>>(std::istream &is, archive_node &n)
Read archive_node from binary data stream.
void insert(const std::string &classname, synthesize_func f)
property_info(property_type t, const std::string &n, unsigned c=1)
This class holds archived versions of GiNaC expressions (class ex).
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
archive_node_id add_node(const archive_node &n)
Add archive_node to archive if the corresponding expression is not already archived.
friend std::ostream & operator<<(std::ostream &os, const archive_node &ar)
Write archive_node to binary data stream.
property_type
Property data types.
std::vector< archive_node > nodes
Vector of archived nodes.
static unarchive_map_t * unarch_map
std::string name
Name of property.
bool find_string(const std::string &name, std::string &ret, unsigned index=0) const
Retrieve property of type "string" from node.
Archived expression descriptor.
archive_node_id root
ID of root node.
void find_ex_by_loc(archive_node_cit loc, ex &ret, lst &sym_lst) const
Retrieve property of type "ex" from the node if it is known that this node in fact contains such a pr...
void add_bool(const std::string &name, bool value)
Add property of type "bool" to node.
Information about a stored property.
unsigned archive_node_id
Numerical ID value to refer to an archive_node.
archive_node & get_node(archive_node_id id)
Retrieve archive_node by ID.
unsigned value
Stored value.
void forget()
Delete cached unarchived expressions in all archive_nodes (mainly for debugging).
std::map< std::string, archive_atom >::const_iterator inv_at_cit
The map of from strings to indices of the atoms vectors allows for faster archiving.
std::map< ex, archive_node_id, ex_is_less > exprtable
Map of stored expressions to nodes for faster archiving.
friend std::istream & operator>>(std::istream &is, archive_node &ar)
Read archive_node from binary data stream.
This page is part of the GiNaC
developer's reference. It was generated automatically by doxygen. For
an introduction, see the tutorial.