Alembic Version 1.1
Loading...
Searching...
No Matches
TypedArraySample.h
Go to the documentation of this file.
1//-*****************************************************************************
2//
3// Copyright (c) 2009-2012,
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_TypedArraySample_h
38#define Alembic_Abc_TypedArraySample_h
39
42
43namespace Alembic {
44namespace Abc {
45namespace ALEMBIC_VERSION_NS {
46
48
49//-*****************************************************************************
50template <class TRAITS>
52{
53public:
54 typedef TRAITS traits_type;
56 typedef typename TRAITS::value_type value_type;
57 typedef typename std::vector<value_type> value_vector;
58
59 //-*************************************************************************
60 // Default
62 : AbcA::ArraySample( NULL, TRAITS::dataType(), Dimensions() ) {}
63
64 //-*************************************************************************
65 // From pointer+num or pointer+dims
66 TypedArraySample( const value_type *iValues, size_t iNumVals )
67 : AbcA::ArraySample( reinterpret_cast<const void *>( iValues ),
68 TRAITS::dataType(), Dimensions( iNumVals ) ) {}
69
70 TypedArraySample( const value_type *iValues, const Dimensions &iDims )
71 : AbcA::ArraySample( reinterpret_cast<const void *>( iValues ),
72 TRAITS::dataType(), iDims ) {}
73
74 //-*************************************************************************
75 // From std::vector
77 : AbcA::ArraySample( reinterpret_cast<const void *>( iVec.size() > 0 ?
78 &iVec.front() :
79 NULL ),
80 TRAITS::dataType(), Dimensions( iVec.size() ) ) {}
81
82 // This is for the case in which the data is multi-dimensional
84 const Dimensions &iDims )
85 : AbcA::ArraySample( reinterpret_cast<const void *>( iVec.size() > 0 ?
86 &iVec.front() :
87 NULL ),
88 TRAITS::dataType(), iDims )
89 {
90 ABCA_ASSERT( iDims.numPoints() == iVec.size(),
91 "Invalid dimensions in TypedArraySample" );
92 }
93
94 //-*************************************************************************
95 // COPY & ASSIGMENT
96 //-*************************************************************************
97
98 // From base copy
100 : AbcA::ArraySample( iCopy )
101 {
102 ABCA_ASSERT( iCopy.getDataType() == TRAITS::dataType(),
103 "Invalid DataType in TypedArraySample. Expected: "
104 << TRAITS::dataType()
105 << ", but got: " << iCopy.getDataType() );
106 }
107
109 {
110 ArraySample::operator=( iCopy );
111
112 ABCA_ASSERT( iCopy.getDataType() == TRAITS::dataType(),
113 "Invalid DataType in TypedArraySample. Expected: "
114 << TRAITS::dataType()
115 << ", but got: " << iCopy.getDataType() );
116
117 return *this;
118 }
119
120 const value_type *get() const
121 {
122 return reinterpret_cast<const value_type *>( getData() );
123 }
124
125 const value_type *operator->() const { return this->get(); }
126
127 //-*************************************************************************
128 const value_type &operator[]( const size_t i ) const
129 {
130 return this->get()[i];
131 }
132
133 //-*************************************************************************
134 size_t size() const { return this->getDimensions().numPoints(); }
135
137 {
138 return TypedArraySample<TRAITS>( NULL, 0 );
139 }
140
141 //-*************************************************************************
143
144};
145
146//-*****************************************************************************
147// TYPEDEFS
148//-*****************************************************************************
163
168
173
178
183
188
193
196
199
202
206
210
213
216
217//-*****************************************************************************
218typedef Alembic::Util::shared_ptr<BoolArraySample> BoolArraySamplePtr;
219typedef Alembic::Util::shared_ptr<UcharArraySample> UcharArraySamplePtr;
220typedef Alembic::Util::shared_ptr<CharArraySample> CharArraySamplePtr;
221typedef Alembic::Util::shared_ptr<UInt16ArraySample> UInt16ArraySamplePtr;
222typedef Alembic::Util::shared_ptr<Int16ArraySample> Int16ArraySamplePtr;
223typedef Alembic::Util::shared_ptr<UInt32ArraySample> UInt32ArraySamplePtr;
224typedef Alembic::Util::shared_ptr<Int32ArraySample> Int32ArraySamplePtr;
225typedef Alembic::Util::shared_ptr<UInt64ArraySample> UInt64ArraySamplePtr;
226typedef Alembic::Util::shared_ptr<Int64ArraySample> Int64ArraySamplePtr;
227typedef Alembic::Util::shared_ptr<HalfArraySample> HalfArraySamplePtr;
228typedef Alembic::Util::shared_ptr<FloatArraySample> FloatArraySamplePtr;
229typedef Alembic::Util::shared_ptr<DoubleArraySample> DoubleArraySamplePtr;
230typedef Alembic::Util::shared_ptr<StringArraySample> StringArraySamplePtr;
231typedef Alembic::Util::shared_ptr<WstringArraySample> WstringArraySamplePtr;
232
233typedef Alembic::Util::shared_ptr<V2sArraySample> V2sArraySamplePtr;
234typedef Alembic::Util::shared_ptr<V2iArraySample> V2iArraySamplePtr;
235typedef Alembic::Util::shared_ptr<V2fArraySample> V2fArraySamplePtr;
236typedef Alembic::Util::shared_ptr<V2dArraySample> V2dArraySamplePtr;
237
238typedef Alembic::Util::shared_ptr<V3sArraySample> V3sArraySamplePtr;
239typedef Alembic::Util::shared_ptr<V3iArraySample> V3iArraySamplePtr;
240typedef Alembic::Util::shared_ptr<V3fArraySample> V3fArraySamplePtr;
241typedef Alembic::Util::shared_ptr<V3dArraySample> V3dArraySamplePtr;
242
243typedef Alembic::Util::shared_ptr<P2sArraySample> P2sArraySamplePtr;
244typedef Alembic::Util::shared_ptr<P2iArraySample> P2iArraySamplePtr;
245typedef Alembic::Util::shared_ptr<P2fArraySample> P2fArraySamplePtr;
246typedef Alembic::Util::shared_ptr<P2dArraySample> P2dArraySamplePtr;
247
248typedef Alembic::Util::shared_ptr<P3sArraySample> P3sArraySamplePtr;
249typedef Alembic::Util::shared_ptr<P3iArraySample> P3iArraySamplePtr;
250typedef Alembic::Util::shared_ptr<P3fArraySample> P3fArraySamplePtr;
251typedef Alembic::Util::shared_ptr<P3dArraySample> P3dArraySamplePtr;
252
253typedef Alembic::Util::shared_ptr<Box2sArraySample> Box2sArraySamplePtr;
254typedef Alembic::Util::shared_ptr<Box2iArraySample> Box2iArraySamplePtr;
255typedef Alembic::Util::shared_ptr<Box2fArraySample> Box2fArraySamplePtr;
256typedef Alembic::Util::shared_ptr<Box2dArraySample> Box2dArraySamplePtr;
257
258typedef Alembic::Util::shared_ptr<Box3sArraySample> Box3sArraySamplePtr;
259typedef Alembic::Util::shared_ptr<Box3iArraySample> Box3iArraySamplePtr;
260typedef Alembic::Util::shared_ptr<Box3fArraySample> Box3fArraySamplePtr;
261typedef Alembic::Util::shared_ptr<Box3dArraySample> Box3dArraySamplePtr;
262
263typedef Alembic::Util::shared_ptr<M33fArraySample> M33fArraySamplePtr;
264typedef Alembic::Util::shared_ptr<M33dArraySample> M33dArraySamplePtr;
265
266typedef Alembic::Util::shared_ptr<M44fArraySample> M44fArraySamplePtr;
267typedef Alembic::Util::shared_ptr<M44dArraySample> M44dArraySamplePtr;
268
269typedef Alembic::Util::shared_ptr<QuatfArraySample> QuatfArraySamplePtr;
270typedef Alembic::Util::shared_ptr<QuatdArraySample> QuatdArraySamplePtr;
271
272typedef Alembic::Util::shared_ptr<C3hArraySample> C3hArraySamplePtr;
273typedef Alembic::Util::shared_ptr<C3fArraySample> C3fArraySamplePtr;
274typedef Alembic::Util::shared_ptr<C3cArraySample> C3cArraySamplePtr;
275
276typedef Alembic::Util::shared_ptr<C4hArraySample> C4hArraySamplePtr;
277typedef Alembic::Util::shared_ptr<C4fArraySample> C4fArraySamplePtr;
278typedef Alembic::Util::shared_ptr<C4cArraySample> C4cArraySamplePtr;
279
280typedef Alembic::Util::shared_ptr<N2fArraySample> N2fArraySamplePtr;
281typedef Alembic::Util::shared_ptr<N2dArraySample> N2dArraySamplePtr;
282
283typedef Alembic::Util::shared_ptr<N3fArraySample> N3fArraySamplePtr;
284typedef Alembic::Util::shared_ptr<N3dArraySample> N3dArraySamplePtr;
285
286} // End namespace ALEMBIC_VERSION_NS
287
288using namespace ALEMBIC_VERSION_NS;
289
290} // End namespace Abc
291} // End namespace Alembic
292
293#endif
#define ABCA_ASSERT(COND, TEXT)
Definition Foundation.h:99
#define ALEMBIC_VERSION_NS
Definition Foundation.h:105
TypedArraySample< TRAITS > operator=(const AbcA::ArraySample &iCopy)
TypedArraySample(const value_vector &iVec, const Dimensions &iDims)
static TypedArraySample< TRAITS > emptySample()
TypedArraySample(const value_type *iValues, const Dimensions &iDims)
const value_type & operator[](const size_t i) const
TypedArraySample(const value_type *iValues, size_t iNumVals)
Alembic::Util::shared_ptr< C3fArraySample > C3fArraySamplePtr
TypedArraySample< Float64TPTraits > DoubleArraySample
TypedArraySample< Box2iTPTraits > Box2iArraySample
Alembic::Util::shared_ptr< Box3iArraySample > Box3iArraySamplePtr
TypedArraySample< V2iTPTraits > V2iArraySample
TypedArraySample< M44fTPTraits > M44fArraySample
Alembic::Util::shared_ptr< Box3fArraySample > Box3fArraySamplePtr
TypedArraySample< Int16TPTraits > Int16ArraySample
TypedArraySample< V3dTPTraits > V3dArraySample
Alembic::Util::shared_ptr< C4hArraySample > C4hArraySamplePtr
TypedArraySample< V3fTPTraits > V3fArraySample
TypedArraySample< Box3sTPTraits > Box3sArraySample
Alembic::Util::shared_ptr< P2sArraySample > P2sArraySamplePtr
Alembic::Util::shared_ptr< Box3sArraySample > Box3sArraySamplePtr
Alembic::Util::shared_ptr< N3fArraySample > N3fArraySamplePtr
Alembic::Util::shared_ptr< P2dArraySample > P2dArraySamplePtr
TypedArraySample< Box3iTPTraits > Box3iArraySample
TypedArraySample< C4cTPTraits > C4cArraySample
Alembic::Util::shared_ptr< FloatArraySample > FloatArraySamplePtr
Alembic::Util::shared_ptr< P3sArraySample > P3sArraySamplePtr
TypedArraySample< WstringTPTraits > WstringArraySample
Alembic::Util::shared_ptr< UcharArraySample > UcharArraySamplePtr
TypedArraySample< P3iTPTraits > P3iArraySample
TypedArraySample< C4fTPTraits > C4fArraySample
Alembic::Util::shared_ptr< Box2dArraySample > Box2dArraySamplePtr
TypedArraySample< Float32TPTraits > FloatArraySample
Alembic::Util::shared_ptr< Box2fArraySample > Box2fArraySamplePtr
TypedArraySample< P2fTPTraits > P2fArraySample
TypedArraySample< C3fTPTraits > C3fArraySample
TypedArraySample< BooleanTPTraits > BoolArraySample
Alembic::Util::shared_ptr< QuatfArraySample > QuatfArraySamplePtr
Alembic::Util::shared_ptr< M33fArraySample > M33fArraySamplePtr
TypedArraySample< QuatfTPTraits > QuatfArraySample
Alembic::Util::shared_ptr< QuatdArraySample > QuatdArraySamplePtr
Alembic::Util::shared_ptr< V3dArraySample > V3dArraySamplePtr
Alembic::Util::shared_ptr< Box3dArraySample > Box3dArraySamplePtr
Alembic::Util::shared_ptr< C3hArraySample > C3hArraySamplePtr
Alembic::Util::shared_ptr< M44fArraySample > M44fArraySamplePtr
TypedArraySample< P2iTPTraits > P2iArraySample
Alembic::Util::shared_ptr< UInt64ArraySample > UInt64ArraySamplePtr
TypedArraySample< V2sTPTraits > V2sArraySample
Alembic::Util::shared_ptr< Box2iArraySample > Box2iArraySamplePtr
Alembic::Util::shared_ptr< Int16ArraySample > Int16ArraySamplePtr
TypedArraySample< Uint16TPTraits > UInt16ArraySample
TypedArraySample< M33dTPTraits > M33dArraySample
TypedArraySample< Uint64TPTraits > UInt64ArraySample
Alembic::Util::shared_ptr< DoubleArraySample > DoubleArraySamplePtr
Alembic::Util::shared_ptr< M33dArraySample > M33dArraySamplePtr
TypedArraySample< N2dTPTraits > N2dArraySample
Alembic::Util::shared_ptr< Int32ArraySample > Int32ArraySamplePtr
Alembic::Util::shared_ptr< V2dArraySample > V2dArraySamplePtr
Alembic::Util::shared_ptr< UInt16ArraySample > UInt16ArraySamplePtr
TypedArraySample< P3dTPTraits > P3dArraySample
Alembic::Util::shared_ptr< V2sArraySample > V2sArraySamplePtr
Alembic::Util::shared_ptr< P2fArraySample > P2fArraySamplePtr
Alembic::Util::shared_ptr< C4fArraySample > C4fArraySamplePtr
Alembic::Util::shared_ptr< N2fArraySample > N2fArraySamplePtr
Alembic::Util::shared_ptr< Box2sArraySample > Box2sArraySamplePtr
TypedArraySample< QuatdTPTraits > QuatdArraySample
Alembic::Util::shared_ptr< V3fArraySample > V3fArraySamplePtr
Alembic::Util::shared_ptr< BoolArraySample > BoolArraySamplePtr
TypedArraySample< P3fTPTraits > P3fArraySample
Alembic::Util::shared_ptr< V3sArraySample > V3sArraySamplePtr
Alembic::Util::shared_ptr< WstringArraySample > WstringArraySamplePtr
TypedArraySample< Int32TPTraits > Int32ArraySample
TypedArraySample< StringTPTraits > StringArraySample
TypedArraySample< V2fTPTraits > V2fArraySample
Alembic::Util::shared_ptr< N3dArraySample > N3dArraySamplePtr
Alembic::Util::shared_ptr< C3cArraySample > C3cArraySamplePtr
Alembic::Util::shared_ptr< M44dArraySample > M44dArraySamplePtr
TypedArraySample< M33fTPTraits > M33fArraySample
Alembic::Util::shared_ptr< HalfArraySample > HalfArraySamplePtr
TypedArraySample< C4hTPTraits > C4hArraySample
TypedArraySample< C3cTPTraits > C3cArraySample
TypedArraySample< Box2sTPTraits > Box2sArraySample
Alembic::Util::shared_ptr< P3fArraySample > P3fArraySamplePtr
Alembic::Util::shared_ptr< C4cArraySample > C4cArraySamplePtr
TypedArraySample< Int64TPTraits > Int64ArraySample
TypedArraySample< N2fTPTraits > N2fArraySample
Alembic::Util::shared_ptr< N2dArraySample > N2dArraySamplePtr
Alembic::Util::shared_ptr< Int64ArraySample > Int64ArraySamplePtr
TypedArraySample< C3hTPTraits > C3hArraySample
Alembic::Util::shared_ptr< P3iArraySample > P3iArraySamplePtr
TypedArraySample< V3sTPTraits > V3sArraySample
Alembic::Util::shared_ptr< V3iArraySample > V3iArraySamplePtr
TypedArraySample< Int8TPTraits > CharArraySample
TypedArraySample< M44dTPTraits > M44dArraySample
TypedArraySample< Box2fTPTraits > Box2fArraySample
Alembic::Util::shared_ptr< UInt32ArraySample > UInt32ArraySamplePtr
TypedArraySample< P2dTPTraits > P2dArraySample
Alembic::Util::shared_ptr< P3dArraySample > P3dArraySamplePtr
TypedArraySample< Box3dTPTraits > Box3dArraySample
TypedArraySample< Box3fTPTraits > Box3fArraySample
TypedArraySample< Float16TPTraits > HalfArraySample
Alembic::Util::shared_ptr< V2iArraySample > V2iArraySamplePtr
TypedArraySample< P2sTPTraits > P2sArraySample
Alembic::Util::shared_ptr< P2iArraySample > P2iArraySamplePtr
TypedArraySample< Box2dTPTraits > Box2dArraySample
TypedArraySample< N3fTPTraits > N3fArraySample
TypedArraySample< P3sTPTraits > P3sArraySample
Alembic::Util::shared_ptr< V2fArraySample > V2fArraySamplePtr
Alembic::Util::shared_ptr< StringArraySample > StringArraySamplePtr
TypedArraySample< V2dTPTraits > V2dArraySample
Alembic::Util::shared_ptr< CharArraySample > CharArraySamplePtr
TypedArraySample< Uint8TPTraits > UcharArraySample
TypedArraySample< V3iTPTraits > V3iArraySample
TypedArraySample< N3dTPTraits > N3dArraySample
TypedArraySample< Uint32TPTraits > UInt32ArraySample
Alembic namespace ...
Definition ArchiveInfo.h:46