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

# globaldatabase.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
    00025 #ifndef __GLOBALDATABASE_H_
    00026 #define __GLOBALDATABASE_H_
    00027
    00028 #include "agent.h"
    00029 #include "configurablelist.h"
    00030
    00031 #ifndef NOCONFIGURATOR
    00032 namespace lpzrobots {
    00033   class ConfiguratorProxy;
    00034 }
    00035 #endif
    00036
    00037 typedef std::vector<Agent*> AgentList;
    00038
    00039 class GlobalDataBase {
    00040   public:
    00041     GlobalDataBase();
    00042
    00043     virtual ~GlobalDataBase();
    00044
    00045     virtual AgentList& getAgents() = 0;
    00046
    00047     template <typename Derived> struct dynamic_agent_caster {
    00048         Agent* operator()(Derived instance) { return dynamic_cast<Agent*>(instance); }
    00049     };
    00050
    00051     /**
    00052      * Creates the Configurator and, if already exists, destroys the old one.
    00053      */
    00054     void createConfigurator();
    00055
    00056     /**
    00057      * Destroys the Configurator if it was created.
    00058      */
    00059     void removeConfigurator();
    00060
    00061     /**
    00062      * @return true if the Configurator is open and alive
    00063      */
    00064     bool isConfiguratorOpen();
    00065
    00066     ConfigurableList configs;
    00067
    00068 #ifndef NOCONFIGURATOR
    00069     lpzrobots::ConfiguratorProxy * configurator;
    00070 #else
    00071     void* configurator;
    00072 #endif
    00073
    00074 };
    00075
    00076 #endif /* __GLOBALDATABASE_H_ */