CoreLinux++  0.4.32
Handler.hpp
1 #if !defined(__HANDLER_HPP)
2 #define __HANDLER_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 #if !defined(__REQUEST_HPP)
29 #include <Request.hpp>
30 #endif
31 
32 namespace corelinux
33 {
34 
35  DECLARE_CLASS( Handler );
36 
43  class Handler : public Synchronized
44  {
45  public:
46 
47  //
48  // Constructors and destructors
49  //
50 
52 
53  Handler( void );
54 
56 
58 
60 
61  virtual ~Handler( void );
62 
63  //
64  // Operator overloads
65  //
67 
69 
71 
72  bool operator==( HandlerCref ) const;
73 
74  //
75  // Accessors
76  //
78 
79  HandlerPtr operator++( void ) ;
80 
82 
83  HandlerPtr operator--( void ) ;
84 
85  //
86  // Mutators
87  //
88 
96  void succeedHandler( HandlerPtr ) throw ( Assertion );
97 
105  void precedeHandler( HandlerPtr ) throw ( Assertion );
106 
108 
109  void extractSelf( void );
110 
119  virtual void handleRequest( RequestPtr ) ;
120 
121  protected:
122 
132  virtual bool handlesType( RequestPtr ) = 0;
133 
140  virtual void handle( RequestPtr ) = 0;
141 
143 
144  void setSuccessor( HandlerPtr ) ;
145 
147 
148  void setPredecessor( HandlerPtr ) ;
149 
151 
153  protected:
154 
156 
158 
160 
162 
163  private:
164 
165  };
166 }
167 #endif // if !defined(__HANDLER_HPP)
168 
169 /*
170  Common rcs information do not modify
171  $Author: frankc $
172  $Revision: 1.1 $
173  $Date: 2000/04/27 14:32:21 $
174  $Locker: $
175 */
176 
177 
178 
virtual void handleRequest(RequestPtr)
Routine which either invokes the work method or passes along to successor.
Definition: Handler.cpp:210
Defines an interface for handling requests, accessing successors, and optionally implements the succe...
Definition: Handler.hpp:43
Handler(void)
Default constructor.
Definition: Handler.cpp:33
HandlerRef operator=(HandlerCref)
Operator assignment.
Definition: Handler.cpp:63
virtual ~Handler(void)
Virtual destructor.
Definition: Handler.cpp:56
bool operator==(HandlerCref) const
Equality operator.
Definition: Handler.cpp:70
void setSuccessor(HandlerPtr)
Sets the objects theSuccessor member.
Definition: Handler.cpp:231
HandlerPtr operator++(void)
Returns successor or NULLPTR if end-of-chain.
Definition: Handler.cpp:77
Forward reference the various common classes.
Definition: AbstractAllocator.hpp:32
void succeedHandler(HandlerPtr)
Have this tie itself as the successor to the argument handler pointer.
Definition: Handler.cpp:93
void precedeHandler(HandlerPtr)
Have this tie itself as the predecessor to the argument handler pointer.
Definition: Handler.cpp:138
void setPredecessor(HandlerPtr)
Sets the objects thePredecessor member.
Definition: Handler.cpp:239
HandlerPtr operator--(void)
Returns predecessor or NULLPTR if end-of-chain.
Definition: Handler.cpp:85
HandlerPtr thePredecessor
Supports chaining of responsibility where.
Definition: Handler.hpp:161
virtual bool handlesType(RequestPtr)=0
Implementation required.
HandlerPtr theSuccessor
Supports chaining of responsibility.
Definition: Handler.hpp:157
Assertion is-a Exception created when an assertion fails.
Definition: Assertion.hpp:423
Synchronized is a mixin which allows class objects to enable monitor functionality.
Definition: Synchronized.hpp:41
virtual void handle(RequestPtr)=0
Implementation required.
void setSiblings(HandlerPtr, HandlerPtr)
Sets the object siblings as atomic operation.
Definition: Handler.cpp:247
void extractSelf(void)
Removes links from self.
Definition: Handler.cpp:183
A Request is used for type identification to a handler object.
Definition: Request.hpp:38

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