Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mediator.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef __MEDIATOR_H_
25 #define __MEDIATOR_H_
26 
27 
28 #include "mediatorcollegue.h"
29 #include <vector>
30 
31 /**
32  * The default MediatorEvent holds no information,
33  * the implementation of the mediator should implement a
34  * derived version of the MediatorEvent.
35  */
37 {
38  public:
39 };
40 
41 class Mediator
42 {
43  public:
44  typedef std::vector<MediatorCollegue*> MediatorCollegueListType;
45 
46  Mediator();
47  virtual ~Mediator();
48 
49  virtual void mediatorInformed(MediatorCollegue* source, MediatorEvent* event) = 0;
50 
51  void addMediatorCollegue(MediatorCollegue* collegue);
52 
54 
56 
57  MediatorCollegue* getMediatorCollegue(unsigned int index);
58 
59  unsigned int getMediatorCollegueIndex(MediatorCollegue* collegue);
60 
61  unsigned int getNumberOfMediatorCollegues();
62 
63  void mediate(unsigned int indexOfMediatorCollegue, MediatorEvent* event);
64 
65  void mediate(MediatorCollegue* collegue, MediatorEvent* event);
66 
67  void mediateToAll(MediatorEvent* event);
68 
69  void mediateToAllQMP(MediatorEvent* event);
70 
71 
72 
73  protected:
74 
75 
76  private:
77  MediatorCollegueListType collegueList;
78 };
79 
80 #endif /* _MEDIATOR_H_ */
void addMediatorCollegue(MediatorCollegue *collegue)
Definition: mediator.cpp:40
unsigned int getNumberOfMediatorCollegues()
Definition: mediator.cpp:71
void mediateToAll(MediatorEvent *event)
Definition: mediator.cpp:89
void mediate(unsigned int indexOfMediatorCollegue, MediatorEvent *event)
Definition: mediator.cpp:76
Mediator()
Definition: mediator.cpp:29
virtual ~Mediator()
Definition: mediator.cpp:31
std::vector< MediatorCollegue * > MediatorCollegueListType
Definition: mediator.h:44
The default MediatorEvent holds no information, the implementation of the mediator should implement a...
Definition: mediator.h:36
virtual void mediatorInformed(MediatorCollegue *source, MediatorEvent *event)=0
Definition: mediator.h:41
void mediateToAllQMP(MediatorEvent *event)
Definition: mediator.cpp:98
Definition: mediatorcollegue.h:32
void removeMediatorCollegue(MediatorCollegue *collegue)
Definition: mediator.cpp:45
void removeAllMediatorCollegues()
Definition: mediator.cpp:33
unsigned int getMediatorCollegueIndex(MediatorCollegue *collegue)
Definition: mediator.cpp:63
MediatorCollegue * getMediatorCollegue(unsigned int index)
Definition: mediator.cpp:57