Templated helper to retrieve a subsystem
- example of naming a subsystem
This commit is contained in:
@@ -268,6 +268,7 @@ public:
|
|||||||
const std::string& get_vendor() { return _vendor; }
|
const std::string& get_vendor() { return _vendor; }
|
||||||
const std::string& get_renderer() { return _renderer; }
|
const std::string& get_renderer() { return _renderer; }
|
||||||
|
|
||||||
|
static const char* subsystemName() { return "sound"; };
|
||||||
private:
|
private:
|
||||||
class SoundManagerPrivate;
|
class SoundManagerPrivate;
|
||||||
/// private implementation object
|
/// private implementation object
|
||||||
@@ -298,5 +299,3 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
#endif // _SG_SOUNDMGR_OPENAL_HXX
|
#endif // _SG_SOUNDMGR_OPENAL_HXX
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -414,6 +414,12 @@ public:
|
|||||||
void reportTiming();
|
void reportTiming();
|
||||||
void setReportTimingCb(void* userData,SGSubsystemTimingCb cb) {reportTimingCb = cb;reportTimingUserData = userData;}
|
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:
|
private:
|
||||||
std::vector<SGSubsystemGroupRef> _groups;
|
std::vector<SGSubsystemGroupRef> _groups;
|
||||||
unsigned int _initPosition;
|
unsigned int _initPosition;
|
||||||
|
|||||||
Reference in New Issue
Block a user