Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
FormalRTEStructure.h
Go to the documentation of this file.
1
6/*
7 * This file is part of Algorithms library toolkit.
8 * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
9
10 * Algorithms library toolkit is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14
15 * Algorithms library toolkit is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19
20 * You should have received a copy of the GNU General Public License
21 * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#pragma once
25
26#include <ext/memory>
27#include "FormalRTEElement.h"
28
29#include "FormalRTEEmpty.h"
30
32
33namespace rte {
34
40template < class SymbolType >
41class FormalRTEStructure final {
46
47public:
51 explicit FormalRTEStructure ( );
52
59
65 explicit FormalRTEStructure ( const FormalRTEElement < SymbolType > & structure );
66
73
80
87
93 void setStructure ( const FormalRTEElement < SymbolType > & structure );
94
102 out << structure.getStructure ( );
103 return out;
104 }
105
114 friend std::strong_ordering operator <=> ( const FormalRTEStructure < SymbolType > & first, const FormalRTEStructure < SymbolType > & second ) {
115 return first.getStructure() <=> second.getStructure();
116 }
117
127 return first.getStructure() == second.getStructure();
128 }
129
136 return FormalRTEStructure < DefaultSymbolType > ( std::move ( * std::move ( getStructure ( ) ).normalize ( ) ) );
137 }
138
139};
140
141template < class SymbolType >
143 setStructure ( std::move ( structure ) );
144}
145
146template < class SymbolType >
148}
149
150template < class SymbolType >
152}
153
154template < class SymbolType >
156 return * m_structure;
157}
158
159template < class SymbolType >
161 return * m_structure;
162}
163
164template < class SymbolType >
166 setStructure ( ext::move_copy ( structure ) );
167}
168
169template < class SymbolType >
171 this->m_structure = ext::smart_ptr < FormalRTEElement < SymbolType > > ( std::move ( param ).clone ( ) );
172}
173
174} /* namespace rte */
175
177
Definition: ostream.h:14
Managed pointer simulating value like behavior.
Definition: memory.hpp:233
Definition: FormalRTEElement.h:54
Represents the empty expression in the regular tree expression. The node can't have any children.
Definition: FormalRTEEmpty.h:40
Represents unbounded regular expression structure. Regular expression is stored as a tree of Unbounde...
Definition: FormalRTEStructure.h:41
FormalRTEStructure()
Creates a new instance of the expression structure. Defaultly created structure is empty expression.
Definition: FormalRTEStructure.h:151
const FormalRTEElement< SymbolType > & getStructure() const
Definition: FormalRTEStructure.h:155
void setStructure(FormalRTEElement< SymbolType > &&param)
Definition: FormalRTEStructure.h:170
friend bool operator==(const FormalRTEStructure< SymbolType > &first, const FormalRTEStructure< SymbolType > &second)
Equality operator implementation for the expression structure.
Definition: FormalRTEStructure.h:126
friend ext::ostream & operator<<(ext::ostream &out, const FormalRTEStructure< SymbolType > &structure)
Strucuture printer to the stream.
Definition: FormalRTEStructure.h:101
friend std::strong_ordering operator<=>(const FormalRTEStructure< SymbolType > &first, const FormalRTEStructure< SymbolType > &second)
Three way comparison operator implementation for the expression structure.
Definition: FormalRTEStructure.h:114
FormalRTEStructure< DefaultSymbolType > normalize() &&
Performs the type normalization of the rte structure.
Definition: FormalRTEStructure.h:135
p second
Definition: ToRegExpAlgebraic.h:126
auto move_copy(const T &param)
Allow moving of copied instance of the source.
Definition: utility.hpp:45
Definition: ToFTAGlushkov.h:22