Add explicit default constructor and copy constructor to class Time

This commit is contained in:
Erik Broberg
2016-05-31 19:50:11 -04:00
parent 6d4c9331dd
commit 9ddb54d546
2 changed files with 43 additions and 0 deletions
+4
View File
@@ -58,6 +58,10 @@ class SyncBuffer;
class Time {
public:
Time();
Time(const Time& other);
/**
* Initializes the Time singleton.
* \return <code>true</code> if the initialization succeeded, <code>false</code>
+39
View File
@@ -37,6 +37,45 @@ namespace openspace {
Time* Time::_instance = nullptr;
Time::Time()
: _time(-1.0)
, _dt(1.0)
//local copies
, _timeJumped(false)
, _timePaused(false)
, _jockeHasToFixThisLater(false)
//shared copies
, _sharedTime(-1.0)
, _sharedDt(1.0)
, _sharedTimeJumped(false)
//synced copies
, _syncedTime(-1.0)
, _syncedDt(1.0)
, _syncedTimeJumped(false)
{
}
Time::Time(const Time& other)
: _time(other._time)
, _dt(other._dt)
//local copies
, _timeJumped(other._timeJumped)
, _timePaused(other._timePaused)
, _jockeHasToFixThisLater(other._jockeHasToFixThisLater)
//shared copies
, _sharedTime(other._sharedTime)
, _sharedDt(other._sharedDt)
, _sharedTimeJumped(other._sharedTimeJumped)
//synced copies
, _syncedTime(other._syncedTime)
, _syncedDt(other._syncedDt)
, _syncedTimeJumped(other._syncedTimeJumped)
{
}
void Time::initialize() {
ghoul_assert(_instance == nullptr, "Static time must not have been ininitialized");
_instance = new Time();