LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
lexiconCompoundElement.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) 2006 by CEA *
8 * author Olivier MESNARD olivier.mesnard@cea.fr *
9 * *
10 * lexiconCompoundElement.h - description *
11 * common definition to implement lexiconIdGenerator and lexiconIdAccessor *
12 *****************************************************************************/
13#include <iostream>
14#include "common/LimaCommon.h"
15
16#ifndef FSA_LEXICON_COMPOUND_ELEMENT_H
17#define FSA_LEXICON_COMPOUND_ELEMENT_H
18
19namespace Lima {
20namespace Common {
21namespace FsaAccess {
22
23class LIMA_FSAACCESS_EXPORT DepCompound : public std::pair<uint64_t, uint64_t> {
24 friend LIMA_FSAACCESS_EXPORT std::ostream& operator << ( std::ostream& os, const DepCompound& cmp);
25public:
27 : std::pair<uint64_t, uint64_t> (0,0) {}
28 DepCompound(uint64_t head , uint64_t ext)
29 : std::pair<uint64_t, uint64_t> (head, ext) {}
30 DepCompound(const DepCompound& dc);
31 DepCompound& operator=(const DepCompound& dc);
32 uint64_t getHead() const { return first; }
33 uint64_t getExt() const { return second ;}
34 void print (std::ostream& os) const;
35};
36
38{
39 bool operator()(const DepCompound& cpp1, const DepCompound& cpp2) const
40 {
41 if( cpp1.getHead() < cpp2.getHead() )
42 return true;
43 else if( cpp1.getHead() > cpp2.getHead() )
44 return false;
45 else
46 return ( cpp1.getExt() < cpp2.getExt() );
47 }
48};
49
50
51class LIMA_FSAACCESS_EXPORT ExtCompound : public std::pair<uint64_t, uint64_t> {
52 friend LIMA_FSAACCESS_EXPORT std::ostream& operator << ( std::ostream& os, const ExtCompound& cmp);
53public:
55 : std::pair<uint64_t, uint64_t> (0, 0) {}
56 ExtCompound(uint64_t first , uint64_t next)
57 : std::pair<uint64_t, uint64_t> (first, next) {}
58 ExtCompound(const ExtCompound& dc);
59 ExtCompound& operator=(const ExtCompound& dc);
60 uint64_t getFirst() const { return first; }
61 uint64_t getNext() const { return second; }
62 void print ( std::ostream& os) const;
63};
64
66{
67 bool operator()(const ExtCompound& cpp1, const ExtCompound& cpp2) const
68 {
69 if( cpp1.getFirst() < cpp2.getFirst() )
70 return true;
71 else if( cpp1.getFirst() > cpp2.getFirst() )
72 return false;
73 else
74 return ( cpp1.getNext() < cpp2.getNext() );
75 }
76};
77
78class LIMA_FSAACCESS_EXPORT DepCompoundLink : public std::pair<Lima::Common::FsaAccess::DepCompound, uint64_t> {
79public:
80 DepCompoundLink() : std::pair<Lima::Common::FsaAccess::DepCompound, uint64_t>() {}
82 : std::pair<Lima::Common::FsaAccess::DepCompound, uint64_t>() {std::make_pair(depCompound,id);}
84 uint64_t getId() const { return second ;}
85};
86
88{
89 bool operator()(const DepCompoundLink& link1, const DepCompoundLink& link2) const
90 {
91 return m_op(link1.getDepCompound(), link2.getDepCompound() );
92 }
94};
95
96class LIMA_FSAACCESS_EXPORT ExtCompoundLink : public std::pair<Lima::Common::FsaAccess::ExtCompound, uint64_t> {
97public:
99 : std::pair<Lima::Common::FsaAccess::ExtCompound, uint64_t> (extCompound, id) {}
101 uint64_t getId() const { return second; }
102};
103
105{
106 bool operator()(const ExtCompoundLink& link1, const ExtCompoundLink& link2) const
107 {
108 return m_op(link1.getExtCompound(), link2.getExtCompound() );
109 }
111};
112
113
114} // namespace FsaAccess
115} // namespace Common
116} // namespace Lima
117
118#endif //FSA_LEXICON_COMPOUND_ELEMENT_H
QDebug & operator<<(QDebug &qd, const std::string &str)
Definition QsLog.cpp:39
#define LIMA_FSAACCESS_EXPORT
Definition LimaCommon.h:130
DepCompound(uint64_t head, uint64_t ext)
ExtCompound(uint64_t first, uint64_t next)
NAUTITIA.
STL namespace.
bool operator()(const DepCompoundLink &link1, const DepCompoundLink &link2) const
bool operator()(const DepCompound &cpp1, const DepCompound &cpp2) const
bool operator()(const ExtCompoundLink &link1, const ExtCompoundLink &link2) const
bool operator()(const ExtCompound &cpp1, const ExtCompound &cpp2) const