Alembic: AbcCoreHDF5/ApwImpl.h Source File

Alembic 1.8.11

Loading...
Searching...
No Matches
ApwImpl.h
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_AbcCoreHDF5_ApwImpl_h
38#define Alembic_AbcCoreHDF5_ApwImpl_h
39
40#include <Alembic/AbcCoreHDF5/Foundation.h>
41#include <Alembic/AbcCoreHDF5/SimplePwImpl.h>
42#include <Alembic/AbcCoreHDF5/WrittenArraySampleMap.h>
43
44namespace Alembic {
45namespace AbcCoreHDF5 {
46namespace ALEMBIC_VERSION_NS {
47
48//-*****************************************************************************
49 class ApwImpl
50 : public SimplePwImpl<AbcA::ArrayPropertyWriter,
51 ApwImpl,
52 const AbcA::ArraySample &,
53 AbcA::ArraySample::Key>
54 , public Alembic::Util::enable_shared_from_this<ApwImpl>
55{
56protected:
57 friend class CpwData;
58
59 //-*************************************************************************
60 ApwImpl( AbcA::CompoundPropertyWriterPtr iParent,
61 hid_t iParentGroup,
62 const std::string & iName,
63 const AbcA::MetaData & iMetaData,
64 const AbcA::DataType & iDataType,
65 uint32_t iTimeSamplingIndex );
66
67 virtual AbcA::ArrayPropertyWriterPtr asArrayPtr();
68
69public:
70 virtual ~ApwImpl();
71
72 //-*************************************************************************
73 static AbcA::ArraySample::Key
74 computeSampleKey( const AbcA::ArraySample &iSamp )
75 {
76 return iSamp.getKey();
77 }
78
79 //-*************************************************************************
80 bool sameAsPreviousSample( const AbcA::ArraySample &iSamp,
81 const AbcA::ArraySample::Key &iKey ) const
82 {
83 return ( m_previousWrittenArraySampleID &&
84 iKey == m_previousWrittenArraySampleID->getKey() );
85 }
86
87 //-*************************************************************************
88 void copyPreviousSample( hid_t iGroup,
89 const std::string &iSampleName,
90 index_t iSampleIndex );
91
92 //-*************************************************************************
93 void writeSample( hid_t iGroup,
94 const std::string &iSampleName,
95 index_t iSampleIndex,
96 const AbcA::ArraySample & iSamp,
97 const AbcA::ArraySample::Key &iKey );
98
99protected:
100 // Previous written array sample identifier!
101 WrittenArraySampleIDPtr m_previousWrittenArraySampleID;
102
103private:
104 bool m_isScalarLike;
105 std::size_t m_previousNumPoints;
106
107};
108
109} // End namespace ALEMBIC_VERSION_NS
110
111using namespace ALEMBIC_VERSION_NS;
112
113} // End namespace AbcCoreHDF5
114} // End namespace Alembic
115
116#endif
Alembic::AbcCoreHDF5::ALEMBIC_VERSION_NS::ApwImpl::asArrayPtr
virtual AbcA::ArrayPropertyWriterPtr asArrayPtr()
Definition ApwImpl.cpp:86
Alembic
Alembic namespace ...
Definition ArchiveInfo.cpp:39