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  virtual hash_t __hash__() const;
30  virtual bool __eq__(const Basic &o) const;
31 
36  virtual int compare(const Basic &o) const;
38  inline const std::string &get_name() const
39  {
40  return name_;
41  }
42 
43  virtual vec_basic get_args() const
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  virtual hash_t __hash__() const;
69  virtual bool __eq__(const Basic &o) const;
74  virtual int compare(const Basic &o) const;
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:95
Dummy()
Dummy Constructors.
Definition: symbol.cpp:40
virtual int compare(const Basic &o) const
Definition: symbol.cpp:70
size_t dummy_index
Dummy index.
Definition: symbol.h:56
static size_t count_
Dummy count.
Definition: symbol.h:54
virtual hash_t __hash__() const
Definition: symbol.cpp:54
virtual bool __eq__(const Basic &o) const
Definition: symbol.cpp:62
virtual bool __eq__(const Basic &o) const
Definition: symbol.cpp:17
virtual int compare(const Basic &o) const
Definition: symbol.cpp:24
const std::string & get_name() const
Definition: symbol.h:38
virtual vec_basic get_args() const
Returns the list of arguments.
Definition: symbol.h:43
Symbol(const std::string &name)
Symbol Constructor.
Definition: symbol.cpp:7
std::string name_
name of Symbol
Definition: symbol.h:18
virtual hash_t __hash__() const
Definition: symbol.cpp:10
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