LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
StringMap.h
Go to the documentation of this file.
1// Copyright 2002-2013 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6/***************************************************************************
7 * Copyright (C) 2003 by CEA *
8 * author Olivier MESNARD olivier.mesnard@cea.fr *
9 * *
10 * composed dictionnary *
11 ***************************************************************************/
12#ifndef COMMON_STRINGMAP_STRINGMAP_HPP
13#define COMMON_STRINGMAP_STRINGMAP_HPP
14
15
16#include "common/LimaCommon.h"
17
19
20namespace Lima {
21namespace Common {
22namespace StringMap {
23
24/*
25 * typename accessMethod: class with following method:
26 * accessMethod(bool keyOrderingIsForward)
27 * int getIndex(const basic_string<Lima::LimaChar>& key) const;
28 * uint64_t getSize() const;
29 * void read(keyFileName);
30 *
31 * typename contentElement: class or predefined type with following features
32 * copy constructor
33 *
34// * typename storedSet: class with following method:
35// * contentElement operator [] (int);
36 *
37 */
38
39// Example : frequency dictionary
40//typedef FsaAccessSpare16 accessMethod;
41//typedef int contentElement;
42//typedef std::vector<int> storedSet;
43
44//template <typename accessMethod, typename contentElement, typename storedSet>
45template <typename accessMethod, typename contentElement>
46class StringMap {
47public:
48 StringMap(const contentElement& defaultValue );
49 virtual ~StringMap();
50 void parseAccessMethod( const std::string &keyFileName );
51 uint64_t getSize() const;
52 const contentElement& getDefaultValue() const { return m_emptyElement; }
53/*
54 std::pair<ComposedDict16_subword_iterator, ComposedDict16_subword_iterator>
55 getSubWordEntries(
56 const Lima::uint64_t offset,
57 const Lima::LimaString& key ) const;
58*/
59protected:
60 // automaton, tree or other acces method
61 accessMethod m_accessMethod;
62 // set of data associated to entries
63// storedSet m_data;
64 // default return value for getElement() when there is no entry in dictionary
65 contentElement m_emptyElement;
66};
67
68} // namespace StringMap
69} // namespace Commmon
70} // namespace Lima
71
72#include "common/StringMap/StringMap.tcc"
73
74#endif //COMMON_STRINGMAP_STRINGMAP_HPP
void parseAccessMethod(const std::string &keyFileName)
const contentElement & getDefaultValue() const
Definition StringMap.h:52
StringMap(const contentElement &defaultValue)
NAUTITIA.