CoreLinux++  0.4.32
Context.hpp
1 #if !defined (__CONTEXT_HPP)
2 #define __CONTEXT_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 <Context.hpp>
26 #endif
27 
28 
29 namespace corelinux
30 {
31 
32  DECLARE_CLASS( State );
33  DECLARE_CLASS( Context );
34 
40  class Context
41  {
42  public:
43 
45 
46  Context( void );
47 
53 
55 
56  virtual ~Context( void );
57 
58  //
59  // Operator overloads
60  //
68 
75  bool operator==( ContextCref ) const;
76 
77  //
78  // Mutators
79  //
80 
82 
83  virtual void request( void ) throw ( NullPointerException );
84 
86 
87  virtual void changeState( StatePtr );
88 
89  protected:
90 
91  //
92  // Accessors
93  //
95 
96  StatePtr getState( void ) const;
97 
98  //
99  // Mutators
100  //
101 
103 
104  void setState( StatePtr );
105 
106  private:
107 
109 
110  StatePtr theState;
111 
112  };
113 
114 }
115 
116 #endif // if !defined(__CONTEXT_HPP)
117 
118 /*
119  Common rcs information do not modify
120  $Author: frankc $
121  $Revision: 1.1 $
122  $Date: 2000/05/17 03:43:30 $
123  $Locker: $
124 */
125 
126 
Allow an object to alter its behavior when its internal state changes.
Definition: State.hpp:40
void setState(StatePtr)
Set the state instance.
Definition: Context.cpp:112
StatePtr getState(void) const
Retrieve the state instance.
Definition: Context.cpp:105
Context(void)
Default Constructor.
Definition: Context.cpp:37
bool operator==(ContextCref) const
Equality operator overload.
Definition: Context.cpp:77
virtual void changeState(StatePtr)
Change the state of the context.
Definition: Context.cpp:98
NullPointerException is the base exception type for NullPointer.
Definition: NullPointerException.hpp:40
virtual ~Context(void)
Virtual Destructor.
Definition: Context.cpp:55
Context defines the interface to clients and maintains an instance of a State subclass.
Definition: Context.hpp:40
ContextRef operator=(ContextCref)
Assignment operator overload.
Definition: Context.cpp:62
virtual void request(void)
Invoke a context request which is delegated to State.
Definition: Context.cpp:84

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