LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
ChainIdStruct.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
18#ifndef LIMA_GRAPH_CHAINIDSTRUCT_H
19#define LIMA_GRAPH_CHAINIDSTRUCT_H
20
22
23namespace Lima {
24namespace LinguisticProcessing {
25namespace LinguisticAnalysisStructure {
26
28
34{
35public:
36
37 static const uint64_t noid=UINT_MAX;
38
41 uint64_t chainId = noid,
42 ChainElemType type = PART) :
43 m_chainType(chainType), m_chainId(chainId), m_elemType(type) {}
44 virtual ~ChainIdStruct() {}
45
47 m_chainType(cis.m_chainType),
48// m_pathId(cis.m_pathId),
49 m_chainId(cis.m_chainId),
50 m_elemType(cis.m_elemType)
51 {
52 }
53
55 {
56 m_chainType = cis.m_chainType;
57// m_pathId = cis.m_pathId;
58 m_chainId = cis.m_chainId;
59 m_elemType = cis.m_elemType;
60 return (*this);
61 }
62
63 inline bool operator==(const ChainIdStruct& cis) const;
64
65 bool operator<(const ChainIdStruct& cis) const
66 {
67// if (m_chainType==cis.m_chainType) return (m_chainType < cis.m_chainType);
68 return (m_chainId < cis.m_chainId);
69 }
70
71 inline Common::MediaticData::ChainsType chainType() const { return m_chainType; }
72 inline void chainType(Common::MediaticData::ChainsType t) { m_chainType = t; }
73 inline uint64_t chainId() const { return m_chainId; }
74 inline void chainId(uint64_t chainId) { m_chainId = chainId; }
75 inline ChainElemType elemType() const { return m_elemType; }
76 inline void elemType(ChainElemType type) { m_elemType = type; }
77
78
79private:
82 uint64_t m_chainId;
83 ChainElemType m_elemType;
84};
85
86
87inline std::ostream& operator<<(std::ostream& os, const ChainIdStruct& ids)
88{
89 os << "[";
91 os << "0";
93 os << "N";
94 else
95 os << "V";
96 os << ";";
97 os << ids.chainId() << ";";
98 switch (ids.elemType())
99 {
100 case BEGIN: os << "b"; break;
101 case END: os << "e"; break;
102 case UNIGRAM: os << "u"; break;
103 case PART: os << "p"; break;
104 default: os << "u";
105 }
106 os << "]";
107 return os;
108}
109
110inline QDebug& operator<<(QDebug& os, const ChainIdStruct& ids)
111{
112 os << "[";
114 os << "0";
116 os << "N";
117 else
118 os << "V";
119 os << ";";
120 os << ids.chainId() << ";";
121 switch (ids.elemType())
122 {
123 case BEGIN: os << "b"; break;
124 case END: os << "e"; break;
125 case UNIGRAM: os << "u"; break;
126 case PART: os << "p"; break;
127 default: os << "u";
128 }
129 os << "]";
130 return os;
131}
132
133inline bool ChainIdStruct::operator==(const ChainIdStruct& cis) const
134{
135 return ( (m_chainType == cis.m_chainType) && (m_chainId == cis.m_chainId) );
136}
137
138} // closing namespace LinguisticAnalysisStructure
139} // closing namespace LinguisticProcessing
140} // closing namespace Lima
141
142#endif // LIMA_GRAPH_CHAINIDSTRUCT_H
ChainIdStruct(Common::MediaticData::ChainsType chainType=Common::MediaticData::NO_CHAIN_TYPE, uint64_t chainId=noid, ChainElemType type=PART)
ChainsType
syntactic chains type
std::ostream & operator<<(std::ostream &os, const ChainIdStruct &ids)
NAUTITIA.