Coin Logo http://www.sim.no/
http://www.coin3d.org/

SbTime.h
1 #ifndef COIN_SBTIME_H
2 #define COIN_SBTIME_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) by Kongsberg Oil & Gas Technologies.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Kongsberg Oil & Gas Technologies
18  * about acquiring a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <stdio.h>
28 
29 #include <Inventor/system/inttypes.h>
30 #include <Inventor/SbBasic.h>
31 #include <Inventor/SbString.h>
32 
33 // Avoid problem with Microsoft Visual C++ Win32 API headers (they
34 // #define "max" (in 3 different header files, no less)).
35 #ifdef max
36 #define SBTIME_UNDEF_MAX
37 #undef max
38 #endif // max
39 
40 
41 class COIN_DLL_API SbTime {
42 public:
43  SbTime(void);
44  SbTime(const double sec);
45  SbTime(const int32_t sec, const long usec);
46  SbTime(const struct timeval * const tv);
47  static SbTime getTimeOfDay(void);
48  void setToTimeOfDay(void);
49  static SbTime zero(void);
50 
51  static SbTime max(void);
52  static SbTime maxTime(void);
53  static void sleep(int msec);
54  void setValue(const double sec);
55  void setValue(const int32_t sec, const long usec);
56  void setValue(const struct timeval * const tv);
57  void setMsecValue(const unsigned long msec);
58  double getValue(void) const;
59  void getValue(time_t & sec, long & usec) const;
60  void getValue(struct timeval * tv) const;
61  unsigned long getMsecValue(void) const;
62  SbString format(const char * const fmt = "%S.%i") const;
63  SbString formatDate(const char * const fmt = NULL) const;
64  SbBool parsedate(const char * const date);
65  friend COIN_DLL_API SbTime operator +(const SbTime & t0, const SbTime & t1);
66  friend COIN_DLL_API SbTime operator -(const SbTime & t0, const SbTime & t1);
67  SbTime & operator +=(const SbTime & tm);
68  SbTime & operator -=(const SbTime & tm);
69  SbTime operator-(void) const;
70  friend COIN_DLL_API SbTime operator *(const double s, const SbTime & tm);
71  friend COIN_DLL_API SbTime operator *(const SbTime & tm, const double s);
72  friend COIN_DLL_API SbTime operator /(const SbTime & tm, const double s);
73  SbTime & operator *=(const double s);
74  SbTime & operator /=(const double s);
75  double operator /(const SbTime & tm) const;
76  SbTime operator %(const SbTime & tm) const;
77  int operator ==(const SbTime & tm) const;
78  int operator !=(const SbTime & tm) const;
79  SbBool operator <(const SbTime & tm) const;
80  SbBool operator >(const SbTime & tm) const;
81  SbBool operator <=(const SbTime & tm) const;
82  SbBool operator >=(const SbTime & tm) const;
83 
84  void print(FILE * fp) const;
85 
86 private:
87  double dtime;
88  void addToString(SbString & str, const double val) const;
89 };
90 
91 COIN_DLL_API SbTime operator +(const SbTime & t0, const SbTime & t1);
92 COIN_DLL_API SbTime operator -(const SbTime & t0, const SbTime & t1);
93 COIN_DLL_API SbTime operator *(const double s, const SbTime & tm);
94 COIN_DLL_API SbTime operator *(const SbTime & tm, const double s);
95 COIN_DLL_API SbTime operator /(const SbTime & tm, const double s);
96 
97 // Avoid problem with Microsoft Win32 API headers (see above).
98 // Redefine macro max() back to a definition compatible with what it
99 // is in the MSVC header files.
100 #ifdef SBTIME_UNDEF_MAX
101 #define max(a,b) (((a) > (b)) ? (a) : (b))
102 #undef SBTIME_UNDEF_MAX
103 #endif // SBTIME_UNDEF_MAX
104 
105 #endif // !COIN_SBTIME_H
SbVec2d operator*(const SbVec2d &v, double d)
Definition: SbVec2d.h:82
SbVec2d operator-(const SbVec2d &v1, const SbVec2d &v2)
Definition: SbVec2d.h:99
The SbTime class instances represents time values.SbTime is a convenient way of doing system independ...
Definition: SbTime.h:41
SbVec2d operator/(const SbVec2d &v, double d)
Definition: SbVec2d.h:90
SbVec2d operator+(const SbVec2d &v1, const SbVec2d &v2)
Definition: SbVec2d.h:95
The SbString class is a string class with convenience functions for string operations.This is the class used for storing and working with character strings. It automatically takes care of supporting all the &quot;bookkeeping&quot; tasks usually associated with working with character strings, like memory allocation and deallocation etc.
Definition: SbString.h:42

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Fri Sep 9 2016 for Coin by Doxygen 1.8.5.