OObject.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_OObject_h
#define Alembic_Abc_OObject_h
#include <Alembic/Util/Export.h>
#include <Alembic/Abc/Foundation.h>
#include <Alembic/Abc/Base.h>
#include <Alembic/Abc/Argument.h>
#include <Alembic/Abc/OArchive.h>
namespace Alembic {
namespace Abc {
namespace ALEMBIC_VERSION_NS {
class OCompoundProperty;
//-*****************************************************************************
class ALEMBIC_EXPORT OObject : public Base
{
public:
typedef OObject this_type;
typedef OObject operator_bool_base_type;
//-*************************************************************************
// CONSTRUCTION, DESTRUCTION, ASSIGNMENT
//-*************************************************************************
OObject() {}
OObject( OObject iParentObject,
const std::string &iName,
const Argument &iArg0 = Argument(),
const Argument &iArg1 = Argument(),
const Argument &iArg2 = Argument() );
OObject( AbcA::ObjectWriterPtr iPtr,
const Argument &iArg0 = Argument(),
const Argument &iArg1 = Argument(),
const Argument &iArg2 = Argument() )
: m_object( iPtr )
{
// Set the error handling policy
getErrorHandler().setPolicy(
GetErrorHandlerPolicy( iPtr, iArg0, iArg1, iArg2 ) );
}
// Deprecated in favor of the constructor above
OObject( AbcA::ObjectWriterPtr iPtr,
WrapExistingFlag /* iFlag */,
const Argument &iArg0 = Argument(),
const Argument &iArg1 = Argument(),
const Argument &iArg2 = Argument() )
: m_object( iPtr )
{
// Set the error handling policy
getErrorHandler().setPolicy(
GetErrorHandlerPolicy( iPtr, iArg0, iArg1, iArg2 ) );
}
OObject( OArchive & iArchive,
const Argument &iArg0 = Argument(),
const Argument &iArg1 = Argument(),
const Argument &iArg2 = Argument() )
{
init( iArchive, iArg0, iArg1, iArg2 );
}
// deprecated in favor of the constructor above
OObject( OArchive & iArchive,
TopFlag /* iTop */,
const Argument &iArg0 = Argument(),
const Argument &iArg1 = Argument(),
const Argument &iArg2 = Argument() )
{
init( iArchive, iArg0, iArg1, iArg2 );
}
virtual ~OObject();
//-*************************************************************************
// OBJECT WRITER FUNCTIONALITY
//-*************************************************************************
const AbcA::ObjectHeader & getHeader() const;
const std::string &getName() const
{ return getHeader().getName(); }
const std::string &getFullName() const
{ return getHeader().getFullName(); }
const AbcA::MetaData &getMetaData() const
{ return getHeader().getMetaData(); }
OArchive getArchive();
OObject getParent();
size_t getNumChildren();
const AbcA::ObjectHeader & getChildHeader( size_t i );
const AbcA::ObjectHeader * getChildHeader( const std::string &iName );
OCompoundProperty getProperties();
//-*************************************************************************
// ADVANCED TOOLS
// Unless you really know why you need to be using these next few
// functions, they're probably best left alone. These functions attempt
// to find a pointer to an existing writer, instead of creating a new one.
//-*************************************************************************
OObject getChild( size_t iChildIndex );
OObject getChild( const std::string &iChildName );
// PROXY METHODS
// An OObject can refer to another OObject. When read in, this instance
// will be represented by the target source hierarchy and its children.
bool addChildInstance( OObject iTarget, const std::string& iName );
//-*************************************************************************
// ABC BASE MECHANISMS
// These functions are used by Abc to deal with errors, rewrapping,
// and so on.
//-*************************************************************************
AbcA::ObjectWriterPtr getPtr() { return m_object; }
const AbcA::ObjectWriterPtr getPtr() const { return m_object; }
void reset() { m_object.reset(); Base::reset(); }
bool valid() const
{
return ( Base::valid() && m_object );
}
ALEMBIC_OPERATOR_BOOL( valid() );
private:
void init( OArchive & iArchive,
const Argument &iArg0,
const Argument &iArg1,
const Argument &iArg2 );
void init( AbcA::ObjectWriterPtr iParentObject,
const std::string &iName,
ErrorHandler::Policy iParentPolicy,
const Argument &iArg0,
const Argument &iArg1,
const Argument &iARg2 );
protected:
AbcA::ObjectWriterPtr m_object;
};
} // End namespace ALEMBIC_VERSION_NS
using namespace ALEMBIC_VERSION_NS;
} // End namespace Abc
} // End namespace Alembic
#endif
Foundation.h
Argument.h
Base.h
Export.h
ALEMBIC_EXPORT
#define ALEMBIC_EXPORT
Definition: Export.h:51
OArchive.h
ALEMBIC_VERSION_NS
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:105
Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData
Definition: MetaData.h:60
Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::ObjectHeader
Definition: ObjectHeader.h:52
Alembic::Abc::ALEMBIC_VERSION_NS::Argument
Definition: Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::Base
Definition: Base.h:49
Alembic::Abc::ALEMBIC_VERSION_NS::Base::valid
bool valid() const
Definition: Base.h:65
Alembic::Abc::ALEMBIC_VERSION_NS::Base::reset
void reset()
Definition: Base.h:70
Alembic::Abc::ALEMBIC_VERSION_NS::ErrorHandler::Policy
Policy
Definition: ErrorHandler.h:52
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive
Definition: OArchive.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::OCompoundProperty
Definition: OCompoundProperty.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::OObject
Definition: OObject.h:54
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getChild
OObject getChild(size_t iChildIndex)
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::OObject
OObject()
Definition: OObject.h:68
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::OObject
OObject(OArchive &iArchive, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
Definition: OObject.h:111
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getProperties
OCompoundProperty getProperties()
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::OObject
OObject(OObject iParentObject, const std::string &iName, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getChildHeader
const AbcA::ObjectHeader & getChildHeader(size_t i)
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::ALEMBIC_OPERATOR_BOOL
ALEMBIC_OPERATOR_BOOL(valid())
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getName
const std::string & getName() const
Definition: OObject.h:146
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getPtr
const AbcA::ObjectWriterPtr getPtr() const
Definition: OObject.h:221
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::operator_bool_base_type
OObject operator_bool_base_type
Definition: OObject.h:60
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::OObject
OObject(AbcA::ObjectWriterPtr iPtr, WrapExistingFlag, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
Definition: OObject.h:96
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getPtr
AbcA::ObjectWriterPtr getPtr()
Definition: OObject.h:220
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::addChildInstance
bool addChildInstance(OObject iTarget, const std::string &iName)
-************************************************************************
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::~OObject
virtual ~OObject()
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getHeader
const AbcA::ObjectHeader & getHeader() const
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getChildHeader
const AbcA::ObjectHeader * getChildHeader(const std::string &iName)
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getMetaData
const AbcA::MetaData & getMetaData() const
Definition: OObject.h:156
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getNumChildren
size_t getNumChildren()
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::reset
void reset()
Definition: OObject.h:225
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::this_type
OObject this_type
Definition: OObject.h:59
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getParent
OObject getParent()
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::m_object
AbcA::ObjectWriterPtr m_object
Definition: OObject.h:254
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::valid
bool valid() const
Definition: OObject.h:229
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::OObject
OObject(AbcA::ObjectWriterPtr iPtr, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
Definition: OObject.h:84
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::OObject
OObject(OArchive &iArchive, TopFlag, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument())
Definition: OObject.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getFullName
const std::string & getFullName() const
Definition: OObject.h:151
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getArchive
OArchive getArchive()
Alembic::Abc::ALEMBIC_VERSION_NS::OObject::getChild
OObject getChild(const std::string &iChildName)
Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::ObjectWriterPtr
Alembic::Util::shared_ptr< ObjectWriter > ObjectWriterPtr
Definition: ForwardDeclarations.h:82
Alembic::Abc::ALEMBIC_VERSION_NS
Definition: ArchiveInfo.h:48
Alembic::Abc::ALEMBIC_VERSION_NS::GetErrorHandlerPolicy
ErrorHandler::Policy GetErrorHandlerPolicy(SOMETHING iSomething, const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition: Argument.h:242
Alembic::Abc::ALEMBIC_VERSION_NS::WrapExistingFlag
WrapExistingFlag
Definition: Foundation.h:94
Alembic::Abc::ALEMBIC_VERSION_NS::TopFlag
TopFlag
Definition: Foundation.h:104
Alembic
Alembic namespace ...
Definition: ArchiveInfo.h:46