Loading...
Searching...
No Matches
ArchiveInfo.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_ArchiveInfo_h
#define Alembic_Abc_ArchiveInfo_h
#include <Alembic/Util/Export.h>
#include <Alembic/Abc/Foundation.h>
#include <Alembic/Abc/IArchive.h>
#include <Alembic/Abc/OArchive.h>
#include <time.h>
namespace Alembic {
namespace Abc {
namespace ALEMBIC_VERSION_NS {
//-*****************************************************************************
// Alembic archive information:
// Useful utilities that readers and writers can use to provide
// useful annotations into the alembic file.
//-*****************************************************************************
// Some MetaData key constants
static ALEMBIC_EXPORT_CONST char * kApplicationNameKey = "_ai_Application";
static ALEMBIC_EXPORT_CONST char * kDateWrittenKey = "_ai_DateWritten";
static ALEMBIC_EXPORT_CONST char * kUserDescriptionKey = "_ai_Description";
static ALEMBIC_EXPORT_CONST char * kDCCFPSKey = "_ai_DCC_FPS";
//-*****************************************************************************
template <class ARCHIVE_CTOR>
OArchive CreateArchiveWithInfo(
ARCHIVE_CTOR iCtor,
const std::string &iFileName,
const std::string & iApplicationWriter,
const std::string & iUserDescription,
const Argument &iArg0 = Argument(),
const Argument &iArg1 = Argument() );
//-*****************************************************************************
template <class ARCHIVE_CTOR>
OArchive CreateArchiveWithInfo(
ARCHIVE_CTOR iCtor,
const std::string &iFileName,
double iDCCFPS,
const std::string & iApplicationWriter,
const std::string & iUserDescription,
const Argument &iArg0 = Argument(),
const Argument &iArg1 = Argument() );
//-*****************************************************************************
ALEMBIC_EXPORT void
GetArchiveInfo(
IArchive & iArchive,
std::string & oApplicationWriter,
std::string & oAlembicVersion,
Util::uint32_t & oAlembicApiVersion,
std::string & oDateWritten,
std::string & oUserDescription );
//-*****************************************************************************
ALEMBIC_EXPORT void
GetArchiveInfo(
IArchive & iArchive,
std::string & oApplicationWriter,
std::string & oAlembicVersion,
Util::uint32_t & oAlembicApiVersion,
std::string & oDateWritten,
std::string & oUserDescription,
double & oDCCFPS);
//-*****************************************************************************
ALEMBIC_EXPORT void
GetArchiveStartAndEndTime(
IArchive & iArchive,
double & oStartTime,
double & oEndTime );
//-*****************************************************************************
template <class ARCHIVE_CTOR>
OArchive CreateArchiveWithInfo(
ARCHIVE_CTOR iCtor,
const std::string &iFileName,
double iDCCFPS,
const std::string &iApplicationWriter,
const std::string &iUserDescription,
const Argument &iArg0,
const Argument &iArg1 )
{
AbcA::MetaData md = GetMetaData( iArg0, iArg1 );
ErrorHandler::Policy policy = GetErrorHandlerPolicyFromArgs( iArg0, iArg1 );
if ( iApplicationWriter != "" )
{
md.set( kApplicationNameKey, iApplicationWriter );
}
time_t rawtimeNow;
time( &rawtimeNow );
char dateBuf [128];
#if defined _WIN32 || defined _WIN64
ctime_s( dateBuf, 128, &rawtimeNow);
#else
ctime_r( &rawtimeNow, dateBuf );
#endif
std::size_t bufLen = strlen( dateBuf );
if ( bufLen > 0 && dateBuf[bufLen - 1] == '\n' )
{
dateBuf[bufLen - 1] = '\0';
}
md.set( kDateWrittenKey, dateBuf );
if ( iUserDescription != "" )
{
md.set( kUserDescriptionKey, iUserDescription );
}
if ( iDCCFPS > 0.0 )
{
md.set( kDCCFPSKey, std::to_string( iDCCFPS ) );
}
return OArchive( iCtor, iFileName, md, policy );
}
template <class ARCHIVE_CTOR>
OArchive CreateArchiveWithInfo(
ARCHIVE_CTOR iCtor,
const std::string &iFileName,
const std::string &iApplicationWriter,
const std::string &iUserDescription,
const Argument &iArg0,
const Argument &iArg1 )
{
return CreateArchiveWithInfo( iCtor, iFileName, 0, iApplicationWriter,
iUserDescription, iArg0, iArg1 );
}
} // End namespace ALEMBIC_VERSION_NS
using namespace ALEMBIC_VERSION_NS;
} // End namespace Abc
} // End namespace Alembic
#endif
Foundation.h
Export.h
ALEMBIC_EXPORT_CONST
#define ALEMBIC_EXPORT_CONST
Definition Export.h:53
ALEMBIC_EXPORT
#define ALEMBIC_EXPORT
Definition Export.h:51
IArchive.h
OArchive.h
ALEMBIC_VERSION_NS
#define ALEMBIC_VERSION_NS
Definition Foundation.h:105
Alembic::Abc::ALEMBIC_VERSION_NS::Argument
Definition Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::ErrorHandler::Policy
Policy
Definition ErrorHandler.h:52
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive
Definition IArchive.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::OArchive
Definition OArchive.h:53
Alembic::Util::ALEMBIC_VERSION_NS::uint32_t
Alembic::Abc::ALEMBIC_VERSION_NS
Definition ArchiveInfo.h:48
Alembic::Abc::ALEMBIC_VERSION_NS::GetErrorHandlerPolicyFromArgs
ErrorHandler::Policy GetErrorHandlerPolicyFromArgs(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition Argument.h:258
Alembic::Abc::ALEMBIC_VERSION_NS::CreateArchiveWithInfo
OArchive CreateArchiveWithInfo(ARCHIVE_CTOR iCtor, const std::string &iFileName, const std::string &iApplicationWriter, const std::string &iUserDescription, const Argument &iArg0=Argument(), const Argument &iArg1=Argument())
Definition ArchiveInfo.h:225
Alembic::Abc::ALEMBIC_VERSION_NS::kApplicationNameKey
static ALEMBIC_EXPORT_CONST char * kApplicationNameKey
Definition ArchiveInfo.h:57
Alembic::Abc::ALEMBIC_VERSION_NS::kUserDescriptionKey
static ALEMBIC_EXPORT_CONST char * kUserDescriptionKey
Definition ArchiveInfo.h:59
Alembic::Abc::ALEMBIC_VERSION_NS::GetArchiveInfo
ALEMBIC_EXPORT void GetArchiveInfo(IArchive &iArchive, std::string &oApplicationWriter, std::string &oAlembicVersion, Util::uint32_t &oAlembicApiVersion, std::string &oDateWritten, std::string &oUserDescription)
Alembic::Abc::ALEMBIC_VERSION_NS::GetArchiveStartAndEndTime
ALEMBIC_EXPORT void GetArchiveStartAndEndTime(IArchive &iArchive, double &oStartTime, double &oEndTime)
Alembic::Abc::ALEMBIC_VERSION_NS::kDateWrittenKey
static ALEMBIC_EXPORT_CONST char * kDateWrittenKey
Definition ArchiveInfo.h:58
Alembic::Abc::ALEMBIC_VERSION_NS::kDCCFPSKey
static ALEMBIC_EXPORT_CONST char * kDCCFPSKey
Definition ArchiveInfo.h:60
Alembic::Abc::ALEMBIC_VERSION_NS::GetMetaData
AbcA::MetaData GetMetaData(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition Argument.h:273
Alembic::Abc
Definition ArchiveInfo.h:47
Alembic
Alembic namespace ...
Definition ArchiveInfo.h:46