Katana Plug-in APIs 0.1
Public Member Functions

Foundry::Katana::SampleAccessor< ValueT > Class Template Reference

#include <FnSampleAccessor.h>

Inheritance diagram for Foundry::Katana::SampleAccessor< ValueT >:
Foundry::Katana::SampleAccessorBase< ValueT >

List of all members.

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

Detailed Description

template<typename ValueT>
class Foundry::Katana::SampleAccessor< ValueT >

A SampleAccessor provides access to the sample buffers contained in a DataAttribute. Create one by calling the getSamples() method of any DataAttribute.

Note:
Pointers and references returned by 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;
     }
 }

Constructor & Destructor Documentation

template<typename ValueT>
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.

Parameters:
attrThe attribute whose data is to be accessed.
template<typename ValueT>
Foundry::Katana::SampleAccessor< ValueT >::SampleAccessor ( const Attribute attr) [inline, explicit]

Constructor for an accessor that does not take ownership of attr.

template<typename ValueT>
Foundry::Katana::SampleAccessor< ValueT >::SampleAccessor ( Attribute &&  attr) [inline, explicit]

Constructor for an accessor that takes ownership of attr.

template<typename ValueT>
Foundry::Katana::SampleAccessor< ValueT >::SampleAccessor ( ) [inline]

Constructs an invalid SampleAccessor, that is, isValid() will return false.


Member Function Documentation

template<typename ValueT>
const_reference Foundry::Katana::SampleAccessor< ValueT >::at ( difference_type  i) const [inline]

Returns a reference to the ith sample.

Exceptions:
std::out_of_rangeif i is not a valid index.
template<typename ValueT>
const_reference Foundry::Katana::SampleAccessor< ValueT >::back ( ) const [inline]

Returns a reference to the last sample.

template<typename ValueT>
const_iterator Foundry::Katana::SampleAccessor< ValueT >::begin ( ) const [inline]

Returns an iterator to the first sample.

template<typename ValueT>
const_iterator Foundry::Katana::SampleAccessor< ValueT >::end ( ) const [inline]

Returns an iterator to the past-the-end sample.

template<typename ValueT>
const_reference Foundry::Katana::SampleAccessor< ValueT >::front ( ) const [inline]

Returns a reference to the first sample.

template<typename ValueT>
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().

template<typename ValueT>
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.

template<typename ValueT>
FnPlatform::ArrayView<float> Foundry::Katana::SampleAccessor< ValueT >::getSampleTimes ( ) const [inline]

Returns a view of the samples times present in this attribute.

template<typename ValueT>
const_reference Foundry::Katana::SampleAccessor< ValueT >::operator[] ( difference_type  i) const [inline]

Returns a reference to the ith sample.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator