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
20using namespace std;
21
22namespace Lima {
23namespace LinguisticProcessing {
24namespace Automaton {
25
26/***********************************************************************/
27// constructors
28/***********************************************************************/
30 m_unit(0),
31 m_nextState(0)
32{}
33
35 m_unit(unit),
36 m_nextState(state)
37{}
38
40{
41 copy(t);
42}
43
44/***********************************************************************/
45// desctructor
46/***********************************************************************/
48 freeMem();
49}
50
51/***********************************************************************/
52// assignment operator
53/***********************************************************************/
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/***********************************************************************/
65void Transition::freeMem() {
66 if (m_unit != 0) {
67 delete m_unit;
68 }
69 m_unit = 0;
70}
71
72void Transition::copy(const Transition& t) {
73 m_unit = t.transitionUnit()->clone();
74 m_nextState = t.nextState();
75}
76
77/***********************************************************************/
78// output
79/***********************************************************************/
80
81ostream& operator << (ostream& os, const Transition& t) {
82 return os << "[" << *(t.transitionUnit()) << "] -> " << t.nextState();
83}
84
85QDebug& operator << (QDebug& os, const Transition& t) {
86 return os << "[" << *(t.transitionUnit()) << "] -> " << t.nextState();
87}
88
89} // namespace end
90} // namespace end
91} // namespace end
virtual TransitionUnit * clone() const =0
Transition & operator=(const Transition &transition)
std::ostream & operator<<(std::ostream &os, const DFFSPos &x)
NAUTITIA.
STL namespace.