Alembic Version 1.1
Loading...
Searching...
No Matches
OObject.h
Go to the documentation of this file.
1//-*****************************************************************************
2//
3// Copyright (c) 2009-2013,
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_OObject_h
38#define Alembic_Abc_OObject_h
39
40#include <Alembic/Util/Export.h>
42#include <Alembic/Abc/Base.h>
45
46namespace Alembic {
47namespace Abc {
48namespace ALEMBIC_VERSION_NS {
49
50class OCompoundProperty;
51
52//-*****************************************************************************
54{
55public:
61
62 //-*************************************************************************
63 // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
64 //-*************************************************************************
65
69
74 OObject( OObject iParentObject,
75 const std::string &iName,
76
77 const Argument &iArg0 = Argument(),
78 const Argument &iArg1 = Argument(),
79 const Argument &iArg2 = Argument() );
80
85 const Argument &iArg0 = Argument(),
86 const Argument &iArg1 = Argument(),
87 const Argument &iArg2 = Argument() )
88 : m_object( iPtr )
89 {
90 // Set the error handling policy
91 getErrorHandler().setPolicy(
92 GetErrorHandlerPolicy( iPtr, iArg0, iArg1, iArg2 ) );
93 }
94
95 // Deprecated in favor of the constructor above
97 WrapExistingFlag /* iFlag */,
98 const Argument &iArg0 = Argument(),
99 const Argument &iArg1 = Argument(),
100 const Argument &iArg2 = Argument() )
101 : m_object( iPtr )
102 {
103 // Set the error handling policy
104 getErrorHandler().setPolicy(
105 GetErrorHandlerPolicy( iPtr, iArg0, iArg1, iArg2 ) );
106 }
107
111 OObject( OArchive & iArchive,
112 const Argument &iArg0 = Argument(),
113 const Argument &iArg1 = Argument(),
114 const Argument &iArg2 = Argument() )
115 {
116 init( iArchive, iArg0, iArg1, iArg2 );
117 }
118
119 // deprecated in favor of the constructor above
120 OObject( OArchive & iArchive,
121 TopFlag /* iTop */,
122 const Argument &iArg0 = Argument(),
123 const Argument &iArg1 = Argument(),
124 const Argument &iArg2 = Argument() )
125 {
126 init( iArchive, iArg0, iArg1, iArg2 );
127 }
128
131
134 virtual ~OObject();
135
136 //-*************************************************************************
137 // OBJECT WRITER FUNCTIONALITY
138 //-*************************************************************************
139
143
146 const std::string &getName() const
147 { return getHeader().getName(); }
148
151 const std::string &getFullName() const
152 { return getHeader().getFullName(); }
153
157 { return getHeader().getMetaData(); }
158
162
167
172
176
179 const AbcA::ObjectHeader * getChildHeader( const std::string &iName );
180
184
185 //-*************************************************************************
186 // ADVANCED TOOLS
187 // Unless you really know why you need to be using these next few
188 // functions, they're probably best left alone. These functions attempt
189 // to find a pointer to an existing writer, instead of creating a new one.
190 //-*************************************************************************
191
196 OObject getChild( size_t iChildIndex );
197
202 OObject getChild( const std::string &iChildName );
203
205 // PROXY METHODS
206 // An OObject can refer to another OObject. When read in, this instance
207 // will be represented by the target source hierarchy and its children.
209 bool addChildInstance( OObject iTarget, const std::string& iName );
210
211 //-*************************************************************************
212 // ABC BASE MECHANISMS
213 // These functions are used by Abc to deal with errors, rewrapping,
214 // and so on.
215 //-*************************************************************************
216
220 AbcA::ObjectWriterPtr getPtr() { return m_object; }
221 const AbcA::ObjectWriterPtr getPtr() const { return m_object; }
222
225 void reset() { m_object.reset(); Base::reset(); }
226
229 bool valid() const
230 {
231 return ( Base::valid() && m_object );
232 }
233
237
238private:
239
240 void init( OArchive & iArchive,
241 const Argument &iArg0,
242 const Argument &iArg1,
243 const Argument &iArg2 );
244
245 void init( AbcA::ObjectWriterPtr iParentObject,
246 const std::string &iName,
247 ErrorHandler::Policy iParentPolicy,
248
249 const Argument &iArg0,
250 const Argument &iArg1,
251 const Argument &iARg2 );
252
253protected:
255};
256
257} // End namespace ALEMBIC_VERSION_NS
258
259using namespace ALEMBIC_VERSION_NS;
260
261} // End namespace Abc
262} // End namespace Alembic
263
264#endif
#define ALEMBIC_EXPORT
Definition Export.h:51
#define ALEMBIC_VERSION_NS
Definition Foundation.h:105
OObject getChild(size_t iChildIndex)
OObject(OArchive &iArchive, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
Definition OObject.h:111
OObject(OObject iParentObject, const std::string &iName, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
const AbcA::ObjectHeader & getChildHeader(size_t i)
const std::string & getName() const
Definition OObject.h:146
const AbcA::ObjectWriterPtr getPtr() const
Definition OObject.h:221
OObject(AbcA::ObjectWriterPtr iPtr, WrapExistingFlag, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
Definition OObject.h:96
bool addChildInstance(OObject iTarget, const std::string &iName)
-************************************************************************
const AbcA::ObjectHeader & getHeader() const
const AbcA::ObjectHeader * getChildHeader(const std::string &iName)
const AbcA::MetaData & getMetaData() const
Definition OObject.h:156
OObject(AbcA::ObjectWriterPtr iPtr, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
Definition OObject.h:84
OObject(OArchive &iArchive, TopFlag, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
Definition OObject.h:120
const std::string & getFullName() const
Definition OObject.h:151
OObject getChild(const std::string &iChildName)
Alembic::Util::shared_ptr< ObjectWriter > ObjectWriterPtr
ErrorHandler::Policy GetErrorHandlerPolicy(SOMETHING iSomething, const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition Argument.h:242
Alembic namespace ...
Definition ArchiveInfo.h:46