fbsdk/fbtime.h Source File

fbtime.h
Go to the documentation of this file.
1 #ifndef __FBTIME_H__
2 #define __FBTIME_H__
3 /**************************************************************************
4  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5  All Rights Reserved.
6 
7  The coded instructions, statements, computer programs, and/or related
8  material (collectively the "Data") in these files contain unpublished
9  information proprietary to Autodesk, Inc. and/or its licensors, which is
10  protected by Canada and United States of America federal copyright law
11  and by international treaties.
12 
13  The Data may not be disclosed or distributed to third parties, in whole
14  or in part, without the prior written consent of Autodesk, Inc.
15  ("Autodesk").
16 
17  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24  FREE.
25 
26  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36 
37 **************************************************************************/
38 
43 #include <kaydaradef.h>
44 
45 #ifndef FBSDK_DLL
46 
49  #define FBSDK_DLL K_DLLIMPORT
50 #endif
51 
52 #include <fbsdk/fbstring.h>
53 
54 #ifdef FBSDKUseNamespace
55  namespace FBSDKNamespace {
56 #endif
57 
59 // FBTime
61 
63 enum FBTimeMode {
81 };
82 
83 FB_FORWARD( FBTime );
84 
87 {
88  private:
89  kLongLong mTime;
90  public:
91 
94  {
97  eDefaultFormat
98  };
99 
100  /* Constructor.
101  * \param pTime Time to initialize with(default=0).
102  */
103  FBTime( kLongLong pTime=0);
104 
113  FBTime (int pHour,int pMinute,int pSecond=0,int pFrame=0,int pField=0, FBTimeMode pTimeMode=kFBTimeModeDefault);
114 
120  FBString GetTimeString(FBTimeMode pMode=kFBTimeModeDefault, ETimeFormats pFormat = eDefaultFormat);
121 
125  void SetTimeString(const char *pTime);
126 
137  bool GetTime(int &pHour, int &pMinute, int &pSecond, int &pFrame, int &pField, int &pMilliSecond, FBTimeMode pTimeMode=kFBTimeModeDefault );
141  kLongLong GetMilliSeconds();
142 
146  void SetMilliSeconds(kLongLong pMilliSeconds);
147 
151  kLongLong& Get();
152 
156  const kLongLong& Get() const;
157 
161  void Set( kLongLong pTime );
162 
166  double GetSecondDouble();
167 
171  void SetSecondDouble(double pTime);
172 
181  void SetTime (int pHour,int pMinute=0,int pSecond=0,int pFrame=0,int pField=0, FBTimeMode pTimeMode=kFBTimeModeDefault);
182 
184 
188  FBTime& operator= (const FBTime& pTime);
189  FBTime& operator+= (const FBTime& pTime);
190  FBTime& operator-= (const FBTime& pTime);
191  FBTime& operator*= (const FBTime& pTime);
192  FBTime& operator/= (const FBTime& pTime);
194 
196 
200  FBTime& operator= (double pConstant);
201  FBTime& operator+= (double pConstant);
202  FBTime& operator-= (double pConstant);
203  FBTime& operator*= (double pConstant);
204  FBTime& operator/= (double pConstant);
206 
208 
212  FBTime operator- (const FBTime &pTime);
213  FBTime operator+ (const FBTime &pTime);
214  FBTime operator/ (const FBTime &pTime);
215  FBTime operator* (const FBTime &pTime);
217 
219 
223  FBTime operator- (double pConstant);
224  FBTime operator+ (double pConstant);
225  FBTime operator/ (double pConstant);
226  FBTime operator* (double pConstant);
228 
230 
234  bool operator== (const FBTime& pTime);
235  bool operator!= (const FBTime& pTime);
236  bool operator>= (const FBTime& pTime);
237  bool operator<= (const FBTime& pTime);
238  bool operator> (const FBTime& pTime);
239  bool operator< (const FBTime& pTime);
241 
247  kLongLong GetFrame(FBTimeMode pTimeMode=kFBTimeModeDefault);
248 
253  void SetFrame(kLongLong pFrames, FBTimeMode pTimeMode=kFBTimeModeDefault);
254 
256  static const FBTime Infinity;
257 
259  static const FBTime MinusInfinity;
260 
262  static const FBTime Zero;
263 
265  static const FBTime Epsilon;
266 
268  static const FBTime OneSecond;
269 
271  static const FBTime OneMinute;
272 
274  static const FBTime OneHour;
275 };
276 
278 
281 {
282  private:
283  double mSecond;
284  double mFrame;
285  double mRate;
286  public:
287 
291  FBTimeCode(float pRate=FRAMES_30);
292 
299  void SetTimeCode(int pHour,int pMinute=0,int pSecond=0,float pFrame=0);
300 
305  FBString GetTimeCodeString(FBTime::ETimeFormats pFormat = FBTime::eDefaultFormat);
306 
311  void SetTimeCodeString(const char *pTime, FBTime::ETimeFormats pFormat = FBTime::eDefaultFormat);
312 
315  FBTime GetTime() const;
316 
320  void SetTime(FBTime pTime);
321 
324  double GetFrame() const;
325 
329  void SetFrame(double pFrame);
330 
333  float GetFrameRate() const;
334 
338  double GetRawSecond() const;
339 
343  double GetRawFrame() const;
344 
348  double GetRawRate() const;
349 
354  bool operator==(const FBTimeCode& pTimeCode)const;
355 
360  bool operator!=(const FBTimeCode& pTimeCode)const;
361 
362 
364  static const float NTSC_DROP;
365  static const float NTSC_FULL;
366  static const float PAL_25;
367  static const float MPAL_30;
368  static const float FILM_24;
369  static const float FILM_23976;
370  static const float FRAMES_30;
371  static const float FRAMES_5994;
372 };
373 
375 // FBTimeSpan
377 
379 
382 {
383  private:
384  FBTime mStart;
385  FBTime mStop;
386  public:
391  FBTimeSpan( FBTime pStart=0,FBTime pStop=0);
392 
394 
397  FBTime& GetStart();
398  FBTime& GetStop();
399  const FBTime& GetStart() const;
400  const FBTime& GetStop() const;
402 
407  void Set( FBTime pStart, FBTime pStop );
408 
412  FBTime GetDuration();
413 
417  FBTime GetSignedDuration();
418 
423  int GetDirection();
424 
429  bool operator& (FBTime &pTime);
430 
434  FBTimeSpan operator& (FBTimeSpan &pTimeSpan);
435 };
437 // Global
439 #ifdef FBSDKUseNamespace
440  }
441 #endif
442 
443 #endif
444 
static const float FRAMES_5994
-59.94f
Definition: fbtime.h:371
#define Set(a0, a1, a2, a3)
Definition: Python-ast.h:467
1000 : 1 millisecond
Definition: fbtime.h:65
TimeCode data structure.
Definition: fbtime.h:280
Custom framerate.
Definition: fbtime.h:80
FBTimeMode
Different time modes available.
Definition: fbtime.h:63
static const float PAL_25
-25.0f
Definition: fbtime.h:366
static const FBTime MinusInfinity
Time constant: Minus Infinity, the lowest negative time value.
Definition: fbtime.h:259
static const float MPAL_30
-29.971f Currently not supported : "1" is added just to differentiate from NTSC_FULL(-29.97f)
Definition: fbtime.h:367
Basic string class.
Definition: fbstring.h:66
static const FBTime Epsilon
Time constant: Epsilon, the smallest time increment.
Definition: fbtime.h:265
static const FBTime Zero
Time constant: Zero.
Definition: fbtime.h:262
static const float FILM_23976
-23.976f
Definition: fbtime.h:369
format as SMPTE
Definition: fbtime.h:95
static const FBTime OneMinute
Time constant: One Minute.
Definition: fbtime.h:271
static const FBTime Infinity
Time constant: Infinity, the largest time value.
Definition: fbtime.h:256
FBString operator+(const FBString &p1Str, const char *p2Str)
#define FBSDKNamespace
FBSDKNamespace define.
Definition: fbversion.h:64
ETimeFormats
Different time format available.
Definition: fbtime.h:93
Time data structure.
Definition: fbtime.h:86
static const float FILM_24
-24.0f
Definition: fbtime.h:368
Default Time Mode.
Definition: fbtime.h:64
#define FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:62
bool operator==(const FBPickInfos &pLhs, const FBPickInfos &pRhs)
format as numeric frame
Definition: fbtime.h:96
TimeSpan class.
Definition: fbtime.h:381
static const FBTime OneHour
Time constant: One Hour.
Definition: fbtime.h:274
static const float NTSC_FULL
-29.97f
Definition: fbtime.h:365
String class.
static const float FRAMES_30
-30.0f
Definition: fbtime.h:370
static const FBTime OneSecond
Time constant: One Second.
Definition: fbtime.h:268
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbtime.h:49
static const float NTSC_DROP
Rates.
Definition: fbtime.h:364