HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
timeRange.h
Go to the documentation of this file.
1 //
2 // Copyright 2024 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_USD_VALIDATION_USD_VALIDATION_TIME_RANGE_H
8 #define PXR_USD_VALIDATION_USD_VALIDATION_TIME_RANGE_H
9 
10 /// \file
11 
12 #include "pxr/pxr.h"
13 #include "pxr/base/gf/interval.h"
14 #include "pxr/usd/usd/timeCode.h"
17 
19 
20 /// \class UsdValidationTimeRange
21 ///
22 /// A class which describes the interval at which validation is to be performed.
23 ///
24 /// Clients can validate using a GfInterval, which can also encode a closed
25 /// single time code as well.
26 /// The interval can be passed to UsdAttribute::GetTimeSamplesInInterval() to
27 /// retrieve relevant samples. Time dependent attributes can then be validated
28 /// at each time sample in the validation callback itself by the clients.
29 ///
30 /// UsdValidationTimeRange can also specify if UsdTimeCode::Default() should be
31 /// included in the validation interval or not.
32 ///
33 /// To validate for all time samples, clients can provide an interval using
34 /// GfInterval::GetFullInterval().
35 ///
36 /// \sa UsdAttribute::GetTimeSamplesInInterval
38 {
39  GfInterval _interval;
40  bool _includeTimeCodeDefault;
41 
42 public:
43 
44  /// Construct an UsdValidationTimeRange, which signifies
45  /// validate full time interval, including UsdTimeCode::Default().
48 
49  /// Construct a UsdValidationTimeRange with a specific \p timeCode.
50  ///
51  /// If \p timeCode is UsdTimeCode::Default(), the time range will be
52  /// empty, i.e. no time to validate, but _includeTimeCodeDefault will be
53  /// true.
55  explicit UsdValidationTimeRange(const UsdTimeCode &timeCode);
56 
57  /// Construct a UsdValidationTimeRange with a specific \p interval.
58  ///
59  /// \p includeTimeCodeDefault is used to determine if UsdTimeCode::Default()
60  /// should be included in the UsdValidationTimeRange or not
61  /// (default is true).
63  explicit UsdValidationTimeRange(const GfInterval &interval,
64  bool includeTimeCodeDefault = true);
65 
66  /// Return true if the time range includes UsdTimeCode::Default().
68  bool IncludesTimeCodeDefault() const;
69 
70  /// Return the interval to validate.
72  GfInterval GetInterval() const;
73 };
74 
76 
77 #endif // PXR_USD_VALIDATION_USD_VALIDATION_TIME_RANGE_H
USDVALIDATION_API bool IncludesTimeCodeDefault() const
Return true if the time range includes UsdTimeCode::Default().
#define USDVALIDATION_API
Definition: api.h:25
USDVALIDATION_API UsdValidationTimeRange()
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
USDVALIDATION_API GfInterval GetInterval() const
Return the interval to validate.