Loading...
Searching...
No Matches
OBaseProperty.h
Go to the documentation of this file.
//-*****************************************************************************
//
// Copyright (c) 2009-2013,
// 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_OBaseProperty_h
#define Alembic_Abc_OBaseProperty_h
#include <Alembic/Abc/Foundation.h>
#include <Alembic/Abc/Base.h>
#include <Alembic/Abc/Argument.h>
#include <Alembic/Abc/OObject.h>
#include <Alembic/Abc/OArchive.h>
namespace Alembic {
namespace Abc {
namespace ALEMBIC_VERSION_NS {
//-*****************************************************************************
template <class PROP_PTR>
class OBasePropertyT : public Base
{
public:
typedef OBasePropertyT<PROP_PTR> this_type;
typedef OBasePropertyT<PROP_PTR> operator_bool_base_type;
protected:
friend class OCompoundProperty;
//-*************************************************************************
// CONSTRUCTION, DESTRUCTION, ASSIGNMENT
//-*************************************************************************
OBasePropertyT() {}
OBasePropertyT(
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(); }
OObject 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;
};
//-*****************************************************************************
typedef OBasePropertyT<AbcA::BasePropertyWriterPtr> OBaseProperty;
//-*****************************************************************************
// TEMPLATE AND INLINE FUNCTIONS
//-*****************************************************************************
//-*****************************************************************************
template <class PROP_PTR>
inline OBasePropertyT<PROP_PTR>::OBasePropertyT
(
PROP_PTR iPtr,
ErrorHandler::Policy iPolicy )
: m_property( iPtr )
{
getErrorHandler().setPolicy( iPolicy );
}
namespace {
const AbcA::PropertyHeader g_phd;
}
//-*****************************************************************************
//-*****************************************************************************
//-*****************************************************************************
template <class PROP_PTR>
const AbcA::PropertyHeader &OBasePropertyT<PROP_PTR>::getHeader() const
{
ALEMBIC_ABC_SAFE_CALL_BEGIN( "OBaseProperty::getHeader()" );
return m_property->getHeader();
ALEMBIC_ABC_SAFE_CALL_END();
// Not all error handlers throw, so have a default behavior.
return g_phd;
};
//-*****************************************************************************
template <class PROP_PTR>
OObject OBasePropertyT<PROP_PTR>::getObject() const
{
ALEMBIC_ABC_SAFE_CALL_BEGIN( "OBaseProperty::getObject()" );
return OObject( m_property->getObject(),
kWrapExisting,
getErrorHandlerPolicy() );
ALEMBIC_ABC_SAFE_CALL_END();
// Not all error handlers throw. Have a default.
return OObject();
}
} // 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
OArchive.h
OObject.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::OBasePropertyT
Definition OBaseProperty.h:58
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::isCompound
bool isCompound() const
Definition OBaseProperty.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getName
const std::string & getName() const
Definition OBaseProperty.h:102
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::OBasePropertyT
OBasePropertyT()
Definition OBaseProperty.h:74
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::isSimple
bool isSimple() const
Definition OBaseProperty.h:125
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getHeader
const AbcA::PropertyHeader & getHeader() const
Definition OBaseProperty.h:211
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT< AbcA::BasePropertyWriterPtr >::m_property
AbcA::BasePropertyWriterPtr m_property
Definition OBaseProperty.h:180
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT< AbcA::BasePropertyWriterPtr >::OCompoundProperty
friend class OCompoundProperty
Definition OBaseProperty.h:66
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getPtr
PROP_PTR getPtr() const
Definition OBaseProperty.h:162
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::reset
void reset()
Definition OBaseProperty.h:166
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::ALEMBIC_OPERATOR_BOOL
ALEMBIC_OPERATOR_BOOL(valid())
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::OBasePropertyT
OBasePropertyT(PROP_PTR iPtr, ErrorHandler::Policy iPolicy)
Definition OBaseProperty.h:193
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::operator_bool_base_type
OBasePropertyT< PROP_PTR > operator_bool_base_type
Definition OBaseProperty.h:63
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getTimeSampling
AbcA::TimeSamplingPtr getTimeSampling() const
Definition OBaseProperty.h:143
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getPropertyType
AbcA::PropertyType getPropertyType() const
Definition OBaseProperty.h:107
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::this_type
OBasePropertyT< PROP_PTR > this_type
Definition OBaseProperty.h:62
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getObject
OObject getObject() const
Definition OBaseProperty.h:225
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getDataType
const AbcA::DataType & getDataType() const
Definition OBaseProperty.h:136
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::valid
bool valid() const
Definition OBaseProperty.h:170
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::isScalar
bool isScalar() const
Definition OBaseProperty.h:112
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::isArray
bool isArray() const
Definition OBaseProperty.h:116
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::getMetaData
const AbcA::MetaData & getMetaData() const
Definition OBaseProperty.h:129
Alembic::Abc::ALEMBIC_VERSION_NS::OObject
Definition OObject.h:54
Alembic::Abc::ALEMBIC_VERSION_NS
Definition ArchiveInfo.h:48
Alembic::Abc::ALEMBIC_VERSION_NS::kWrapExisting
@ kWrapExisting
Definition Foundation.h:95
Alembic::Abc::ALEMBIC_VERSION_NS::OBaseProperty
OBasePropertyT< AbcA::BasePropertyWriterPtr > OBaseProperty
Definition OBaseProperty.h:184
Alembic::Abc
Definition ArchiveInfo.h:47
Alembic
Alembic namespace ...
Definition ArchiveInfo.h:46