/src/alembic/lib/Alembic/Abc/ISchemaObject.h
Line | Count | Source (jump to first uncovered line) |
1 | | //-***************************************************************************** |
2 | | // |
3 | | // Copyright (c) 2009-2011, |
4 | | // Sony Pictures Imageworks Inc. and |
5 | | // Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd. |
6 | | // |
7 | | // All rights reserved. |
8 | | // |
9 | | // Redistribution and use in source and binary forms, with or without |
10 | | // modification, are permitted provided that the following conditions are |
11 | | // met: |
12 | | // * Redistributions of source code must retain the above copyright |
13 | | // notice, this list of conditions and the following disclaimer. |
14 | | // * Redistributions in binary form must reproduce the above |
15 | | // copyright notice, this list of conditions and the following disclaimer |
16 | | // in the documentation and/or other materials provided with the |
17 | | // distribution. |
18 | | // * Neither the name of Sony Pictures Imageworks, nor |
19 | | // Industrial Light & Magic, nor the names of their contributors may be used |
20 | | // to endorse or promote products derived from this software without specific |
21 | | // prior written permission. |
22 | | // |
23 | | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
24 | | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
25 | | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
26 | | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
27 | | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
28 | | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
29 | | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
30 | | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
31 | | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
32 | | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
33 | | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
34 | | // |
35 | | //-***************************************************************************** |
36 | | |
37 | | #ifndef Alembic_Abc_ISchemaObject_h |
38 | | #define Alembic_Abc_ISchemaObject_h |
39 | | |
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> |
45 | | |
46 | | namespace Alembic { |
47 | | namespace Abc { |
48 | | namespace ALEMBIC_VERSION_NS { |
49 | | |
50 | | //-***************************************************************************** |
51 | | //! An ISchemaObject is an object with a single schema. This is just |
52 | | //! a convenience class, really, but it also deals with setting up and |
53 | | //! validating metadata |
54 | | template <class SCHEMA> |
55 | | class ISchemaObject : public IObject |
56 | | { |
57 | | public: |
58 | | //-************************************************************************* |
59 | | // TYPEDEFS AND IDENTIFIERS |
60 | | //-************************************************************************* |
61 | | typedef SCHEMA schema_type; |
62 | | typedef ISchemaObject<SCHEMA> this_type; |
63 | | |
64 | | //! Our schema title contains the schema title of the underlying |
65 | | //! compound property, along with the default name of that compound |
66 | | //! property. So, for example - most AbcGeom types put their |
67 | | //! data in ".geom", so, "AbcGeom_PolyMesh_v1:.geom" |
68 | | //! Sometimes schema titles from underlying schemas are "", but |
69 | | //! ours never are. |
70 | | static std::string getSchemaObjTitle() |
71 | 444 | { |
72 | 444 | return SCHEMA::getSchemaTitle() + std::string( ":" ) |
73 | 444 | + SCHEMA::getDefaultSchemaName(); |
74 | 444 | } Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IPolyMeshSchema>::getSchemaObjTitle() Line | Count | Source | 71 | 74 | { | 72 | 74 | return SCHEMA::getSchemaTitle() + std::string( ":" ) | 73 | 74 | + SCHEMA::getDefaultSchemaName(); | 74 | 74 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ISubDSchema>::getSchemaObjTitle() Line | Count | Source | 71 | 74 | { | 72 | 74 | return SCHEMA::getSchemaTitle() + std::string( ":" ) | 73 | 74 | + SCHEMA::getDefaultSchemaName(); | 74 | 74 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IFaceSetSchema>::getSchemaObjTitle() Line | Count | Source | 71 | 74 | { | 72 | 74 | return SCHEMA::getSchemaTitle() + std::string( ":" ) | 73 | 74 | + SCHEMA::getDefaultSchemaName(); | 74 | 74 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ICurvesSchema>::getSchemaObjTitle() Line | Count | Source | 71 | 74 | { | 72 | 74 | return SCHEMA::getSchemaTitle() + std::string( ":" ) | 73 | 74 | + SCHEMA::getDefaultSchemaName(); | 74 | 74 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IXformSchema>::getSchemaObjTitle() Line | Count | Source | 71 | 74 | { | 72 | 74 | return SCHEMA::getSchemaTitle() + std::string( ":" ) | 73 | 74 | + SCHEMA::getDefaultSchemaName(); | 74 | 74 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcMaterial::v12::IMaterialSchema>::getSchemaObjTitle() Line | Count | Source | 71 | 74 | { | 72 | 74 | return SCHEMA::getSchemaTitle() + std::string( ":" ) | 73 | 74 | + SCHEMA::getDefaultSchemaName(); | 74 | 74 | } |
|
75 | | |
76 | | static const char * getSchemaTitle() |
77 | 222 | { |
78 | 222 | return SCHEMA::getSchemaTitle(); |
79 | 222 | } Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IPolyMeshSchema>::getSchemaTitle() Line | Count | Source | 77 | 37 | { | 78 | 37 | return SCHEMA::getSchemaTitle(); | 79 | 37 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ISubDSchema>::getSchemaTitle() Line | Count | Source | 77 | 37 | { | 78 | 37 | return SCHEMA::getSchemaTitle(); | 79 | 37 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IFaceSetSchema>::getSchemaTitle() Line | Count | Source | 77 | 37 | { | 78 | 37 | return SCHEMA::getSchemaTitle(); | 79 | 37 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ICurvesSchema>::getSchemaTitle() Line | Count | Source | 77 | 37 | { | 78 | 37 | return SCHEMA::getSchemaTitle(); | 79 | 37 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IXformSchema>::getSchemaTitle() Line | Count | Source | 77 | 37 | { | 78 | 37 | return SCHEMA::getSchemaTitle(); | 79 | 37 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcMaterial::v12::IMaterialSchema>::getSchemaTitle() Line | Count | Source | 77 | 37 | { | 78 | 37 | return SCHEMA::getSchemaTitle(); | 79 | 37 | } |
|
80 | | |
81 | | //! This will check whether or not a given entity (as represented by |
82 | | //! a metadata) strictly matches the interpretation of this |
83 | | //! schema object |
84 | | static bool matches( const AbcA::MetaData &iMetaData, |
85 | | SchemaInterpMatching iMatching = kStrictMatching ) |
86 | 222 | { |
87 | | |
88 | 222 | if ( std::string() == getSchemaTitle() || iMatching == kNoMatching ) |
89 | 0 | { |
90 | 0 | return true; |
91 | 0 | } |
92 | | |
93 | | |
94 | 222 | if ( iMatching == kStrictMatching ) |
95 | 222 | { |
96 | 222 | return iMetaData.get( "schemaObjTitle" ) == getSchemaObjTitle() || |
97 | 222 | iMetaData.get( "schema" ) == getSchemaObjTitle(); |
98 | 222 | } |
99 | | |
100 | 0 | if ( iMatching == kSchemaTitleMatching ) |
101 | 0 | { |
102 | 0 | return iMetaData.get( "schema" ) == getSchemaTitle(); |
103 | 0 | } |
104 | | |
105 | 0 | return false; |
106 | 0 | } Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IPolyMeshSchema>::matches(Alembic::AbcCoreAbstract::v12::MetaData const&, Alembic::Abc::v12::SchemaInterpMatching) Line | Count | Source | 86 | 37 | { | 87 | | | 88 | 37 | if ( std::string() == getSchemaTitle() || iMatching == kNoMatching ) | 89 | 0 | { | 90 | 0 | return true; | 91 | 0 | } | 92 | | | 93 | | | 94 | 37 | if ( iMatching == kStrictMatching ) | 95 | 37 | { | 96 | 37 | return iMetaData.get( "schemaObjTitle" ) == getSchemaObjTitle() || | 97 | 37 | iMetaData.get( "schema" ) == getSchemaObjTitle(); | 98 | 37 | } | 99 | | | 100 | 0 | if ( iMatching == kSchemaTitleMatching ) | 101 | 0 | { | 102 | 0 | return iMetaData.get( "schema" ) == getSchemaTitle(); | 103 | 0 | } | 104 | | | 105 | 0 | return false; | 106 | 0 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ISubDSchema>::matches(Alembic::AbcCoreAbstract::v12::MetaData const&, Alembic::Abc::v12::SchemaInterpMatching) Line | Count | Source | 86 | 37 | { | 87 | | | 88 | 37 | if ( std::string() == getSchemaTitle() || iMatching == kNoMatching ) | 89 | 0 | { | 90 | 0 | return true; | 91 | 0 | } | 92 | | | 93 | | | 94 | 37 | if ( iMatching == kStrictMatching ) | 95 | 37 | { | 96 | 37 | return iMetaData.get( "schemaObjTitle" ) == getSchemaObjTitle() || | 97 | 37 | iMetaData.get( "schema" ) == getSchemaObjTitle(); | 98 | 37 | } | 99 | | | 100 | 0 | if ( iMatching == kSchemaTitleMatching ) | 101 | 0 | { | 102 | 0 | return iMetaData.get( "schema" ) == getSchemaTitle(); | 103 | 0 | } | 104 | | | 105 | 0 | return false; | 106 | 0 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IFaceSetSchema>::matches(Alembic::AbcCoreAbstract::v12::MetaData const&, Alembic::Abc::v12::SchemaInterpMatching) Line | Count | Source | 86 | 37 | { | 87 | | | 88 | 37 | if ( std::string() == getSchemaTitle() || iMatching == kNoMatching ) | 89 | 0 | { | 90 | 0 | return true; | 91 | 0 | } | 92 | | | 93 | | | 94 | 37 | if ( iMatching == kStrictMatching ) | 95 | 37 | { | 96 | 37 | return iMetaData.get( "schemaObjTitle" ) == getSchemaObjTitle() || | 97 | 37 | iMetaData.get( "schema" ) == getSchemaObjTitle(); | 98 | 37 | } | 99 | | | 100 | 0 | if ( iMatching == kSchemaTitleMatching ) | 101 | 0 | { | 102 | 0 | return iMetaData.get( "schema" ) == getSchemaTitle(); | 103 | 0 | } | 104 | | | 105 | 0 | return false; | 106 | 0 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ICurvesSchema>::matches(Alembic::AbcCoreAbstract::v12::MetaData const&, Alembic::Abc::v12::SchemaInterpMatching) Line | Count | Source | 86 | 37 | { | 87 | | | 88 | 37 | if ( std::string() == getSchemaTitle() || iMatching == kNoMatching ) | 89 | 0 | { | 90 | 0 | return true; | 91 | 0 | } | 92 | | | 93 | | | 94 | 37 | if ( iMatching == kStrictMatching ) | 95 | 37 | { | 96 | 37 | return iMetaData.get( "schemaObjTitle" ) == getSchemaObjTitle() || | 97 | 37 | iMetaData.get( "schema" ) == getSchemaObjTitle(); | 98 | 37 | } | 99 | | | 100 | 0 | if ( iMatching == kSchemaTitleMatching ) | 101 | 0 | { | 102 | 0 | return iMetaData.get( "schema" ) == getSchemaTitle(); | 103 | 0 | } | 104 | | | 105 | 0 | return false; | 106 | 0 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IXformSchema>::matches(Alembic::AbcCoreAbstract::v12::MetaData const&, Alembic::Abc::v12::SchemaInterpMatching) Line | Count | Source | 86 | 37 | { | 87 | | | 88 | 37 | if ( std::string() == getSchemaTitle() || iMatching == kNoMatching ) | 89 | 0 | { | 90 | 0 | return true; | 91 | 0 | } | 92 | | | 93 | | | 94 | 37 | if ( iMatching == kStrictMatching ) | 95 | 37 | { | 96 | 37 | return iMetaData.get( "schemaObjTitle" ) == getSchemaObjTitle() || | 97 | 37 | iMetaData.get( "schema" ) == getSchemaObjTitle(); | 98 | 37 | } | 99 | | | 100 | 0 | if ( iMatching == kSchemaTitleMatching ) | 101 | 0 | { | 102 | 0 | return iMetaData.get( "schema" ) == getSchemaTitle(); | 103 | 0 | } | 104 | | | 105 | 0 | return false; | 106 | 0 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcMaterial::v12::IMaterialSchema>::matches(Alembic::AbcCoreAbstract::v12::MetaData const&, Alembic::Abc::v12::SchemaInterpMatching) Line | Count | Source | 86 | 37 | { | 87 | | | 88 | 37 | if ( std::string() == getSchemaTitle() || iMatching == kNoMatching ) | 89 | 0 | { | 90 | 0 | return true; | 91 | 0 | } | 92 | | | 93 | | | 94 | 37 | if ( iMatching == kStrictMatching ) | 95 | 37 | { | 96 | 37 | return iMetaData.get( "schemaObjTitle" ) == getSchemaObjTitle() || | 97 | 37 | iMetaData.get( "schema" ) == getSchemaObjTitle(); | 98 | 37 | } | 99 | | | 100 | 0 | if ( iMatching == kSchemaTitleMatching ) | 101 | 0 | { | 102 | 0 | return iMetaData.get( "schema" ) == getSchemaTitle(); | 103 | 0 | } | 104 | | | 105 | 0 | return false; | 106 | 0 | } |
|
107 | | |
108 | | //! This will check whether or not a given object (as represented by |
109 | | //! an object header) strictly matches the interpretation of this |
110 | | //! schema object, as well as the data type. |
111 | | static bool matches( const AbcA::ObjectHeader &iHeader, |
112 | | SchemaInterpMatching iMatching = kStrictMatching ) |
113 | 222 | { |
114 | 222 | return matches( iHeader.getMetaData(), iMatching ); |
115 | 222 | } Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IPolyMeshSchema>::matches(Alembic::AbcCoreAbstract::v12::ObjectHeader const&, Alembic::Abc::v12::SchemaInterpMatching) Line | Count | Source | 113 | 37 | { | 114 | 37 | return matches( iHeader.getMetaData(), iMatching ); | 115 | 37 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ISubDSchema>::matches(Alembic::AbcCoreAbstract::v12::ObjectHeader const&, Alembic::Abc::v12::SchemaInterpMatching) Line | Count | Source | 113 | 37 | { | 114 | 37 | return matches( iHeader.getMetaData(), iMatching ); | 115 | 37 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IFaceSetSchema>::matches(Alembic::AbcCoreAbstract::v12::ObjectHeader const&, Alembic::Abc::v12::SchemaInterpMatching) Line | Count | Source | 113 | 37 | { | 114 | 37 | return matches( iHeader.getMetaData(), iMatching ); | 115 | 37 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ICurvesSchema>::matches(Alembic::AbcCoreAbstract::v12::ObjectHeader const&, Alembic::Abc::v12::SchemaInterpMatching) Line | Count | Source | 113 | 37 | { | 114 | 37 | return matches( iHeader.getMetaData(), iMatching ); | 115 | 37 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IXformSchema>::matches(Alembic::AbcCoreAbstract::v12::ObjectHeader const&, Alembic::Abc::v12::SchemaInterpMatching) Line | Count | Source | 113 | 37 | { | 114 | 37 | return matches( iHeader.getMetaData(), iMatching ); | 115 | 37 | } |
Alembic::Abc::v12::ISchemaObject<Alembic::AbcMaterial::v12::IMaterialSchema>::matches(Alembic::AbcCoreAbstract::v12::ObjectHeader const&, Alembic::Abc::v12::SchemaInterpMatching) Line | Count | Source | 113 | 37 | { | 114 | 37 | return matches( iHeader.getMetaData(), iMatching ); | 115 | 37 | } |
|
116 | | |
117 | | |
118 | | //-************************************************************************* |
119 | | // CONSTRUCTION, DESTRUCTION, ASSIGNMENT |
120 | | //-************************************************************************* |
121 | | |
122 | | //! The default constructor creates an empty ISchemaObject function set. |
123 | | //! ... |
124 | 0 | ISchemaObject() {} |
125 | | |
126 | | //! The primary constructor creates an ISchemaObject as a child of iParent |
127 | | ISchemaObject( const IObject & iParent, |
128 | | const std::string &iName, |
129 | | const Argument &iArg0 = Argument(), |
130 | | const Argument &iArg1 = Argument() ) |
131 | | : IObject( iParent, iName, GetErrorHandlerPolicyFromArgs( iArg0, iArg1 ) ) |
132 | 0 | { |
133 | 0 | Arguments args; |
134 | 0 | iArg0.setInto( args ); |
135 | 0 | iArg1.setInto( args ); |
136 | |
|
137 | 0 | ALEMBIC_ABC_SAFE_CALL_BEGIN( |
138 | 0 | "ISchemaObject::ISchemaObject( IObject )" ); |
139 | |
|
140 | 0 | const AbcA::ObjectHeader &oheader = this->getHeader(); |
141 | |
|
142 | 0 | ABCA_ASSERT( matches( oheader, args.getSchemaInterpMatching() ), |
143 | 0 | "Incorrect match of schema: " |
144 | 0 | << oheader.getMetaData().get( "schema" ) |
145 | 0 | << " to expected: " |
146 | 0 | << getSchemaTitle() ); |
147 | | |
148 | 0 | ABCA_ASSERT(m_object, "Bad child: " << iName); |
149 | | // Make the schema. |
150 | 0 | m_schema = SCHEMA( m_object->getProperties(), |
151 | 0 | SCHEMA::getDefaultSchemaName(), |
152 | 0 | this->getErrorHandlerPolicy(), |
153 | 0 | args.getSchemaInterpMatching() ); |
154 | |
|
155 | 0 | ALEMBIC_ABC_SAFE_CALL_END_RESET(); |
156 | 0 | } Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IPolyMeshSchema>::ISchemaObject(Alembic::Abc::v12::IObject const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Alembic::Abc::v12::Argument const&, Alembic::Abc::v12::Argument const&) Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ISubDSchema>::ISchemaObject(Alembic::Abc::v12::IObject const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Alembic::Abc::v12::Argument const&, Alembic::Abc::v12::Argument const&) Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IFaceSetSchema>::ISchemaObject(Alembic::Abc::v12::IObject const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Alembic::Abc::v12::Argument const&, Alembic::Abc::v12::Argument const&) Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ICurvesSchema>::ISchemaObject(Alembic::Abc::v12::IObject const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Alembic::Abc::v12::Argument const&, Alembic::Abc::v12::Argument const&) Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IXformSchema>::ISchemaObject(Alembic::Abc::v12::IObject const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Alembic::Abc::v12::Argument const&, Alembic::Abc::v12::Argument const&) Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcMaterial::v12::IMaterialSchema>::ISchemaObject(Alembic::Abc::v12::IObject const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Alembic::Abc::v12::Argument const&, Alembic::Abc::v12::Argument const&) |
157 | | |
158 | | //! Wrap an existing schema object. |
159 | | //! ... |
160 | | ISchemaObject( const IObject & iObject, |
161 | | const Argument &iArg0 = Argument(), |
162 | | const Argument &iArg1 = Argument() ) |
163 | | : IObject( iObject ) |
164 | | { |
165 | | getErrorHandler().setPolicy( |
166 | | GetErrorHandlerPolicy( iObject, iArg0, iArg1 ) ); |
167 | | |
168 | | ALEMBIC_ABC_SAFE_CALL_BEGIN( |
169 | | "ISchemaObject::ISchemaObject( wrap )" ); |
170 | | |
171 | | const AbcA::ObjectHeader &oheader = this->getHeader(); |
172 | | |
173 | | ABCA_ASSERT( matches( oheader.getMetaData(), |
174 | | GetSchemaInterpMatching( iArg0, iArg1 ) ), |
175 | | "Incorrect match of schema: " |
176 | | << oheader.getMetaData().get( "schemaObjTitle" ) |
177 | | << " to expected: " |
178 | | << getSchemaObjTitle() ); |
179 | | |
180 | | m_schema = SCHEMA( this->getProperties(), |
181 | | SCHEMA::getDefaultSchemaName(), |
182 | | this->getErrorHandlerPolicy(), |
183 | | GetSchemaInterpMatching( iArg0, iArg1 ) ); |
184 | | |
185 | | ALEMBIC_ABC_SAFE_CALL_END_RESET(); |
186 | | } |
187 | | |
188 | | // Deprecated in favor of the constructor above |
189 | | ISchemaObject( const IObject & iObject, |
190 | | WrapExistingFlag iFlag, |
191 | | const Argument &iArg0 = Argument(), |
192 | | const Argument &iArg1 = Argument() ) |
193 | | : IObject( iObject ) |
194 | | { |
195 | | getErrorHandler().setPolicy( |
196 | | GetErrorHandlerPolicy( iObject, iArg0, iArg1 ) ); |
197 | | |
198 | | ALEMBIC_ABC_SAFE_CALL_BEGIN( |
199 | | "ISchemaObject::ISchemaObject( wrapflag )" ); |
200 | | |
201 | | const AbcA::ObjectHeader &oheader = this->getHeader(); |
202 | | |
203 | | ABCA_ASSERT( matches( oheader.getMetaData(), |
204 | | GetSchemaInterpMatching( iArg0, iArg1 ) ), |
205 | | "Incorrect match of schema: " |
206 | | << oheader.getMetaData().get( "schemaObjTitle" ) |
207 | | << " to expected: " |
208 | | << getSchemaObjTitle() ); |
209 | | |
210 | | m_schema = SCHEMA( this->getProperties(), |
211 | | SCHEMA::getDefaultSchemaName(), |
212 | | this->getErrorHandlerPolicy(), |
213 | | GetSchemaInterpMatching( iArg0, iArg1 ) ); |
214 | | |
215 | | ALEMBIC_ABC_SAFE_CALL_END_RESET(); |
216 | | } |
217 | | |
218 | | //-************************************************************************* |
219 | | // ABC BASE MECHANISMS |
220 | | // These functions are used by Abc to deal with errors, rewrapping, |
221 | | // and so on. |
222 | | //-************************************************************************* |
223 | | |
224 | | //! Schemas are not necessarily cheap to copy, so we return by reference |
225 | | //! rather than by value. |
226 | 0 | SCHEMA &getSchema() { return m_schema; } |
227 | 0 | const SCHEMA &getSchema() const { return m_schema; } Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IPolyMeshSchema>::getSchema() const Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ISubDSchema>::getSchema() const Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IFaceSetSchema>::getSchema() const Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ICurvesSchema>::getSchema() const Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IXformSchema>::getSchema() const |
228 | | |
229 | | //! Reset returns this function set to an empty, default |
230 | | //! state. |
231 | 0 | void reset() { m_schema.reset(); IObject::reset(); } Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IPolyMeshSchema>::reset() Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ISubDSchema>::reset() Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IFaceSetSchema>::reset() Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::ICurvesSchema>::reset() Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcGeom::v12::IXformSchema>::reset() Unexecuted instantiation: Alembic::Abc::v12::ISchemaObject<Alembic::AbcMaterial::v12::IMaterialSchema>::reset() |
232 | | |
233 | | //! Valid returns whether this function set is |
234 | | //! valid. |
235 | | bool valid() const |
236 | 0 | { |
237 | 0 | return ( IObject::valid() && m_schema.valid() ); |
238 | 0 | } |
239 | | |
240 | | //! The unspecified-bool-type operator casts the object to "true" |
241 | | //! if it is valid, and "false" otherwise. |
242 | | ALEMBIC_OVERRIDE_OPERATOR_BOOL( this_type::valid() ); |
243 | | |
244 | | protected: |
245 | | SCHEMA m_schema; |
246 | | }; |
247 | | |
248 | | //-***************************************************************************** |
249 | | // TEMPLATE AND INLINE FUNCTIONS |
250 | | //-***************************************************************************** |
251 | | |
252 | | inline ErrorHandler::Policy GetErrorHandlerPolicy( const Argument &iArg0, |
253 | | const Argument &iArg1 ) |
254 | 0 | { |
255 | 0 | Arguments args; |
256 | 0 | iArg0.setInto( args ); |
257 | 0 | iArg1.setInto( args ); |
258 | 0 | return args.getErrorHandlerPolicy(); |
259 | 0 | } |
260 | | |
261 | | } // End namespace ALEMBIC_VERSION_NS |
262 | | |
263 | | using namespace ALEMBIC_VERSION_NS; |
264 | | |
265 | | } // End namespace Abc |
266 | | } // End namespace Alembic |
267 | | |
268 | | #endif |