Coverage Report

Created: 2025-07-18 06:15

/src/alembic/lib/Alembic/Abc/ICompoundProperty.cpp
Line
Count
Source (jump to first uncovered line)
1
//-*****************************************************************************
2
//
3
// Copyright (c) 2009-2011,
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
#include <Alembic/Abc/ICompoundProperty.h>
38
39
namespace Alembic {
40
namespace Abc {
41
namespace ALEMBIC_VERSION_NS {
42
43
//-*****************************************************************************
44
ICompoundProperty::ICompoundProperty( const ICompoundProperty & iParent,
45
                                      const std::string &iName,
46
                                      const Argument &iArg0 )
47
0
{
48
0
    init( iParent.getPtr(), iName, GetErrorHandlerPolicy( iParent ), iArg0 );
49
0
}
50
51
//-*****************************************************************************
52
ICompoundProperty::ICompoundProperty( AbcA::CompoundPropertyReaderPtr iPtr,
53
                                      const Argument &iArg0,
54
                                      const Argument &iArg1 )
55
1
  : IBasePropertyT<AbcA::CompoundPropertyReaderPtr>(
56
1
      iPtr,
57
1
      GetErrorHandlerPolicy( iPtr, iArg0, iArg1 ) )
58
1
{
59
    // Nothing!
60
1
}
61
62
//-*****************************************************************************
63
ICompoundProperty::ICompoundProperty( AbcA::CompoundPropertyReaderPtr iPtr,
64
                                      WrapExistingFlag /* iWrapFlag */,
65
                                      const Argument &iArg0,
66
                                      const Argument &iArg1 )
67
0
  : IBasePropertyT<AbcA::CompoundPropertyReaderPtr>(
68
0
      iPtr,
69
0
      GetErrorHandlerPolicy( iPtr, iArg0, iArg1 ) )
70
0
{
71
    // Nothing!
72
0
}
73
74
//-*****************************************************************************
75
ICompoundProperty::ICompoundProperty( const IObject & iObject,
76
                                      const Argument &iArg0,
77
                                      const Argument &iArg1 )
78
0
{
79
0
    init( iObject, iArg0, iArg1 );
80
0
}
81
82
//-*****************************************************************************
83
ICompoundProperty::ICompoundProperty( const IObject & iObject,
84
                                      TopFlag /* iTopFlag */,
85
                                      const Argument &iArg0,
86
                                      const Argument &iArg1 )
87
0
{
88
0
    init( iObject, iArg0, iArg1 );
89
0
}
90
91
//-*****************************************************************************
92
ICompoundProperty::~ICompoundProperty()
93
7
{
94
    // Here for debug support
95
7
}
96
97
//-*****************************************************************************
98
size_t ICompoundProperty::getNumProperties() const
99
0
{
100
0
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "ICompoundProperty::getNumProperties()" );
101
102
0
    return m_property->getNumProperties();
103
104
0
    ALEMBIC_ABC_SAFE_CALL_END();
105
106
    // Not all error handlers throw, have a default.
107
0
    return 0;
108
0
}
109
110
//-*****************************************************************************
111
const AbcA::PropertyHeader &ICompoundProperty::getPropertyHeader( size_t iIdx ) const
112
0
{
113
0
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "ICompoundProperty::getPropertyHeader()" );
114
115
0
    return m_property->getPropertyHeader( iIdx );
116
117
0
    ALEMBIC_ABC_SAFE_CALL_END();
118
119
    // Not all error handlers throw, have a default.
120
0
    static const AbcA::PropertyHeader hd;
121
0
    return hd;
122
0
}
123
124
//-*****************************************************************************
125
const AbcA::PropertyHeader *
126
ICompoundProperty::getPropertyHeader( const std::string &iName ) const
127
0
{
128
0
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "ICompoundProperty::getPropertyHeader()" );
129
130
0
    return m_property->getPropertyHeader( iName );
131
132
0
    ALEMBIC_ABC_SAFE_CALL_END();
133
134
    // Not all error handlers throw, have a default.
135
0
    return NULL;
136
0
}
137
138
//-*****************************************************************************
139
ICompoundProperty ICompoundProperty::getParent() const
140
0
{
141
0
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "ICompoundProperty::getParent()" );
142
143
0
    return ICompoundProperty( m_property->getParent(),
144
0
                              getErrorHandlerPolicy() );
145
146
0
    ALEMBIC_ABC_SAFE_CALL_END();
147
148
    // Not all error handlers throw. Have a default.
149
0
    return ICompoundProperty();
150
0
}
151
152
//-*****************************************************************************
153
void ICompoundProperty::init ( const IObject & iObject,
154
                               const Argument &iArg0,
155
                               const Argument &iArg1 )
156
0
{
157
0
    getErrorHandler().setPolicy(
158
0
        GetErrorHandlerPolicy( iObject, iArg0, iArg1 ) );
159
160
0
    ALEMBIC_ABC_SAFE_CALL_BEGIN(
161
0
        "ICompoundProperty::init( IObject )" );
162
163
0
    m_property = iObject.getProperties().getPtr();
164
165
0
    ALEMBIC_ABC_SAFE_CALL_END_RESET();
166
0
}
167
168
//-*****************************************************************************
169
void ICompoundProperty::init( AbcA::CompoundPropertyReaderPtr iParent,
170
                              const std::string &iName,
171
                              ErrorHandler::Policy iParentPolicy,
172
                              const Argument &iArg0 )
173
0
{
174
0
    Arguments args( iParentPolicy );
175
0
    iArg0.setInto( args );
176
177
0
    getErrorHandler().setPolicy( args.getErrorHandlerPolicy() );
178
179
0
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "ICompoundProperty::init()" );
180
181
0
    ABCA_ASSERT( iParent, "invalid parent" );
182
183
0
    const AbcA::PropertyHeader *pheader =
184
0
        iParent->getPropertyHeader( iName );
185
186
0
    ABCA_ASSERT( pheader != NULL,
187
0
                 "Nonexistent compound property: " << iName );
188
189
0
    m_property = iParent->getCompoundProperty( iName );
190
191
0
    ALEMBIC_ABC_SAFE_CALL_END_RESET();
192
0
}
193
194
} // End namespace ALEMBIC_VERSION_NS
195
} // End namespace Abc
196
} // End namespace Alembic