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_WriteUtil_h
38 #define Alembic_AbcCoreHDF5_WriteUtil_h
39 
40 #include <Alembic/AbcCoreHDF5/Foundation.h>
41 #include <Alembic/AbcCoreHDF5/WrittenArraySampleMap.h>
42 #include <Alembic/AbcCoreHDF5/StringWriteUtil.h>
43 
44 namespace Alembic {
45 namespace AbcCoreHDF5 {
46 namespace ALEMBIC_VERSION_NS {
47 
48 //-*****************************************************************************
49 void
50 WriteReferences( hid_t iParent,
51                  const std::string& iRefName,
52                  size_t iNumRefs,
53                  const void *iRefs );
54 
55 //-*****************************************************************************
56 WrittenArraySampleMap& GetWrittenArraySampleMap(
57     AbcA::ArchiveWriterPtr iArchive );
58 
59 //-*****************************************************************************
60 void
61 WriteDimensions( hid_t iParent,
62                  const std::string &iName,
63                  const Dimensions &iDims );
64 
65 //-*****************************************************************************
66 void
67 WriteKey( hid_t iParent,
68           const std::string &iAttrName,
69           const AbcA::ArraySample::Key &iKey );
70 
71 //-*****************************************************************************
72 void
73 WriteMetaData( hid_t iParent,
74                const std::string &iName,
75                const AbcA::MetaData &iMetaData );
76 
77 //-*****************************************************************************
78 void
79 WriteDataToAttr( hid_t iParent,
80                  hid_t iDspace,
81                  const std::string &iAttrName,
82                  hid_t iFileType,
83                  hid_t iNativeType,
84                  const void *iData );
85 
86 //-*****************************************************************************
87 void
88 WriteScalar( hid_t iParent,
89              const std::string &iName,
90              hid_t iFileType,
91              hid_t iNativeType,
92              const void *iData );
93 
94 //-*****************************************************************************
95 void
96 WriteSmallArray( hid_t iParent,
97                  const std::string &iName,
98                  hid_t iFileType,
99                  hid_t iNativeType,
100                  size_t iNumVals,
101                  const void *Data );
102 
103 //-*****************************************************************************
104 void
105 CopyWrittenArray( hid_t iParent,
106                   const std::string &iName,
107                   WrittenArraySampleIDPtr iRef );
108 
109 //-*****************************************************************************
110 WrittenArraySampleIDPtr
111 WriteArray( WrittenArraySampleMap &iMap,
112             hid_t iGroup,
113             const std::string &iName,
114             const AbcA::ArraySample &iSamp,
115             const AbcA::ArraySample::Key &iKey,
116             hid_t iFileType,
117             hid_t iNativeType,
118             int iCompressionLevel );
119 
120 //-*****************************************************************************
121 void
122 WritePropertyInfo( hid_t iGroup,
123                    const AbcA::PropertyHeader &iHeader,
124                    bool isScalarLike,
125                    uint32_t iTimeSamplingIndex,
126                    uint32_t iNumSamples,
127                    uint32_t iFirstChangedIndex,
128                    uint32_t iLastChangedIndex );
129 
130 //-*****************************************************************************
131 void
132 WriteTimeSampling( hid_t iGroup,
133                    const std::string &iName,
134                    const AbcA::TimeSampling &iTsmp );
135 
136 } // End namespace ALEMBIC_VERSION_NS
137 
138 using namespace ALEMBIC_VERSION_NS;
139 
140 } // End namespace AbcCoreHDF5
141 } // End namespace Alembic
142 
143 #endif
144 
145