|
Katana Plug-in APIs 0.1
|
#include <FnSampleAccessor.h>
Public Member Functions | |
| SampleAccessor (const Attribute &attr) | |
| SampleAccessor (const Attribute *attr) | |
| SampleAccessor (Attribute &&attr) | |
| SampleAccessor () | |
| const_iterator | begin () const & |
| const_iterator | end () const & |
| const_reference | front () const & |
| const_reference | back () const & |
| const_reference | operator[] (difference_type i) const & |
| const_reference | at (difference_type i) const & |
| FnPlatform::ArrayView< float > | getSampleTimes () const & |
| const_reference | getNearestSample (float t) const & |
| int64_t | getNearestSampleIndex (float t) const |
A SampleAccessor provides access to the sample buffers contained in a DataAttribute. Create one by calling the getSamples() method of any DataAttribute.
SampleAccessor are invalidated when the accessor is destructed.C++11 Example:
auto accessor = attr.getSamples(); for (const auto& sample : accessor) { int64_t idx = sample.getSampleIndex(); float t = sample.getSampleTime(); const int* data = sample.data(); for (int val : sample) { // ... } }
C++98 Example:
IntAttribute::accessor_type accessor = attr.getSamples(); for (IntAttribute::accessor_type::const_iterator it = accessor.begin(); it != accessor.end(); ++it) { int64_t idx = it->getSampleIndex(); float t = it->getSampleTime(); const int* data = it->data(); for (IntAttribute::sample_type::const_iterator valIt = it->begin(); valueIt != sampleIt->end(); ++valueIt) { int val = *it; } }
| Foundry::Katana::SampleAccessor< ValueT >::SampleAccessor | ( | const Attribute & | attr | ) | [inline, explicit] |
Constructs a SampleAccessor to access data of the given attribute. You should call getSamples() on a DataAttribute instead.
| attr | The attribute whose data is to be accessed. |
| Foundry::Katana::SampleAccessor< ValueT >::SampleAccessor | ( | const Attribute * | attr | ) | [inline, explicit] |
Constructor for an accessor that does not take ownership of attr.
| Foundry::Katana::SampleAccessor< ValueT >::SampleAccessor | ( | Attribute && | attr | ) | [inline, explicit] |
Constructor for an accessor that takes ownership of attr.
| Foundry::Katana::SampleAccessor< ValueT >::SampleAccessor | ( | ) | [inline] |
Constructs an invalid SampleAccessor, that is, isValid() will return false.
| const_reference Foundry::Katana::SampleAccessor< ValueT >::at | ( | difference_type | i | ) | const [inline] |
Returns a reference to the ith sample.
| std::out_of_range | if i is not a valid index. |
| const_reference Foundry::Katana::SampleAccessor< ValueT >::back | ( | ) | const [inline] |
Returns a reference to the last sample.
| const_iterator Foundry::Katana::SampleAccessor< ValueT >::begin | ( | ) | const [inline] |
Returns an iterator to the first sample.
| const_iterator Foundry::Katana::SampleAccessor< ValueT >::end | ( | ) | const [inline] |
Returns an iterator to the past-the-end sample.
| const_reference Foundry::Katana::SampleAccessor< ValueT >::front | ( | ) | const [inline] |
Returns a reference to the first sample.
| const_reference Foundry::Katana::SampleAccessor< ValueT >::getNearestSample | ( | float | t | ) | const [inline] |
Returns a reference to the sample closest to t, or a reference to a default-constructed Sample if the accessor contains no time samples.
Referenced by Foundry::Katana::StringAttribute::getValuesAs(), Foundry::Katana::DoubleAttribute::getValuesAs(), Foundry::Katana::FloatAttribute::getValuesAs(), and Foundry::Katana::IntAttribute::getValuesAs().
| int64_t Foundry::Katana::SampleAccessor< ValueT >::getNearestSampleIndex | ( | float | t | ) | const [inline] |
Returns the index of the sample closest to t, or 0 if the accessor contains no time samples.
| FnPlatform::ArrayView<float> Foundry::Katana::SampleAccessor< ValueT >::getSampleTimes | ( | ) | const [inline] |
Returns a view of the samples times present in this attribute.
| const_reference Foundry::Katana::SampleAccessor< ValueT >::operator[] | ( | difference_type | i | ) | const [inline] |
Returns a reference to the ith sample.
1.7.3