Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
PositionHeap.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
27
29#include <core/xmlApi.hpp>
30
33
35
36namespace core {
37
38template < class SymbolType >
39struct xmlApi < indexes::stringology::PositionHeap < SymbolType > > {
41 static bool first ( const ext::deque < sax::Token >::const_iterator & input );
42 static std::string xmlTagName ( );
43 static void compose ( ext::deque < sax::Token > & output, const indexes::stringology::PositionHeap < SymbolType > & index );
44};
45
46template < class SymbolType >
51 indexes::stringology::PositionHeap < SymbolType > res ( std::move ( root ), std::move ( string ) );
52
54 return res;
55}
56
57template < class SymbolType >
60}
61
62template < class SymbolType >
64 return "PositionHeap";
65}
66
67template < class SymbolType >
69 output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::START_ELEMENT );
70 core::xmlApi < ext::trie < SymbolType, unsigned > >::compose ( output, index.getRoot ( ) );
72 output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::END_ELEMENT );
73}
74
75} /* namespace core */
76
Class extending the deque class from the standard library. Original reason is to allow printing of th...
Definition: deque.hpp:44
Class introducing a trie with interface trying to be close to the interface of standard library conta...
Definition: trie.hpp:47
Position heap string index. Tree like representation of all suffixes. The suffixes are themselves rep...
Definition: PositionHeap.h:56
const ext::trie< SymbolType, unsigned > & getRoot() const &
Definition: PositionHeap.h:203
const string::LinearString< SymbolType > & getString() const &
Definition: PositionHeap.h:213
static void popToken(ext::deque< Token >::iterator &input, Token::TokenType type, const std::string &data)
Definition: FromXMLParserHelper.cpp:39
static bool isToken(ext::deque< Token >::const_iterator input, Token::TokenType type, const std::string &data)
Definition: FromXMLParserHelper.cpp:29
Linear string.
Definition: LinearString.h:57
return res
Definition: MinimizeByPartitioning.h:145
Definition: normalize.hpp:10
Definition: CompressedBitParallelTreeIndex.h:40
Definition: xmlApi.hpp:27