HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IFactory.h
Go to the documentation of this file.
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 
41 #include <Alembic/Abc/IArchive.h>
42 #include <Alembic/Util/Export.h>
43 
44 namespace Alembic {
45 namespace AbcCoreFactory {
46 namespace ALEMBIC_VERSION_NS {
47 
49 {
50 public:
51  IFactory();
52  ~IFactory();
53 
54  //! The type which yielded a valid IArchive (or kUnknown if invalid)
55  enum CoreType
56  {
59  kUnknown
60  };
61 
62  //! Try to open a file and set oType to the one that yields a successful
63  //! oType, or kUnknown if the IArchive isn't valid
64  Alembic::Abc::IArchive getArchive( const std::string & iFileName,
65  CoreType & oType );
66 
67  //! Try to open a file and return IArchive. If the file wasn't a valid
68  //! file or known type and invalid archive is returned.
69  Alembic::Abc::IArchive getArchive( const std::string & iFileName );
70 
71  //! Use the streams (Alembic does not take ownership) to read the data from
72  //! This is currently only valid for Ogawa. The streams must all reference
73  //! the same data.
74  Alembic::Abc::IArchive getArchive(
75  const std::vector< std::istream * > & iStreams, CoreType & oType );
76 
77  //! If opening an HDF5 file, sets whether to use the cached hierarchy
78  //! if it exists, the default value is true
79  void setHDF5CacheHierarchy( bool iCacheHierarchy )
80  {
81  m_cacheHierarchy = iCacheHierarchy;
82  }
83 
84  //! Gets whether an HDF5 file will use the cached hierarchy
85  bool getHDF5CacheHierarchy() const { return m_cacheHierarchy; }
86 
87  //! Set the array sample cache, the HDF5 implementation optionally uses this
90  {
91  m_cachePtr = iCachePtr;
92  }
93 
94  //! Get the array sample cache
96  {
97  return m_cachePtr;
98  }
99 
100  //! Gets the number of streams that will be opened when opening an Ogawa
101  //! file
102  size_t getOgawaNumStreams() const { return m_numStreams; }
103 
104  //! Sets the number of streams that will be opened when opening an Ogawa
105  //! file, the default is 1
106  void setOgawaNumStreams( size_t iNumStreams )
107  {
108  m_numStreams = iNumStreams;
109  }
110 
111  //! Gets the error handler policy
113 
114  //! Sets the error handler policy, the default is kThrowPolicy
116  {
117  m_policy = iPolicy;
118  }
119 
120 private:
121  bool m_cacheHierarchy;
122  size_t m_numStreams;
125 
126 };
127 
128 } // End namespace ALEMBIC_VERSION_NS
129 
130 using namespace ALEMBIC_VERSION_NS;
131 
132 } // End namespace Abc
133 } // End namespace Alembic
134 
135 #endif
void setSampleCache(Alembic::AbcCoreAbstract::ReadArraySampleCachePtr iCachePtr)
Set the array sample cache, the HDF5 implementation optionally uses this.
Definition: IFactory.h:88
Alembic::Abc::ErrorHandler::Policy getPolicy()
Gets the error handler policy.
Definition: IFactory.h:112
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
void setHDF5CacheHierarchy(bool iCacheHierarchy)
Definition: IFactory.h:79
Alembic::Util::shared_ptr< ReadArraySampleCache > ReadArraySampleCachePtr
void setPolicy(Alembic::Abc::ErrorHandler::Policy iPolicy)
Sets the error handler policy, the default is kThrowPolicy.
Definition: IFactory.h:115
Alembic::AbcCoreAbstract::ReadArraySampleCachePtr getSampleCache() const
Get the array sample cache.
Definition: IFactory.h:95
CoreType
The type which yielded a valid IArchive (or kUnknown if invalid)
Definition: IFactory.h:55
bool getHDF5CacheHierarchy() const
Gets whether an HDF5 file will use the cached hierarchy.
Definition: IFactory.h:85
#define ALEMBIC_EXPORT
Definition: Export.h:51
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:104