GiNaC 1.8.7
|
This class stores all properties needed to record/retrieve the state of one object of class basic (or a derived class). More...
#include <archive.h>
Classes | |
struct | archive_node_cit_range |
struct | property |
Archived property (data type, name and associated data) More... | |
struct | property_info |
Information about a stored property. More... | |
Public Types | |
enum | property_type { PTYPE_BOOL , PTYPE_UNSIGNED , PTYPE_STRING , PTYPE_NODE } |
Property data types. More... | |
typedef std::vector< property_info > | propinfovector |
typedef std::vector< property >::const_iterator | archive_node_cit |
Public Member Functions | |
archive_node (archive &ar) | |
archive_node (archive &ar, const ex &expr) | |
Recursively construct archive node from expression. More... | |
const archive_node & | operator= (const archive_node &other) |
Assignment operator of archive_node. More... | |
void | add_bool (const std::string &name, bool value) |
Add property of type "bool" to node. More... | |
void | add_unsigned (const std::string &name, unsigned value) |
Add property of type "unsigned int" to node. More... | |
void | add_string (const std::string &name, const std::string &value) |
Add property of type "string" to node. More... | |
void | add_ex (const std::string &name, const ex &value) |
Add property of type "ex" to node. More... | |
bool | find_bool (const std::string &name, bool &ret, unsigned index=0) const |
Retrieve property of type "bool" from node. More... | |
bool | find_unsigned (const std::string &name, unsigned &ret, unsigned index=0) const |
Retrieve property of type "unsigned" from node. More... | |
bool | find_string (const std::string &name, std::string &ret, unsigned index=0) const |
Retrieve property of type "string" from node. More... | |
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. More... | |
archive_node_cit | find_last (const std::string &name) const |
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. More... | |
bool | find_ex (const std::string &name, ex &ret, lst &sym_lst, unsigned index=0) const |
Retrieve property of type "ex" from node. More... | |
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 property at the given location. More... | |
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. More... | |
void | get_properties (propinfovector &v) const |
Return vector of properties stored in node. More... | |
ex | unarchive (lst &sym_lst) const |
Convert archive node to GiNaC expression. More... | |
bool | has_same_ex_as (const archive_node &other) const |
Check if the archive_node stores the same expression as another archive_node. More... | |
bool | has_ex () const |
ex | get_ex () const |
void | forget () |
Delete cached unarchived expressions from node (for debugging). More... | |
void | printraw (std::ostream &os) const |
Output archive_node to stream in ugly raw format (for debugging). More... | |
Private Attributes | |
archive & | a |
Reference to the archive to which this node belongs. More... | |
std::vector< property > | props |
Vector of stored properties. More... | |
bool | has_expression |
Flag indicating whether a cached unarchived representation of this node exists. More... | |
ex | e |
The cached unarchived representation of this node (if any). More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const archive_node &ar) |
Write archive_node to binary data stream. More... | |
std::istream & | operator>> (std::istream &is, archive_node &ar) |
Read archive_node from binary data stream. More... | |
This class stores all properties needed to record/retrieve the state of one object of class basic (or a derived class).
Each property is addressed by its name and data type.
typedef std::vector<property_info> GiNaC::archive_node::propinfovector |
typedef std::vector<property>::const_iterator GiNaC::archive_node::archive_node_cit |
|
inline |
Recursively construct archive node from expression.
Definition at line 339 of file archive.cpp.
References GiNaC::ex::bp.
const archive_node & GiNaC::archive_node::operator= | ( | const archive_node & | other | ) |
Assignment operator of archive_node.
Definition at line 326 of file archive.cpp.
References e, has_expression, and props.
void GiNaC::archive_node::add_bool | ( | const std::string & | name, |
bool | value | ||
) |
Add property of type "bool" to node.
Definition at line 395 of file archive.cpp.
References a, GiNaC::archive::atomize(), props, PTYPE_BOOL, and value.
void GiNaC::archive_node::add_unsigned | ( | const std::string & | name, |
unsigned | value | ||
) |
Add property of type "unsigned int" to node.
Definition at line 400 of file archive.cpp.
References a, GiNaC::archive::atomize(), props, PTYPE_UNSIGNED, and value.
void GiNaC::archive_node::add_string | ( | const std::string & | name, |
const std::string & | value | ||
) |
Add property of type "string" to node.
Definition at line 405 of file archive.cpp.
References a, GiNaC::archive::atomize(), props, PTYPE_STRING, and value.
void GiNaC::archive_node::add_ex | ( | const std::string & | name, |
const ex & | value | ||
) |
Add property of type "ex" to node.
Definition at line 410 of file archive.cpp.
References a, GiNaC::archive::add_node(), archive_node(), GiNaC::archive::atomize(), props, PTYPE_NODE, and value.
Referenced by GiNaC::container< C >::archive().
bool GiNaC::archive_node::find_bool | ( | const std::string & | name, |
bool & | ret, | ||
unsigned | index = 0 |
||
) | const |
Retrieve property of type "bool" from node.
Definition at line 418 of file archive.cpp.
References a, GiNaC::archive::atomize(), props, and PTYPE_BOOL.
bool GiNaC::archive_node::find_unsigned | ( | const std::string & | name, |
unsigned & | ret, | ||
unsigned | index = 0 |
||
) | const |
Retrieve property of type "unsigned" from node.
Definition at line 436 of file archive.cpp.
References a, GiNaC::archive::atomize(), props, and PTYPE_UNSIGNED.
bool GiNaC::archive_node::find_string | ( | const std::string & | name, |
std::string & | ret, | ||
unsigned | index = 0 |
||
) | const |
Retrieve property of type "string" from node.
Definition at line 454 of file archive.cpp.
References a, GiNaC::archive::atomize(), props, PTYPE_STRING, and GiNaC::archive::unatomize().
Referenced by unarchive().
archive_node::archive_node_cit GiNaC::archive_node::find_first | ( | const std::string & | name | ) | const |
Find the location in the vector of properties of the first/last property with a given name.
Definition at line 357 of file archive.cpp.
References a, GiNaC::archive::atomize(), and props.
archive_node::archive_node_cit GiNaC::archive_node::find_last | ( | const std::string & | name | ) | const |
Definition at line 367 of file archive.cpp.
References a, GiNaC::archive::atomize(), and props.
archive_node::archive_node_cit_range GiNaC::archive_node::find_property_range | ( | const std::string & | name1, |
const std::string & | name2 | ||
) | const |
Find a range of locations in the vector of properties.
The result begins at the first property with name1 and ends one past the last property with name2.
Definition at line 379 of file archive.cpp.
References a, GiNaC::archive::atomize(), GiNaC::archive_node::archive_node_cit_range::begin, GiNaC::archive_node::archive_node_cit_range::end, and props.
bool GiNaC::archive_node::find_ex | ( | const std::string & | name, |
ex & | ret, | ||
lst & | sym_lst, | ||
unsigned | index = 0 |
||
) | const |
Retrieve property of type "ex" from node.
Definition at line 477 of file archive.cpp.
References a, GiNaC::archive::atomize(), GiNaC::archive::get_node(), props, PTYPE_NODE, and unarchive().
void GiNaC::archive_node::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 property at the given location.
This is much more efficient than the preceding function.
Definition at line 472 of file archive.cpp.
References a, GiNaC::archive::get_node(), and unarchive().
const archive_node & GiNaC::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.
Definition at line 495 of file archive.cpp.
References a, GiNaC::archive::atomize(), GiNaC::archive::get_node(), props, and PTYPE_NODE.
void GiNaC::archive_node::get_properties | ( | propinfovector & | v | ) | const |
Return vector of properties stored in node.
Definition at line 512 of file archive.cpp.
References a, props, and GiNaC::archive::unatomize().
Convert archive node to GiNaC expression.
Definition at line 544 of file archive.cpp.
References GiNaC::status_flags::dynallocated, e, GiNaC::find_factory_fcn(), find_string(), and has_expression.
Referenced by find_ex(), and find_ex_by_loc().
bool GiNaC::archive_node::has_same_ex_as | ( | const archive_node & | other | ) | const |
Check if the archive_node stores the same expression as another archive_node.
Definition at line 349 of file archive.cpp.
References GiNaC::ex::bp, e, and has_expression.
|
inline |
Definition at line 146 of file archive.h.
References has_expression.
|
inline |
void GiNaC::archive_node::forget | ( | ) |
Delete cached unarchived expressions from node (for debugging).
Definition at line 616 of file archive.cpp.
References e, and has_expression.
Referenced by GiNaC::archive::forget().
void GiNaC::archive_node::printraw | ( | std::ostream & | os | ) | const |
Output archive_node to stream in ugly raw format (for debugging).
Definition at line 664 of file archive.cpp.
References a, GiNaC::ex::bp, e, has_expression, props, PTYPE_BOOL, PTYPE_NODE, PTYPE_STRING, PTYPE_UNSIGNED, and GiNaC::archive::unatomize().
|
friend |
Write archive_node to binary data stream.
Definition at line 200 of file archive.cpp.
|
friend |
Read archive_node from binary data stream.
Definition at line 245 of file archive.cpp.
|
private |
Reference to the archive to which this node belongs.
Definition at line 154 of file archive.h.
Referenced by add_bool(), add_ex(), add_string(), add_unsigned(), find_bool(), find_ex(), find_ex_by_loc(), find_ex_node(), find_first(), find_last(), find_property_range(), find_string(), find_unsigned(), get_properties(), and printraw().
|
private |
Vector of stored properties.
Definition at line 157 of file archive.h.
Referenced by add_bool(), add_ex(), add_string(), add_unsigned(), find_bool(), find_ex(), find_ex_node(), find_first(), find_last(), find_property_range(), find_string(), find_unsigned(), get_properties(), operator=(), and printraw().
|
mutableprivate |
Flag indicating whether a cached unarchived representation of this node exists.
Definition at line 160 of file archive.h.
Referenced by forget(), has_ex(), has_same_ex_as(), operator=(), printraw(), and unarchive().
|
mutableprivate |
The cached unarchived representation of this node (if any).
Definition at line 163 of file archive.h.
Referenced by forget(), get_ex(), has_same_ex_as(), operator=(), printraw(), and unarchive().