CoreLinux++  0.4.32
State.hpp
1 #if !defined (__STATE_HPP)
2 #define __STATE_HPP
3 
4 /*
5  CoreLinux++
6  Copyright (C) 1999,2000 CoreLinux Consortium
7 
8  The CoreLinux++ Library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version.
12 
13  The CoreLinux++ Library Library is distributed in the hope that it will
14  be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public
19  License along with the GNU C Library; see the file COPYING.LIB. If not,
20  write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  Boston, MA 02111-1307, USA.
22 */
23 
24 #if !defined(__COMMON_HPP)
25 #include <Common.hpp>
26 #endif
27 
28 namespace corelinux
29 {
30 
31  DECLARE_CLASS( Context );
32  DECLARE_CLASS( State );
33 
40  class State
41  {
42  public:
44 
45  State( void );
46 
48 
49  virtual ~State( void );
50 
51  //
52  // Operator overloads
53  //
60  bool operator==( StateCref ) const;
61 
62  //
63  // Mutators
64  //
66 
67  virtual void handle( void ) = 0;
68 
69  protected:
75  State( StateCref ) throw ( Assertion );
76 
85 
87 
89  throw ( NullPointerException );
90 
91  };
92 
93 }
94 
95 #endif // if !defined(__STATE_HPP)
96 
97 /*
98  Common rcs information do not modify
99  $Author: frankc $
100  $Revision: 1.1 $
101  $Date: 2000/05/17 03:43:30 $
102  $Locker: $
103 */
104 
105 
Allow an object to alter its behavior when its internal state changes.
Definition: State.hpp:40
void setCurrentState(ContextPtr, StatePtr)
Sets context state change.
Definition: State.cpp:83
virtual ~State(void)
Virtual Destructor.
Definition: State.cpp:57
NullPointerException is the base exception type for NullPointer.
Definition: NullPointerException.hpp:40
bool operator==(StateCref) const
Equality operator overload.
Definition: State.cpp:76
StateRef operator=(StateCref)
Assignment operator overload.
Definition: State.cpp:66
virtual void handle(void)=0
Called by context.
Context defines the interface to clients and maintains an instance of a State subclass.
Definition: Context.hpp:40
Assertion is-a Exception created when an assertion fails.
Definition: Assertion.hpp:423
State(void)
Default Constructor.
Definition: State.cpp:39

This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium