1 // Copyright (C) 2009 - 2012 Mathias Froehlich
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License as
5 // published by the Free Software Foundation; either version 2 of the
6 // License, or (at your option) any later version.
8 // This program is distributed in the hope that it will be useful, but
9 // WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include <simgear/hla/HLAFederate.hxx>
21 #include "AIBVHPager.hxx"
27 class AIManager : public simgear::HLAFederate {
32 virtual simgear::HLAObjectClass* createObjectClass(const std::string& name);
35 virtual bool update();
36 virtual bool shutdown();
38 void insert(const SGSharedPtr<AIObject>& aiObject);
39 void schedule(AIObject& object, const SGTimeStamp& simTime);
41 const SGTimeStamp& getSimTime() const
44 const AIBVHPager& getPager() const;
45 AIBVHPager& getPager();
47 /// For the list of ai object that are active
48 typedef std::list<SGSharedPtr<AIObject> > ObjectList;
49 /// For the schedule of the next update of an ai object
50 typedef std::map<SGTimeStamp, ObjectList> TimeStampObjectListMap;
52 typedef std::map<SGTimeStamp, ObjectList::iterator> TimeStampObjectListIteratorMap;
55 /// The current simulation time
57 /// The maximum time advance step size that is taken
60 /// Single element list that is used to store the currently worked on
61 /// ai object. This is a helper for any work method in the object.
62 ObjectList _currentObject;
64 /// List of objects that are inserted and need to be initialized
65 ObjectList _initObjectList;
66 /// List of running and ready to use objects, is in execution order
67 ObjectList _objectList;
68 /// Map of insert points for specific simulation times
69 TimeStampObjectListIteratorMap _timeStampObjectListIteratorMap;
71 /// for paging bounding volume trees