HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
40 #include <Alembic/Abc/Foundation.h>
42 
43 namespace Alembic {
44 namespace Abc {
45 namespace ALEMBIC_VERSION_NS {
46 
48 
49 //-*****************************************************************************
50 template <class TRAITS>
52 {
53 public:
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  {
103  "Invalid DataType in TypedArraySample. Expected: "
104  << TRAITS::dataType()
105  << ", but got: " << iCopy.getDataType() );
106  }
107 
109  {
110  ArraySample::operator=( iCopy );
111 
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 //-*****************************************************************************
218 typedef Alembic::Util::shared_ptr<BoolArraySample> BoolArraySamplePtr;
219 typedef Alembic::Util::shared_ptr<UcharArraySample> UcharArraySamplePtr;
220 typedef Alembic::Util::shared_ptr<CharArraySample> CharArraySamplePtr;
221 typedef Alembic::Util::shared_ptr<UInt16ArraySample> UInt16ArraySamplePtr;
222 typedef Alembic::Util::shared_ptr<Int16ArraySample> Int16ArraySamplePtr;
223 typedef Alembic::Util::shared_ptr<UInt32ArraySample> UInt32ArraySamplePtr;
224 typedef Alembic::Util::shared_ptr<Int32ArraySample> Int32ArraySamplePtr;
225 typedef Alembic::Util::shared_ptr<UInt64ArraySample> UInt64ArraySamplePtr;
226 typedef Alembic::Util::shared_ptr<Int64ArraySample> Int64ArraySamplePtr;
227 typedef Alembic::Util::shared_ptr<HalfArraySample> HalfArraySamplePtr;
228 typedef Alembic::Util::shared_ptr<FloatArraySample> FloatArraySamplePtr;
229 typedef Alembic::Util::shared_ptr<DoubleArraySample> DoubleArraySamplePtr;
230 typedef Alembic::Util::shared_ptr<StringArraySample> StringArraySamplePtr;
231 typedef Alembic::Util::shared_ptr<WstringArraySample> WstringArraySamplePtr;
232 
233 typedef Alembic::Util::shared_ptr<V2sArraySample> V2sArraySamplePtr;
234 typedef Alembic::Util::shared_ptr<V2iArraySample> V2iArraySamplePtr;
235 typedef Alembic::Util::shared_ptr<V2fArraySample> V2fArraySamplePtr;
236 typedef Alembic::Util::shared_ptr<V2dArraySample> V2dArraySamplePtr;
237 
238 typedef Alembic::Util::shared_ptr<V3sArraySample> V3sArraySamplePtr;
239 typedef Alembic::Util::shared_ptr<V3iArraySample> V3iArraySamplePtr;
240 typedef Alembic::Util::shared_ptr<V3fArraySample> V3fArraySamplePtr;
241 typedef Alembic::Util::shared_ptr<V3dArraySample> V3dArraySamplePtr;
242 
243 typedef Alembic::Util::shared_ptr<P2sArraySample> P2sArraySamplePtr;
244 typedef Alembic::Util::shared_ptr<P2iArraySample> P2iArraySamplePtr;
245 typedef Alembic::Util::shared_ptr<P2fArraySample> P2fArraySamplePtr;
246 typedef Alembic::Util::shared_ptr<P2dArraySample> P2dArraySamplePtr;
247 
248 typedef Alembic::Util::shared_ptr<P3sArraySample> P3sArraySamplePtr;
249 typedef Alembic::Util::shared_ptr<P3iArraySample> P3iArraySamplePtr;
250 typedef Alembic::Util::shared_ptr<P3fArraySample> P3fArraySamplePtr;
251 typedef Alembic::Util::shared_ptr<P3dArraySample> P3dArraySamplePtr;
252 
253 typedef Alembic::Util::shared_ptr<Box2sArraySample> Box2sArraySamplePtr;
254 typedef Alembic::Util::shared_ptr<Box2iArraySample> Box2iArraySamplePtr;
255 typedef Alembic::Util::shared_ptr<Box2fArraySample> Box2fArraySamplePtr;
256 typedef Alembic::Util::shared_ptr<Box2dArraySample> Box2dArraySamplePtr;
257 
258 typedef Alembic::Util::shared_ptr<Box3sArraySample> Box3sArraySamplePtr;
259 typedef Alembic::Util::shared_ptr<Box3iArraySample> Box3iArraySamplePtr;
260 typedef Alembic::Util::shared_ptr<Box3fArraySample> Box3fArraySamplePtr;
261 typedef Alembic::Util::shared_ptr<Box3dArraySample> Box3dArraySamplePtr;
262 
263 typedef Alembic::Util::shared_ptr<M33fArraySample> M33fArraySamplePtr;
264 typedef Alembic::Util::shared_ptr<M33dArraySample> M33dArraySamplePtr;
265 
266 typedef Alembic::Util::shared_ptr<M44fArraySample> M44fArraySamplePtr;
267 typedef Alembic::Util::shared_ptr<M44dArraySample> M44dArraySamplePtr;
268 
269 typedef Alembic::Util::shared_ptr<QuatfArraySample> QuatfArraySamplePtr;
270 typedef Alembic::Util::shared_ptr<QuatdArraySample> QuatdArraySamplePtr;
271 
272 typedef Alembic::Util::shared_ptr<C3hArraySample> C3hArraySamplePtr;
273 typedef Alembic::Util::shared_ptr<C3fArraySample> C3fArraySamplePtr;
274 typedef Alembic::Util::shared_ptr<C3cArraySample> C3cArraySamplePtr;
275 
276 typedef Alembic::Util::shared_ptr<C4hArraySample> C4hArraySamplePtr;
277 typedef Alembic::Util::shared_ptr<C4fArraySample> C4fArraySamplePtr;
278 typedef Alembic::Util::shared_ptr<C4cArraySample> C4cArraySamplePtr;
279 
280 typedef Alembic::Util::shared_ptr<N2fArraySample> N2fArraySamplePtr;
281 typedef Alembic::Util::shared_ptr<N2dArraySample> N2dArraySamplePtr;
282 
283 typedef Alembic::Util::shared_ptr<N3fArraySample> N3fArraySamplePtr;
284 typedef Alembic::Util::shared_ptr<N3dArraySample> N3dArraySamplePtr;
285 
286 } // End namespace ALEMBIC_VERSION_NS
287 
288 using namespace ALEMBIC_VERSION_NS;
289 
290 } // End namespace Abc
291 } // End namespace Alembic
292 
293 #endif
TypedArraySample< Int32TPTraits > Int32ArraySample
Alembic::Util::shared_ptr< C3cArraySample > C3cArraySamplePtr
Alembic::Util::shared_ptr< UInt32ArraySample > UInt32ArraySamplePtr
Alembic::Util::shared_ptr< P3sArraySample > P3sArraySamplePtr
TypedArraySample< C4fTPTraits > C4fArraySample
Alembic::Util::shared_ptr< HalfArraySample > HalfArraySamplePtr
TypedArraySample< Box3sTPTraits > Box3sArraySample
TypedArraySample< Box2fTPTraits > Box2fArraySample
TypedArraySample< WstringTPTraits > WstringArraySample
TypedArraySample(const value_type *iValues, size_t iNumVals)
TypedArraySample< C4hTPTraits > C4hArraySample
TypedArraySample< P3sTPTraits > P3sArraySample
Alembic::Util::shared_ptr< UInt64ArraySample > UInt64ArraySamplePtr
Alembic::Util::shared_ptr< Box2fArraySample > Box2fArraySamplePtr
TypedArraySample< Box2iTPTraits > Box2iArraySample
TypedArraySample< V3iTPTraits > V3iArraySample
Alembic::Util::shared_ptr< Int32ArraySample > Int32ArraySamplePtr
TypedArraySample< QuatdTPTraits > QuatdArraySample
void
Definition: png.h:1083
TypedArraySample< P2iTPTraits > P2iArraySample
Alembic::Util::shared_ptr< V3sArraySample > V3sArraySamplePtr
Alembic::Util::shared_ptr< V3fArraySample > V3fArraySamplePtr
TypedArraySample< C3hTPTraits > C3hArraySample
TypedArraySample< N3fTPTraits > N3fArraySample
Alembic::Util::shared_ptr< CharArraySample > CharArraySamplePtr
TypedArraySample< M33dTPTraits > M33dArraySample
Alembic::Util::shared_ptr< DoubleArraySample > DoubleArraySamplePtr
Alembic::Util::shared_ptr< P2fArraySample > P2fArraySamplePtr
Alembic::Util::shared_ptr< Box3iArraySample > Box3iArraySamplePtr
Alembic::Util::shared_ptr< Box3sArraySample > Box3sArraySamplePtr
TypedArraySample< V3sTPTraits > V3sArraySample
Alembic::Util::shared_ptr< V3iArraySample > V3iArraySamplePtr
TypedArraySample< V2fTPTraits > V2fArraySample
Alembic::Util::shared_ptr< P3iArraySample > P3iArraySamplePtr
TypedArraySample< Box3fTPTraits > Box3fArraySample
TypedArraySample< V2iTPTraits > V2iArraySample
TypedArraySample< Uint64TPTraits > UInt64ArraySample
uint64 value_type
Definition: GA_PrimCompat.h:29
Alembic::Util::shared_ptr< FloatArraySample > FloatArraySamplePtr
TypedArraySample< V2sTPTraits > V2sArraySample
TypedArraySample< TRAITS > operator=(const AbcA::ArraySample &iCopy)
static TypedArraySample< TRAITS > emptySample()
TypedArraySample< StringTPTraits > StringArraySample
TypedArraySample< N2dTPTraits > N2dArraySample
Alembic::Util::shared_ptr< BoolArraySample > BoolArraySamplePtr
TypedArraySample< Box2sTPTraits > Box2sArraySample
TypedArraySample< V2dTPTraits > V2dArraySample
TypedArraySample< C3cTPTraits > C3cArraySample
TypedArraySample< Uint16TPTraits > UInt16ArraySample
Alembic::Util::shared_ptr< N2fArraySample > N2fArraySamplePtr
TypedArraySample< V3dTPTraits > V3dArraySample
Alembic::Util::shared_ptr< M44fArraySample > M44fArraySamplePtr
Alembic::Util::shared_ptr< V2fArraySample > V2fArraySamplePtr
TypedArraySample< M44fTPTraits > M44fArraySample
TypedArraySample< N2fTPTraits > N2fArraySample
TypedArraySample< N3dTPTraits > N3dArraySample
TypedArraySample< V3fTPTraits > V3fArraySample
TypedArraySample< Box3dTPTraits > Box3dArraySample
Alembic::Util::shared_ptr< P2iArraySample > P2iArraySamplePtr
TypedArraySample< Int8TPTraits > CharArraySample
Alembic::Util::shared_ptr< C4cArraySample > C4cArraySamplePtr
TypedArraySample< Uint8TPTraits > UcharArraySample
Alembic::Util::shared_ptr< Int64ArraySample > Int64ArraySamplePtr
Alembic::Util::shared_ptr< Box2iArraySample > Box2iArraySamplePtr
Alembic::Util::shared_ptr< UcharArraySample > UcharArraySamplePtr
TypedArraySample< P2dTPTraits > P2dArraySample
TypedArraySample< Float16TPTraits > HalfArraySample
Alembic::Util::shared_ptr< V2iArraySample > V2iArraySamplePtr
Alembic::Util::shared_ptr< Box2dArraySample > Box2dArraySamplePtr
TypedArraySample(const value_vector &iVec, const Dimensions &iDims)
TypedArraySample< Box3iTPTraits > Box3iArraySample
TypedArraySample< QuatfTPTraits > QuatfArraySample
TypedArraySample< Int16TPTraits > Int16ArraySample
TypedArraySample(const AbcA::ArraySample &iCopy)
TypedArraySample(const value_type *iValues, const Dimensions &iDims)
Alembic::Util::shared_ptr< P3dArraySample > P3dArraySamplePtr
Alembic::Util::shared_ptr< QuatfArraySample > QuatfArraySamplePtr
Alembic::Util::shared_ptr< UInt16ArraySample > UInt16ArraySamplePtr
Alembic::Util::shared_ptr< WstringArraySample > WstringArraySamplePtr
TypedArraySample< P2fTPTraits > P2fArraySample
Alembic::Util::shared_ptr< N3fArraySample > N3fArraySamplePtr
Alembic::Util::shared_ptr< N3dArraySample > N3dArraySamplePtr
GLsizeiptr size
Definition: glcorearb.h:664
TypedArraySample< P3iTPTraits > P3iArraySample
TypedArraySample< Float64TPTraits > DoubleArraySample
Alembic::Util::shared_ptr< Box2sArraySample > Box2sArraySamplePtr
TypedArraySample< P3dTPTraits > P3dArraySample
BaseDimensions< Alembic::Util::uint64_t > Dimensions
Definition: Dimensions.h:189
Alembic::Util::shared_ptr< Box3fArraySample > Box3fArraySamplePtr
Alembic::Util::shared_ptr< V2sArraySample > V2sArraySamplePtr
Alembic::Util::shared_ptr< V2dArraySample > V2dArraySamplePtr
TypedArraySample< Box2dTPTraits > Box2dArraySample
TypedArraySample< Uint32TPTraits > UInt32ArraySample
TypedArraySample< M44dTPTraits > M44dArraySample
TypedArraySample< M33fTPTraits > M33fArraySample
Alembic::Util::shared_ptr< P2sArraySample > P2sArraySamplePtr
const value_type & operator[](const size_t i) const
Alembic::Util::shared_ptr< C4fArraySample > C4fArraySamplePtr
Alembic::Util::shared_ptr< StringArraySample > StringArraySamplePtr
TypedArraySample< P3fTPTraits > P3fArraySample
TypedArraySample< C4cTPTraits > C4cArraySample
TypedArraySample< Int64TPTraits > Int64ArraySample
Alembic::Util::shared_ptr< C3fArraySample > C3fArraySamplePtr
Alembic::Util::shared_ptr< Box3dArraySample > Box3dArraySamplePtr
Alembic::Util::shared_ptr< M33dArraySample > M33dArraySamplePtr
Alembic::Util::shared_ptr< M33fArraySample > M33fArraySamplePtr
TypedArraySample< Float32TPTraits > FloatArraySample
TypedArraySample< BooleanTPTraits > BoolArraySample
#define const
Definition: zconf.h:214
TypedArraySample< P2sTPTraits > P2sArraySample
Alembic::Util::shared_ptr< C3hArraySample > C3hArraySamplePtr
HUSD_API const char * dataType()
Alembic::Util::shared_ptr< Int16ArraySample > Int16ArraySamplePtr
Alembic::Util::shared_ptr< QuatdArraySample > QuatdArraySamplePtr
Alembic::Util::shared_ptr< N2dArraySample > N2dArraySamplePtr
Alembic::Util::shared_ptr< C4hArraySample > C4hArraySamplePtr
Alembic::Util::shared_ptr< V3dArraySample > V3dArraySamplePtr
#define ABCA_ASSERT(COND, TEXT)
Definition: Foundation.h:99
TypedArraySample< C3fTPTraits > C3fArraySample
Alembic::Util::shared_ptr< M44dArraySample > M44dArraySamplePtr
Alembic::Util::shared_ptr< P3fArraySample > P3fArraySamplePtr
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:88
Alembic::Util::shared_ptr< P2dArraySample > P2dArraySamplePtr