36#ifndef Alembic_Abc_ITypedScalarProperty_h
37#define Alembic_Abc_ITypedScalarProperty_h
39#include <Alembic/Abc/Foundation.h>
40#include <Alembic/Abc/IScalarProperty.h>
41#include <Alembic/Abc/TypedPropertyTraits.h>
45namespace ALEMBIC_VERSION_NS {
48template <
class TRAITS>
55 typedef TRAITS traits_type;
57 typedef typename TRAITS::value_type value_type;
63 return TRAITS::interpretation();
69 static bool matches(
const AbcA::MetaData &iMetaData,
70 SchemaInterpMatching iMatching = kStrictMatching )
72 if ( iMatching == kStrictMatching )
74 return ( iMetaData.get(
"interpretation" ) ==
83 static bool matches(
const AbcA::PropertyHeader &iHeader,
84 SchemaInterpMatching iMatching = kStrictMatching )
87 iHeader.getDataType().getPod() == TRAITS::dataType().getPod() &&
88 iHeader.getDataType().getExtent() ==
89 TRAITS::dataType().getExtent() &&
91 matches( iHeader.getMetaData(), iMatching ) );
108 const std::string &iName,
113 Arguments args( GetErrorHandlerPolicy( iParent ) );
114 iArg0.setInto( args );
115 iArg1.setInto( args );
117 getErrorHandler().setPolicy( args.getErrorHandlerPolicy() );
119 ALEMBIC_ABC_SAFE_CALL_BEGIN(
120 "ITypedScalarProperty::ITypedScalarProperty()" );
122 AbcA::CompoundPropertyReaderPtr parent = iParent.
getPtr();
124 ABCA_ASSERT( parent != NULL,
125 "NULL CompoundPropertyReader passed into "
126 <<
"ITypedScalarProperty ctor" );
128 const AbcA::PropertyHeader *pheader =
129 parent->getPropertyHeader( iName );
130 ABCA_ASSERT( pheader != NULL,
131 "Nonexistent scalar property: " << iName );
133 ABCA_ASSERT(
matches( *pheader, args.getSchemaInterpMatching() ),
134 "Incorrect match of header datatype: "
135 << pheader->getDataType()
137 << TRAITS::dataType()
138 <<
",\n...or incorrect match of interpretation: "
139 << pheader->getMetaData().get(
"interpretation" )
141 << TRAITS::interpretation() );
143 m_property = parent->getScalarProperty( iName );
145 ALEMBIC_ABC_SAFE_CALL_END_RESET();
157 ALEMBIC_ABC_SAFE_CALL_BEGIN(
158 "ITypedScalarProperty::ITypedScalarProperty()" );
160 const AbcA::PropertyHeader &pheader = iProperty->getHeader();
163 GetSchemaInterpMatching( iArg0, iArg1 ) ),
164 "Incorrect match of header datatype: "
165 << pheader.getDataType()
167 << TRAITS::dataType()
168 <<
",\n...or incorrect match of interpretation: "
169 << pheader.getMetaData().get(
"interpretation" )
171 << TRAITS::interpretation() );
173 m_property = iProperty;
175 ALEMBIC_ABC_SAFE_CALL_END_RESET();
181 WrapExistingFlag iWrapFlag,
194 void get( value_type &iVal,
283using namespace ALEMBIC_VERSION_NS;
Definition Argument.h:120
PROP_PTR getPtr() const
Definition IBaseProperty.h:156
Definition ICompoundProperty.h:53
Definition ISampleSelector.h:49
void get(void *oSample, const ISampleSelector &iSS=ISampleSelector()) const
Definition IScalarProperty.cpp:97
IScalarProperty()
Definition IScalarProperty.h:66
Definition ITypedScalarProperty.h:50
ITypedScalarProperty(AbcA::ScalarPropertyReaderPtr iProp, WrapExistingFlag iWrapFlag, const Argument &iArg0=Argument(), const Argument &iArg1=Argument())
Deprecated in favor of the constructor above.
Definition ITypedScalarProperty.h:180
value_type getValue(const ISampleSelector &iSS=ISampleSelector()) const
Definition ITypedScalarProperty.h:202
static bool matches(const AbcA::MetaData &iMetaData, SchemaInterpMatching iMatching=kStrictMatching)
Definition ITypedScalarProperty.h:69
ITypedScalarProperty(AbcA::ScalarPropertyReaderPtr iProperty, const Argument &iArg0=Argument(), const Argument &iArg1=Argument())
Definition ITypedScalarProperty.h:152
void get(value_type &iVal, const ISampleSelector &iSS=ISampleSelector()) const
Definition ITypedScalarProperty.h:194
static bool matches(const AbcA::PropertyHeader &iHeader, SchemaInterpMatching iMatching=kStrictMatching)
Definition ITypedScalarProperty.h:83
ITypedScalarProperty()
Definition ITypedScalarProperty.h:100
ITypedScalarProperty(const ICompoundProperty &iParent, const std::string &iName, const Argument &iArg0=Argument(), const Argument &iArg1=Argument())
Definition ITypedScalarProperty.h:107
static const char * getInterpretation()
Definition ITypedScalarProperty.h:61
Alembic namespace ...
Definition ArchiveInfo.cpp:39