Statistics
| Branch: | Revision:

root / src / sim / cfsm.cc @ e26d3d25

History | View | Annotate | Download (1.56 KB)

1 01873262 Georg Kunz
//========================================================================
2
//  CFSM.CC - part of
3
//
4
//                 OMNeT++/OMNEST
5
//              Discrete System Simulation in C++
6
//
7
//   Member functions of
8
//    cFSM  : Finite State Machine state
9
//
10
//  Author: Andras Varga
11
//
12
//========================================================================
13
14
/*--------------------------------------------------------------*
15
  Copyright (C) 1992-2008 Andras Varga
16
  Copyright (C) 2006-2008 OpenSim Ltd.
17

18
  This file is distributed WITHOUT ANY WARRANTY. See the file
19
  `license' for details on this and other legal matters.
20
*--------------------------------------------------------------*/
21
22
#include <stdio.h>       // sprintf
23
#include <string.h>      // strlen
24
#include <sstream>
25
#include "globals.h"
26
#include "cfsm.h"
27
28
USING_NAMESPACE
29
30
using std::ostream;
31
32
33
Register_Class(cFSM);
34
35
36
cFSM::cFSM(const char *name) :
37
  cOwnedObject(name)
38
{
39
  _state=0;
40
  _statename="INIT";
41
}
42
43
cFSM& cFSM::operator=(const cFSM& vs)
44
{
45
    if (this==&vs) return *this;
46
47
    cOwnedObject::operator=(vs);
48
    _statename=vs._statename;
49
    _state=vs._state;
50
    return *this;
51
}
52
53
std::string cFSM::info() const
54
{
55
    std::stringstream out;
56
    if (!_statename)
57
        out << "state: " << _state;
58
    else
59
        out << "state: " << _statename << " (" << _state << ")";
60
    return out.str();
61
}
62
63
void cFSM::parsimPack(cCommBuffer *buffer)
64
{
65
    throw cRuntimeError(this,"parsimPack() not implemented");
66
}
67
68
void cFSM::parsimUnpack(cCommBuffer *buffer)
69
{
70
    throw cRuntimeError(this,"parsimUnpack() not implemented");
71
}