---
name: "corelinux_State"
section: "3"
platform: "linux"
package: "libcorelinux-dev"
version: "0.4.32-5"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/corelinux_State"
---

# corelinux\_State(3)

Allow an object to alter its behavior when its internal state changes.

## NAME

corelinux::State - Allow an object to alter its behavior when its internal state changes.

## SYNOPSIS

`#include <State.hpp>`

### Public Member Functions

**State** (void)\
 *Default Constructor.*  virtual **~State** (void)\
 *Virtual Destructor.*  bool **operator==** (**StateCref**) const \
 *Equality operator overload.*  virtual void **handle** (void)=0\
 *Called by context.*

### Protected Member Functions

**State** (**StateCref**)  throw ( Assertion )\
 *Copy Constructor.*  **StateRef** **operator=** (**StateCref**)  throw ( Assertion )\
 *Assignment operator overload.*  void **setCurrentState** (**ContextPtr**, **StatePtr**)  throw ( NullPointerException )\
 *Sets context state change.*

## Detailed Description

Allow an object to alter its behavior when its internal state changes.

The object will appear to change its class. **State** is best served as a flyweight and singleton.

## Constructor & Destructor Documentation

### corelinux::State::State (StateCref) throw ( Assertion )` [protected]`

Copy Constructor. **Parameters:**

*State* const reference

**Exceptions:**

*Assertion* to help enforce singleton

## Member Function Documentation

### StateRef corelinux::State::operator= (StateCref) throw ( Assertion )` [protected]`

Assignment operator overload. **Parameters:**

*State* const reference

**Returns:**

**State** reference to self

**Exceptions:**

*Assertion* to help enforce singleton

### bool corelinux::State::operator== (StateCref) const

Equality operator overload. **Parameters:**

*State* const reference

**Returns:**

true if equal, false otherwise

## Author

Generated automatically by Doxygen for CoreLinux++ from the source code.
