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

# mediator.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  *   Copyright (C) 2005-2011 LpzRobots development team                    *
    00003  *    Georg Martius  <georg dot martius at web dot de>                     *
    00004  *    Frank Guettler <guettler at informatik dot uni-leipzig dot de        *
    00005  *    Frank Hesse    <frank at nld dot ds dot mpg dot de>                  *
    00006  *    Ralf Der       <ralfder at mis dot mpg dot 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 #ifndef __MEDIATOR_H_
    00025 #define __MEDIATOR_H_
    00026
    00027
    00028 #include "mediatorcollegue.h"
    00029 #include <vector>
    00030
    00031 /**
    00032  * The default MediatorEvent holds no information,
    00033  * the implementation of the mediator should implement a
    00034  * derived version of the MediatorEvent.
    00035  */
    00036 class MediatorEvent
    00037 {
    00038   public:
    00039 };
    00040
    00041 class Mediator
    00042 {
    00043   public:
    00044     typedef std::vector<MediatorCollegue*> MediatorCollegueListType;
    00045
    00046     Mediator();
    00047     virtual ~Mediator();
    00048
    00049     virtual void mediatorInformed(MediatorCollegue* source, MediatorEvent* event) = 0;
    00050
    00051     void addMediatorCollegue(MediatorCollegue* collegue);
    00052
    00053     void removeMediatorCollegue(MediatorCollegue *collegue);
    00054
    00055     void removeAllMediatorCollegues();
    00056
    00057     MediatorCollegue* getMediatorCollegue(unsigned int index);
    00058
    00059     unsigned int getMediatorCollegueIndex(MediatorCollegue* collegue);
    00060
    00061     unsigned int getNumberOfMediatorCollegues();
    00062
    00063     void mediate(unsigned int indexOfMediatorCollegue, MediatorEvent* event);
    00064
    00065     void mediate(MediatorCollegue* collegue, MediatorEvent* event);
    00066
    00067     void mediateToAll(MediatorEvent* event);
    00068
    00069     void mediateToAllQMP(MediatorEvent* event);
    00070
    00071
    00072
    00073   protected:
    00074
    00075
    00076   private:
    00077     MediatorCollegueListType collegueList;
    00078 };
    00079
    00080 #endif /* _MEDIATOR_H_ */