00001 /*************************************************************************** 00002 * Copyright (C) 2006-2008 by Antonello Lobianco * 00003 * http://regmas.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 3 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef STDSUPERAGENTMANAGER_H 00021 #define STDSUPERAGENTMANAGER_H 00022 00023 // standard headers 00024 #include <string> 00025 #include <vector> 00026 #include <stdexcept> 00027 #include <iostream> 00028 #include <sstream> 00029 00030 // regmas headers... 00031 #include "BaseRegmas.h" 00032 #include "Gis.h" 00033 #include "RegData.h" 00034 00035 00036 class Manager_base; 00037 00039 00061 class SuperAgentManager: public BaseRegmas{ 00062 00063 public: 00064 SuperAgentManager(ThreadManager* MTHREAD_h); 00065 ~SuperAgentManager(); 00066 00068 vector<string> getAgentTypeNames(); 00070 vector<int> getAgentCountByType(); 00072 vector<Manager_base*> getManagers(){return managers;}; 00073 00075 void addManager(Manager_base* manager_h){managers.push_back(manager_h);}; 00077 void setAgentMoulds(); 00079 void populateAgents(); 00081 void locate(); 00083 void assignObjectsToAgents(); 00085 void assignSpatialObjectsToAgents(); 00086 int getNewUniqueAgentID(){int toReturn=uniqueAgentIDCounter; uniqueAgentIDCounter++; return toReturn;} 00087 int getNewUniqueManagerID(){int toReturn=uniqueManagerIDCounter; uniqueManagerIDCounter++; return toReturn;} 00089 void rescaleMoulds(double factor_h); 00091 void createBehaviours(); 00093 void endInit(); 00094 00096 void prepare(); 00098 void act(); 00100 void update(); 00102 void planNext(); 00103 00104 vector <Agent_base*> getAgentsByType(bool onlySpatial, string category_h=""); 00105 00106 private: 00107 vector <Manager_base*> managers; 00108 int uniqueAgentIDCounter; 00109 int uniqueManagerIDCounter; 00110 }; 00111 00112 #endif