Alembic: AbcCoreHDF5/OrData.h Source File

Alembic 1.8.11

Loading...
Searching...
No Matches
OrData.h
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_AbcCoreHDF5_OrData_h
38#define Alembic_AbcCoreHDF5_OrData_h
39
40#include <Alembic/AbcCoreHDF5/HDF5Hierarchy.h>
41#include <Alembic/AbcCoreHDF5/Foundation.h>
42
43
44namespace Alembic {
45namespace AbcCoreHDF5 {
46namespace ALEMBIC_VERSION_NS {
47
48class CprData;
49
50// data class owned by OrImpl, or ArImpl if it is a "top" object.
51// it owns and makes child objects as well as the group hid_t
52// when necessary
53 class OrData : public Alembic::Util::enable_shared_from_this<OrData>
54{
55public:
56 OrData( ObjectHeaderPtr iHeader,
57 H5Node & iParentGroup,
58 int32_t iArchiveVersion );
59
60 ~OrData();
61
62 AbcA::CompoundPropertyReaderPtr
63 getProperties( AbcA::ObjectReaderPtr iParent );
64
65 size_t getNumChildren();
66
67 const AbcA::ObjectHeader &
68 getChildHeader( AbcA::ObjectReaderPtr iParent, size_t i );
69
70 const AbcA::ObjectHeader *
71 getChildHeader( AbcA::ObjectReaderPtr, const std::string &iName );
72
73 AbcA::ObjectReaderPtr
74 getChild( AbcA::ObjectReaderPtr iParent, const std::string &iName );
75
76 AbcA::ObjectReaderPtr
77 getChild( AbcA::ObjectReaderPtr iParent, size_t i );
78
79private:
80
81 struct Child
82 {
83 bool loadedMetaData;
84 ObjectHeaderPtr header;
85 WeakOrPtr made;
86 Alembic::Util::mutex lock;
87 };
88
89 typedef std::map<std::string, size_t> ChildrenMap;
90
91 H5Node m_group;
92 H5Node m_oldGroup;
93
94 Alembic::Util::mutex m_childObjectsMutex;
95
96 // The children
97 Child * m_children;
98 ChildrenMap m_childrenMap;
99
100 // Our "top" property.
101 Alembic::Util::weak_ptr< AbcA::CompoundPropertyReader > m_top;
102 Alembic::Util::shared_ptr < CprData > m_data;
103};
104
105typedef Alembic::Util::shared_ptr<OrData> OrDataPtr;
106
107} // End namespace ALEMBIC_VERSION_NS
108
109using namespace ALEMBIC_VERSION_NS;
110
111} // End namespace AbcCoreHDF5
112} // End namespace Alembic
113
114#endif
Alembic::AbcCoreHDF5::ALEMBIC_VERSION_NS::CprData
Definition CprData.h:51
Alembic::AbcCoreHDF5::ALEMBIC_VERSION_NS::H5Node
Definition HDF5Hierarchy.h:50
Alembic::Util::ALEMBIC_VERSION_NS::mutex
Definition Foundation.h:176
Alembic
Alembic namespace ...
Definition ArchiveInfo.cpp:39