Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
symbol.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//symbol.hpp is free software: you can redistribute it and/or modify
4//it under the terms of the GNU General Public License as published by
5//the Free Software Foundation, either version 3 of the License, or
6//(at your option) any later version.
7//
8//symbol.hpp is distributed in the hope that it will be useful,
9//but WITHOUT ANY WARRANTY; without even the implied warranty of
10//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11//GNU General Public License for more details.
12//
13//You should have received a copy of the GNU General Public License
14//along with symbol.hpp. If not, see <http://www.gnu.org/licenses/>.
15//
16// Copyright(C) Bertini2 Development Team
17//
18// See <http://www.gnu.org/licenses/> for a copy of the license,
19// as well as COPYING. Bertini2 is provided with permitted
20// additional terms in the b2/licenses/ directory.
21
22// symbol.hpp: Declares the class Symbol.
23
30
31#ifndef BERTINI_FUNCTION_TREE_SYMBOL_HPP
32#define BERTINI_FUNCTION_TREE_SYMBOL_HPP
33
34
36
37
38
39namespace bertini {
40namespace node {
46 class Symbol : public Node
47 {
48
49 public:
50
51 virtual ~Symbol() = default;
52
53 private:
55
56 template <typename Archive>
57 void serialize(Archive& ar, const unsigned /*version*/) {
58 ar & boost::serialization::base_object<Node>(*this);
59 }
60 };
61
62
63
64
65
66
67
68
78 {
79 public:
81 const std::string& name() const
82 {
83 return name_;
84 }
85
87 void name(const std::string& new_name)
88 {
89 name_ = new_name;
90 }
91
92 protected:
93 ~NameHolder() = default; // not polymorphic; never delete through NameHolder*
94
95 NameHolder() = default;
96
98 explicit NameHolder(std::string new_name) : name_(std::move(new_name))
99 {}
100
101 std::string name_;
102
103 private:
105
106 template <typename Archive>
107 void serialize(Archive& ar, const unsigned /*version*/) {
108 ar & name_;
109 }
110 };
111
112
113
114
120 class NamedSymbol : public Symbol
121 {
122
123 public:
124
128 const std::string & name() const;
129
133 void name(const std::string & new_name);
134
135
139 NamedSymbol(const std::string & new_name);
140
141
142 void print(std::ostream& target) const override;
143
144 virtual ~NamedSymbol() = default;
145
146 protected:
147 NamedSymbol() = default;
148
149 std::string name_;
150
151 private:
152
154
155 template <typename Archive>
156 void serialize(Archive& ar, const unsigned /*version*/) {
157 ar & boost::serialization::base_object<Symbol>(*this);
158 ar & name_;
159 }
160
161 };
162
163} // re: namespace node
164} // re: namespace bertini
165
166#endif
NameHolder(std::string new_name)
Construct holding the given name.
Definition symbol.hpp:98
std::string name_
The stored name.
Definition symbol.hpp:101
void name(const std::string &new_name)
Set the name.
Definition symbol.hpp:87
friend class boost::serialization::access
Definition symbol.hpp:104
const std::string & name() const
Definition symbol.hpp:81
NamedSymbol(const std::string &new_name)
Parameterized constructor, sets the name of the symbol.
virtual ~NamedSymbol()=default
std::string name_
The stored name.
Definition symbol.hpp:149
friend class boost::serialization::access
Definition symbol.hpp:153
const std::string & name() const
Get the name of the named symbol.
void name(const std::string &new_name)
Get the name of the named symbol.
void print(std::ostream &target) const override
Virtual method for printing Nodes to arbitrary output streams.
Abstract symbol class.
Definition symbol.hpp:47
virtual ~Symbol()=default
friend class boost::serialization::access
Definition symbol.hpp:54
Definition canonical.hpp:56
Definition algorithm_builder.hpp:36
Defines the abstract Node base class.