Loading...
Searching...
No Matches
UsdUtilsTimeCodeRange Class Reference

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

#include <timeCodeRange.h>

Classes

class  const_iterator
 A forward iterator into a UsdUtilsTimeCodeRange. More...
 

Public Types

using iterator = const_iterator
 

Public Member Functions

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

Static Public Member Functions

static USDUTILS_API UsdUtilsTimeCodeRange CreateFromFrameSpec (const std::string &frameSpec)
 Create a time code range from 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

◆ iterator

Definition at line 180 of file timeCodeRange.h.

Constructor & Destructor Documentation

◆ UsdUtilsTimeCodeRange() [1/4]

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() [2/4]

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() [3/4]

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() [4/4]

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

◆ begin()

iterator begin ( ) const
inline

Return an iterator to the start of this range.

Definition at line 329 of file timeCodeRange.h.

◆ cbegin()

const_iterator cbegin ( ) const
inline

Return a const_iterator to the start of this range.

Definition at line 334 of file timeCodeRange.h.

◆ cend()

const_iterator cend ( ) const
inline

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

Definition at line 344 of file timeCodeRange.h.

◆ CreateFromFrameSpec()

static USDUTILS_API 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.

◆ empty()

bool empty ( ) const
inline

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

Definition at line 349 of file timeCodeRange.h.

◆ end()

iterator end ( ) const
inline

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

Definition at line 339 of file timeCodeRange.h.

◆ GetEndTimeCode()

UsdTimeCode GetEndTimeCode ( ) const
inline

Return the end time code of this range.

Definition at line 319 of file timeCodeRange.h.

◆ GetStartTimeCode()

UsdTimeCode GetStartTimeCode ( ) const
inline

Return the start time code of this range.

Definition at line 314 of file timeCodeRange.h.

◆ GetStride()

double GetStride ( ) const
inline

Return the stride value of this range.

Definition at line 324 of file timeCodeRange.h.

◆ IsValid()

bool 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.

◆ operator bool()

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.

◆ operator!=()

bool operator!= ( const UsdUtilsTimeCodeRange other) const
inline

Return true if this range is not equivalent to other.

Definition at line 373 of file timeCodeRange.h.

◆ operator==()

bool 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: