symbol.h
Go to the documentation of this file.
1 
6 #ifndef SYMENGINE_SYMBOL_H
7 #define SYMENGINE_SYMBOL_H
8 
9 #include <symengine/basic.h>
10 
11 namespace SymEngine
12 {
13 
14 class Symbol : public Basic
15 {
16 private:
19 
20 public:
21  IMPLEMENT_TYPEID(SYMENGINE_SYMBOL)
23  explicit Symbol(const std::string &name);
25  hash_t __hash__() const override;
30  bool __eq__(const Basic &o) const override;
31 
36  int compare(const Basic &o) const override;
38  inline const std::string &get_name() const
39  {
40  return name_;
41  }
42 
43  vec_basic get_args() const override
44  {
45  return {};
46  }
47  RCP<const Symbol> as_dummy() const;
48 };
49 
50 class Dummy : public Symbol
51 {
52 private:
54  static size_t count_;
56  size_t dummy_index;
57 
58 public:
59  IMPLEMENT_TYPEID(SYMENGINE_DUMMY)
61  explicit Dummy();
62  explicit Dummy(const std::string &name);
64  hash_t __hash__() const override;
69  bool __eq__(const Basic &o) const override;
74  int compare(const Basic &o) const override;
75  size_t get_index() const
76  {
77  return dummy_index;
78  }
79 };
80 
82 inline RCP<const Symbol> symbol(const std::string &name)
83 {
84  return make_rcp<const Symbol>(name);
85 }
86 
88 inline RCP<const Dummy> dummy()
89 {
90  return make_rcp<const Dummy>();
91 }
92 
93 inline RCP<const Dummy> dummy(const std::string &name)
94 {
95  return make_rcp<const Dummy>(name);
96 }
97 
98 } // namespace SymEngine
99 
100 #endif
The base class for SymEngine.
#define IMPLEMENT_TYPEID(SYMENGINE_ID)
Inline members and functions.
Definition: basic.h:340
The lowest unit of symbolic representation.
Definition: basic.h:97
Dummy()
Dummy Constructors.
Definition: symbol.cpp:40
int compare(const Basic &o) const override
Definition: symbol.cpp:70
hash_t __hash__() const override
Definition: symbol.cpp:54
size_t dummy_index
Dummy index.
Definition: symbol.h:56
static size_t count_
Dummy count.
Definition: symbol.h:54
bool __eq__(const Basic &o) const override
Definition: symbol.cpp:62
const std::string & get_name() const
Definition: symbol.h:38
Symbol(const std::string &name)
Symbol Constructor.
Definition: symbol.cpp:7
bool __eq__(const Basic &o) const override
Definition: symbol.cpp:17
std::string name_
name of Symbol
Definition: symbol.h:18
int compare(const Basic &o) const override
Definition: symbol.cpp:24
hash_t __hash__() const override
Definition: symbol.cpp:10
vec_basic get_args() const override
Returns the list of arguments.
Definition: symbol.h:43
Main namespace for SymEngine package.
Definition: add.cpp:19
RCP< const Dummy > dummy()
inline version to return Dummy
Definition: symbol.h:88
RCP< const Symbol > symbol(const std::string &name)
inline version to return Symbol
Definition: symbol.h:82