Alembic: AbcCoreFactory/IFactory.h Source File

Alembic 1.8.11

Loading...
Searching...
No Matches
IFactory.h
1//-*****************************************************************************
2//
3// Copyright (c) 2013-2015,
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_AbcCoreFactory_IFactory_h
38#define Alembic_AbcCoreFactory_IFactory_h
39
40#include <Alembic/AbcCoreAbstract/ReadArraySampleCache.h>
41#include <Alembic/Abc/IArchive.h>
42#include <Alembic/Util/Export.h>
43
44namespace Alembic {
45namespace AbcCoreFactory {
46namespace ALEMBIC_VERSION_NS {
47
48 class ALEMBIC_EXPORT IFactory
49{
50public:
51 IFactory();
52 ~IFactory();
53
55 enum CoreType
56 {
57 kHDF5,
58 kOgawa,
59 kLayer,
60 kUnknown
61 };
62
65 Alembic::Abc::IArchive getArchive( const std::string & iFileName,
66 CoreType & oType );
67
70 Alembic::Abc::IArchive getArchive( const std::string & iFileName );
71
74 Alembic::Abc::IArchive getArchive(
75 const std::vector< std::string > & iFileNames );
76
81 Alembic::Abc::IArchive getArchive(
82 const std::vector< std::string > & iFileNames, CoreType & oType );
83
87 Alembic::Abc::IArchive getArchive(
88 const std::vector< std::istream * > & iStreams, CoreType & oType );
89
90 // TODO, how do we best layer streams, and strings
91
94 void setHDF5CacheHierarchy( bool iCacheHierarchy )
95 {
96 m_cacheHierarchy = iCacheHierarchy;
97 }
98
100 bool getHDF5CacheHierarchy() const { return m_cacheHierarchy; }
101
103 void setSampleCache(
104 Alembic::AbcCoreAbstract::ReadArraySampleCachePtr iCachePtr )
105 {
106 m_cachePtr = iCachePtr;
107 }
108
110 Alembic::AbcCoreAbstract::ReadArraySampleCachePtr getSampleCache() const
111 {
112 return m_cachePtr;
113 }
114
117 size_t getOgawaNumStreams() const { return m_numStreams; }
118
121 void setOgawaNumStreams( size_t iNumStreams )
122 {
123 m_numStreams = iNumStreams;
124 }
125
126 enum OgawaReadStrategy
127 {
128 kFileStreams,
129 kMemoryMappedFiles
130 };
131
133 OgawaReadStrategy getOgawaReadStrategy() { return m_readStrategy; }
134
137 void setOgawaReadStrategy( OgawaReadStrategy iStrategy )
138 {
139 m_readStrategy = iStrategy;
140 }
141
142
144 Alembic::Abc::ErrorHandler::Policy getPolicy() { return m_policy; }
145
147 void setPolicy( Alembic::Abc::ErrorHandler::Policy iPolicy )
148 {
149 m_policy = iPolicy;
150 }
151
152private:
153 bool m_cacheHierarchy;
154 size_t m_numStreams;
155 OgawaReadStrategy m_readStrategy;
156 Alembic::AbcCoreAbstract::ReadArraySampleCachePtr m_cachePtr;
157 Alembic::Abc::ErrorHandler::Policy m_policy;
158
159};
160
161} // End namespace ALEMBIC_VERSION_NS
162
163using namespace ALEMBIC_VERSION_NS;
164
165} // End namespace Abc
166} // End namespace Alembic
167
168#endif
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive
Definition IArchive.h:53
Alembic::AbcCoreFactory::ALEMBIC_VERSION_NS::IFactory::setSampleCache
void setSampleCache(Alembic::AbcCoreAbstract::ReadArraySampleCachePtr iCachePtr)
Set the array sample cache, the HDF5 implementation optionally uses this.
Definition IFactory.h:103
Alembic::AbcCoreFactory::ALEMBIC_VERSION_NS::IFactory::getOgawaNumStreams
size_t getOgawaNumStreams() const
Definition IFactory.h:117
Alembic::AbcCoreFactory::ALEMBIC_VERSION_NS::IFactory::getOgawaReadStrategy
OgawaReadStrategy getOgawaReadStrategy()
Get the I/O strategy used for reading Ogawa files.
Definition IFactory.h:133
Alembic::AbcCoreFactory::ALEMBIC_VERSION_NS::IFactory::getSampleCache
Alembic::AbcCoreAbstract::ReadArraySampleCachePtr getSampleCache() const
Get the array sample cache.
Definition IFactory.h:110
Alembic::AbcCoreFactory::ALEMBIC_VERSION_NS::IFactory::CoreType
CoreType
The type which yielded a valid IArchive (or kUnknown if invalid)
Definition IFactory.h:56
Alembic::AbcCoreFactory::ALEMBIC_VERSION_NS::IFactory::getHDF5CacheHierarchy
bool getHDF5CacheHierarchy() const
Gets whether an HDF5 file will use the cached hierarchy.
Definition IFactory.h:100
Alembic::AbcCoreFactory::ALEMBIC_VERSION_NS::IFactory::getPolicy
Alembic::Abc::ErrorHandler::Policy getPolicy()
Gets the error handler policy.
Definition IFactory.h:144
Alembic::AbcCoreFactory::ALEMBIC_VERSION_NS::IFactory::setOgawaReadStrategy
void setOgawaReadStrategy(OgawaReadStrategy iStrategy)
Definition IFactory.h:137
Alembic::AbcCoreFactory::ALEMBIC_VERSION_NS::IFactory::setPolicy
void setPolicy(Alembic::Abc::ErrorHandler::Policy iPolicy)
Sets the error handler policy, the default is kThrowPolicy.
Definition IFactory.h:147
Alembic::AbcCoreFactory::ALEMBIC_VERSION_NS::IFactory::setOgawaNumStreams
void setOgawaNumStreams(size_t iNumStreams)
Definition IFactory.h:121
Alembic::AbcCoreFactory::ALEMBIC_VERSION_NS::IFactory::setHDF5CacheHierarchy
void setHDF5CacheHierarchy(bool iCacheHierarchy)
Definition IFactory.h:94
Alembic
Alembic namespace ...
Definition ArchiveInfo.cpp:39