1 #include <symengine/printers.h>
2 #include <symengine/subs.h>
3 #if HAVE_SYMENGINE_RTTI
4 #include <symengine/serialize-cereal.h>
13 #define STRINGIFY0(x) #x
14 #define STRINGIFY(x) STRINGIFY0(x)
18 #define SYMENGINE_INCLUDE_ALL
19 #define SYMENGINE_ENUM(type, Class) STRINGIFY(Class),
20 #include "symengine/type_codes.inc"
23 #undef SYMENGINE_INCLUDE_ALL
30 return type_names[id];
35 auto a = this->get_type_code();
36 auto b = o.get_type_code();
44 return a < b ? -1 : 1;
55 #if HAVE_SYMENGINE_RTTI
57 unsigned short major = SYMENGINE_MAJOR_VERSION;
58 unsigned short minor = SYMENGINE_MINOR_VERSION;
63 throw NotImplementedError(
"Serialization not implemented in no-rtti mode");
69 #if HAVE_SYMENGINE_RTTI
70 unsigned short major, minor;
74 iarchive(major, minor);
75 if (major != SYMENGINE_MAJOR_VERSION or minor != SYMENGINE_MINOR_VERSION) {
76 throw SerializationError(StreamFmt()
77 <<
"SymEngine-" << SYMENGINE_MAJOR_VERSION
78 <<
"." << SYMENGINE_MINOR_VERSION
79 <<
" was asked to deserialize an object "
80 <<
"created using SymEngine-" << major <<
"."
86 throw NotImplementedError(
"Serialization not implemented in no-rtti mode");
95 RCP<const Basic> Basic::xreplace(
const map_basic_basic &xreplace_dict)
const
100 const char *get_version()
102 return SYMENGINE_VERSION;
107 return is_a_Number(b) or is_a<Symbol>(b) or is_a<Constant>(b);
The lowest unit of symbolic representation.
RCP< const Basic > subs(const map_basic_basic &subs_dict) const
Substitutes 'subs_dict' into 'self'.
std::string dumps() const
Returns a string of the instance serialized.
std::string __str__() const
static RCP< const Basic > loads(const std::string &)
Creates an instance of a serialized string.
int __cmp__(const Basic &o) const
Comparison operator.
virtual int compare(const Basic &o) const =0
RCP< Basic > rcp_from_this()
Get RCP<T> pointer to self (it will cast the pointer to T)
Main namespace for SymEngine package.
bool is_a_Number(const Basic &b)
bool is_a_Atom(const Basic &b)
Returns true if b is an atom. i.e. b.get_args returns an empty vector.
RCP< const Basic > xreplace(const RCP< const Basic > &x, const map_basic_basic &subs_dict, bool cache=true)
Mappings in the subs_dict are applied to the expression tree of x