#include <vector>
#include <map>
#include <memory> // for std::auto_ptr
-
+
#include <simgear/compiler.h>
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/math/SGMath.hxx>
void init();
void update(double dt);
-
+
void suspend();
void resume();
void stop();
*/
bool add( SGSampleGroup *sgrp, const std::string& refname );
- /**
+ /**
* Remove a sample group from the sound manager.
* @param refname Reference name of the sample group to remove
* @return true if successful, false otherwise
const std::string& get_vendor() { return _vendor; }
const std::string& get_renderer() { return _renderer; }
+ static const char* subsystemName() { return "sound"; };
private:
class SoundManagerPrivate;
/// private implementation object
std::auto_ptr<SoundManagerPrivate> d;
-
+
bool _active;
bool _changed;
float _volume;
#endif // _SG_SOUNDMGR_OPENAL_HXX
-
-
std::string eventName;
SGTimeStamp time;
-public:
+public:
TimingInfo(const std::string& name, const SGTimeStamp &t) :
eventName(name), time(t)
{ }
INIT_DONE, ///< subsystem is fully initialised
INIT_CONTINUE ///< init should be called again
} InitStatus;
-
+
virtual InitStatus incrementalInit ();
/**
* </p>
*/
virtual void shutdown ();
-
+
/**
* Acquire the subsystem's property bindings.
*
void reportTiming(void);
/**
- * Place time stamps at strategic points in the execution of subsystems
+ * Place time stamps at strategic points in the execution of subsystems
* update() member functions. Predominantly for debugging purposes.
*/
void stamp(const std::string& name);
*
*/
void set_fixed_update_time(double fixed_dt);
-
+
/**
* retrive list of member subsystem names
- */
+ */
string_list member_names() const;
-
+
private:
class Member;
typedef std::vector<Member *> MemberVec;
MemberVec _members;
-
+
double _fixedUpdateTime;
double _updateTimeRemainder;
-
+
/// index of the member we are currently init-ing
unsigned int _initPosition;
};
virtual void add (const char * name,
SGSubsystem * subsystem,
- GroupType group = GENERAL,
+ GroupType group = GENERAL,
double min_time_sec = 0);
/**
void reportTiming();
void setReportTimingCb(void* userData,SGSubsystemTimingCb cb) {reportTimingCb = cb;reportTimingUserData = userData;}
+ template<class T>
+ T* get_subsystem() const
+ {
+ return dynamic_cast<T*>(get_subsystem(T::subsystemName()));
+ }
+
private:
std::vector<SGSubsystemGroupRef> _groups;
unsigned int _initPosition;