Alembic Version 1.1
IArchive.h
Go to the documentation of this file.
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_IArchive_h
38#define Alembic_Abc_IArchive_h
39
40#include <Alembic/Util/Export.h>
42#include <Alembic/Abc/Base.h>
44
45namespace Alembic {
46namespace Abc {
47namespace ALEMBIC_VERSION_NS {
48
49class IObject;
50
51//-*****************************************************************************
53{
54public:
59
60 //-*************************************************************************
61 // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
62 //-*************************************************************************
63
67
72 template <class ARCHIVE_CTOR>
77 ARCHIVE_CTOR iCtor,
78
80 const std::string &iFileName,
81
84
88
92
96 : m_archive( iPtr )
97 {
98 // Set the error handling policy.
99 getErrorHandler().setPolicy( iPolicy );
100 }
101
102 // Deprecated in favor of the constructor above
105 WrapExistingFlag /* iWrap */,
107 : m_archive( iPtr )
108 {
109 // Set the error handling policy.
110 getErrorHandler().setPolicy( iPolicy );
111 }
112
116
119
120 //-*************************************************************************
121 // ARCHIVE WRITER FUNCTIONALITY
122 //-*************************************************************************
123
126 std::string getName() const;
127
131
136
141
142 //-*************************************************************************
143 // ABC BASE MECHANISMS
144 // These functions are used by Abc to deal with errors, rewrapping,
145 // and so on.
146 //-*************************************************************************
147
151 AbcA::ArchiveReaderPtr getPtr() { return m_archive; }
152
155 void reset() { m_archive.reset(); Base::reset(); }
156
159
163
169
172 bool valid() const
173 {
174 return ( Base::valid() && m_archive );
175 }
176
180
184
185private:
186 AbcA::ArchiveReaderPtr m_archive;
187};
188
189//-*****************************************************************************
193GetArchiveReaderPtr( IArchive& iPrp ) { return iPrp.getPtr(); }
194
195//-*****************************************************************************
196//-*****************************************************************************
197template <class ARCHIVE_CTOR>
198IArchive::IArchive( ARCHIVE_CTOR iCtor,
199 const std::string &iFileName,
200 ErrorHandler::Policy iPolicy,
202{
203 // Set the error handling policy.
204 getErrorHandler().setPolicy( iPolicy );
205
206 ALEMBIC_ABC_SAFE_CALL_BEGIN( "IArchive::IArchive( iFileName )" );
207
208 m_archive = iCtor( iFileName, iCachePtr );
209
211
212}
213
214} // End namespace ALEMBIC_VERSION_NS
215
216using namespace ALEMBIC_VERSION_NS;
217
218} // End namespace Abc
219} // End namespace Alembic
220
221
222
223#endif
#define ALEMBIC_ABC_SAFE_CALL_BEGIN(CONTEXT)
Definition: ErrorHandler.h:172
#define ALEMBIC_ABC_SAFE_CALL_END_RESET()
Definition: ErrorHandler.h:181
#define ALEMBIC_EXPORT
Definition: Export.h:51
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:105
ErrorHandler & getErrorHandler() const
Definition: Base.h:76
AbcA::ArchiveReaderPtr getPtr()
Definition: IArchive.h:151
IArchive(AbcA::ArchiveReaderPtr iPtr, WrapExistingFlag, ErrorHandler::Policy iPolicy=ErrorHandler::kThrowPolicy)
Definition: IArchive.h:103
void setReadArraySampleCachePtr(AbcA::ReadArraySampleCachePtr iPtr)
IArchive(AbcA::ArchiveReaderPtr iPtr, ErrorHandler::Policy iPolicy=ErrorHandler::kThrowPolicy)
Definition: IArchive.h:87
index_t getMaxNumSamplesForTimeSamplingIndex(uint32_t iIndex)
AbcA::TimeSamplingPtr getTimeSampling(uint32_t iIndex)
Returns the TimeSampling at a given index.
AbcA::ReadArraySampleCachePtr getReadArraySampleCachePtr()
Alembic::Util::shared_ptr< TimeSampling > TimeSamplingPtr
Definition: TimeSampling.h:137
Alembic::Util::shared_ptr< ReadArraySampleCache > ReadArraySampleCachePtr
Alembic::Util::shared_ptr< ArchiveReader > ArchiveReaderPtr
Smart Ptrs to Readers.
AbcA::ArchiveReaderPtr GetArchiveReaderPtr(AbcA::ArchiveReaderPtr iPtr)
Definition: Foundation.h:219
Alembic namespace ...
Definition: ArchiveInfo.h:46