# cFSM Class Reference
[Utility classes]

`#include <cfsm.h>`

Inheritance diagram for cFSM:

List of all members.

## Detailed Description

Store the state of an FSM.

This class is used in conjunction with the FSM_Switch() and other FSM_ macros.

See also:
  FSM_Switch, FSM_Transient, FSM_Steady, FSM_Enter, FSM_Exit, FSM_Goto

## Public Member Functions

Constructors, destructor, assignment.
| cFSM (const char *name=NULL)
| cFSM (const cFSM &vs)
cFSM & | operator= (const cFSM &vs)
Redefined cObject member functions.
virtual cPolymorphic * | dup () const
virtual std::string | info () const
virtual void | writeContents (std::ostream &os)
virtual void | netPack (cCommBuffer *buffer)
virtual void | netUnpack (cCommBuffer *buffer)
FSM functions.
int | state () const
const char * | stateName () const
int | inTransientState () const
void | setState (int state, const char *stn=NULL)

## Constructor & Destructor Documentation

cFSM::cFSM | ( | const char * | name = `NULL` | ) | `[explicit]`

| Constructor.

cFSM::cFSM | ( | const cFSM & | vs | ) | `[inline]`

| Copy constructor.

## Member Function Documentation

virtual cPolymorphic* cFSM::dup | ( |  | ) | const`[inline, virtual]`

| Creates and returns an exact copy of this object. See cObject for more details. Reimplemented from cObject.

virtual std::string cFSM::info | ( |  | ) | const`[virtual]`

| Produces a one-line description of object contents into the buffer passed as argument. See cObject for more details. Reimplemented from cPolymorphic.

int cFSM::inTransientState | ( |  | ) | const`[inline]`

| Returns true if the FSM is currently in a transient state.

virtual void cFSM::netPack | ( | cCommBuffer * | buffer | ) | `[virtual]`

| Serializes the object into a PVM or MPI send buffer. Used by the simulation kernel for parallel execution. See cObject for more details. Reimplemented from cObject.

virtual void cFSM::netUnpack | ( | cCommBuffer * | buffer | ) | `[virtual]`

| Deserializes the object from a PVM or MPI receive buffer Used by the simulation kernel for parallel execution. See cObject for more details. Reimplemented from cObject.

cFSM& cFSM::operator= | ( | const cFSM & | vs | ) |

| Assignment operator. The name member doesn't get copied; see cObject's operator=() for more details.

void cFSM::setState | ( | int | state,
|  | const char * | stn = `NULL`
| ) | `[inline]`

Sets the state of the FSM.

This method is usually invoked through the FSM_Goto() macro.

The first arg is the state code. The second arg is the name of the state. setState() assumes this is pointer to a string literal (the string is not copied, only the pointer is stored).

See also:
  FSM_Goto

int cFSM::state | ( |  | ) | const`[inline]`

| Returns the state the FSM is currently in.

const char* cFSM::stateName | ( |  | ) | const`[inline]`

| Returns the name of the state the FSM is currently in.

virtual void cFSM::writeContents | ( | std::ostream & | os | ) | `[virtual]`

| Writes textual information about this object to the stream. See cObject for more details. Reimplemented from cObject.

The documentation for this class was generated from the following file:

- cfsm.h