HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UsdUtilsTimeCodeRange Class Reference

#include <timeCodeRange.h>

Classes

class  const_iterator
 

Public Types

using iterator = const_iterator
 

Public Member Functions

 UsdUtilsTimeCodeRange ()
 
 UsdUtilsTimeCodeRange (const UsdTimeCode timeCode)
 
 UsdUtilsTimeCodeRange (const UsdTimeCode startTimeCode, const UsdTimeCode endTimeCode)
 
 UsdUtilsTimeCodeRange (const UsdTimeCode startTimeCode, const UsdTimeCode endTimeCode, const double stride)
 
UsdTimeCode GetStartTimeCode () const
 Return the start time code of this range. More...
 
UsdTimeCode GetEndTimeCode () const
 Return the end time code of this range. More...
 
double GetStride () const
 Return the stride value of this range. More...
 
iterator begin () const
 Return an iterator to the start of this range. More...
 
const_iterator cbegin () const
 Return a const_iterator to the start of this range. More...
 
iterator end () const
 Return the past-the-end iterator for this range. More...
 
const_iterator cend () const
 Return the past-the-end const_iterator for this range. More...
 
bool empty () const
 Return true if this range contains no time codes, or false otherwise. More...
 
bool IsValid () const
 
 operator bool () const
 
bool operator== (const UsdUtilsTimeCodeRange &other) const
 Return true if this range is equivalent to other. More...
 
bool operator!= (const UsdUtilsTimeCodeRange &other) const
 Return true if this range is not equivalent to other. More...
 

Static Public Member Functions

static USDUTILS_API
UsdUtilsTimeCodeRange 
CreateFromFrameSpec (const std::string &frameSpec)
 

Detailed Description

Represents a range of UsdTimeCode values as start and end time codes and a stride value.

A UsdUtilsTimeCodeRange can be iterated to retrieve all time code values in the range. The range may be empty, it may contain a single time code, or it may represent multiple time codes from start to end. The interval defined by the start and end time codes is closed on both ends.

Note that when constructing a UsdUtilsTimeCodeRange, UsdTimeCode::EarliestTime() and UsdTimeCode::Default() cannot be used as the start or end time codes. Also, the end time code cannot be less than the start time code for positive stride values, and the end time code cannot be greater than the start time code for negative stride values. Finally, the stride value cannot be zero. If any of these conditions are not satisfied, then an invalid empty range will be returned.

Definition at line 73 of file timeCodeRange.h.

Member Typedef Documentation

Constructor & Destructor Documentation

UsdUtilsTimeCodeRange::UsdUtilsTimeCodeRange ( )
inline

Construct an invalid empty range.

The start time code will be initialized to zero, and any iteration of the range will yield no time codes.

Definition at line 219 of file timeCodeRange.h.

UsdUtilsTimeCodeRange::UsdUtilsTimeCodeRange ( const UsdTimeCode  timeCode)
inline

Construct a range containing only the given timeCode.

An iteration of the range will yield only that time code.

Definition at line 227 of file timeCodeRange.h.

UsdUtilsTimeCodeRange::UsdUtilsTimeCodeRange ( const UsdTimeCode  startTimeCode,
const UsdTimeCode  endTimeCode 
)
inline

Construct a range containing the time codes from startTimeCode to endTimeCode.

If endTimeCode is greater than or equal to startTimeCode, then the stride will be 1.0. Otherwise, the stride will be -1.0.

Definition at line 237 of file timeCodeRange.h.

UsdUtilsTimeCodeRange::UsdUtilsTimeCodeRange ( const UsdTimeCode  startTimeCode,
const UsdTimeCode  endTimeCode,
const double  stride 
)
inline

Construct a range containing the time codes from startTimeCode to endTimeCode using the stride value stride.

UsdTimeCode::EarliestTime() and UsdTimeCode::Default() cannot be used as startTimeCode or endTimeCode. If stride is a positive value, then endTimeCode cannot be less than startTimeCode. If stride is a negative value, then endTimeCode cannot be greater than startTimeCode. Finally, the stride value cannot be zero. If any of these conditions are not satisfied, then a coding error will be issued and an invalid empty range will be returned.

Definition at line 257 of file timeCodeRange.h.

Member Function Documentation

iterator UsdUtilsTimeCodeRange::begin ( void  ) const
inline

Return an iterator to the start of this range.

Definition at line 329 of file timeCodeRange.h.

const_iterator UsdUtilsTimeCodeRange::cbegin ( ) const
inline

Return a const_iterator to the start of this range.

Definition at line 334 of file timeCodeRange.h.

const_iterator UsdUtilsTimeCodeRange::cend ( ) const
inline

Return the past-the-end const_iterator for this range.

Definition at line 344 of file timeCodeRange.h.

static USDUTILS_API UsdUtilsTimeCodeRange UsdUtilsTimeCodeRange::CreateFromFrameSpec ( const std::string frameSpec)
static

Create a time code range from frameSpec.

A FrameSpec is a compact string representation of a time code range. A FrameSpec may contain up to three floating point values for the start time code, end time code, and stride values of a time code range.

A FrameSpec containing just a single floating point value represents a time code range containing only that time code.

A FrameSpec containing two floating point values separated by the range separator (':') represents a time code range from the first value as the start time code to the second values as the end time code.

A FrameSpec that specifies both a start and end time code value may also optionally specify a third floating point value as the stride, separating it from the first two values using the stride separator ('x').

The following are examples of valid FrameSpecs: 123 101:105 105:101 101:109x2 101:110x2 101:104x0.5

An empty string corresponds to an invalid empty time code range.

A coding error will be issued if the given string is malformed.

bool UsdUtilsTimeCodeRange::empty ( void  ) const
inline

Return true if this range contains no time codes, or false otherwise.

Definition at line 349 of file timeCodeRange.h.

iterator UsdUtilsTimeCodeRange::end ( void  ) const
inline

Return the past-the-end iterator for this range.

Definition at line 339 of file timeCodeRange.h.

UsdTimeCode UsdUtilsTimeCodeRange::GetEndTimeCode ( ) const
inline

Return the end time code of this range.

Definition at line 319 of file timeCodeRange.h.

UsdTimeCode UsdUtilsTimeCodeRange::GetStartTimeCode ( ) const
inline

Return the start time code of this range.

Definition at line 314 of file timeCodeRange.h.

double UsdUtilsTimeCodeRange::GetStride ( ) const
inline

Return the stride value of this range.

Definition at line 324 of file timeCodeRange.h.

bool UsdUtilsTimeCodeRange::IsValid ( ) const
inline

Return true if this range contains one or more time codes, or false otherwise.

Definition at line 355 of file timeCodeRange.h.

UsdUtilsTimeCodeRange::operator bool ( ) const
inlineexplicit

Return true if this range contains one or more time codes, or false otherwise.

Definition at line 361 of file timeCodeRange.h.

bool UsdUtilsTimeCodeRange::operator!= ( const UsdUtilsTimeCodeRange other) const
inline

Return true if this range is not equivalent to other.

Definition at line 373 of file timeCodeRange.h.

bool UsdUtilsTimeCodeRange::operator== ( const UsdUtilsTimeCodeRange other) const
inline

Return true if this range is equivalent to other.

Definition at line 366 of file timeCodeRange.h.


The documentation for this class was generated from the following file: