36#ifndef Alembic_Abc_OTypedScalarProperty_h
37#define Alembic_Abc_OTypedScalarProperty_h
39#include <Alembic/Abc/Foundation.h>
40#include <Alembic/Abc/OScalarProperty.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 return ( iMetaData.get(
"interpretation" ) ==
79 static bool matches(
const AbcA::PropertyHeader &iHeader,
80 SchemaInterpMatching iMatching = kStrictMatching )
82 return ( iHeader.getDataType().getPod() ==
83 TRAITS::dataType().getPod() &&
84 ( iHeader.getDataType().getExtent() ==
85 TRAITS::dataType().getExtent() ||
88 matches( iHeader.getMetaData(), iMatching );
103 AbcA::CompoundPropertyWriterPtr iParent,
104 const std::string &iName,
111 init( iParent, iName, iArg0, iArg1, iArg2, iArg3 );
119 const std::string &iName,
125 init( iParent.
getPtr(), iName, GetErrorHandlerPolicy( iParent ),
126 iArg0, iArg1, iArg2 );
133 AbcA::ScalarPropertyWriterPtr iProp,
136 :
OScalarProperty( iProp, GetErrorHandlerPolicy( iProp, iArg0, iArg1 ) )
138 ALEMBIC_ABC_SAFE_CALL_BEGIN(
139 "OTypedScalarProperty::OTypedScalarProperty()" );
141 const AbcA::PropertyHeader &pheader = iProp->getHeader();
143 ABCA_ASSERT(
matches( pheader, GetSchemaInterpMatching( iArg0,iArg1 ) ),
145 "Incorrect match of header datatype: "
146 << pheader.getDataType()
148 << TRAITS::dataType()
149 <<
",\n...or incorrect match of interpretation: "
150 << pheader.getMetaData().get(
"interpretation" )
152 << TRAITS::interpretation() );
154 ALEMBIC_ABC_SAFE_CALL_END_RESET();
159 AbcA::ScalarPropertyWriterPtr iProp,
160 WrapExistingFlag iWrapFlag,
173 void set(
const value_type &iVal )
180 void init( AbcA::CompoundPropertyWriterPtr iParent,
181 const std::string &iName,
188 iArg0.setInto( args );
189 iArg1.setInto( args );
190 iArg2.setInto( args );
191 iArg3.setInto( args );
193 getErrorHandler().setPolicy( args.getErrorHandlerPolicy() );
195 ALEMBIC_ABC_SAFE_CALL_BEGIN(
"OTypedScalarProperty::init()" );
197 ABCA_ASSERT( iParent,
"NULL CompoundPropertyWriterPtr" );
199 AbcA::MetaData mdata = args.getMetaData();
205 AbcA::TimeSamplingPtr tsPtr = args.getTimeSampling();
207 uint32_t tsIndex = args.getTimeSamplingIndex();
214 tsIndex = iParent->getObject()->getArchive()->addTimeSampling(
218 m_property = iParent->createScalarProperty( iName, mdata,
219 TRAITS::dataType(), tsIndex );
221 ALEMBIC_ABC_SAFE_CALL_END_RESET();
299using namespace ALEMBIC_VERSION_NS;
Definition Argument.h:120
PROP_PTR getPtr() const
Definition OBaseProperty.h:162
Definition OCompoundProperty.h:53
OScalarProperty()
Definition OScalarProperty.h:65
void set(const void *iSample)
Definition OScalarProperty.cpp:87
Definition OTypedScalarProperty.h:50
static const char * getInterpretation()
Definition OTypedScalarProperty.h:61
static bool matches(const AbcA::PropertyHeader &iHeader, SchemaInterpMatching iMatching=kStrictMatching)
Definition OTypedScalarProperty.h:79
OTypedScalarProperty()
Definition OTypedScalarProperty.h:97
OTypedScalarProperty(AbcA::ScalarPropertyWriterPtr iProp, const Argument &iArg0=Argument(), const Argument &iArg1=Argument())
Definition OTypedScalarProperty.h:132
OTypedScalarProperty(OCompoundProperty iParent, const std::string &iName, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
Definition OTypedScalarProperty.h:117
OTypedScalarProperty(AbcA::CompoundPropertyWriterPtr iParent, const std::string &iName, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition OTypedScalarProperty.h:102
void set(const value_type &iVal)
Definition OTypedScalarProperty.h:173
static bool matches(const AbcA::MetaData &iMetaData, SchemaInterpMatching iMatching=kStrictMatching)
Definition OTypedScalarProperty.h:69
Alembic namespace ...
Definition ArchiveInfo.cpp:39