36#ifndef Alembic_Abc_ITypedArrayProperty_h
37#define Alembic_Abc_ITypedArrayProperty_h
39#include <Alembic/Abc/Foundation.h>
40#include <Alembic/Abc/IArrayProperty.h>
41#include <Alembic/Abc/TypedPropertyTraits.h>
42#include <Alembic/Abc/TypedArraySample.h>
46namespace ALEMBIC_VERSION_NS {
49template <
class TRAITS>
56 typedef TRAITS traits_type;
58 typedef typename TRAITS::value_type value_type;
60 typedef shared_ptr<sample_type> sample_ptr_type;
66 return TRAITS::interpretation();
72 static bool matches(
const AbcA::MetaData &iMetaData,
73 SchemaInterpMatching iMatching = kStrictMatching )
75 if ( iMatching == kStrictMatching )
77 return ( iMetaData.get(
"interpretation" ) ==
86 static bool matches(
const AbcA::PropertyHeader &iHeader,
87 SchemaInterpMatching iMatching = kStrictMatching )
89 return ( iHeader.getDataType().getPod() ==
90 TRAITS::dataType().getPod() &&
91 ( iHeader.getDataType().getExtent() ==
92 TRAITS::dataType().getExtent() ||
95 matches( iHeader.getMetaData(), iMatching );
112 const std::string &iName,
116 Arguments args( GetErrorHandlerPolicy( iParent ) );
117 iArg0.setInto( args );
118 iArg1.setInto( args );
120 getErrorHandler().setPolicy( args.getErrorHandlerPolicy() );
122 ALEMBIC_ABC_SAFE_CALL_BEGIN(
123 "ITypedArrayProperty::ITypedArrayProperty()" );
125 AbcA::CompoundPropertyReaderPtr parent = iParent.
getPtr();
126 ABCA_ASSERT( parent != NULL,
127 "NULL CompoundPropertyReader passed into "
128 <<
"ITypedArrayProperty ctor" );
130 const AbcA::PropertyHeader *pheader =
131 parent->getPropertyHeader( iName );
132 ABCA_ASSERT( pheader != NULL,
133 "Nonexistent array property: " << iName );
135 ABCA_ASSERT(
matches( *pheader, args.getSchemaInterpMatching() ),
136 "Incorrect match of header datatype: "
137 << pheader->getDataType()
139 << TRAITS::dataType()
140 <<
",\n...or incorrect match of interpretation: "
141 << pheader->getMetaData().get(
"interpretation" )
143 << TRAITS::interpretation() );
145 m_property = parent->getArrayProperty( iName );
147 ALEMBIC_ABC_SAFE_CALL_END_RESET();
157 ALEMBIC_ABC_SAFE_CALL_BEGIN(
158 "ITypedArrayProperty::ITypedArrayProperty()" );
160 const AbcA::PropertyHeader &pheader = iProperty->getHeader();
162 ABCA_ASSERT(
matches( pheader,GetSchemaInterpMatching( iArg0, iArg1 ) ),
163 "Incorrect match of header datatype: "
164 << pheader.getDataType()
166 << TRAITS::dataType()
167 <<
",\n...or incorrect match of interpretation: "
168 << pheader.getMetaData().get(
"interpretation" )
170 << TRAITS::interpretation() );
172 m_property = iProperty;
174 ALEMBIC_ABC_SAFE_CALL_END_RESET();
179 WrapExistingFlag iWrapFlag,
192 void get( sample_ptr_type& iVal,
195 AbcA::ArraySamplePtr ptr;
197 iVal = Alembic::Util::static_pointer_cast<sample_type,
198 AbcA::ArraySample>( ptr );
285using namespace ALEMBIC_VERSION_NS;
Definition Argument.h:120
void get(AbcA::ArraySamplePtr &oSample, const ISampleSelector &iSS=ISampleSelector()) const
Definition IArrayProperty.cpp:113
IArrayProperty()
Definition IArrayProperty.h:66
PROP_PTR getPtr() const
Definition IBaseProperty.h:156
Definition ICompoundProperty.h:53
Definition ISampleSelector.h:49
Definition ITypedArrayProperty.h:51
static bool matches(const AbcA::MetaData &iMetaData, SchemaInterpMatching iMatching=kStrictMatching)
Definition ITypedArrayProperty.h:72
ITypedArrayProperty(const ICompoundProperty &iParent, const std::string &iName, const Argument &iArg0=Argument(), const Argument &iArg1=Argument())
Definition ITypedArrayProperty.h:111
static bool matches(const AbcA::PropertyHeader &iHeader, SchemaInterpMatching iMatching=kStrictMatching)
Definition ITypedArrayProperty.h:86
void get(sample_ptr_type &iVal, const ISampleSelector &iSS=ISampleSelector()) const
Definition ITypedArrayProperty.h:192
static const char * getInterpretation()
Definition ITypedArrayProperty.h:64
ITypedArrayProperty()
Definition ITypedArrayProperty.h:104
sample_ptr_type getValue(const ISampleSelector &iSS=ISampleSelector()) const
Definition ITypedArrayProperty.h:203
ITypedArrayProperty(AbcA::ArrayPropertyReaderPtr iProperty, const Argument &iArg0=Argument(), const Argument &iArg1=Argument())
Definition ITypedArrayProperty.h:153
Definition TypedArraySample.h:52
Alembic namespace ...
Definition ArchiveInfo.cpp:39