Alembic 1.8.11
Loading...
Searching...
No Matches
Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::TimeSampling Class Reference

#include <TimeSampling.h>

Public Member Functions

 TimeSampling (const TimeSamplingType &iTimeSamplingType, const std::vector< chrono_t > &iSampleTimes)
 TimeSampling (chrono_t iTimePerCycle, chrono_t iStartTime)
 TimeSampling (const TimeSampling &copy)
TimeSamplingoperator= (const TimeSampling &copy)
bool operator== (const TimeSampling &iRhs) const
size_t getNumStoredTimes () const
const std::vector< chrono_t > & getStoredTimes () const
TimeSamplingType getTimeSamplingType () const
chrono_t getSampleTime (index_t iIndex) const
std::pair< index_t, chrono_t > getFloorIndex (chrono_t iTime, index_t iNumSamples) const
std::pair< index_t, chrono_t > getCeilIndex (chrono_t iTime, index_t iNumSamples) const
std::pair< index_t, chrono_t > getNearIndex (chrono_t iTime, index_t iNumSamples) const

Protected Attributes

TimeSamplingType m_timeSamplingType
std::vector< chrono_t > m_sampleTimes

Detailed Description

The TimeSampling class's whole job is to report information about the time values that are associated with the samples that were written to a property. Most of the time, the sampling will be uniform or cyclic, in which case this is mostly an algorithmic interface to the small sample times buffer. In the case where the sampling is truly acyclic, this class acts as an accessor to that array of times.

Constructor & Destructor Documentation

◆ TimeSampling() [1/2]

Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::TimeSampling::TimeSampling ( const TimeSamplingType & iTimeSamplingType,
const std::vector< chrono_t > & iSampleTimes )

The TimeSampling class is really a portable interface, usable via aggregation, that the SimplePropertyReaders and Writers (and their derived classes) can use to provide consistent time-sampling introspection to clients.

Parameters
iSampleTimesThe number of time samples per cycle

◆ TimeSampling() [2/2]

Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::TimeSampling::TimeSampling ( chrono_t iTimePerCycle,
chrono_t iStartTime )

Convenience constructor which creates uniform time sampling with the specified time per cycle and the specified start time.

Member Function Documentation

◆ getCeilIndex()

std::pair< index_t, chrono_t > Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::TimeSampling::getCeilIndex ( chrono_t iTime,
index_t iNumSamples ) const

Find the smallest valid index that has a time greater than the given time. Invalid to call this with zero samples. If the maximum sample time is less than iTime, index numSamples-1 will be returned.

Return the index of the sampled time that is >= iTime

◆ getFloorIndex()

std::pair< index_t, chrono_t > Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::TimeSampling::getFloorIndex ( chrono_t iTime,
index_t iNumSamples ) const

Find the largest valid index that has a time less than or equal to the given time. Invalid to call this with zero samples. If the minimum sample time is greater than iTime, index 0 will be returned.

Return the index of the sampled time that is <= iTime

◆ getNearIndex()

std::pair< index_t, chrono_t > Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::TimeSampling::getNearIndex ( chrono_t iTime,
index_t iNumSamples ) const

Find the valid index with the closest time to the given time. Invalid to call this with zero samples.

Return the index of the sampled time that is: (iTime - floorTime < ceilTime - iTime) ? getFloorIndex( iTime ) : getCeilIndex( iTime );

◆ getNumStoredTimes()

size_t Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::TimeSampling::getNumStoredTimes ( ) const
inline

Get the number of stored times. This is same as the samples per cycle in the time sampling type except for acyclic time sampling. There will always be at least one sample because a start time is always needed.

◆ getSampleTime()

chrono_t Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::TimeSampling::getSampleTime ( index_t iIndex) const

Get the time of any sample it is invalid to call this for out-of-range indices.

Member Data Documentation

◆ m_timeSamplingType

TimeSamplingType Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::TimeSampling::m_timeSamplingType
protected

A TimeSamplingType This is "Uniform", "Cyclic", or "Acyclic".


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