AVPKit
ITimeValue.h
1 /*******************************************************************************
2  * Copyright (c) 2024, 2026, Olivier Ayache. All rights reserved.
3  *
4  * This file is part of AVPKit.
5  *
6  * AVPKit is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * AVPKit is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with AVPKit. If not, see <http://www.gnu.org/licenses/>.
18  *******************************************************************************/
19 
20 /*
21  * ITimeValue.h
22  *
23  * Created on: Sep 19, 2008
24  * Author: aclarke
25  */
26 
27 #ifndef ITIMEVALUE_H_
28 #define ITIMEVALUE_H_
29 
30 #include <com/avpkit/ferry/RefCounted.h>
31 #include <com/avpkit/core/AVPKit.h>
32 
33 namespace com { namespace avpkit { namespace core
34 {
35 
42 class VS_API_AVPKIT ITimeValue: public com::avpkit::ferry::RefCounted
43 {
44 public:
45  typedef enum
46  {
47  DAYS,
48  HOURS,
49  MINUTES,
50  SECONDS,
51  MILLISECONDS,
52  MICROSECONDS,
53  NANOSECONDS,
54  } Unit;
55 
62  static ITimeValue* make(int64_t value, Unit unit);
63 
69  static ITimeValue* make(ITimeValue *src);
70 
76  virtual int64_t get(Unit unit) = 0;
77 
88  virtual int32_t compareTo(ITimeValue* other)=0;
89 
98  static int32_t compare(ITimeValue *a, ITimeValue* b);
99 
106  static int32_t compare(int64_t a, int64_t b);
107 
108 protected:
109  ITimeValue();
110  virtual ~ITimeValue();
111 
112 };
113 
114 }}}
115 #endif /* ITIMEVALUE_H_ */
Time (duration) values with units.
Definition: ITimeValue.h:43
virtual int64_t get(Unit unit)=0
Get the value of this ITimeValue, in the specified Unit.
virtual int32_t compareTo(ITimeValue *other)=0
Compare this timeValue to another.
Parent of all Ferry objects – it mains reference counts in native code.
Definition: RefCounted.h:85
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...