FrameStamp
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_FRAMESTAMP
#define OSG_FRAMESTAMP 1
#include <osg/Referenced>
#if defined(__sgi) || (defined(WIN32) && !defined(__MWERKS__))
#include <time.h>
#else
#include <ctime>
using std::tm;
#endif
namespace osg
{
class OSG_EXPORT FrameStamp : public Referenced
{
public:
FrameStamp();
FrameStamp(const FrameStamp& fs);
FrameStamp& operator = (const FrameStamp& fs);
void setFrameNumber(unsigned int fnum) { _frameNumber = fnum; }
unsigned int getFrameNumber() const { return _frameNumber; }
void setReferenceTime(double refTime) { _referenceTime = refTime; }
double getReferenceTime() const { return _referenceTime; }
void setSimulationTime(double refTime) { _simulationTime = refTime; }
double getSimulationTime() const { return _simulationTime; }
void setCalendarTime(const tm& calendarTime);
void getCalendarTime(tm& calendarTime) const;
// keep public to allow it to be permit allocation which is
// not on the heap used osgcluster
virtual ~FrameStamp();
protected:
// note no dynamic memory is used so that data can be passed
// via a simple memory copy or within a data packet across
// the network.
unsigned int _frameNumber;
double _referenceTime;
double _simulationTime;
// member variables of time.h's tm structure, copied here to
// ensure that all data is not dynamic. The tm structure itself
// is not completely consistent between implementations, which
// could be a problem when sending the FrameStamp across a network
// with different versions of tm (i.e mixing Unix and Windows.)
int tm_sec; /* Seconds. [0-60] (1 leap second) */
int tm_min; /* Minutes. [0-59] */
int tm_hour; /* Hours. [0-23] */
int tm_mday; /* Day. [1-31] */
int tm_mon; /* Month. [0-11] */
int tm_year; /* Year - 1900. */
int tm_wday; /* Day of week. [0-6] */
int tm_yday; /* Days in year. [0-365] */
int tm_isdst; /* DST. [-1/0/1]*/
};
}
#endif
Referenced
osg::FrameStamp::setSimulationTime
void setSimulationTime(double refTime)
Definition FrameStamp:49
osg::FrameStamp::FrameStamp
FrameStamp()
osg::FrameStamp::tm_mday
int tm_mday
Definition FrameStamp:78
osg::FrameStamp::FrameStamp
FrameStamp(const FrameStamp &fs)
osg::FrameStamp::getSimulationTime
double getSimulationTime() const
Definition FrameStamp:50
osg::FrameStamp::_frameNumber
unsigned int _frameNumber
Definition FrameStamp:66
osg::FrameStamp::tm_year
int tm_year
Definition FrameStamp:80
osg::FrameStamp::getCalendarTime
void getCalendarTime(tm &calendarTime) const
osg::FrameStamp::tm_min
int tm_min
Definition FrameStamp:76
osg::FrameStamp::tm_isdst
int tm_isdst
Definition FrameStamp:83
osg::FrameStamp::setReferenceTime
void setReferenceTime(double refTime)
Definition FrameStamp:46
osg::FrameStamp::setCalendarTime
void setCalendarTime(const tm &calendarTime)
osg::FrameStamp::tm_hour
int tm_hour
Definition FrameStamp:77
osg::FrameStamp::tm_wday
int tm_wday
Definition FrameStamp:81
osg::FrameStamp::~FrameStamp
virtual ~FrameStamp()
osg::FrameStamp::getFrameNumber
unsigned int getFrameNumber() const
Definition FrameStamp:44
osg::FrameStamp::_simulationTime
double _simulationTime
Definition FrameStamp:68
osg::FrameStamp::tm_yday
int tm_yday
Definition FrameStamp:82
osg::FrameStamp::_referenceTime
double _referenceTime
Definition FrameStamp:67
osg::FrameStamp::tm_sec
int tm_sec
Definition FrameStamp:75
osg::FrameStamp::tm_mon
int tm_mon
Definition FrameStamp:79
osg::FrameStamp::getReferenceTime
double getReferenceTime() const
Definition FrameStamp:47
osg::FrameStamp::setFrameNumber
void setFrameNumber(unsigned int fnum)
Definition FrameStamp:43
osg::Referenced::Referenced
Referenced()
osg
Definition AlphaFunc:19
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39