37#ifndef Alembic_Abc_ISchemaObject_h
38#define Alembic_Abc_ISchemaObject_h
40#include <Alembic/Abc/Foundation.h>
41#include <Alembic/Abc/IObject.h>
42#include <Alembic/Abc/ISchema.h>
43#include <Alembic/Abc/Argument.h>
44#include <Alembic/Abc/Base.h>
48namespace ALEMBIC_VERSION_NS {
54template <
class SCHEMA>
61 typedef SCHEMA schema_type;
72 return SCHEMA::getSchemaTitle() + std::string(
":" )
73 + SCHEMA::getDefaultSchemaName();
76 static const char * getSchemaTitle()
78 return SCHEMA::getSchemaTitle();
84 static bool matches(
const AbcA::MetaData &iMetaData,
85 SchemaInterpMatching iMatching = kStrictMatching )
88 if ( std::string() == getSchemaTitle() || iMatching == kNoMatching )
94 if ( iMatching == kStrictMatching )
100 if ( iMatching == kSchemaTitleMatching )
102 return iMetaData.get(
"schema" ) == getSchemaTitle();
111 static bool matches(
const AbcA::ObjectHeader &iHeader,
112 SchemaInterpMatching iMatching = kStrictMatching )
114 return matches( iHeader.getMetaData(), iMatching );
128 const std::string &iName,
131 :
IObject( iParent, iName, GetErrorHandlerPolicyFromArgs( iArg0, iArg1 ) )
134 iArg0.setInto( args );
135 iArg1.setInto( args );
137 ALEMBIC_ABC_SAFE_CALL_BEGIN(
138 "ISchemaObject::ISchemaObject( IObject )" );
140 const AbcA::ObjectHeader &oheader = this->
getHeader();
142 ABCA_ASSERT(
matches( oheader, args.getSchemaInterpMatching() ),
143 "Incorrect match of schema: "
144 << oheader.getMetaData().get(
"schema" )
146 << getSchemaTitle() );
148 ABCA_ASSERT(m_object,
"Bad child: " << iName);
150 m_schema = SCHEMA( m_object->getProperties(),
151 SCHEMA::getDefaultSchemaName(),
152 this->getErrorHandlerPolicy(),
153 args.getSchemaInterpMatching() );
155 ALEMBIC_ABC_SAFE_CALL_END_RESET();
165 getErrorHandler().setPolicy(
166 GetErrorHandlerPolicy( iObject, iArg0, iArg1 ) );
168 ALEMBIC_ABC_SAFE_CALL_BEGIN(
169 "ISchemaObject::ISchemaObject( wrap )" );
171 const AbcA::ObjectHeader &oheader = this->
getHeader();
173 ABCA_ASSERT(
matches( oheader.getMetaData(),
174 GetSchemaInterpMatching( iArg0, iArg1 ) ),
175 "Incorrect match of schema: "
176 << oheader.getMetaData().get(
"schemaObjTitle" )
181 SCHEMA::getDefaultSchemaName(),
182 this->getErrorHandlerPolicy(),
183 GetSchemaInterpMatching( iArg0, iArg1 ) );
185 ALEMBIC_ABC_SAFE_CALL_END_RESET();
190 WrapExistingFlag iFlag,
195 getErrorHandler().setPolicy(
196 GetErrorHandlerPolicy( iObject, iArg0, iArg1 ) );
198 ALEMBIC_ABC_SAFE_CALL_BEGIN(
199 "ISchemaObject::ISchemaObject( wrapflag )" );
201 const AbcA::ObjectHeader &oheader = this->
getHeader();
203 ABCA_ASSERT(
matches( oheader.getMetaData(),
204 GetSchemaInterpMatching( iArg0, iArg1 ) ),
205 "Incorrect match of schema: "
206 << oheader.getMetaData().get(
"schemaObjTitle" )
211 SCHEMA::getDefaultSchemaName(),
212 this->getErrorHandlerPolicy(),
213 GetSchemaInterpMatching( iArg0, iArg1 ) );
215 ALEMBIC_ABC_SAFE_CALL_END_RESET();
227 const SCHEMA &
getSchema()
const {
return m_schema; }
252inline ErrorHandler::Policy GetErrorHandlerPolicy(
const Argument &iArg0,
256 iArg0.setInto( args );
257 iArg1.setInto( args );
258 return args.getErrorHandlerPolicy();
263using namespace ALEMBIC_VERSION_NS;
Definition Argument.h:120
IObject()
Definition IObject.h:68
const AbcA::ObjectHeader & getHeader() const
Definition IObject.cpp:67
ICompoundProperty getProperties() const
Definition IObject.cpp:379
void reset()
Reset returns this function set to an empty, default state.
Definition IObject.cpp:369
bool valid() const
Definition IObject.h:251
ISchemaObject(const IObject &iObject, const Argument &iArg0=Argument(), const Argument &iArg1=Argument())
Definition ISchemaObject.h:160
ALEMBIC_OVERRIDE_OPERATOR_BOOL(this_type::valid())
bool valid() const
Definition ISchemaObject.h:235
void reset()
Definition ISchemaObject.h:231
static std::string getSchemaObjTitle()
Definition ISchemaObject.h:70
SCHEMA & getSchema()
Definition ISchemaObject.h:226
ISchemaObject(const IObject &iParent, const std::string &iName, const Argument &iArg0=Argument(), const Argument &iArg1=Argument())
The primary constructor creates an ISchemaObject as a child of iParent.
Definition ISchemaObject.h:127
static bool matches(const AbcA::MetaData &iMetaData, SchemaInterpMatching iMatching=kStrictMatching)
Definition ISchemaObject.h:84
ISchemaObject()
Definition ISchemaObject.h:124
static bool matches(const AbcA::ObjectHeader &iHeader, SchemaInterpMatching iMatching=kStrictMatching)
Definition ISchemaObject.h:111
Alembic namespace ...
Definition ArchiveInfo.cpp:39