Alembic: AbcCoreOgawa/AwImpl.h Source File

Alembic 1.8.11

Loading...
Searching...
No Matches
AwImpl.h
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_AwImpl_h
38#define Alembic_AbcCoreOgawa_AwImpl_h
39
40#include <Alembic/AbcCoreOgawa/Foundation.h>
41#include <Alembic/AbcCoreOgawa/WrittenSampleMap.h>
42#include <Alembic/AbcCoreOgawa/WriteUtil.h>
43
44namespace Alembic {
45namespace AbcCoreOgawa {
46namespace ALEMBIC_VERSION_NS {
47
48//-*****************************************************************************
49class OwData;
50class OwImpl;
51
52//-*****************************************************************************
53 class AwImpl : public AbcA::ArchiveWriter
54 , public Alembic::Util::enable_shared_from_this<AwImpl>
55{
56private:
57 friend class WriteArchive;
58
59 AwImpl( const std::string &iFileName,
60 const AbcA::MetaData &iMetaData );
61
62 AwImpl( std::ostream * iStream,
63 const AbcA::MetaData & iMetaData );
64
65public:
66 virtual ~AwImpl();
67
68 //-*************************************************************************
69 // ABSTRACT FUNCTIONS
70 //-*************************************************************************
71 virtual const std::string &getName() const;
72
73 virtual const AbcA::MetaData &getMetaData() const;
74
75 virtual AbcA::ObjectWriterPtr getTop();
76
77 virtual AbcA::ArchiveWriterPtr asArchivePtr();
78
79 //-*************************************************************************
80 // GLOBAL FILE CONTEXT STUFF.
81 //-*************************************************************************
82 WrittenSampleMap &getWrittenSampleMap()
83 {
84 return m_writtenSampleMap;
85 }
86
87 MetaDataMapPtr getMetaDataMap()
88 {
89 return m_metaDataMap;
90 }
91
92 virtual Util::uint32_t addTimeSampling( const AbcA::TimeSampling & iTs );
93
94 virtual AbcA::TimeSamplingPtr getTimeSampling( Util::uint32_t iIndex );
95
96 virtual Util::uint32_t getNumTimeSamplings()
97 { return m_timeSamples.size(); }
98
99 virtual AbcA::index_t getMaxNumSamplesForTimeSamplingIndex(
100 Util::uint32_t iIndex );
101
102 virtual void setMaxNumSamplesForTimeSamplingIndex( Util::uint32_t iIndex,
103 AbcA::index_t iMaxIndex );
104
105private:
106 void init();
107 std::string m_fileName;
108 AbcA::MetaData m_metaData;
109 Alembic::Ogawa::OArchive m_archive;
110
111 Alembic::Util::weak_ptr< AbcA::ObjectWriter > m_top;
112 Alembic::Util::shared_ptr < OwData > m_data;
113
114 std::vector < AbcA::TimeSamplingPtr > m_timeSamples;
115
116 std::vector < AbcA::index_t > m_maxSamples;
117
118 WrittenSampleMap m_writtenSampleMap;
119 MetaDataMapPtr m_metaDataMap;
120};
121
122} // End namespace ALEMBIC_VERSION_NS
123
124using namespace ALEMBIC_VERSION_NS;
125
126} // End namespace AbcCoreOgawa
127} // End namespace Alembic
128
129#endif
Alembic::AbcCoreOgawa::ALEMBIC_VERSION_NS::AwImpl::getTop
virtual AbcA::ObjectWriterPtr getTop()
Definition AwImpl.cpp:147
Alembic::AbcCoreOgawa::ALEMBIC_VERSION_NS::AwImpl::getName
virtual const std::string & getName() const
Definition AwImpl.cpp:129
Alembic::AbcCoreOgawa::ALEMBIC_VERSION_NS::AwImpl::getNumTimeSamplings
virtual Util::uint32_t getNumTimeSamplings()
Definition AwImpl.h:96
Alembic::AbcCoreOgawa::ALEMBIC_VERSION_NS::AwImpl::getMetaData
virtual const AbcA::MetaData & getMetaData() const
Definition AwImpl.cpp:135
Alembic::AbcCoreOgawa::ALEMBIC_VERSION_NS::AwImpl::asArchivePtr
virtual AbcA::ArchiveWriterPtr asArchivePtr()
Definition AwImpl.cpp:141
Alembic::AbcCoreOgawa::ALEMBIC_VERSION_NS::OwData
Definition OwData.h:54
Alembic::AbcCoreOgawa::ALEMBIC_VERSION_NS::OwImpl
Definition OwImpl.h:52
Alembic::AbcCoreOgawa::ALEMBIC_VERSION_NS::WrittenSampleMap
Definition WrittenSampleMap.h:92
Alembic::Ogawa::ALEMBIC_VERSION_NS::OArchive
Definition OArchive.h:49
Alembic
Alembic namespace ...
Definition ArchiveInfo.cpp:39