Loading...
Searching...
No Matches
IArchive.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_IArchive_h
#define Alembic_Abc_IArchive_h
#include <Alembic/Util/Export.h>
#include <Alembic/Abc/Foundation.h>
#include <Alembic/Abc/Base.h>
#include <Alembic/Abc/Argument.h>
namespace Alembic {
namespace Abc {
namespace ALEMBIC_VERSION_NS {
class IObject;
//-*****************************************************************************
class ALEMBIC_EXPORT IArchive : public Base
{
public:
typedef IArchive this_type;
//-*************************************************************************
// CONSTRUCTION, DESTRUCTION, ASSIGNMENT
//-*************************************************************************
IArchive() {}
template <class ARCHIVE_CTOR>
IArchive(
ARCHIVE_CTOR iCtor,
const std::string &iFileName,
ErrorHandler::Policy iPolicy = ErrorHandler::kThrowPolicy,
AbcA::ReadArraySampleCachePtr iCachePtr = AbcA::ReadArraySampleCachePtr());
IArchive(
AbcA::ArchiveReaderPtr iPtr,
ErrorHandler::Policy iPolicy = ErrorHandler::kThrowPolicy )
: m_archive( iPtr )
{
// Set the error handling policy.
getErrorHandler().setPolicy( iPolicy );
}
// Deprecated in favor of the constructor above
IArchive(
AbcA::ArchiveReaderPtr iPtr,
WrapExistingFlag /* iWrap */,
ErrorHandler::Policy iPolicy = ErrorHandler::kThrowPolicy )
: m_archive( iPtr )
{
// Set the error handling policy.
getErrorHandler().setPolicy( iPolicy );
}
~IArchive();
//-*************************************************************************
// ARCHIVE WRITER FUNCTIONALITY
//-*************************************************************************
std::string getName() const;
IObject getTop() const;
AbcA::ReadArraySampleCachePtr getReadArraySampleCachePtr();
void setReadArraySampleCachePtr( AbcA::ReadArraySampleCachePtr iPtr );
//-*************************************************************************
// ABC BASE MECHANISMS
// These functions are used by Abc to deal with errors, rewrapping,
// and so on.
//-*************************************************************************
AbcA::ArchiveReaderPtr getPtr() { return m_archive; }
void reset() { m_archive.reset(); Base::reset(); }
AbcA::TimeSamplingPtr getTimeSampling( uint32_t iIndex );
uint32_t getNumTimeSamplings();
index_t getMaxNumSamplesForTimeSamplingIndex( uint32_t iIndex );
bool valid() const
{
return ( Base::valid() && m_archive );
}
int32_t getArchiveVersion();
ALEMBIC_OPERATOR_BOOL( valid() );
private:
AbcA::ArchiveReaderPtr m_archive;
};
//-*****************************************************************************
inline AbcA::ArchiveReaderPtr
GetArchiveReaderPtr( IArchive& iPrp ) { return iPrp.getPtr(); }
//-*****************************************************************************
//-*****************************************************************************
template <class ARCHIVE_CTOR>
IArchive::IArchive( ARCHIVE_CTOR iCtor,
const std::string &iFileName,
ErrorHandler::Policy iPolicy,
AbcA::ReadArraySampleCachePtr iCachePtr )
{
// Set the error handling policy.
getErrorHandler().setPolicy( iPolicy );
ALEMBIC_ABC_SAFE_CALL_BEGIN( "IArchive::IArchive( iFileName )" );
m_archive = iCtor( iFileName, iCachePtr );
ALEMBIC_ABC_SAFE_CALL_END_RESET();
}
} // 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_BEGIN
#define ALEMBIC_ABC_SAFE_CALL_BEGIN(CONTEXT)
Definition ErrorHandler.h:172
ALEMBIC_ABC_SAFE_CALL_END_RESET
#define ALEMBIC_ABC_SAFE_CALL_END_RESET()
Definition ErrorHandler.h:181
Export.h
ALEMBIC_EXPORT
#define ALEMBIC_EXPORT
Definition Export.h:51
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::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::ErrorHandler::kThrowPolicy
@ kThrowPolicy
Definition ErrorHandler.h:55
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive
Definition IArchive.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::getPtr
AbcA::ArchiveReaderPtr getPtr()
Definition IArchive.h:151
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::getArchiveVersion
int32_t getArchiveVersion()
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::ALEMBIC_OPERATOR_BOOL
ALEMBIC_OPERATOR_BOOL(valid())
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::getName
std::string getName() const
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::IArchive
IArchive(AbcA::ArchiveReaderPtr iPtr, WrapExistingFlag, ErrorHandler::Policy iPolicy=ErrorHandler::kThrowPolicy)
Definition IArchive.h:103
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::setReadArraySampleCachePtr
void setReadArraySampleCachePtr(AbcA::ReadArraySampleCachePtr iPtr)
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::getNumTimeSamplings
uint32_t getNumTimeSamplings()
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::valid
bool valid() const
Definition IArchive.h:172
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::getTop
IObject getTop() const
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::reset
void reset()
Definition IArchive.h:155
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::IArchive
IArchive(AbcA::ArchiveReaderPtr iPtr, ErrorHandler::Policy iPolicy=ErrorHandler::kThrowPolicy)
Definition IArchive.h:87
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::getMaxNumSamplesForTimeSamplingIndex
index_t getMaxNumSamplesForTimeSamplingIndex(uint32_t iIndex)
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::getTimeSampling
AbcA::TimeSamplingPtr getTimeSampling(uint32_t iIndex)
Returns the TimeSampling at a given index.
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::this_type
IArchive this_type
Definition IArchive.h:58
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::IArchive
IArchive()
Definition IArchive.h:66
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::getReadArraySampleCachePtr
AbcA::ReadArraySampleCachePtr getReadArraySampleCachePtr()
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::~IArchive
~IArchive()
Alembic::Abc::ALEMBIC_VERSION_NS::IObject
Definition IObject.h:54
Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::index_t
int64_t index_t
Definition Foundation.h:62
Alembic::Abc::ALEMBIC_VERSION_NS
Definition ArchiveInfo.h:48
Alembic::Abc::ALEMBIC_VERSION_NS::GetArchiveReaderPtr
AbcA::ArchiveReaderPtr GetArchiveReaderPtr(AbcA::ArchiveReaderPtr iPtr)
Definition Foundation.h:219
Alembic::Abc::ALEMBIC_VERSION_NS::WrapExistingFlag
WrapExistingFlag
Definition Foundation.h:94
Alembic::Abc
Definition ArchiveInfo.h:47
Alembic
Alembic namespace ...
Definition ArchiveInfo.h:46