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

« back to all changes in this revision

Viewing changes to corelinux/Mediator.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(__MEDIATOR_HPP)
 
2
#define __MEDIATOR
 
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(__ITERATOR_HPP)
 
29
#include <Iterator.hpp>
 
30
#endif
 
31
 
 
32
#if   !defined(__EVENT_HPP)
 
33
#include <Event.hpp>
 
34
#endif
 
35
 
 
36
namespace corelinux
 
37
{
 
38
   DECLARE_CLASS( Colleague );
 
39
   DECLARE_CLASS( Mediator );
 
40
 
 
41
   /**
 
42
   Mediator declares an interface for communicating with Colleague objects.
 
43
   */
 
44
 
 
45
   class Mediator
 
46
   {
 
47
   public:
 
48
 
 
49
      //
 
50
      // Constructors and destructor
 
51
      //
 
52
 
 
53
                        /// Default constructor
 
54
 
 
55
                        Mediator( void );
 
56
 
 
57
                        /// Copy constructor
 
58
 
 
59
                        Mediator( MediatorCref );
 
60
 
 
61
                        /// Virtual destructor
 
62
 
 
63
      virtual           ~Mediator( void );
 
64
 
 
65
      //
 
66
      // Operator overloads
 
67
      //
 
68
 
 
69
               /// Assignment operator
 
70
 
 
71
               MediatorRef operator=( MediatorCref );
 
72
 
 
73
               /// Equality operator
 
74
 
 
75
               bool operator==( MediatorCref ) const;
 
76
 
 
77
      //
 
78
      // The working part
 
79
      //
 
80
 
 
81
      virtual  void  action( Event<Identifier>* ) 
 
82
         throw ( NullPointerException );
 
83
 
 
84
   protected:
 
85
 
 
86
      //
 
87
      // Mutators
 
88
      //
 
89
 
 
90
               /**
 
91
               colleagueCreated requires a implementation for
 
92
               derivations that need to gather information
 
93
               from the Colleague to distribute action events
 
94
               @param Colleague pointer
 
95
               */
 
96
 
 
97
      virtual  void  colleagueCreated( ColleaguePtr ) = 0;
 
98
 
 
99
      //
 
100
      // Factory methods
 
101
      //
 
102
 
 
103
               /**
 
104
               When action is called on the Mediator, it
 
105
               will ask the implementation for the Colleagues
 
106
               that are interested in the event identified by
 
107
               the identifier
 
108
               @param IdentifierCref key to interested parties
 
109
               @return Iterator over Colleague pointer
 
110
               */
 
111
 
 
112
      virtual  Iterator<ColleaguePtr>  *createIterator( Event<Identifier>* ) = 0;
 
113
 
 
114
               /**
 
115
               Called when action is through with the colleague iteration
 
116
               @param Iterator over Colleague pointer
 
117
               */
 
118
 
 
119
      virtual  void  destroyIterator( Iterator<ColleaguePtr> * ) = 0;
 
120
 
 
121
   private:
 
122
 
 
123
   };
 
124
}
 
125
 
 
126
#endif // if !defined(__MEDIATOR_HPP)
 
127
 
 
128
/*
 
129
   Common rcs information do not modify
 
130
   $Author: frankc $
 
131
   $Revision: 1.1 $
 
132
   $Date: 2000/05/07 03:41:47 $
 
133
   $Locker:  $
 
134
*/
 
135