LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
transition.cpp
Go to the documentation of this file.
1
// Copyright 2002-2018 CEA LIST
2
// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3
//
4
// SPDX-License-Identifier: MIT
5
6
/******************************************************************************
7
*
8
* File : transition.cpp
9
* Author : Romaric Besan�on (besanconr@zoe.cea.fr)
10
* Created on : Fri Oct 04 2002
11
* Copyright : (c) 2002 by CEA
12
* Version : $Id$
13
*
14
******************************************************************************/
15
16
17
#include "
transition.h
"
18
#include <iostream>
19
20
using namespace
std
;
21
22
namespace
Lima
{
23
namespace
LinguisticProcessing {
24
namespace
Automaton {
25
26
/***********************************************************************/
27
// constructors
28
/***********************************************************************/
29
Transition::Transition
():
30
m_unit(0),
31
m_nextState(0)
32
{}
33
34
Transition::Transition
(
TransitionUnit
* unit,
Tstate
state):
35
m_unit(unit),
36
m_nextState(state)
37
{}
38
39
Transition::Transition
(
const
Transition
& t)
40
{
41
copy(t);
42
}
43
44
/***********************************************************************/
45
// desctructor
46
/***********************************************************************/
47
Transition::~Transition
() {
48
freeMem();
49
}
50
51
/***********************************************************************/
52
// assignment operator
53
/***********************************************************************/
54
Transition
&
Transition::operator =
(
const
Transition
& t) {
55
if
(
this
!= &t) {
56
freeMem();
57
copy(t);
58
}
59
return
*
this
;
60
}
61
62
/***********************************************************************/
63
// helper functions for constructors and assignment operator
64
/***********************************************************************/
65
void
Transition::freeMem() {
66
if
(m_unit != 0) {
67
delete
m_unit;
68
}
69
m_unit = 0;
70
}
71
72
void
Transition::copy(
const
Transition& t) {
73
m_unit = t.transitionUnit()->
clone
();
74
m_nextState = t.nextState();
75
}
76
77
/***********************************************************************/
78
// output
79
/***********************************************************************/
80
81
ostream&
operator <<
(ostream& os,
const
Transition
& t) {
82
return
os <<
"["
<< *(t.
transitionUnit
()) <<
"] -> "
<< t.
nextState
();
83
}
84
85
QDebug&
operator <<
(QDebug& os,
const
Transition
& t) {
86
return
os <<
"["
<< *(t.
transitionUnit
()) <<
"] -> "
<< t.
nextState
();
87
}
88
89
}
// namespace end
90
}
// namespace end
91
}
// namespace end
Lima::LinguisticProcessing::Automaton::TransitionUnit
Definition
transitionUnit.h:52
Lima::LinguisticProcessing::Automaton::TransitionUnit::clone
virtual TransitionUnit * clone() const =0
Lima::LinguisticProcessing::Automaton::Transition
Definition
transition.h:32
Lima::LinguisticProcessing::Automaton::Transition::operator=
Transition & operator=(const Transition &transition)
Definition
transition.cpp:54
Lima::LinguisticProcessing::Automaton::Transition::~Transition
virtual ~Transition()
Definition
transition.cpp:47
Lima::LinguisticProcessing::Automaton::Transition::nextState
Tstate nextState() const
Definition
transition.h:65
Lima::LinguisticProcessing::Automaton::Transition::Transition
Transition()
Definition
transition.cpp:29
Lima::LinguisticProcessing::Automaton::Transition::transitionUnit
TransitionUnit * transitionUnit() const
Definition
transition.h:62
Lima::LinguisticProcessing::Automaton::Tstate
uint64_t Tstate
Definition
automatonCommon.h:41
Lima::LinguisticProcessing::Automaton::operator<<
std::ostream & operator<<(std::ostream &os, const DFFSPos &x)
Definition
automaton.cpp:371
Lima
NAUTITIA.
Definition
AmosePluginsManager.h:15
std
STL namespace.
transition.h
lima_linguisticprocessing
src
linguisticProcessing
core
Automaton
transition.cpp
Generated by
1.9.8