1 #pragma once 2 // Description: 3 // Particle group manager. 4 // 5 // Copyright (C) 2001 Frank Becker 6 // 7 // This program is free software; you can redistribute it and/or modify it under 8 // the terms of the GNU General Public License as published by the Free Software 9 // Foundation; either version 2 of the License, or (at your option) any later 10 // version. 11 // 12 // This program is distributed in the hope that it will be useful, but WITHOUT 13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details 15 // 16 17 #include <string> 18 #include <list> 19 #include <hashMap.hpp> 20 21 #include <HashString.hpp> 22 #include <Singleton.hpp> 23 24 class ParticleGroup; 25 26 class ParticleGroupManager 27 { 28 friend class Singleton<ParticleGroupManager>; 29 public: 30 bool init( void); 31 void reset( void); 32 void draw( void); 33 bool update( void); 34 35 void addGroup( const std::string &groupName, int groupSize); 36 void addLink( const std::string &group1, const std::string &group2); 37 ParticleGroup *getParticleGroup( const std::string &groupName); 38 39 int getAliveCount( void); 40 41 private: 42 ~ParticleGroupManager(); 43 ParticleGroupManager( void); 44 45 ParticleGroupManager( const ParticleGroupManager&); 46 ParticleGroupManager &operator=(const ParticleGroupManager&); 47 48 hash_map< 49 const std::string, ParticleGroup*, hash<const std::string>, std::equal_to<const std::string> > _particleGroupMap; 50 std::list<ParticleGroup*> _particleGroupList; 51 52 struct LinkedParticleGroup 53 { 54 ParticleGroup *group1; 55 ParticleGroup *group2; 56 }; 57 58 std::list<LinkedParticleGroup*> _linkedParticleGroupList; 59 }; 60 61 typedef Singleton<ParticleGroupManager> ParticleGroupManagerS; 62