From 63ccb3df4c195124acb660c2ac7e11a42677476a Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 13 Nov 2011 20:34:39 +0000 Subject: [PATCH] std:: namespace fixes, and sink some code from the subsystem header into the implementation. (Hopefully more to follow) --- simgear/structure/SGSmplhist.cxx | 8 +++++--- simgear/structure/SGSmplhist.hxx | 6 ------ simgear/structure/SGSmplstat.cxx | 3 --- simgear/structure/SGSmplstat.hxx | 6 +----- simgear/structure/subsystem_mgr.cxx | 28 +++++++++++++++++++++++++++- simgear/structure/subsystem_mgr.hxx | 29 +++-------------------------- 6 files changed, 36 insertions(+), 44 deletions(-) diff --git a/simgear/structure/SGSmplhist.cxx b/simgear/structure/SGSmplhist.cxx index 73b3f553..760704b3 100644 --- a/simgear/structure/SGSmplhist.cxx +++ b/simgear/structure/SGSmplhist.cxx @@ -15,9 +15,11 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifdef __GNUG__ -#pragma implementation + +#ifdef HAVE_CONFIG_H +#include #endif + #include #include #include "SGSmplhist.hxx" @@ -94,7 +96,7 @@ int SampleHistogram::similarSamples (double d) return (0); } -void SampleHistogram::printBuckets (ostream & s) +void SampleHistogram::printBuckets (std::ostream & s) { for (int i = 0; i < howManyBuckets; i++) { diff --git a/simgear/structure/SGSmplhist.hxx b/simgear/structure/SGSmplhist.hxx index 36ddc502..67a9928c 100644 --- a/simgear/structure/SGSmplhist.hxx +++ b/simgear/structure/SGSmplhist.hxx @@ -16,13 +16,7 @@ License along with this library; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifdef HAVE_CONFIG_H -#include -#endif #ifndef SampleHistogram_h -#ifdef __GNUG__ -#pragma interface -#endif #define SampleHistogram_h 1 #include diff --git a/simgear/structure/SGSmplstat.cxx b/simgear/structure/SGSmplstat.cxx index 6c1afde7..6d071be9 100644 --- a/simgear/structure/SGSmplstat.cxx +++ b/simgear/structure/SGSmplstat.cxx @@ -15,9 +15,6 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifdef __GNUG__ -#pragma implementation -#endif #include diff --git a/simgear/structure/SGSmplstat.hxx b/simgear/structure/SGSmplstat.hxx index 1d1e8d57..d815f400 100644 --- a/simgear/structure/SGSmplstat.hxx +++ b/simgear/structure/SGSmplstat.hxx @@ -16,17 +16,13 @@ License along with this library; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef SampleStatistic_h -#ifdef __GNUG__ -#pragma interface -#endif + #define SampleStatistic_h 1 #undef min #undef max -using namespace std; - class SampleStatistic { protected: diff --git a/simgear/structure/subsystem_mgr.cxx b/simgear/structure/subsystem_mgr.cxx index a59d6ef0..8265f9b3 100644 --- a/simgear/structure/subsystem_mgr.cxx +++ b/simgear/structure/subsystem_mgr.cxx @@ -29,7 +29,7 @@ #include "subsystem_mgr.hxx" #include - +#include "SGSmplstat.hxx" const int SG_MAX_SUBSYSTEM_EXCEPTIONS = 4; //////////////////////////////////////////////////////////////////////// @@ -132,6 +132,32 @@ void SGSubsystem::stamp(const string& name) // Implementation of SGSubsystemGroup. //////////////////////////////////////////////////////////////////////// +class SGSubsystemGroup::Member +{ +private: + Member (const Member &member); +public: + Member (); + virtual ~Member (); + + virtual void update (double delta_time_sec); + void printTimingInformation(double time); + void printTimingStatistics(double minMaxTime=0.0,double minJitter=0.0); + void updateExecutionTime(double time); + double getTimeWarningThreshold(); + void collectDebugTiming (bool collect) { collectTimeStats = collect; }; + + SampleStatistic timeStat; + std::string name; + SGSubsystem * subsystem; + double min_step_sec; + double elapsed_sec; + bool collectTimeStats; + int exceptionCount; +}; + + + SGSubsystemGroup::SGSubsystemGroup () : _fixedUpdateTime(-1.0), _updateTimeRemainder(0.0) diff --git a/simgear/structure/subsystem_mgr.hxx b/simgear/structure/subsystem_mgr.hxx index 60313fd4..f1e2ad9a 100644 --- a/simgear/structure/subsystem_mgr.hxx +++ b/simgear/structure/subsystem_mgr.hxx @@ -1,3 +1,4 @@ + // Written by David Megginson, started 2000-12 // // Copyright (C) 2000 David Megginson, david@megginson.com @@ -31,7 +32,6 @@ #include #include -#include "SGSmplstat.hxx" class TimingInfo @@ -331,31 +331,8 @@ public: void set_fixed_update_time(double fixed_dt); private: - class Member { - - private: - Member (const Member &member); - public: - Member (); - virtual ~Member (); - - virtual void update (double delta_time_sec); - void printTimingInformation(double time); - void printTimingStatistics(double minMaxTime=0.0,double minJitter=0.0); - void updateExecutionTime(double time); - double getTimeWarningThreshold(); - void collectDebugTiming (bool collect) { collectTimeStats = collect; }; - - SampleStatistic timeStat; - std::string name; - SGSubsystem * subsystem; - double min_step_sec; - double elapsed_sec; - bool collectTimeStats; - int exceptionCount; - }; - - Member * get_member (const std::string &name, bool create = false); + class Member; + Member* get_member (const std::string &name, bool create = false); std::vector _members; -- 2.39.5