Loading...
Searching...
No Matches
IBaseProperty.h
Go to the documentation of this file.
//-*****************************************************************************
//
// Copyright (c) 2009-2011,
// Sony Pictures Imageworks, Inc. and
// Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Sony Pictures Imageworks, nor
// Industrial Light & Magic nor the names of their contributors may be used
// to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//-*****************************************************************************
#ifndef Alembic_Abc_IBaseProperty_h
#define Alembic_Abc_IBaseProperty_h
#include <Alembic/Abc/Foundation.h>
#include <Alembic/Abc/Base.h>
#include <Alembic/Abc/Argument.h>
#include <Alembic/Abc/IObject.h>
#include <Alembic/Abc/IArchive.h>
namespace Alembic {
namespace Abc {
namespace ALEMBIC_VERSION_NS {
//-*****************************************************************************
template <class PROP_PTR>
class IBasePropertyT : public Base
{
protected:
//-*************************************************************************
// TYPEDEFS AND IDENTIFIERS
//-*************************************************************************
typedef IBasePropertyT<PROP_PTR> this_type;
typedef IBasePropertyT<PROP_PTR> operator_bool_base_type;
//-*************************************************************************
// CONSTRUCTION, DESTRUCTION, ASSIGNMENT
//-*************************************************************************
IBasePropertyT() {}
IBasePropertyT(
PROP_PTR iPtr,
ErrorHandler::Policy iPolicy );
public:
//-*************************************************************************
// PROPERTY WRITER FUNCTIONALITY
//-*************************************************************************
const AbcA::PropertyHeader & getHeader() const;
const std::string &getName() const
{ return getHeader().getName(); }
AbcA::PropertyType getPropertyType() const
{ return getHeader().getPropertyType(); }
bool isScalar() const { return getPropertyType() == AbcA::kScalarProperty; }
bool isArray() const { return getPropertyType() == AbcA::kArrayProperty; }
bool isCompound() const { return getPropertyType() == AbcA::kCompoundProperty; }
bool isSimple() const { return !isCompound(); }
const AbcA::MetaData &getMetaData() const
{ return getHeader().getMetaData(); }
const AbcA::DataType &getDataType() const
{ return getHeader().getDataType(); }
AbcA::TimeSamplingPtr getTimeSampling() const
{ return getHeader().getTimeSampling(); }
IObject getObject() const;
//-*************************************************************************
// ABC BASE MECHANISMS
// These functions are used by Abc to deal with errors, rewrapping,
// and so on.
//-*************************************************************************
PROP_PTR getPtr() const { return m_property; }
void reset() { m_property.reset(); Base::reset(); }
bool valid() const
{
return ( Base::valid() && m_property );
}
ALEMBIC_OPERATOR_BOOL( valid() );
protected:
PROP_PTR m_property;
};
//-*****************************************************************************
// TEMPLATE AND INLINE FUNCTIONS
//-*****************************************************************************
template <class PROP_PTR>
inline IBasePropertyT<PROP_PTR>::IBasePropertyT
(
PROP_PTR iPtr,
ErrorHandler::Policy iPolicy )
: m_property( iPtr )
{
getErrorHandler().setPolicy( iPolicy );
}
//-*****************************************************************************
template <class PROP_PTR>
const AbcA::PropertyHeader &IBasePropertyT<PROP_PTR>::getHeader() const
{
ALEMBIC_ABC_SAFE_CALL_BEGIN( "IBasePropertyT::getHeader()" );
return m_property->getHeader();
ALEMBIC_ABC_SAFE_CALL_END();
// Not all error handlers throw, so have a default behavior.
static const AbcA::PropertyHeader phd;
return phd;
};
//-*****************************************************************************
template <class PROP_PTR>
IObject IBasePropertyT<PROP_PTR>::getObject() const
{
ALEMBIC_ABC_SAFE_CALL_BEGIN( "IBasePropertyT::getObject()" );
return IObject( m_property->getObject(),
kWrapExisting,
getErrorHandlerPolicy() );
ALEMBIC_ABC_SAFE_CALL_END();
// Not all error handlers throw. Have a default.
return IObject();
}
} // End namespace ALEMBIC_VERSION_NS
using namespace ALEMBIC_VERSION_NS;
} // End namespace Abc
} // End namespace Alembic
#endif
Foundation.h
Argument.h
Base.h
ALEMBIC_ABC_SAFE_CALL_END
#define ALEMBIC_ABC_SAFE_CALL_END()
Definition ErrorHandler.h:198
ALEMBIC_ABC_SAFE_CALL_BEGIN
#define ALEMBIC_ABC_SAFE_CALL_BEGIN(CONTEXT)
Definition ErrorHandler.h:172
IArchive.h
IObject.h
Alembic::Abc::ALEMBIC_VERSION_NS::Base::valid
bool valid() const
Definition Base.h:65
Alembic::Abc::ALEMBIC_VERSION_NS::Base::getErrorHandler
ErrorHandler & getErrorHandler() const
Definition Base.h:76
Alembic::Abc::ALEMBIC_VERSION_NS::Base::getErrorHandlerPolicy
ErrorHandler::Policy getErrorHandlerPolicy() const
Definition Base.h:81
Alembic::Abc::ALEMBIC_VERSION_NS::Base::reset
void reset()
Definition Base.h:70
Alembic::Abc::ALEMBIC_VERSION_NS::Base::Base
Base()
Definition Base.h:51
Alembic::Abc::ALEMBIC_VERSION_NS::ErrorHandler::setPolicy
void setPolicy(Policy iPolicy)
Definition ErrorHandler.h:84
Alembic::Abc::ALEMBIC_VERSION_NS::ErrorHandler::Policy
Policy
Definition ErrorHandler.h:52
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::isArray
bool isArray() const
Definition IBaseProperty.h:114
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::getObject
IObject getObject() const
Definition IBaseProperty.h:207
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::reset
void reset()
Definition IBaseProperty.h:160
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::IBasePropertyT
IBasePropertyT()
Definition IBaseProperty.h:72
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::isSimple
bool isSimple() const
Definition IBaseProperty.h:122
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::this_type
IBasePropertyT< PROP_PTR > this_type
Definition IBaseProperty.h:63
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::getHeader
const AbcA::PropertyHeader & getHeader() const
Definition IBaseProperty.h:192
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::m_property
PROP_PTR m_property
Definition IBaseProperty.h:174
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::isCompound
bool isCompound() const
Definition IBaseProperty.h:118
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::valid
bool valid() const
Definition IBaseProperty.h:164
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::getPropertyType
AbcA::PropertyType getPropertyType() const
Definition IBaseProperty.h:105
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::getName
const std::string & getName() const
Definition IBaseProperty.h:100
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::getTimeSampling
AbcA::TimeSamplingPtr getTimeSampling() const
Definition IBaseProperty.h:140
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::getMetaData
const AbcA::MetaData & getMetaData() const
Definition IBaseProperty.h:126
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::operator_bool_base_type
IBasePropertyT< PROP_PTR > operator_bool_base_type
Definition IBaseProperty.h:64
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::isScalar
bool isScalar() const
Definition IBaseProperty.h:110
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::getDataType
const AbcA::DataType & getDataType() const
Definition IBaseProperty.h:133
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::ALEMBIC_OPERATOR_BOOL
ALEMBIC_OPERATOR_BOOL(valid())
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT::getPtr
PROP_PTR getPtr() const
Definition IBaseProperty.h:156
Alembic::Abc::ALEMBIC_VERSION_NS::IObject
Definition IObject.h:54
Alembic::Abc::ALEMBIC_VERSION_NS
Definition ArchiveInfo.h:48
Alembic::Abc::ALEMBIC_VERSION_NS::kWrapExisting
@ kWrapExisting
Definition Foundation.h:95
Alembic::Abc
Definition ArchiveInfo.h:47
Alembic
Alembic namespace ...
Definition ArchiveInfo.h:46