TrueReality  v0.1.1912
FrameStamp.h
Go to the documentation of this file.
1 /*
2 * True Reality Open Source Game and Simulation Engine
3 * Copyright © 2021 Acid Rain Studios LLC
4 *
5 * This library is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License as published by the Free
7 * Software Foundation; either version 3.0 of the License, or (at your option)
8 * any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * @author Maxim Serebrennik
20 */
21 
22 #pragma once
23 
24 #include <trCore/Export.h>
25 
26 #include <trBase/Base.h>
27 #include <trBase/SmrtPtr.h>
28 #include <trUtil/RefStr.h>
29 
30 #if defined(__sgi) || (defined(WIN32) && !defined(__MWERKS__))
31 #include <time.h>
32 #else
33 #include <ctime>
34 using std::tm;
35 #endif
36 
37 namespace osg
38 {
39  class FrameStamp;
40 }
41 
42 namespace trCore::Nodes
43 {
55  {
56  public:
57 
59 
60  const static trUtil::RefStr CLASS_TYPE;
61 
69  FrameStamp(const std::string name = CLASS_TYPE);
70 
79  FrameStamp(const osg::FrameStamp fs, const std::string name = CLASS_TYPE);
80 
88  virtual const std::string& GetType() const override;
89 
97  virtual void SetName(const std::string& name);
98 
106  virtual osg::FrameStamp* AsOSGClass();
107 
115  virtual const osg::FrameStamp* AsOSGClass() const;
116 
124  void SetFrameNumber(unsigned int fnum);
125 
133  unsigned int GetFrameNumber() const;
134 
142  void SetReferenceTime(double refTime);
143 
151  double GetReferenceTime() const;
152 
160  void SetSimulationTime(double refTime);
161 
169  double GetSimulationTime() const;
170 
178  void SetCalendarTime(const tm& calendarTime);
179 
187  void GetCalendarTime(tm& calendarTime) const;
188 
198  FrameStamp& operator = (const FrameStamp& fs);
199 
200  protected:
201 
204 
210  ~FrameStamp();
211  };
212 }
#define TR_CORE_EXPORT
Definition: trCore/Export.h:33
static const trUtil::RefStr CLASS_TYPE
Adds an easy and swappable access to the base class.
Definition: FrameStamp.h:60
Class which encapsulates the frame number, reference time and calendar time of specific frame...
Definition: FrameStamp.h:54
A string wrapper that will make sure that all of the strings with the same value will point to the sa...
Definition: RefStr.h:50
This class is part of the internal garbage collection system.
Definition: SmrtClass.h:38
This is a Base class that carries the Class name and Unique ID of all the derived classes...
Definition: trBase/Base.h:36
trBase::SmrtPtr< osg::FrameStamp > mFrameStamp
The frame stamp.
Definition: FrameStamp.h:203
Definition: FrameStamp.h:37