HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ArImpl.h
Go to the documentation of this file.
1 //-*****************************************************************************
2 //
3 // Copyright (c) 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_AbcCoreOgawa_ArImpl_h_
38 #define _Alembic_AbcCoreOgawa_ArImpl_h_
39 
42 
43 namespace Alembic {
44 namespace AbcCoreOgawa {
45 namespace ALEMBIC_VERSION_NS {
46 
47 //-*****************************************************************************
48 class OrData;
49 
50 //-*****************************************************************************
51 class ArImpl
52  : public AbcA::ArchiveReader
53  , public Alembic::Util::enable_shared_from_this<ArImpl>
54 {
55 private:
56  friend class ReadArchive;
57 
58  ArImpl( const std::string &iFileName,
59  size_t iNumStreams=1 );
60 
61  ArImpl( const std::vector< std::istream * > & iStreams );
62 
63 public:
64 
65  virtual ~ArImpl();
66 
67  //-*************************************************************************
68  // ABSTRACT FUNCTIONS
69  //-*************************************************************************
70  virtual const std::string &getName() const;
71 
72  virtual const AbcA::MetaData &getMetaData() const;
73 
74  virtual AbcA::ObjectReaderPtr getTop();
75 
76  virtual AbcA::TimeSamplingPtr getTimeSampling( Util::uint32_t iIndex );
77 
79 
81  {
83  }
84 
85  virtual void
87  {
88  }
89 
91  Util::uint32_t iIndex );
92 
93  virtual Util::uint32_t getNumTimeSamplings()
94  {
95  return m_timeSamples.size();
96  }
97 
98  virtual Util::int32_t getArchiveVersion()
99  {
100  return m_archiveVersion;
101  }
102 
104 
105  const std::vector< AbcA::MetaData > & getIndexedMetaData();
106 
107 private:
108  void init();
109 
110  std::string m_fileName;
111  size_t m_numStreams;
112 
113  Ogawa::IArchive m_archive;
114 
115  Alembic::Util::weak_ptr< AbcA::ObjectReader > m_top;
116  Alembic::Util::shared_ptr < OrData > m_data;
117  Alembic::Util::mutex m_orlock;
118 
119  Util::int32_t m_archiveVersion;
120 
121  std::vector < AbcA::TimeSamplingPtr > m_timeSamples;
122  std::vector < AbcA::index_t > m_maxSamples;
123 
124  ObjectHeaderPtr m_header;
125 
126  StreamManager m_manager;
127 
128  std::vector< AbcA::MetaData > m_indexMetaData;
129 };
130 
131 } // End namespace ALEMBIC_VERSION_NS
132 
133 using namespace ALEMBIC_VERSION_NS;
134 
135 } // End namespace AbcCoreOgawa
136 } // End namespace Alembic
137 
138 #endif
Alembic::Util::shared_ptr< StreamID > StreamIDPtr
Definition: StreamManager.h:51
virtual const AbcA::MetaData & getMetaData() const
virtual Util::uint32_t getNumTimeSamplings()
Definition: ArImpl.h:93
virtual AbcA::ReadArraySampleCachePtr getReadArraySampleCachePtr()
Definition: ArImpl.h:80
virtual Util::int32_t getArchiveVersion()
Definition: ArImpl.h:98
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
Alembic::Util::shared_ptr< AbcA::ObjectHeader > ObjectHeaderPtr
Definition: Foundation.h:175
Alembic::Util::shared_ptr< ObjectReader > ObjectReaderPtr
virtual AbcA::index_t getMaxNumSamplesForTimeSamplingIndex(Util::uint32_t iIndex)
virtual AbcA::ObjectReaderPtr getTop()
virtual void setReadArraySampleCachePtr(AbcA::ReadArraySampleCachePtr iPtr)
Definition: ArImpl.h:86
Alembic::Util::shared_ptr< TimeSampling > TimeSamplingPtr
Definition: TimeSampling.h:137
virtual AbcA::TimeSamplingPtr getTimeSampling(Util::uint32_t iIndex)
Alembic::Util::shared_ptr< ReadArraySampleCache > ReadArraySampleCachePtr
const std::vector< AbcA::MetaData > & getIndexedMetaData()
Alembic::Util::shared_ptr< ArchiveReader > ArchiveReaderPtr
Smart Ptrs to Readers.
virtual AbcA::ArchiveReaderPtr asArchivePtr()
virtual const std::string & getName() const
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:104