31#ifndef BERTINI_FUNCTION_TREE_SPECIAL_NUMBER_HPP
32#define BERTINI_FUNCTION_TREE_SPECIAL_NUMBER_HPP
59 virtual ~Pi() = default;
62 template<typename... Ts>
64 std::shared_ptr<Pi>
Make(Ts&& ...ts){
65 return std::static_pointer_cast<Pi>(
Intern(std::shared_ptr<Node>(
new Pi(ts...) )));
68 void print(std::ostream & target)
const override
78 return typeid(Pi).hash_code();
82 return dynamic_cast<Pi const*
>(&other) !=
nullptr;
100 template <
typename Archive>
101 void serialize(Archive& ar,
const unsigned ) {
102 ar & boost::serialization::base_object<Number>(*
this);
103 ar & boost::serialization::base_object<NameHolder>(*
this);
121 virtual ~E() = default;
125 template<typename... Ts>
127 std::shared_ptr<E>
Make(Ts&& ...ts){
128 return std::static_pointer_cast<E>(
Intern(std::shared_ptr<Node>(
new E(ts...) )));
131 void print(std::ostream & target)
const override
139 return typeid(E).hash_code();
143 return dynamic_cast<E const*
>(&other) !=
nullptr;
162 template <
typename Archive>
163 void serialize(Archive& ar,
const unsigned ) {
164 ar & boost::serialization::base_object<Number>(*
this);
165 ar & boost::serialization::base_object<NameHolder>(*
this);
176 std::shared_ptr<Node>
Pi();
181 std::shared_ptr<Node>
E();
186 std::shared_ptr<Node>
I();
191 std::shared_ptr<Node>
Two();
196 std::shared_ptr<Node>
One();
Capability class for things which have a name.
Definition symbol.hpp:78
const std::string & name() const
Definition symbol.hpp:81
Abstract Number type from which other Numbers derive.
Definition number.hpp:50
std::size_t HashImpl() const override
Compute this node's structural hash.
Definition special_number.hpp:137
bool IsSame(Node const &other) const override
Order-sensitive structural equality, shallow given interned children.
Definition special_number.hpp:141
void print(std::ostream &target) const override
Virtual method for printing Nodes to arbitrary output streams.
Definition special_number.hpp:131
friend class boost::serialization::access
Definition special_number.hpp:160
static std::shared_ptr< E > Make(Ts &&...ts)
Construct (and intern) a E node.
Definition special_number.hpp:127
void print(std::ostream &target) const override
Virtual method for printing Nodes to arbitrary output streams.
Definition special_number.hpp:68
static std::shared_ptr< Pi > Make(Ts &&...ts)
Construct (and intern) a Pi node.
Definition special_number.hpp:64
std::size_t HashImpl() const override
Compute this node's structural hash.
Definition special_number.hpp:76
friend class boost::serialization::access
Definition special_number.hpp:98
bool IsSame(Node const &other) const override
Order-sensitive structural equality, shallow given interned children.
Definition special_number.hpp:80
Definition forward_declares.hpp:74
Definition canonical.hpp:56
std::shared_ptr< Node > E()
Construct a shared pointer to .
std::shared_ptr< Node > Intern(std::shared_ptr< Node > const &candidate)
Hash-cons a freshly-built node: return an existing structurally-equal node if one is live,...
std::shared_ptr< Node > Two()
Construct a shared pointer to .
std::shared_ptr< Node > Pi()
Construct a shared pointer to .
std::shared_ptr< Node > One()
Construct a shared pointer to .
std::shared_ptr< Node > exp(const std::shared_ptr< Node > &N)
Build an exponential (e raised to the node) expression-tree node.
Definition arithmetic.hpp:1027
std::shared_ptr< Node > I()
Construct a shared pointer to .
std::shared_ptr< Node > acos(const std::shared_ptr< Node > &N)
Build a arccosine expression-tree node.
Definition trig.hpp:467
std::shared_ptr< Node > Zero()
Construct a shared pointer to .
Definition algorithm_builder.hpp:36
Provides the Number Node types, including Rational, Complex, and Integer.
#define BERTINI_DEFAULT_VISITABLE()
macro for classes which want default Accept implementation, having nothing fancy to do when accepting...
Definition visitable.hpp:121