~ubuntu-branches/ubuntu/gutsy/libcorelinux/gutsy

« back to all changes in this revision

Viewing changes to corelinux/Colleague.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2001-12-29 17:43:34 UTC
  • Revision ID: james.westby@ubuntu.com-20011229174334-ejlsuilsiro5vmzr
Tags: 0.4.32-4
* fix config.{guess,sub} out of date on hppa and s390 (closes: #124296,#121830)
* try to be more descriptive in the description of the package  (closes: #115758)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if   !defined(__COLLEAGUE_HPP)
 
2
#define __COLLEAGUE_HPP
 
3
 
 
4
/*
 
5
   CoreLinux++ 
 
6
   Copyright (C) 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(__VECTOR_HPP)
 
29
#include <Vector.hpp>
 
30
#endif
 
31
 
 
32
#if   !defined(__EVENT_HPP)
 
33
#include <Event.hpp>
 
34
#endif
 
35
 
 
36
namespace corelinux
 
37
{
 
38
   CORELINUX_VECTOR(  IdentifierPtr ,  EventIdentifiers );
 
39
 
 
40
   DECLARE_CLASS( Mediator );
 
41
 
 
42
   DECLARE_CLASS( Colleague );
 
43
 
 
44
   /**
 
45
   Colleague knows its Mediator object, communicates with its mediator 
 
46
   whenever it would have otherwise communicated with another Colleague. 
 
47
   */
 
48
 
 
49
   class Colleague
 
50
   {
 
51
   public:
 
52
 
 
53
      //
 
54
      // Constructors and destructor
 
55
      //
 
56
 
 
57
                        /**
 
58
                        Default constructor requires a Mediator
 
59
                        @param Mediator pointer 
 
60
                        @exception NullPointerException if MediatorPtr 
 
61
                        is NULLPTR
 
62
                        */
 
63
 
 
64
                        Colleague( MediatorPtr )
 
65
                           throw ( NullPointerException );
 
66
 
 
67
                        /**
 
68
                        Copy constructor copies the mediator
 
69
                        reference
 
70
                        @param Colleague const referencee
 
71
                        */
 
72
 
 
73
                        Colleague( ColleagueCref );
 
74
 
 
75
                        /// Virtual destructor 
 
76
 
 
77
      virtual           ~Colleague( void );   
 
78
 
 
79
      //
 
80
      // Operator overloads
 
81
      //
 
82
 
 
83
               /// Assignment operator
 
84
 
 
85
               ColleagueRef   operator=( ColleagueCref );
 
86
 
 
87
               /// Equality operator
 
88
 
 
89
               bool operator==( ColleagueCref ) const;
 
90
 
 
91
      //
 
92
      // Accessors
 
93
      //
 
94
 
 
95
               /**
 
96
               Implementation defined to return the identifiers
 
97
               of the events that this Colleague generates
 
98
               @param EventIdentifiers vector reference
 
99
               */
 
100
 
 
101
      virtual  void  getEventsGenerated( EventIdentifiersRef ) = 0;
 
102
 
 
103
               /**
 
104
               Implementation defined to return the identifiers
 
105
               of the events that this Colleague is interested in
 
106
               @param EventIdentifiers vector reference
 
107
               */
 
108
 
 
109
      virtual  void  getInterestedEvents( EventIdentifiersRef ) = 0;
 
110
 
 
111
      //
 
112
      // Mutators
 
113
      //
 
114
 
 
115
               /**
 
116
               Called by the mediator when another Colleague has
 
117
               generated an event that this colleague instance
 
118
               is interested in.
 
119
               @param Event pointer to event
 
120
               */
 
121
 
 
122
      virtual  void  action( Event<Identifier> * ) = 0;
 
123
 
 
124
   protected:
 
125
 
 
126
      //
 
127
      // Constructor
 
128
      //
 
129
                        /// Default constructor not allowed
 
130
 
 
131
                        Colleague( void ) throw ( Assertion );
 
132
 
 
133
      //
 
134
      // Service method
 
135
      //               
 
136
               /**
 
137
               Called by the Colleague implementation to have
 
138
               the Mediator::action called with the event type
 
139
               @param Event pointer to event
 
140
               @exception NullPointerException if EventPtr is NULLPTR
 
141
               */
 
142
 
 
143
      virtual  void  invokeMediator( Event<Identifier> * ) throw ( NullPointerException );
 
144
 
 
145
   private:
 
146
 
 
147
            /// The Mediator that this Colleague knows
 
148
 
 
149
            MediatorPtr    theMediator;
 
150
   };
 
151
}
 
152
 
 
153
#endif // if !defined(__COLLEAGUE_HPP)
 
154
 
 
155
/*
 
156
   Common rcs information do not modify
 
157
   $Author: prudhomm $
 
158
   $Revision: 1.2 $
 
159
   $Date: 2000/08/31 22:52:20 $
 
160
   $Locker:  $
 
161
*/
 
162
 
 
163