Loading...
Searching...
No Matches
OArchive.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_OArchive_h
#define Alembic_Abc_OArchive_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 OObject;
//-*****************************************************************************
class ALEMBIC_EXPORT OArchive : public Base
{
public:
typedef OArchive this_type;
//-*************************************************************************
// CONSTRUCTION, DESTRUCTION, ASSIGNMENT
//-*************************************************************************
OArchive() {}
template <class ARCHIVE_CTOR>
OArchive(
ARCHIVE_CTOR iCtor,
const std::string &iFileName,
const Argument &iArg0 = Argument(),
const Argument &iArg1 = Argument() );
OArchive(
AbcA::ArchiveWriterPtr iPtr,
ErrorHandler::Policy iPolicy = ErrorHandler::kThrowPolicy )
: m_archive( iPtr )
{
// Set the error handling policy.
getErrorHandler().setPolicy( iPolicy );
}
// Deprecated in favor of the constructor above
OArchive(
AbcA::ArchiveWriterPtr iPtr,
WrapExistingFlag /* iWrap */,
ErrorHandler::Policy iPolicy = ErrorHandler::kThrowPolicy )
: m_archive( iPtr )
{
// Set the error handling policy.
getErrorHandler().setPolicy( iPolicy );
}
~OArchive();
//-*************************************************************************
// ARCHIVE WRITER FUNCTIONALITY
//-*************************************************************************
std::string getName() const;
OObject getTop();
int8_t getCompressionHint() const;
void setCompressionHint( int8_t iCh );
uint32_t addTimeSampling( const AbcA::TimeSampling & iTs );
AbcA::TimeSamplingPtr getTimeSampling( uint32_t iIndex );
uint32_t getNumTimeSamplings();
//-*************************************************************************
// ABC BASE MECHANISMS
// These functions are used by Abc to deal with errors, rewrapping,
// and so on.
//-*************************************************************************
AbcA::ArchiveWriterPtr getPtr() { return m_archive; }
void reset() { m_archive.reset(); Base::reset(); }
bool valid() const
{
return ( Base::valid() && m_archive );
}
ALEMBIC_OPERATOR_BOOL( valid() );
private:
AbcA::ArchiveWriterPtr m_archive;
};
//-*****************************************************************************
inline AbcA::ArchiveWriterPtr GetArchiveWriterPtr( OArchive &iArch )
{
return iArch.getPtr();
}
//-*****************************************************************************
//-*****************************************************************************
template <class ARCHIVE_CTOR>
OArchive::OArchive( ARCHIVE_CTOR iCtor,
const std::string &iFileName,
const Argument &iArg0,
const Argument &iArg1 )
{
// Create arguments
Arguments args( ErrorHandler::kThrowPolicy );
iArg0.setInto( args );
iArg1.setInto( args );
// Set the error handling policy.
getErrorHandler().setPolicy( args.getErrorHandlerPolicy() );
ALEMBIC_ABC_SAFE_CALL_BEGIN( "OArchive::OArchive( iFileName )" );
m_archive = iCtor( iFileName, args.getMetaData() );
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::Argument
Definition Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::Argument::setInto
void setInto(Arguments &iArgs) const
Definition Argument.h:149
Alembic::Abc::ALEMBIC_VERSION_NS::Arguments
Definition Argument.h:49
Alembic::Abc::ALEMBIC_VERSION_NS::Arguments::getMetaData
const AbcA::MetaData & getMetaData() const
Definition Argument.h:86
Alembic::Abc::ALEMBIC_VERSION_NS::Arguments::getErrorHandlerPolicy
ErrorHandler::Policy getErrorHandlerPolicy() const
Definition Argument.h:83
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::OArchive
Definition OArchive.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::getNumTimeSamplings
uint32_t getNumTimeSamplings()
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::setCompressionHint
void setCompressionHint(int8_t iCh)
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::OArchive
OArchive()
Definition OArchive.h:66
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::getCompressionHint
int8_t getCompressionHint() const
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::~OArchive
~OArchive()
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::OArchive
OArchive(AbcA::ArchiveWriterPtr iPtr, WrapExistingFlag, ErrorHandler::Policy iPolicy=ErrorHandler::kThrowPolicy)
Definition OArchive.h:105
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::getTimeSampling
AbcA::TimeSamplingPtr getTimeSampling(uint32_t iIndex)
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::ALEMBIC_OPERATOR_BOOL
ALEMBIC_OPERATOR_BOOL(valid())
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::getName
std::string getName() const
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::this_type
OArchive this_type
Definition OArchive.h:58
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::OArchive
OArchive(AbcA::ArchiveWriterPtr iPtr, ErrorHandler::Policy iPolicy=ErrorHandler::kThrowPolicy)
Definition OArchive.h:89
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::valid
bool valid() const
Definition OArchive.h:177
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::getPtr
AbcA::ArchiveWriterPtr getPtr()
Definition OArchive.h:169
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::addTimeSampling
uint32_t addTimeSampling(const AbcA::TimeSampling &iTs)
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::getTop
OObject getTop()
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive::reset
void reset()
Definition OArchive.h:173
Alembic::Abc::ALEMBIC_VERSION_NS::OObject
Definition OObject.h:54
Alembic::Abc::ALEMBIC_VERSION_NS
Definition ArchiveInfo.h:48
Alembic::Abc::ALEMBIC_VERSION_NS::GetArchiveWriterPtr
AbcA::ArchiveWriterPtr GetArchiveWriterPtr(AbcA::ArchiveWriterPtr iPtr)
Definition Foundation.h:213
Alembic::Abc::ALEMBIC_VERSION_NS::WrapExistingFlag
WrapExistingFlag
Definition Foundation.h:94
Alembic::Abc
Definition ArchiveInfo.h:47
Alembic
Alembic namespace ...
Definition ArchiveInfo.h:46