Alembic
1.8.11
Toggle main menu visibility
Loading...
Searching...
No Matches
OBaseProperty.h
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_OBaseProperty_h
38
#define Alembic_Abc_OBaseProperty_h
39
40
#include <Alembic/Abc/Foundation.h>
41
#include <Alembic/Abc/Base.h>
42
#include <Alembic/Abc/Argument.h>
43
#include <Alembic/Abc/OObject.h>
44
#include <Alembic/Abc/OArchive.h>
45
46
namespace
Alembic
{
47
namespace
Abc {
48
namespace
ALEMBIC_VERSION_NS {
49
50
//-*****************************************************************************
56
template
<
class
PROP_PTR>
57
class
OBasePropertyT
:
public
Base
58
{
59
public
:
62
typedef
OBasePropertyT<PROP_PTR>
this_type
;
63
typedef
OBasePropertyT<PROP_PTR>
operator_bool_base_type;
64
65
protected
:
66
friend
class
OCompoundProperty;
67
68
//-*************************************************************************
69
// CONSTRUCTION, DESTRUCTION, ASSIGNMENT
70
//-*************************************************************************
71
74
OBasePropertyT
() {}
75
78
OBasePropertyT
(
79
82
PROP_PTR iPtr,
83
86
ErrorHandler::Policy iPolicy );
87
90
91
public
:
92
//-*************************************************************************
93
// PROPERTY WRITER FUNCTIONALITY
94
//-*************************************************************************
95
98
const
AbcA::PropertyHeader &
getHeader
()
const
;
99
102
const
std::string &
getName
()
const
103
{
return
getHeader
().getName(); }
104
107
AbcA::PropertyType
getPropertyType
()
const
108
{
return
getHeader
().getPropertyType(); }
109
112
bool
isScalar
()
const
{
return
getPropertyType
() == AbcA::kScalarProperty; }
113
116
bool
isArray
()
const
{
return
getPropertyType
() == AbcA::kArrayProperty; }
117
120
bool
isCompound
()
const
{
return
getPropertyType
() ==
121
AbcA::kCompoundProperty; }
122
125
bool
isSimple
()
const
{
return
!
isCompound
(); }
126
129
const
AbcA::MetaData &
getMetaData
()
const
130
{
return
getHeader
().getMetaData(); }
131
136
const
AbcA::DataType &
getDataType
()
const
137
{
return
getHeader
().getDataType(); }
138
143
AbcA::TimeSamplingPtr
getTimeSampling
()
const
144
{
return
getHeader
().getTimeSampling(); }
145
148
OObject
getObject
()
const
;
149
152
153
//-*************************************************************************
154
// ABC BASE MECHANISMS
155
// These functions are used by Abc to deal with errors, rewrapping,
156
// and so on.
157
//-*************************************************************************
158
162
PROP_PTR
getPtr
()
const
{
return
m_property; }
163
166
void
reset
() { m_property.reset(); Base::reset(); }
167
170
bool
valid
()
const
171
{
172
return
( Base::valid() && m_property );
173
}
174
177
ALEMBIC_OPERATOR_BOOL
(
valid
() );
178
179
protected
:
180
PROP_PTR m_property;
181
};
182
183
//-*****************************************************************************
184
typedef
OBasePropertyT<AbcA::BasePropertyWriterPtr>
OBaseProperty;
185
186
//-*****************************************************************************
187
// TEMPLATE AND INLINE FUNCTIONS
188
//-*****************************************************************************
189
190
//-*****************************************************************************
191
template
<
class
PROP_PTR>
192
inline
OBasePropertyT<PROP_PTR>::OBasePropertyT
193
(
194
PROP_PTR iPtr,
195
ErrorHandler::Policy iPolicy )
196
: m_property( iPtr )
197
{
198
getErrorHandler().setPolicy( iPolicy );
199
}
200
201
namespace
{
202
203
const
AbcA::PropertyHeader g_phd;
204
205
}
206
207
//-*****************************************************************************
208
//-*****************************************************************************
209
//-*****************************************************************************
210
template
<
class
PROP_PTR>
211
const
AbcA::PropertyHeader &
OBasePropertyT<PROP_PTR>::getHeader
()
const
212
{
213
ALEMBIC_ABC_SAFE_CALL_BEGIN(
"OBaseProperty::getHeader()"
);
214
215
return
m_property->getHeader();
216
217
ALEMBIC_ABC_SAFE_CALL_END();
218
219
// Not all error handlers throw, so have a default behavior.
220
return
g_phd;
221
};
222
223
//-*****************************************************************************
224
template
<
class
PROP_PTR>
225
OObject
OBasePropertyT<PROP_PTR>::getObject
()
const
226
{
227
ALEMBIC_ABC_SAFE_CALL_BEGIN(
"OBaseProperty::getObject()"
);
228
229
return
OObject
( m_property->getObject(),
230
getErrorHandlerPolicy() );
231
232
ALEMBIC_ABC_SAFE_CALL_END();
233
234
// Not all error handlers throw. Have a default.
235
return
OObject
();
236
}
237
238
}
// End namespace ALEMBIC_VERSION_NS
239
240
using namespace
ALEMBIC_VERSION_NS;
241
242
}
// End namespace Abc
243
}
// End namespace Alembic
244
245
#endif
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT
Definition
OBaseProperty.h:58
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::isCompound
bool isCompound() const
Definition
OBaseProperty.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getName
const std::string & getName() const
Definition
OBaseProperty.h:102
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::OBasePropertyT
OBasePropertyT()
Definition
OBaseProperty.h:74
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::isSimple
bool isSimple() const
Definition
OBaseProperty.h:125
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getHeader
const AbcA::PropertyHeader & getHeader() const
Definition
OBaseProperty.h:211
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getPtr
PROP_PTR getPtr() const
Definition
OBaseProperty.h:162
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::reset
void reset()
Definition
OBaseProperty.h:166
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::ALEMBIC_OPERATOR_BOOL
ALEMBIC_OPERATOR_BOOL(valid())
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::OBasePropertyT
OBasePropertyT(PROP_PTR iPtr, ErrorHandler::Policy iPolicy)
Definition
OBaseProperty.h:193
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getTimeSampling
AbcA::TimeSamplingPtr getTimeSampling() const
Definition
OBaseProperty.h:143
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getPropertyType
AbcA::PropertyType getPropertyType() const
Definition
OBaseProperty.h:107
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::this_type
OBasePropertyT< PROP_PTR > this_type
Definition
OBaseProperty.h:62
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getObject
OObject getObject() const
Definition
OBaseProperty.h:225
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getDataType
const AbcA::DataType & getDataType() const
Definition
OBaseProperty.h:136
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::valid
bool valid() const
Definition
OBaseProperty.h:170
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::isScalar
bool isScalar() const
Definition
OBaseProperty.h:112
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::isArray
bool isArray() const
Definition
OBaseProperty.h:116
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getMetaData
const AbcA::MetaData & getMetaData() const
Definition
OBaseProperty.h:129
Alembic::Abc::ALEMBIC_VERSION_NS::OObject
Definition
OObject.h:54
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::OObject
OObject()
Definition
OObject.h:68
Alembic
Alembic namespace ...
Definition
ArchiveInfo.cpp:39
Abc
OBaseProperty.h
Generated by
1.18.0