Robot Simulator of the Robotics Group for Self-Organization of Control: mediator.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

- File List
- File Members

# mediator.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  *   Copyright (C) 2005 by Robot Group Leipzig                             *
    00003  *    martius@informatik.uni-leipzig.de                                    *
    00004  *    fhesse@informatik.uni-leipzig.de                                     *
    00005  *    der@informatik.uni-leipzig.de                                        *
    00006  *    guettler@informatik.uni-leipzig.de                                   *
    00007  *                                                                         *
    00008  *   This program is free software; you can redistribute it and/or modify  *
    00009  *   it under the terms of the GNU General Public License as published by  *
    00010  *   the Free Software Foundation; either version 2 of the License, or     *
    00011  *   (at your option) any later version.                                   *
    00012  *                                                                         *
    00013  *   This program is distributed in the hope that it will be useful,       *
    00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
    00016  *   GNU General Public License for more details.                          *
    00017  *                                                                         *
    00018  *   You should have received a copy of the GNU General Public License     *
    00019  *   along with this program; if not, write to the                         *
    00020  *   Free Software Foundation, Inc.,                                       *
    00021  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
    00022  ***************************************************************************
    00023  *                                                                         *
    00024  *  DESCRIPTION                                                            *
    00025  *
    00026  *                                                                         *
    00027  *                                                                         *
    00028  *  $Log: mediator.h,v $
    00029  *  Revision 1.1  2009/08/10 07:34:49  guettler
    00030  *  -Base classes which support use of design pattern
    00031  *   mediator - similar to callbackable, but with more functionality:
    00032  *   The mediator takes a more central role in mediation, the collegues
    00033  *   are able to inform the mediator that something happend with
    00034  *   easy use of mediated events (MediatorEvent).
    00035  *                                                                                 *
    00036  *                                                                         *
    00037  **************************************************************************/
    00038 #ifndef __MEDIATOR_H_
    00039 #define __MEDIATOR_H_
    00040
    00041
    00042 #include "mediatorcollegue.h"
    00043 #include <vector>
    00044
    00045 /**
    00046  * The default MediatorEvent holds no information,
    00047  * the implementation of the mediator should implement a
    00048  * derived version of the MediatorEvent.
    00049  */
    00050 class MediatorEvent
    00051 {
    00052   public:
    00053 };
    00054
    00055 class Mediator
    00056 {
    00057   public:
    00058     typedef std::vector<MediatorCollegue*> MediatorCollegueListType;
    00059
    00060     Mediator();
    00061     virtual ~Mediator();
    00062
    00063     virtual void mediatorInformed(MediatorCollegue* source, MediatorEvent* event) = 0;
    00064
    00065     void addMediatorCollegue(MediatorCollegue* collegue);
    00066
    00067     void removeAllMediatorCollegues();
    00068
    00069     MediatorCollegue* getMediatorCollegue(int index);
    00070
    00071     unsigned int getMediatorCollegueIndex(MediatorCollegue* collegue);
    00072
    00073     unsigned int getNumberOfMediatorCollegues();
    00074
    00075     void mediate(int indexOfMediatorCollegue, MediatorEvent* event);
    00076
    00077     void mediate(MediatorCollegue* collegue, MediatorEvent* event);
    00078
    00079     void mediateToAll(MediatorEvent* event);
    00080
    00081     void mediateToAllQMP(MediatorEvent* event);
    00082
    00083
    00084
    00085   protected:
    00086
    00087
    00088   private:
    00089     MediatorCollegueListType collegueList;
    00090 };
    00091
    00092 #endif /* _MEDIATOR_H_ */