| 1 | // Copyright (C) 2009 - 2012 Mathias Froehlich |
| 2 | // |
| 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. |
| 7 | // |
| 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. |
| 12 | // |
| 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. |
| 16 | |
| 17 | #ifndef AISubsystem_hxx |
| 18 | #define AISubsystem_hxx |
| 19 | |
| 20 | #include <list> |
| 21 | #include <simgear/structure/SGWeakReferenced.hxx> |
| 22 | #include <simgear/timing/timestamp.hxx> |
| 23 | |
| 24 | namespace fgai { |
| 25 | |
| 26 | class AIObject; |
| 27 | |
| 28 | class AISubsystem : public SGWeakReferenced { |
| 29 | public: |
| 30 | AISubsystem() |
| 31 | { } |
| 32 | virtual ~AISubsystem() |
| 33 | { } |
| 34 | |
| 35 | virtual void update(AIObject& object, const SGTimeStamp& dt) = 0; |
| 36 | }; |
| 37 | |
| 38 | class AISubsystemGroup : public AISubsystem { |
| 39 | public: |
| 40 | AISubsystemGroup() |
| 41 | { } |
| 42 | virtual ~AISubsystemGroup() |
| 43 | { } |
| 44 | |
| 45 | virtual void update(AIObject& object, const SGTimeStamp& dt) |
| 46 | { |
| 47 | for (SubsystemList::iterator i = _subsystemList.begin(); |
| 48 | i != _subsystemList.end(); ++i) { |
| 49 | (*i)->update(object, dt); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | private: |
| 54 | typedef std::list<SGSharedPtr<AISubsystem> > SubsystemList; |
| 55 | SubsystemList _subsystemList; |
| 56 | }; |
| 57 | |
| 58 | } // namespace fgai |
| 59 | |
| 60 | #endif |