diff --git a/README.md b/README.md new file mode 100644 index 0000000..4735d1d --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +ofxAlembic +========== +vs2012 version with of 0.8.0 diff --git a/libs/HDF5-COPYING.txt b/libs/HDF5-COPYING.txt deleted file mode 100644 index 25e79e7..0000000 --- a/libs/HDF5-COPYING.txt +++ /dev/null @@ -1,92 +0,0 @@ - -Copyright Notice and License Terms for -HDF5 (Hierarchical Data Format 5) Software Library and Utilities ------------------------------------------------------------------------------ - -HDF5 (Hierarchical Data Format 5) Software Library and Utilities -Copyright 2006-2013 by The HDF Group. - -NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities -Copyright 1998-2006 by the Board of Trustees of the University of Illinois. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted for any purpose (including commercial purposes) -provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions, and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions, and the following disclaimer in the documentation - and/or materials provided with the distribution. - -3. In addition, redistributions of modified forms of the source or binary - code must carry prominent notices stating that the original code was - changed and the date of the change. - -4. All publications or advertising materials mentioning features or use of - this software are asked, but not required, to acknowledge that it was - developed by The HDF Group and by the National Center for Supercomputing - Applications at the University of Illinois at Urbana-Champaign and - credit the contributors. - -5. Neither the name of The HDF Group, the name of the University, nor the - name of any Contributor may be used to endorse or promote products derived - from this software without specific prior written permission from - The HDF Group, the University, or the Contributor, respectively. - -DISCLAIMER: -THIS SOFTWARE IS PROVIDED BY THE HDF GROUP AND THE CONTRIBUTORS -"AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. In no -event shall The HDF Group or the Contributors be liable for any damages -suffered by the users arising out of the use of this software, even if -advised of the possibility of such damage. - ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ - -Contributors: National Center for Supercomputing Applications (NCSA) at -the University of Illinois, Fortner Software, Unidata Program Center (netCDF), -The Independent JPEG Group (JPEG), Jean-loup Gailly and Mark Adler (gzip), -and Digital Equipment Corporation (DEC). - ------------------------------------------------------------------------------ - -Portions of HDF5 were developed with support from the Lawrence Berkeley -National Laboratory (LBNL) and the United States Department of Energy -under Prime Contract No. DE-AC02-05CH11231. - ------------------------------------------------------------------------------ - -Portions of HDF5 were developed with support from the University of -California, Lawrence Livermore National Laboratory (UC LLNL). -The following statement applies to those portions of the product and must -be retained in any redistribution of source code, binaries, documentation, -and/or accompanying materials: - - This work was partially produced at the University of California, - Lawrence Livermore National Laboratory (UC LLNL) under contract - no. W-7405-ENG-48 (Contract 48) between the U.S. Department of Energy - (DOE) and The Regents of the University of California (University) - for the operation of UC LLNL. - - DISCLAIMER: - This work was prepared as an account of work sponsored by an agency of - the United States Government. Neither the United States Government nor - the University of California nor any of their employees, makes any - warranty, express or implied, or assumes any liability or responsibility - for the accuracy, completeness, or usefulness of any information, - apparatus, product, or process disclosed, or represents that its use - would not infringe privately- owned rights. Reference herein to any - specific commercial products, process, or service by trade name, - trademark, manufacturer, or otherwise, does not necessarily constitute - or imply its endorsement, recommendation, or favoring by the United - States Government or the University of California. The views and - opinions of authors expressed herein do not necessarily state or reflect - those of the United States Government or the University of California, - and shall not be used for advertising or product endorsement purposes. ------------------------------------------------------------------------------ - - diff --git a/libs/OpenEXR-LICENSE.txt b/libs/OpenEXR-LICENSE.txt deleted file mode 100644 index 6372750..0000000 --- a/libs/OpenEXR-LICENSE.txt +++ /dev/null @@ -1,34 +0,0 @@ -Copyright (c) 2006, Industrial Light & Magic, a division of Lucasfilm -Entertainment Company Ltd. Portions contributed and copyright held by -others as indicated. 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 Industrial Light & Magic nor the names of - any other contributors to this software 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. - diff --git a/libs/alembic-LICENSE.txt b/libs/alembic-LICENSE.txt deleted file mode 100644 index 32ca924..0000000 --- a/libs/alembic-LICENSE.txt +++ /dev/null @@ -1,116 +0,0 @@ -TM & © 2009-2013 Lucasfilm Entertainment Company Ltd. or Lucasfilm Ltd. -All rights reserved. - -Industrial Light & Magic, ILM and the Bulb and Gear design logo are all -registered trademarks or service marks of Lucasfilm Ltd. - -© 2009-2013 Sony Pictures Imageworks Inc. 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 Industrial Light & Magic nor the names of -its 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. - - -------------------------------------------------------------------------------- - -ALEMBIC ATTACHMENT A — -REQUIRED NOTICES FOR DISTRIBUTION - -The Alembic Software is distributed along with certain third party -components licensed under various open source software licenses ("Open -Source Components"). In addition to the warranty disclaimers contained -in the open source licenses found below, Industrial Light & Magic, a -division of Lucasfilm Entertainment Company Ltd. ("ILM") makes the -following disclaimers regarding the Open Source Components on behalf of -itself, the copyright holders, contributors, and licensors of such Open -Source Components: - -TO THE FULLEST EXTENT PERMITTED UNDER APPLICABLE LAW, THE OPEN SOURCE -COMPONENTS ARE PROVIDED BY THE COPYRIGHT HOLDERS, CONTRIBUTORS, -LICENSORS, AND ILM "AS IS" AND ANY REPRESENTATIONS OR WARRANTIES OF ANY -KIND, WHETHER ORAL OR WRITTEN, WHETHER EXPRESS, IMPLIED, OR ARISING BY -STATUTE, CUSTOM, COURSE OF DEALING, OR TRADE USAGE, INCLUDING WITHOUT -LIMITATION THE IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR -A PARTICULAR PURPOSE, AND NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT -WILL THE COPYRIGHT OWNER, CONTRIBUTORS, LICENSORS, OR ILM AND/OR ITS -AFFILIATES 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 THE OPEN -SOURCE COMPONENTS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Boost C++ Libraries ------------------------------------------------------------------------- - -Boost Software License – Version 1.0 August 17th, 2003 Permission is -hereby granted, free of charge, to any person or organization obtaining -a copy of the software and accompanying documentation covered by this -license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of -the Software, and to permit third-parties to whom the Software is -furnished to do so, all subject to the following: - -The copyright notices in the Software and this entire statement, -including the above license grant, this restriction and the following -disclaimer, must be included in all copies of the Software, in whole or -in part, and all derivative works of the Software, unless such copies or -derivative works are solely in the form of machine-executable object -code generated by a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND -NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE -DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, -WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -MurmurHash3 ------------------------------------------------------------------------- - -The MIT License (MIT) - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/AprImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/AprImpl.h new file mode 100644 index 0000000..b0e5644 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/AprImpl.h @@ -0,0 +1,94 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_AprImpl_h_ +#define _Alembic_AbcCoreHDF5_AprImpl_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +class AprImpl + : public SimplePrImpl + , public Alembic::Util::enable_shared_from_this +{ +public: + AprImpl( AbcA::CompoundPropertyReaderPtr iParent, H5Node & iParentGroup, + PropertyHeaderPtr iHeader, bool iIsScalarLike, + uint32_t iNumSamples, uint32_t iFirstChangedIndex, + uint32_t iLastChangedIndex ); + + virtual AbcA::ArrayPropertyReaderPtr asArrayPtr(); + virtual bool isScalarLike(); + virtual void getDimensions( index_t iSampleIndex, Dimensions & oDim ); + virtual void getAs( index_t iSample, void *iIntoLocation, + PlainOldDataType iPod ); +protected: + friend class SimplePrImpl; + + //-************************************************************************* + // This function is called by SimplePrImpl to provide the actual + // property reading. + void readSample( hid_t iGroup, + const std::string &iSampleName, + index_t iSampleIndex, + AbcA::ArraySamplePtr& oSamplePtr ); + + //-************************************************************************* + // This function is called by SimplePrImpl to provide the actual key reading + bool readKey( hid_t iGroup, + const std::string &iSampleName, + AbcA::ArraySampleKey & oSamplePtr ); + +private: + bool m_isScalarLike; +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/ApwImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/ApwImpl.h new file mode 100644 index 0000000..dd86f0e --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/ApwImpl.h @@ -0,0 +1,116 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_ApwImpl_h_ +#define _Alembic_AbcCoreHDF5_ApwImpl_h_ + +#include +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +class ApwImpl + : public SimplePwImpl + , public Alembic::Util::enable_shared_from_this +{ +protected: + friend class CpwData; + + //-************************************************************************* + ApwImpl( AbcA::CompoundPropertyWriterPtr iParent, + hid_t iParentGroup, + const std::string & iName, + const AbcA::MetaData & iMetaData, + const AbcA::DataType & iDataType, + uint32_t iTimeSamplingIndex ); + + virtual AbcA::ArrayPropertyWriterPtr asArrayPtr(); + +public: + virtual ~ApwImpl(); + + //-************************************************************************* + static AbcA::ArraySample::Key + computeSampleKey( const AbcA::ArraySample &iSamp ) + { + return iSamp.getKey(); + } + + //-************************************************************************* + bool sameAsPreviousSample( const AbcA::ArraySample &iSamp, + const AbcA::ArraySample::Key &iKey ) const + { + return ( m_previousWrittenArraySampleID && + iKey == m_previousWrittenArraySampleID->getKey() ); + } + + //-************************************************************************* + void copyPreviousSample( hid_t iGroup, + const std::string &iSampleName, + index_t iSampleIndex ); + + //-************************************************************************* + void writeSample( hid_t iGroup, + const std::string &iSampleName, + index_t iSampleIndex, + const AbcA::ArraySample & iSamp, + const AbcA::ArraySample::Key &iKey ); + +protected: + // Previous written array sample identifier! + WrittenArraySampleIDPtr m_previousWrittenArraySampleID; + +private: + bool m_isScalarLike; + std::size_t m_previousNumPoints; + +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/ArImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/ArImpl.h new file mode 100644 index 0000000..44775d9 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/ArImpl.h @@ -0,0 +1,128 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_ArImpl_h_ +#define _Alembic_AbcCoreHDF5_ArImpl_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +class OrData; + +//-***************************************************************************** +class ArImpl + : public AbcA::ArchiveReader + , public Alembic::Util::enable_shared_from_this +{ +private: + friend class ReadArchive; + + ArImpl( const std::string &iFileName, + AbcA::ReadArraySampleCachePtr iCache, + const bool iCacheHierarchy ); + +public: + virtual ~ArImpl(); + + //-************************************************************************* + // ABSTRACT FUNCTIONS + //-************************************************************************* + virtual const std::string &getName() const; + + virtual const AbcA::MetaData &getMetaData() const; + + virtual AbcA::ObjectReaderPtr getTop(); + + virtual AbcA::TimeSamplingPtr getTimeSampling( uint32_t iIndex ); + + virtual AbcA::ArchiveReaderPtr asArchivePtr(); + + virtual AbcA::ReadArraySampleCachePtr getReadArraySampleCachePtr() + { + return m_readArraySampleCache; + } + + //! THIS METHOD IS NOT MULTITHREAD SAFE + virtual void + setReadArraySampleCachePtr( AbcA::ReadArraySampleCachePtr iPtr ) + { + m_readArraySampleCache = iPtr; + } + + virtual AbcA::index_t getMaxNumSamplesForTimeSamplingIndex( + uint32_t iIndex ); + + virtual uint32_t getNumTimeSamplings() + { + return m_timeSamples.size(); + } + + virtual int32_t getArchiveVersion() + { + return m_archiveVersion; + } + +private: + std::string m_fileName; + hid_t m_file; + + Alembic::Util::weak_ptr< AbcA::ObjectReader > m_top; + Alembic::Util::shared_ptr < OrData > m_data; + ObjectHeaderPtr m_header; + + int32_t m_archiveVersion; + + std::vector < AbcA::TimeSamplingPtr > m_timeSamples; + std::vector < AbcA::index_t > m_maxSamples; + + AbcA::ReadArraySampleCachePtr m_readArraySampleCache; + + HDF5Hierarchy m_H5H; +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/AwImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/AwImpl.h new file mode 100644 index 0000000..0306b89 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/AwImpl.h @@ -0,0 +1,119 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_AwImpl_h_ +#define _Alembic_AbcCoreHDF5_AwImpl_h_ + +#include +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +class OwData; + +//-***************************************************************************** +class AwImpl : public AbcA::ArchiveWriter + , public Alembic::Util::enable_shared_from_this +{ +private: + friend class WriteArchive; + + AwImpl( const std::string &iFileName, + const AbcA::MetaData &iMetaData, + bool iCacheHistory ); + +public: + virtual ~AwImpl(); + + //-************************************************************************* + // ABSTRACT FUNCTIONS + //-************************************************************************* + virtual const std::string &getName() const; + + virtual const AbcA::MetaData &getMetaData() const; + + virtual AbcA::ObjectWriterPtr getTop(); + + virtual AbcA::ArchiveWriterPtr asArchivePtr(); + + //-************************************************************************* + // GLOBAL FILE CONTEXT STUFF. + //-************************************************************************* + WrittenArraySampleMap &getWrittenArraySampleMap() + { + return m_writtenArraySampleMap; + } + + virtual uint32_t addTimeSampling( const AbcA::TimeSampling & iTs ); + + virtual AbcA::TimeSamplingPtr getTimeSampling( uint32_t iIndex ); + + virtual uint32_t getNumTimeSamplings() { return m_timeSamples.size(); } + + virtual AbcA::index_t getMaxNumSamplesForTimeSamplingIndex( + uint32_t iIndex ); + + virtual void setMaxNumSamplesForTimeSamplingIndex( uint32_t iIndex, + AbcA::index_t iMaxIndex ); + +private: + std::string m_fileName; + AbcA::MetaData m_metaData; + hid_t m_file; + bool m_cacheHierarchy; + + Alembic::Util::weak_ptr< AbcA::ObjectWriter > m_top; + Alembic::Util::shared_ptr < OwData > m_data; + + std::vector < AbcA::TimeSamplingPtr > m_timeSamples; + + std::vector < AbcA::index_t > m_maxSamples; + + WrittenArraySampleMap m_writtenArraySampleMap; +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/CacheImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/CacheImpl.h new file mode 100644 index 0000000..ed5e43e --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/CacheImpl.h @@ -0,0 +1,161 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_CacheImpl_h_ +#define _Alembic_AbcCoreHDF5_CacheImpl_h_ + +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +typedef Alembic::Util::weak_ptr ArraySampleWeakPtr; + +//-***************************************************************************** +class CacheImpl; +typedef Alembic::Util::shared_ptr CacheImplPtr; +typedef Alembic::Util::weak_ptr CacheImplWeakPtr; + +//-***************************************************************************** +//! This class is underimplemented. It ought to allow limits on storage. +//! Todo! +//! THIS CLASS IS NOT MULTITHREAD SAFE +class CacheImpl : public AbcA::ReadArraySampleCache +{ +public: + //-************************************************************************* + // PUBLIC INTERFACE + //-************************************************************************* + CacheImpl(); + + virtual ~CacheImpl(); + + virtual AbcA::ReadArraySampleID + find( const AbcA::ArraySample::Key &iKey ); + + virtual AbcA::ReadArraySampleID + store( const AbcA::ArraySample::Key &iKey, + AbcA::ArraySamplePtr iBytes ); + +private: + //-************************************************************************* + // INTERNAL STORAGE + // Using the unordered map (hash map) + //-************************************************************************* + struct Record + { + Record(){} + Record( AbcA::ArraySamplePtr iGivenPtr, + AbcA::ArraySamplePtr iDeleterPtr ) + : given( iGivenPtr ), + weakDeleter( iDeleterPtr ) + { + ABCA_ASSERT( iGivenPtr && iDeleterPtr, + "Cannot record null records in CacheImpl" ); + ABCA_ASSERT( iGivenPtr.get() == iDeleterPtr.get(), + "Given Ptr must match contents of DeleterPtr" ); + } + + // This is the original, given Array Sample Ptr. + AbcA::ArraySamplePtr given; + + // This is the one we've created which corresponds + // to this record. It has the same pointer as above, + // but has a special deleter that will instead tell this + // class to erase this record. + // This is how we facilitate cache management. + // Also: I LOVE SMART PTRS + // We don't store it directly because we want the destructor + // to get called whenever we're not using this in the world anymore. + ArraySampleWeakPtr weakDeleter; + }; + +public: + class RecordDeleter; + +private: + friend class RecordDeleter; + AbcA::ArraySamplePtr lock( const AbcA::ArraySample::Key &iKey, + AbcA::ArraySamplePtr iSamp ); + void unlock( const AbcA::ArraySample::Key &iKey ); + +public: + class RecordDeleter + { + private: + friend class CacheImpl; + RecordDeleter( const AbcA::ArraySample::Key &iKey, + CacheImplPtr iCache ) + : m_key( iKey ), + m_cache( iCache ) {} + + public: + void operator()( AbcA::ArraySample *iPtr ) + { + CacheImplPtr cachePtr = m_cache.lock(); + if ( cachePtr ) + { + cachePtr->unlock( m_key ); + } + } + + private: + AbcA::ArraySample::Key m_key; + CacheImplWeakPtr m_cache; + }; + +private: + typedef AbcA::UnorderedMapUtil::umap_type Map; + typedef AbcA::UnorderedMapUtil::umap_type + UnlockedMap; + + Map m_lockedMap; + UnlockedMap m_unlockedMap; +}; + +//-***************************************************************************** +AbcA::ReadArraySampleCachePtr MakeCacheImplPtr(); + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/CprData.h b/libs/alembic/include/Alembic/AbcCoreHDF5/CprData.h new file mode 100644 index 0000000..633dda2 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/CprData.h @@ -0,0 +1,118 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_CprData_h_ +#define _Alembic_AbcCoreHDF5_CprData_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +// data class owned by CprImpl, or OrImpl if it is a "top" object +// it owns and makes child properties as well as the group hid_t +// when necessary +class CprData : public Alembic::Util::enable_shared_from_this +{ +public: + + CprData( H5Node & iParentGroup, int32_t iArchiveVersion, + const std::string &iName ); + + ~CprData(); + + size_t getNumProperties(); + + const AbcA::PropertyHeader & + getPropertyHeader( AbcA::CompoundPropertyReaderPtr iParent, size_t i ); + + const AbcA::PropertyHeader * + getPropertyHeader( AbcA::CompoundPropertyReaderPtr iParent, + const std::string &iName ); + + AbcA::ScalarPropertyReaderPtr + getScalarProperty( AbcA::CompoundPropertyReaderPtr iParent, + const std::string &iName ); + + AbcA::ArrayPropertyReaderPtr + getArrayProperty( AbcA::CompoundPropertyReaderPtr iParent, + const std::string &iName ); + + AbcA::CompoundPropertyReaderPtr + getCompoundProperty( AbcA::CompoundPropertyReaderPtr iParent, + const std::string &iName ); + +private: + // My group. + H5Node m_group; + + // Property Headers and Made Property Pointers. + struct SubProperty + { + PropertyHeaderPtr header; + + // extra data that doesn't quite fit into the property header + // but is stuff we only want to read once + uint32_t numSamples; + uint32_t firstChangedIndex; + uint32_t lastChangedIndex; + bool isScalarLike; + + WeakBprPtr made; + std::string name; + }; + + typedef std::map SubPropertiesMap; + typedef std::vector SubPropertyVec; + + // Allocated mutexes, one per SubProperty + Alembic::Util::mutex * m_subPropertyMutexes; + SubPropertyVec m_propertyHeaders; + SubPropertiesMap m_subProperties; +}; + +typedef Alembic::Util::shared_ptr CprDataPtr; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/CprImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/CprImpl.h new file mode 100644 index 0000000..cf79c33 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/CprImpl.h @@ -0,0 +1,116 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_CprImpl_h_ +#define _Alembic_AbcCoreHDF5_CprImpl_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +class CprImpl + : public AbcA::CompoundPropertyReader + , public Alembic::Util::enable_shared_from_this +{ +public: + + // For construction from a compound property reader + CprImpl( AbcA::CompoundPropertyReaderPtr iParent, + H5Node & iParentGroup, + PropertyHeaderPtr iHeader ); + + CprImpl( AbcA::ObjectReaderPtr iParent, + CprDataPtr iData ); + + virtual ~CprImpl(); + + //-************************************************************************* + // FROM ABSTRACT BasePropertyReader + //-************************************************************************* + virtual const AbcA::PropertyHeader & getHeader() const; + + virtual AbcA::ObjectReaderPtr getObject(); + + virtual AbcA::CompoundPropertyReaderPtr getParent(); + + virtual AbcA::CompoundPropertyReaderPtr asCompoundPtr(); + + //-************************************************************************* + // FROM ABSTRACT CompoundPropertyReader + //-************************************************************************* + virtual size_t getNumProperties(); + + virtual const AbcA::PropertyHeader & getPropertyHeader( size_t i ); + + virtual const AbcA::PropertyHeader * + getPropertyHeader( const std::string &iName ); + + virtual AbcA::ScalarPropertyReaderPtr + getScalarProperty( const std::string &iName ); + + virtual AbcA::ArrayPropertyReaderPtr + getArrayProperty( const std::string &iName ); + + virtual AbcA::CompoundPropertyReaderPtr + getCompoundProperty( const std::string &iName ); + + +private: + + // Pointer to parent. + AbcA::CompoundPropertyReaderPtr m_parent; + + // My header + PropertyHeaderPtr m_header; + + // My Object + AbcA::ObjectReaderPtr m_object; + + CprDataPtr m_data; +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/CpwData.h b/libs/alembic/include/Alembic/AbcCoreHDF5/CpwData.h new file mode 100644 index 0000000..79d6b91 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/CpwData.h @@ -0,0 +1,115 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_CpwData_h_ +#define _Alembic_AbcCoreHDF5_CpwData_h_ + +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +// data class owned by CpwImpl, or OwImpl if it is a "top" object +// it owns and makes child properties as well as the group hid_t +// when necessary +class CpwData : public Alembic::Util::enable_shared_from_this +{ +public: + + CpwData( const std::string & iName, hid_t iParentGroup ); + + ~CpwData(); + + size_t getNumProperties(); + + const AbcA::PropertyHeader & getPropertyHeader( size_t i ); + + const AbcA::PropertyHeader * getPropertyHeader( const std::string &iName ); + + AbcA::BasePropertyWriterPtr getProperty( const std::string & iName ); + + AbcA::ScalarPropertyWriterPtr + createScalarProperty( AbcA::CompoundPropertyWriterPtr iParent, + const std::string & iName, + const AbcA::MetaData & iMetaData, + const AbcA::DataType & iDataType, + uint32_t iTimeSamplingIndex ); + + AbcA::ArrayPropertyWriterPtr + createArrayProperty( AbcA::CompoundPropertyWriterPtr iParent, + const std::string & iName, + const AbcA::MetaData & iMetaData, + const AbcA::DataType & iDataType, + uint32_t iTimeSamplingIndex ); + + AbcA::CompoundPropertyWriterPtr + createCompoundProperty( AbcA::CompoundPropertyWriterPtr iParent, + const std::string & iName, + const AbcA::MetaData & iMetaData ); + +private: + + hid_t getGroup(); + + // The parent group. We need to keep this around because we + // don't create our group until we need to. This is guaranteed to + // exist because our parent (or object) is guaranteed to exist. + hid_t m_parentGroup; + + // The group corresponding to this property. + // It may never be created or written. + hid_t m_group; + + // if m_group gets created it will be given this name + std::string m_name; + + typedef std::map MadeProperties; + + PropertyHeaderPtrs m_propertyHeaders; + MadeProperties m_madeProperties; +}; + +typedef Alembic::Util::shared_ptr CpwDataPtr; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/CpwImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/CpwImpl.h new file mode 100644 index 0000000..a575446 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/CpwImpl.h @@ -0,0 +1,131 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_CpwImpl_h_ +#define _Alembic_AbcCoreHDF5_CpwImpl_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +class CpwImpl + : public AbcA::CompoundPropertyWriter + , public Alembic::Util::enable_shared_from_this +{ +public: + + // "top" compound creation called by the object + CpwImpl( AbcA::ObjectWriterPtr iParent, + CpwDataPtr iData, + const AbcA::MetaData & iMeta ); + + // child compound creation + CpwImpl( AbcA::CompoundPropertyWriterPtr iParent, + hid_t iParentGroup, + const std::string & iName, + const AbcA::MetaData & iMeta ); + + virtual ~CpwImpl(); + + //-************************************************************************* + // FROM BasePropertyWriter ABSTRACT + //-************************************************************************* + + virtual const AbcA::PropertyHeader & getHeader() const; + + virtual AbcA::ObjectWriterPtr getObject(); + + virtual AbcA::CompoundPropertyWriterPtr getParent(); + + virtual AbcA::CompoundPropertyWriterPtr asCompoundPtr(); + + //-************************************************************************* + // FROM CompoundPropertyWriter ABSTRACT + //-************************************************************************* + + virtual size_t getNumProperties(); + + virtual const AbcA::PropertyHeader & getPropertyHeader( size_t i ); + + virtual const AbcA::PropertyHeader * + getPropertyHeader( const std::string &iName ); + + virtual AbcA::BasePropertyWriterPtr + getProperty( const std::string & iName ); + + virtual AbcA::ScalarPropertyWriterPtr + createScalarProperty( const std::string & iName, + const AbcA::MetaData & iMetaData, + const AbcA::DataType & iDataType, + uint32_t iTimeSamplingIndex ); + + virtual AbcA::ArrayPropertyWriterPtr + createArrayProperty( const std::string & iName, + const AbcA::MetaData & iMetaData, + const AbcA::DataType & iDataType, + uint32_t iTimeSamplingIndex ); + + virtual AbcA::CompoundPropertyWriterPtr + createCompoundProperty( const std::string & iName, + const AbcA::MetaData & iMetaData ); + +private: + + // The object we belong to. + AbcA::ObjectWriterPtr m_object; + + // The parent compound property writer. + AbcA::CompoundPropertyWriterPtr m_parent; + + // The header which defines this property. + AbcA::PropertyHeader m_header; + + // child data, this is owned by the object for "top" compounds + CpwDataPtr m_data; +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/DataTypeRegistry.h b/libs/alembic/include/Alembic/AbcCoreHDF5/DataTypeRegistry.h new file mode 100644 index 0000000..5d52a77 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/DataTypeRegistry.h @@ -0,0 +1,59 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2011, +// 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_AbcCoreHDF5_DataTypeRegistry_h_ +#define _Alembic_AbcCoreHDF5_DataTypeRegistry_h_ + +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +// You should never need to call these directly, use the tuple below. +// Still, they're kinda handy. +hid_t GetNativeH5T( const AbcA::DataType &adt, bool &oCleanUp ); +hid_t GetFileH5T( const AbcA::DataType &adt, bool &oCleanUp ); + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/Foundation.h b/libs/alembic/include/Alembic/AbcCoreHDF5/Foundation.h new file mode 100644 index 0000000..ef045e0 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/Foundation.h @@ -0,0 +1,114 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_Foundation_h_ +#define _Alembic_AbcCoreHDF5_Foundation_h_ + +#include + +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include + + +#define ALEMBIC_HDF5_FILE_VERSION -8 + +//-***************************************************************************** + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +namespace AbcA = ::Alembic::AbcCoreAbstract; + +using namespace ::Alembic::Util; +using AbcA::index_t; +using AbcA::chrono_t; + +//-***************************************************************************** +typedef Alembic::Util::weak_ptr WeakOwPtr; +typedef Alembic::Util::weak_ptr WeakBpwPtr; + +typedef Alembic::Util::weak_ptr WeakOrPtr; +typedef Alembic::Util::weak_ptr WeakBprPtr; + +//-***************************************************************************** +typedef Alembic::Util::shared_ptr PropertyHeaderPtr; +typedef std::vector PropertyHeaderPtrs; + +typedef Alembic::Util::shared_ptr ObjectHeaderPtr; + +//-***************************************************************************** +inline std::string getSampleName( const std::string &iName, + index_t iSampleIndex ) +{ + if ( iSampleIndex == 0 ) + { + return iName + ".smp0"; + } + else + { + std::ostringstream strm; + strm.width(4); + strm.fill('0'); + strm << iSampleIndex; + return strm.str(); + } +} + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/HDF5Hierarchy.h b/libs/alembic/include/Alembic/AbcCoreHDF5/HDF5Hierarchy.h new file mode 100644 index 0000000..00c29fa --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/HDF5Hierarchy.h @@ -0,0 +1,237 @@ +//-***************************************************************************** +// +// Copyright (c) 2012, +// 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_AbcCoreHDF5_HDF5Hierarchy_h_ +#define _Alembic_AbcCoreHDF5_HDF5Hierarchy_h_ + +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +class HDF5Hierarchy; + +//-***************************************************************************** +class H5Node +{ +public: + H5Node() + : m_object( -1 ), m_ref( 0 ), m_H5HPtr( NULL ) {} + H5Node( hid_t iObject, hobj_ref_t iRef, HDF5Hierarchy* iH5HPtr ) + : m_object( iObject ), m_ref( iRef ), m_H5HPtr( iH5HPtr ) {} + + hid_t getObject() const { return m_object; } + void setObject( hid_t iObject ) { m_object = iObject; } + + hobj_ref_t getRef() const { return m_ref; } + HDF5Hierarchy* getH5HPtr() const { return m_H5HPtr; } + + bool isValidObject() const { return m_object >= 0; } + +private: + hid_t m_object; + hobj_ref_t m_ref; + HDF5Hierarchy* m_H5HPtr; +}; + +//-***************************************************************************** +class HDF5Hierarchy +{ +public: + HDF5Hierarchy() {} + ~HDF5Hierarchy() { clear(); } + + H5Node createNode( hid_t iId ); + + void build( hid_t iFile ); + void clear(); + bool isEnabled() { return m_enabled; } + void setEnabled( bool iEnabled ) { m_enabled = iEnabled; } + + hobj_ref_t getChildRef( hobj_ref_t iParentRef, const std::string &iName ); + bool childExists( hobj_ref_t iParentRef, const std::string &iName ); + bool attrExists( hobj_ref_t iParentRef, const std::string &iName ); + + void readMetaDataString( hobj_ref_t iParentRef, + const std::string &iMetaDataName, + std::string &oMetaDataString ); + + void readMaskInfo( hobj_ref_t iParentRef, + const std::string &iPropName, + size_t& oNumFields, + void *oData ); + + template + void visitAllChildObjects( H5Node iParent, + const std::string &iName, + T &iVisitor ) + { + hobj_ref_t objectRef = getChildRef( iParent.getRef(), iName ); + ChildInfoArray& children = m_objectMap[objectRef].m_children; + + for( ChildInfoArray::iterator it = children.begin(); + it != children.end(); ++it ) + { + iVisitor( it->m_name ); + } + } + + template + void visitAllAttributes( hobj_ref_t iParentRef, + const std::string &iName, + T& iVisitor ) + { + hobj_ref_t objectRef = getChildRef( iParentRef, iName ); + AttrInfoArray& attrs = m_objectMap[objectRef].m_attrs; + + for( AttrInfoArray::iterator it = attrs.begin(); + it != attrs.end(); ++it ) + { + std::string attrName( it->m_name ); + size_t attrNameLen = attrName.size(); + if ( attrNameLen < 6 ) + { + return; + } + + // Last 5 characters. + std::string suffix( attrName, attrNameLen-5 ); + if ( suffix == ".info" ) + { + std::string propertyName( attrName, 0, attrNameLen-5 ); + iVisitor( propertyName ); + } + } + } + + void makeCompactObjectHierarchy( + std::vector &oObjectRefs, + std::vector &oChildrenSizes, + std::vector &oChildrenNames, + std::vector &oChildrenRefs, + std::vector &oAttrSizes, + std::vector &oAttrNames, + std::vector &oHasMask, + std::vector &oMaskBits, + std::vector &oHasMeta, + std::vector &oMetaStrs ); + + void extractFromCompactObjectHierarchy( + hid_t iFile, + std::vector &iObjectRefs, + std::vector &iChildrenSizes, + std::vector &iChildrenNames, + std::vector &iChildrenRefs, + std::vector &iAttrSizes, + std::vector &iAttrNames, + std::vector &iHasMask, + std::vector &iMaskBits, + std::vector &iHasMeta, + std::vector &iMetaStrs ); + +private: + void addObject( hid_t iParent, const char *iName ); + void addAttr( hid_t iParent, const char *iName ); + + friend class ObjectVisitor; + + struct ChildInfo + { + ChildInfo( const string &iName, hobj_ref_t iRef = 0 ) + : m_name( iName ), m_ref( iRef ) {} + + string m_name; + hobj_ref_t m_ref; + + friend inline bool operator<( const ChildInfo &x, const ChildInfo &y ) + { + return x.m_name < y.m_name; + } + }; + + struct MaskInfo + { + size_t m_numFields; + uint32_t m_data[5]; + }; + + struct AttrInfo + { + AttrInfo( const string &iName ) : m_name( iName ), m_mask( NULL ) {} + + string m_name; + string m_meta; + MaskInfo* m_mask; + + void clear() + { + if ( m_mask ) + { + delete m_mask; + m_mask = NULL; + } + } + + friend inline bool operator<( const AttrInfo &x, const AttrInfo &y ) + { + return x.m_name < y.m_name; + } + }; + + typedef std::vector ChildInfoArray; + typedef std::vector AttrInfoArray; + + struct ObjectInfo + { + ChildInfoArray m_children; + AttrInfoArray m_attrs; + }; + + typedef std::map ObjectMap; + + ObjectMap m_objectMap; + bool m_enabled; +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/HDF5HierarchyReader.h b/libs/alembic/include/Alembic/AbcCoreHDF5/HDF5HierarchyReader.h new file mode 100644 index 0000000..281000d --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/HDF5HierarchyReader.h @@ -0,0 +1,68 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_HDF5HierarchyReader_h_ +#define _Alembic_AbcCoreHDF5_HDF5HierarchyReader_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +class HDF5HierarchyReader +{ +public: + HDF5HierarchyReader( hid_t iFile, + HDF5Hierarchy& iH5H, + const bool iCacheHierarchy ); + +private: + void readHierarchy( hid_t iFile ); + + HDF5Hierarchy& m_H5H; +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/HDF5HierarchyWriter.h b/libs/alembic/include/Alembic/AbcCoreHDF5/HDF5HierarchyWriter.h new file mode 100644 index 0000000..8fb47f5 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/HDF5HierarchyWriter.h @@ -0,0 +1,66 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_HDF5HierarchyWriter_h_ +#define _Alembic_AbcCoreHDF5_HDF5HierarchyWriter_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +class HDF5HierarchyWriter +{ +public: + HDF5HierarchyWriter( hid_t iFile, HDF5Hierarchy& iH5H ); + +private: + void writeHierarchy( hid_t iFile ); + + HDF5Hierarchy& m_H5H; +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/HDF5Util.h b/libs/alembic/include/Alembic/AbcCoreHDF5/HDF5Util.h new file mode 100644 index 0000000..7ddc60c --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/HDF5Util.h @@ -0,0 +1,131 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_HDF5Util_h_ +#define _Alembic_AbcCoreHDF5_HDF5Util_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +typedef ::Alembic::Util::BaseDimensions HDimensions; + +//-***************************************************************************** +struct AttrCloser +{ + AttrCloser( hid_t id ) : m_id( id ) {} + ~AttrCloser() { if ( m_id >= 0 ) H5Aclose( m_id ); } + hid_t m_id; +}; + +//-***************************************************************************** +struct DspaceCloser +{ + DspaceCloser( hid_t id ) : m_id( id ) {} + ~DspaceCloser() { if ( m_id >= 0 ) H5Sclose( m_id ); } + hid_t m_id; +}; + +//-***************************************************************************** +struct DsetCloser +{ + DsetCloser( hid_t id ) : m_id( id ) {} + ~DsetCloser() { if (m_id >= 0 ) H5Dclose( m_id ); } + hid_t m_id; +}; + + +//-***************************************************************************** +struct GroupCloser +{ + GroupCloser( hid_t id ) : m_id( id ) {} + ~GroupCloser() { if ( m_id >= 0 ) H5Gclose( m_id ); } + hid_t m_id; +}; + +//-***************************************************************************** +struct DtypeCloser +{ + DtypeCloser( hid_t id ) : m_id( id ) {} + ~DtypeCloser() { if ( m_id >= 0 ) H5Tclose( m_id ); } + hid_t m_id; +}; + +//-***************************************************************************** +struct PlistCloser +{ + PlistCloser( hid_t id ) : m_id( id ) {} + ~PlistCloser() { if ( m_id >= 0 ) H5Pclose( m_id ); } + hid_t m_id; +}; + +//-***************************************************************************** +hid_t CreationOrderPlist(); +hid_t DsetGzipCreatePlist( const Dimensions &dims, int level ); + +//-***************************************************************************** +bool EquivalentDatatypes( hid_t idA, hid_t idB ); + +//-***************************************************************************** +H5Node OpenGroup( H5Node& iParent, const std::string& iName ); + +//-***************************************************************************** +void CloseObject (H5Node& iNode ); + +//-***************************************************************************** +bool GroupExists( H5Node& iParent, const std::string &iName ); + +//-***************************************************************************** +bool ObjectExists( H5Node& iParent, const std::string &iName ); + +//-***************************************************************************** +bool AttrExists( H5Node& iParent, const std::string &iName ); + +//-***************************************************************************** +bool DatasetExists( H5Node& iParent, const std::string &iName ); + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/OrData.h b/libs/alembic/include/Alembic/AbcCoreHDF5/OrData.h new file mode 100644 index 0000000..1b14c41 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/OrData.h @@ -0,0 +1,114 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_OrData_h_ +#define _Alembic_AbcCoreHDF5_OrData_h_ + +#include +#include + + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +class CprData; + +// data class owned by OrImpl, or ArImpl if it is a "top" object. +// it owns and makes child objects as well as the group hid_t +// when necessary +class OrData : public Alembic::Util::enable_shared_from_this +{ +public: + OrData( ObjectHeaderPtr iHeader, + H5Node & iParentGroup, + int32_t iArchiveVersion ); + + ~OrData(); + + AbcA::CompoundPropertyReaderPtr + getProperties( AbcA::ObjectReaderPtr iParent ); + + size_t getNumChildren(); + + const AbcA::ObjectHeader & + getChildHeader( AbcA::ObjectReaderPtr iParent, size_t i ); + + const AbcA::ObjectHeader * + getChildHeader( AbcA::ObjectReaderPtr, const std::string &iName ); + + AbcA::ObjectReaderPtr + getChild( AbcA::ObjectReaderPtr iParent, const std::string &iName ); + + AbcA::ObjectReaderPtr + getChild( AbcA::ObjectReaderPtr iParent, size_t i ); + +private: + + struct Child + { + bool loadedMetaData; + ObjectHeaderPtr header; + WeakOrPtr made; + }; + + typedef std::map ChildrenMap; + typedef std::vector ChildrenVec; + + H5Node m_group; + H5Node m_oldGroup; + + Alembic::Util::mutex m_childObjectsMutex; + + // The children + ChildrenVec m_children; + ChildrenMap m_childrenMap; + + // Our "top" property. + Alembic::Util::weak_ptr< AbcA::CompoundPropertyReader > m_top; + Alembic::Util::shared_ptr < CprData > m_data; +}; + +typedef Alembic::Util::shared_ptr OrDataPtr; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/OrImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/OrImpl.h new file mode 100644 index 0000000..ca08ff9 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/OrImpl.h @@ -0,0 +1,108 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_OrImpl_h_ +#define _Alembic_AbcCoreHDF5_OrImpl_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +class OrImpl + : public AbcA::ObjectReader + , public Alembic::Util::enable_shared_from_this +{ + +public: + + OrImpl( AbcA::ArchiveReaderPtr iArchive, + OrDataPtr iData, + ObjectHeaderPtr iHeader ); + + OrImpl( AbcA::ObjectReaderPtr iParent, + H5Node & iParentGroup, + ObjectHeaderPtr iHeader ); + + virtual ~OrImpl(); + + //-************************************************************************* + // ABSTRACT + //-************************************************************************* + virtual const AbcA::ObjectHeader & getHeader() const; + + virtual AbcA::ArchiveReaderPtr getArchive(); + + virtual AbcA::ObjectReaderPtr getParent(); + + virtual AbcA::CompoundPropertyReaderPtr getProperties(); + + virtual size_t getNumChildren(); + + virtual const AbcA::ObjectHeader & getChildHeader( size_t i ); + + virtual const AbcA::ObjectHeader * getChildHeader + ( const std::string &iName ); + + virtual AbcA::ObjectReaderPtr getChild( const std::string &iName ); + + virtual AbcA::ObjectReaderPtr getChild( size_t i ); + + virtual AbcA::ObjectReaderPtr asObjectPtr(); + +private: + // The parent object + AbcA::ObjectReaderPtr m_parent; + + AbcA::ArchiveReaderPtr m_archive; + + OrDataPtr m_data; + + ObjectHeaderPtr m_header; + +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/OwData.h b/libs/alembic/include/Alembic/AbcCoreHDF5/OwData.h new file mode 100644 index 0000000..24776c4 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/OwData.h @@ -0,0 +1,106 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_OwData_h_ +#define _Alembic_AbcCoreHDF5_OwData_h_ + +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +// Forwards +class CpwData; + +// data class owned by OwImpl, or AImpl if it is a "top" object. +// it owns and makes child properties +class OwData : public Alembic::Util::enable_shared_from_this +{ +public: + OwData( hid_t iParentGroup, + const std::string &iName, + const AbcA::MetaData &iMetaData ); + + ~OwData(); + + AbcA::CompoundPropertyWriterPtr getProperties( + AbcA::ObjectWriterPtr iParent ); + + size_t getNumChildren(); + + const AbcA::ObjectHeader & getChildHeader( size_t i ); + + const AbcA::ObjectHeader * + getChildHeader( const std::string &iName ); + + AbcA::ObjectWriterPtr getChild( const std::string &iName ); + + AbcA::ObjectWriterPtr createChild( AbcA::ObjectWriterPtr iParent, + const std::string & iFullName, + const AbcA::ObjectHeader &iHeader ); + + hid_t getGroup(); + +private: + + // The group corresponding to the object + hid_t m_group; + + typedef std::vector ChildHeaders; + typedef std::map MadeChildren; + + // The children + ChildHeaders m_childHeaders; + MadeChildren m_madeChildren; + + Alembic::Util::weak_ptr< AbcA::CompoundPropertyWriter > m_top; + + // Our "top" property + Alembic::Util::shared_ptr < CpwData > m_data; +}; + +typedef Alembic::Util::shared_ptr OwDataPtr; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/OwImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/OwImpl.h new file mode 100644 index 0000000..e29c11b --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/OwImpl.h @@ -0,0 +1,113 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_OwImpl_h_ +#define _Alembic_AbcCoreHDF5_OwImpl_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +// These are _always_ created as shared ptrs. +class OwImpl + : public AbcA::ObjectWriter + , public Alembic::Util::enable_shared_from_this +{ +public: + + OwImpl( AbcA::ArchiveWriterPtr iArchive, + OwDataPtr iData, + const AbcA::MetaData & iMetaData ); + + OwImpl( AbcA::ObjectWriterPtr iParent, + hid_t iParentGroup, + ObjectHeaderPtr iHeader ); + + virtual ~OwImpl(); + + //-************************************************************************* + // FROM ABSTRACT + //-************************************************************************* + + virtual const AbcA::ObjectHeader & getHeader() const; + + virtual AbcA::ArchiveWriterPtr getArchive(); + + virtual AbcA::ObjectWriterPtr getParent(); + + virtual AbcA::CompoundPropertyWriterPtr getProperties(); + + virtual size_t getNumChildren(); + + virtual const AbcA::ObjectHeader & getChildHeader( size_t i ); + + virtual const AbcA::ObjectHeader * + getChildHeader( const std::string &iName ); + + virtual AbcA::ObjectWriterPtr getChild( const std::string &iName ); + + virtual AbcA::ObjectWriterPtr + createChild( const AbcA::ObjectHeader &iHeader ); + + virtual AbcA::ObjectWriterPtr asObjectPtr(); + +private: + // The parent object, NULL if it is the "top" object + AbcA::ObjectWriterPtr m_parent; + + // The archive ptr. + AbcA::ArchiveWriterPtr m_archive; + + // The header which defines this property. + ObjectHeaderPtr m_header; + + // child object data, this is owned by the archive for "top" objects + OwDataPtr m_data; + +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/ReadUtil.h b/libs/alembic/include/Alembic/AbcCoreHDF5/ReadUtil.h new file mode 100644 index 0000000..568d990 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/ReadUtil.h @@ -0,0 +1,146 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_ReadUtil_h_ +#define _Alembic_AbcCoreHDF5_ReadUtil_h_ + +#include +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +//-***************************************************************************** +// UTILITY THING +//-***************************************************************************** + +//-***************************************************************************** +void +ReadReferences ( hid_t iParent, + const std::string& iRefName, + std::vector& oRefs ); + +//-***************************************************************************** +bool +ReadKey( hid_t iHashDset, + const std::string &iAttrName, + AbcA::ArraySample::Key &oKey ); + +//-***************************************************************************** +bool +ReadMetaData( H5Node& iGroup, + const std::string &iMetaDataName, + AbcA::MetaData &oMetaData ); + +//-***************************************************************************** +void +ReadPropertyHeader( H5Node& iParent, + const std::string & iPropName, + AbcA::PropertyHeader & oHeader, + bool & oIsScalarLike, + uint32_t & oNumSamples, + uint32_t & oFirstChangedIndex, + uint32_t & oLastChangedIndex, + uint32_t & oTimeSamplingIndex ); + +//-***************************************************************************** +void +ReadScalar( hid_t iGroup, + const std::string &iScalarName, + hid_t iFileType, + hid_t iNativeType, + void *oData ); + +//-***************************************************************************** +void +ReadSmallArray( hid_t iGroup, + const std::string &iAttrName, + hid_t iFileType, + hid_t iNativeType, + size_t iMaxElems, + size_t &oReadElems, + void *oData ); + +//-***************************************************************************** +void +ReadDimensions( hid_t iParent, + const std::string &iName, + Dimensions &oDims ); + +//-***************************************************************************** +void +ReadDataSetDimensions( hid_t iParent, + const std::string &iName, + hsize_t iExtent, + Dimensions &oDims ); + +//-***************************************************************************** +AbcA::ArraySamplePtr +ReadArray( AbcA::ReadArraySampleCachePtr iCache, + hid_t iGroup, + const std::string &iArrayName, + const AbcA::DataType &iDataType, + hid_t iFileType, + hid_t iNativeType ); + +//-***************************************************************************** +void +ReadArray( void * iIntoLocation, + hid_t iParent, + const std::string &iName, + const AbcA::DataType &iDataType, + hid_t iType ); + +//-***************************************************************************** +// Fills in oTimeSamples with the different TimeSampling that the archive uses +// Intrinsically all archives have the first TimeSampling for uniform time +// sampling with a start time of 0 and time per cycle of 1 +// (aka identity sampling) +void +ReadTimeSamples( hid_t iParent, + std::vector < AbcA::TimeSamplingPtr > & oTimeSamples ); + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/SimplePrImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/SimplePrImpl.h new file mode 100644 index 0000000..422d4c4 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/SimplePrImpl.h @@ -0,0 +1,457 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_SimplePrImpl_h_ +#define _Alembic_AbcCoreHDF5_SimplePrImpl_h_ + +#include + +#include +#include +#include +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +// This templated base class implements the common logic behind both the +// scalar and array property readers. The only way these two readers differ +// is the type of sample they read and the way those samples are returned +// and managed. Scalar samples are simply copied by value, compared by value, +// and stored by value. Array samples are returned from an optional sample +// cache. +// +// There is a bit of template hoosafudgery going on here, which is always +// troublesome in foundation libraries, because it is hard to read and +// hard to decipher errors. I have kept it to a reasonable minimum, but the +// value of a single code instance is high enough that it's worth a bit of +// obfuscation. +// +// The IMPL class is assumed to have the following functions: +// void readSample( H5G &iGroup, +// const std::string &iSampleName, +// index_t iSampleIndex, +// SAMPLE oSample ); +// +//-***************************************************************************** +template +class SimplePrImpl : public ABSTRACT +{ +protected: + SimplePrImpl( AbcA::CompoundPropertyReaderPtr iParent, + H5Node & iParentGroup, + PropertyHeaderPtr iHeader, + uint32_t iNumSamples, + uint32_t iFirstChangedIndex, + uint32_t iLastChangedIndex ); + +public: + //-************************************************************************* + // ABSTRACT API + //-************************************************************************* + virtual ~SimplePrImpl(); + + virtual const AbcA::PropertyHeader &getHeader() const; + + virtual AbcA::ObjectReaderPtr getObject(); + + virtual AbcA::CompoundPropertyReaderPtr getParent(); + + virtual size_t getNumSamples(); + + virtual bool isConstant(); + + virtual void getSample( index_t iSampleIndex, + SAMPLE oSample ); + + virtual std::pair getFloorIndex( chrono_t iTime ); + + virtual std::pair getCeilIndex( chrono_t iTime ); + + virtual std::pair getNearIndex( chrono_t iTime ); + + virtual bool getKey( index_t iSampleIndex, AbcA::ArraySampleKey & oKey ); + +protected: + + index_t verifySampleIndex( index_t iSampleIndex ); + + void checkSamplesIGroup(); + + // Parent compound property writer. It must exist. + AbcA::CompoundPropertyReaderPtr m_parent; + + // The HDF5 Group associated with the parent property reader. + H5Node m_parentGroup; + + // We don't hold a pointer to the object, but instead + // get it from the compound property reader. + + // The Header + PropertyHeaderPtr m_header; + + // Data Types. + hid_t m_fileDataType; + bool m_cleanFileDataType; + hid_t m_nativeDataType; + bool m_cleanNativeDataType; + + // The number of samples that were written. This may be greater + // than the number of samples that were stored, because we don't + // repeat head or tail samples that repeat + uint32_t m_numSamples; + + // The first sample index that is different from sample 0 + uint32_t m_firstChangedIndex; + + // The last sample index that needed to be written out, if the last sample + // repeats m_numSamples will be greater than this. + uint32_t m_lastChangedIndex; + + // The simple properties only store samples after the first + // sample in a sub group. Therefore, there may not actually be + // a group associated with this property. + H5Node m_samplesIGroup; + + // used to prevent race condition when setting m_samplesIGroup + Alembic::Util::mutex m_samplesIGroupMutex; +}; + +//-***************************************************************************** +//-***************************************************************************** +//-***************************************************************************** +// IMPLEMENTATION +//-***************************************************************************** +//-***************************************************************************** +//-***************************************************************************** + +//-***************************************************************************** +template +SimplePrImpl::SimplePrImpl +( + AbcA::CompoundPropertyReaderPtr iParent, + H5Node & iParentGroup, + PropertyHeaderPtr iHeader, + uint32_t iNumSamples, + uint32_t iFirstChangedIndex, + uint32_t iLastChangedIndex +) + : m_parent( iParent ) + , m_parentGroup( iParentGroup ) + , m_header( iHeader ) + , m_fileDataType( -1 ) + , m_cleanFileDataType( false ) + , m_nativeDataType( -1 ) + , m_cleanNativeDataType( false ) + , m_numSamples( iNumSamples ) + , m_firstChangedIndex( iFirstChangedIndex ) + , m_lastChangedIndex( iLastChangedIndex ) +{ + // Validate all inputs. + ABCA_ASSERT( m_parent, "Invalid parent" ); + ABCA_ASSERT( m_parentGroup.isValidObject(), "Invalid parent group" ); + ABCA_ASSERT( m_header, "Invalid header" ); + ABCA_ASSERT( m_header->getPropertyType() != AbcA::kCompoundProperty, + "Tried to create a simple property with a compound header" ); + + // Get data types + PlainOldDataType POD = m_header->getDataType().getPod(); + if ( POD != kStringPOD && POD != kWstringPOD ) + { + m_fileDataType = GetFileH5T( m_header->getDataType(), + m_cleanFileDataType ); + m_nativeDataType = GetNativeH5T( m_header->getDataType(), + m_cleanNativeDataType ); + } + + // Get our name. + const std::string &myName = m_header->getName(); + + // Validate the first and last changed index + ABCA_ASSERT( m_firstChangedIndex <= m_numSamples && + m_lastChangedIndex <= m_numSamples && + m_firstChangedIndex <= m_lastChangedIndex, + "Corrupt sampling information for property: " << myName + << " first change index: " << m_firstChangedIndex + << " last change index: " << m_lastChangedIndex + << " total number of samples: " << m_numSamples ); +} + +//-***************************************************************************** +// Destructor is at the end, so that this file has a logical ordering that +// matches the order of operations (create, get samples, destroy) +//-***************************************************************************** + +//-***************************************************************************** +template +const AbcA::PropertyHeader & +SimplePrImpl::getHeader() const +{ + ABCA_ASSERT( m_header, "Invalid header" ); + return *m_header; +} + +//-***************************************************************************** +template +AbcA::ObjectReaderPtr +SimplePrImpl::getObject() +{ + ABCA_ASSERT( m_parent, "Invalid parent" ); + return m_parent->getObject(); +} + +//-***************************************************************************** +template +AbcA::CompoundPropertyReaderPtr +SimplePrImpl::getParent() +{ + ABCA_ASSERT( m_parent, "Invalid parent" ); + return m_parent; +} + +//-***************************************************************************** +template +size_t SimplePrImpl::getNumSamples() +{ + return ( size_t )m_numSamples; +} + +//-***************************************************************************** +template +bool SimplePrImpl::isConstant() +{ + // No first change means no changes at all + return ( m_firstChangedIndex == 0 ); +} + +//-***************************************************************************** +template +index_t SimplePrImpl::verifySampleIndex( index_t iIndex ) +{ + // Verify sample index + ABCA_ASSERT( iIndex >= 0 && + iIndex < m_numSamples, + "Invalid sample index: " << iIndex + << ", should be between 0 and " << m_numSamples-1 ); + + // greater than the last index that had a change? read it from there + if ( iIndex > m_lastChangedIndex ) + { + iIndex = m_lastChangedIndex; + } + // less than the first change? map to 0 + else if ( iIndex < m_firstChangedIndex ) + { + iIndex = 0; + } + + return iIndex; +} + +//-***************************************************************************** +template +void SimplePrImpl::checkSamplesIGroup() +{ + // Create the subsequent samples group. + if ( !m_samplesIGroup.isValidObject() ) + { + Alembic::Util::scoped_lock l( m_samplesIGroupMutex ); + + if ( m_samplesIGroup.isValidObject() ) + return; + + std::string samplesIName = m_header->getName() + ".smpi"; + ABCA_ASSERT( GroupExists( m_parentGroup, samplesIName ), + "Invalid property: " << m_header->getName() + << ", missing smpi" ); + + m_samplesIGroup = OpenGroup( m_parentGroup, + samplesIName.c_str() ); + ABCA_ASSERT( m_samplesIGroup.isValidObject(), + "Invalid property: " << m_header->getName() + << ", invalid smpi group" ); + } +} + +//-***************************************************************************** +template +std::pair +SimplePrImpl::getFloorIndex( chrono_t iTime ) +{ + return m_header->getTimeSampling()->getFloorIndex( iTime, m_numSamples ); +} + +//-***************************************************************************** +template +std::pair +SimplePrImpl::getCeilIndex( chrono_t iTime ) +{ + return m_header->getTimeSampling()->getCeilIndex( iTime, m_numSamples ); +} + +//-***************************************************************************** +template +std::pair +SimplePrImpl::getNearIndex( chrono_t iTime ) +{ + return m_header->getTimeSampling()->getNearIndex( iTime, m_numSamples ); +} + +//-***************************************************************************** +template +void +SimplePrImpl::getSample( index_t iSampleIndex, + SAMPLE oSample ) +{ + iSampleIndex = verifySampleIndex( iSampleIndex ); + + // Get our name. + const std::string &myName = m_header->getName(); + + if ( iSampleIndex == 0 ) + { + // Read the sample from the parent group. + // Sample 0 is always on the parent group, with + // our name + ".smp0" as the name of it. + std::string sample0Name = getSampleName( myName, 0 ); + if ( m_header->getPropertyType() == AbcA::kScalarProperty ) + { + ABCA_ASSERT( AttrExists( m_parentGroup, sample0Name.c_str() ), + "Invalid property in SimplePrImpl getSample: " + << myName << ", missing smp0" ); + } + else + { + ABCA_ASSERT( DatasetExists( m_parentGroup, sample0Name ), + "Invalid propertyin SimplePrImpl getSample: " + << myName << ", missing smp1" ); + } + + static_cast( this )->readSample( m_parentGroup.getObject(), + sample0Name, + iSampleIndex, + oSample ); + } + else + { + checkSamplesIGroup(); + + // Read the sample. + std::string sampleName = getSampleName( myName, iSampleIndex ); + static_cast( this )->readSample( m_samplesIGroup.getObject(), + sampleName, + iSampleIndex, + oSample ); + } +} + +//-***************************************************************************** +template +bool +SimplePrImpl::getKey( index_t iSampleIndex, + AbcA::ArraySampleKey & oKey ) +{ + iSampleIndex = verifySampleIndex( iSampleIndex ); + + // Get our name. + const std::string &myName = m_header->getName(); + + if ( iSampleIndex == 0 ) + { + // Read the sample from the parent group. + // Sample 0 is always on the parent group, with + // our name + ".smp0" as the name of it. + std::string sample0Name = getSampleName( myName, 0 ); + if ( m_header->getPropertyType() == AbcA::kScalarProperty ) + { + ABCA_ASSERT( AttrExists( m_parentGroup, sample0Name.c_str() ), + "Invalid property in SimplePrImpl getKey: " + << myName << ", missing smp0" ); + } + else + { + ABCA_ASSERT( DatasetExists( m_parentGroup, sample0Name ), + "Invalid property in SimplePrImpl getKey: " + << myName << ", missing smp1" ); + } + + return static_cast( this )->readKey( m_parentGroup.getObject(), + sample0Name, + oKey ); + } + else + { + checkSamplesIGroup(); + + // Read the sample. + std::string sampleName = getSampleName( myName, iSampleIndex ); + return static_cast( this )->readKey( m_samplesIGroup.getObject(), + sampleName, + oKey ); + } +} + +//-***************************************************************************** +template +SimplePrImpl::~SimplePrImpl() +{ + // Clean up our samples group, if necessary. + CloseObject( m_samplesIGroup ); + + if ( m_fileDataType >= 0 && m_cleanFileDataType ) + { + H5Tclose( m_fileDataType ); + m_fileDataType = -1; + } + + if ( m_nativeDataType >= 0 && m_cleanNativeDataType ) + { + H5Tclose( m_nativeDataType ); + m_nativeDataType = -1; + } +} + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/SimplePwImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/SimplePwImpl.h new file mode 100644 index 0000000..74381a4 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/SimplePwImpl.h @@ -0,0 +1,448 @@ +//-***************************************************************************** +// +// 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_AbcCoreHDF5_SimplePwImpl_h_ +#define _Alembic_AbcCoreHDF5_SimplePwImpl_h_ + +#include +#include +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +// This templated base class implements the common logic behind both the +// scalar and array property writers. The only way these two writers differ +// is the type of sample they write and the way those samples are stored +// and copied. Scalar samples are simply copied by value, compared by value, +// and stored by value. Array samples are assumed to be "big", and are +// first condensed into a "key" (using a checksum), which is compared +// to other "keys" of previously written samples. However, the primary logic +// of when to compare, when to copy, when to write, and how to manage time +// values is common across both classes, and represents the primary complexity. +// To minimize redundancy, errors, and code size, we create a common base class. +// +// It is assumed that the IMPL class will provide a mechanism for constructing +// a KEY from a SAMPLE. +// +// The IMPL class is assumed to have the following functions: +// KEY computeSampleKey( SAMPLE iSamp ) const; +// bool sameAsPreviousSample( SAMPLE iSamp, const KEY &iKey ) const; +// void copyPreviousSample( index_t iSampleIndex ); +// void writeSample( index_t iSampleIndex, SAMPLE iSamp, const KEY &iKey ); +// +//-***************************************************************************** +template +class SimplePwImpl : public ABSTRACT +{ +protected: + SimplePwImpl( AbcA::CompoundPropertyWriterPtr iParent, + hid_t iParentGroup, + const std::string & iName, + const AbcA::MetaData & iMetaData, + const AbcA::DataType & iDataType, + uint32_t iTimeSamplingIndex, + AbcA::PropertyType iPropType ); + +public: + virtual ~SimplePwImpl(); + + //-************************************************************************* + // FROM ABSTRACT + //-************************************************************************* + + virtual const AbcA::PropertyHeader & getHeader() const; + + virtual AbcA::ObjectWriterPtr getObject(); + + virtual AbcA::CompoundPropertyWriterPtr getParent(); + +private: + hid_t getSampleIGroup(); + +public: + // Scalar/Array API + virtual void setSample( SAMPLE iSamp ); + + virtual void setFromPreviousSample( ); + + virtual size_t getNumSamples(); + + virtual void setTimeSamplingIndex( uint32_t iIndex ); + +protected: + // The parent compound property writer. + AbcA::CompoundPropertyWriterPtr m_parent; + + // The parent group. We need to keep this around because we + // don't create our group until we need to. This is guaranteed to + // exist because our parent (or object) is guaranteed to exist. + hid_t m_parentGroup; + + // The header which defines this property. + PropertyHeaderPtr m_header; + + // The DataTypes for this property. + hid_t m_fileDataType; + bool m_cleanFileDataType; + hid_t m_nativeDataType; + bool m_cleanNativeDataType; + + // The group corresponding to this property. + // It may never be created or written. + hid_t m_sampleIGroup; + + // Index of the next sample to write + uint32_t m_nextSampleIndex; + + // Index representing the first sample that is different from sample 0 + uint32_t m_firstChangedIndex; + + // Index representing the last sample in which a change has occured + // There is no need to repeat samples if they are the same between this + // index and m_nextSampleIndex + uint32_t m_lastChangedIndex; + + // Index representing which TimeSampling from the ArchiveWriter to use. + uint32_t m_timeSamplingIndex; +}; + +//-***************************************************************************** +//-***************************************************************************** +//-***************************************************************************** +// IMPLEMENTATION +//-***************************************************************************** +//-***************************************************************************** +//-***************************************************************************** + +//-***************************************************************************** +template +SimplePwImpl::SimplePwImpl +( + AbcA::CompoundPropertyWriterPtr iParent, + hid_t iParentGroup, + const std::string & iName, + const AbcA::MetaData & iMetaData, + const AbcA::DataType & iDataType, + uint32_t iTimeSamplingIndex, + AbcA::PropertyType iPropType +) + : m_parent( iParent ) + , m_parentGroup( iParentGroup ) + , m_fileDataType( -1 ) + , m_cleanFileDataType( false ) + , m_nativeDataType( -1 ) + , m_cleanNativeDataType( false ) + , m_sampleIGroup( -1 ) + , m_nextSampleIndex( 0 ) + , m_firstChangedIndex( 0 ) + , m_lastChangedIndex( 0 ) + , m_timeSamplingIndex(iTimeSamplingIndex) +{ + // Check the validity of all inputs. + ABCA_ASSERT( m_parent, "Invalid parent" ); + + ABCA_ASSERT( iName != "" && iName.find('/') == std::string::npos, + "Invalid name" ); + + // will assert if TimeSamplingPtr not found + AbcA::TimeSamplingPtr ts = + m_parent->getObject()->getArchive()->getTimeSampling( + m_timeSamplingIndex ); + + m_header = PropertyHeaderPtr( new AbcA::PropertyHeader( iName, iPropType, + iMetaData, iDataType, ts ) ); + + ABCA_ASSERT( m_header, "Invalid property header" ); + ABCA_ASSERT( m_parentGroup >= 0, "Invalid parent group" ); + ABCA_ASSERT( m_header->getDataType().getExtent() > 0, + "Invalid DatatType extent"); + + // Get data types + PlainOldDataType POD = m_header->getDataType().getPod(); + if ( POD != kStringPOD && POD != kWstringPOD ) + { + m_fileDataType = GetFileH5T( m_header->getDataType(), + m_cleanFileDataType ); + m_nativeDataType = GetNativeH5T( m_header->getDataType(), + m_cleanNativeDataType ); + + ABCA_ASSERT( m_fileDataType >= 0, "Couldn't get file datatype" ); + ABCA_ASSERT( m_nativeDataType >= 0, "Couldn't get native datatype" ); + } +} + +//-***************************************************************************** +// Destructor is at the end, so that this file has a logical ordering that +// matches the order of operations (create, set samples, destroy) +//-***************************************************************************** + +//-***************************************************************************** +template +const AbcA::PropertyHeader & +SimplePwImpl::getHeader() const +{ + ABCA_ASSERT( m_header, "Invalid header" ); + return *m_header; +} + +//-***************************************************************************** +template +AbcA::ObjectWriterPtr +SimplePwImpl::getObject() +{ + ABCA_ASSERT( m_parent, "Invalid parent" ); + return m_parent->getObject(); +} + +//-***************************************************************************** +template +AbcA::CompoundPropertyWriterPtr +SimplePwImpl::getParent() +{ + ABCA_ASSERT( m_parent, "Invalid parent" ); + return m_parent; +} + +//-***************************************************************************** +template +hid_t SimplePwImpl::getSampleIGroup() +{ + if ( m_sampleIGroup >= 0 ) + { + return m_sampleIGroup; + } + + ABCA_ASSERT( m_parentGroup >= 0, "invalid parent group" ); + ABCA_ASSERT( m_nextSampleIndex > 0, + "can't create sampleI group before numSamples > 1" ); + + const std::string groupName = m_header->getName() + ".smpi"; + + hid_t copl = CreationOrderPlist(); + PlistCloser plistCloser( copl ); + + m_sampleIGroup = H5Gcreate2( m_parentGroup, + groupName.c_str(), + H5P_DEFAULT, + copl, + H5P_DEFAULT ); + ABCA_ASSERT( m_sampleIGroup >= 0, + "Could not create simple samples group named: " + << groupName ); + + return m_sampleIGroup; +} + +//-***************************************************************************** +template +void SimplePwImpl::setSample +( SAMPLE iSamp ) +{ + // Make sure we aren't writing more samples than we have times for + // This applies to acyclic sampling only + ABCA_ASSERT( + !m_header->getTimeSampling()->getTimeSamplingType().isAcyclic() || + m_header->getTimeSampling()->getNumStoredTimes() > + m_nextSampleIndex, + "Can not write more samples than we have times for when using " + "Acyclic sampling." ); + + // The Key helps us analyze the sample. + KEY key = static_cast(this)->computeSampleKey( iSamp ); + + // We need to write the sample + if ( m_nextSampleIndex == 0 || + !(static_cast(this)->sameAsPreviousSample( iSamp, key )) ) + { + const std::string &myName = m_header->getName(); + + // we only need to repeat samples if this is not the first change + if (m_firstChangedIndex != 0) + { + // copy the samples from after the last change to the latest index + for ( index_t smpI = m_lastChangedIndex + 1; + smpI < m_nextSampleIndex; ++smpI ) + { + assert( smpI > 0 ); + static_cast(this)->copyPreviousSample( + getSampleIGroup(), + getSampleName( myName, smpI ), + smpI ); + } + } + else + { + m_firstChangedIndex = m_nextSampleIndex; + } + + // Write this sample, which will update its internal + // cache of what the previously written sample was. + static_cast(this)->writeSample( + m_nextSampleIndex == 0 ? m_parentGroup : getSampleIGroup(), + getSampleName( myName, m_nextSampleIndex ), + m_nextSampleIndex, iSamp, key ); + + // this index is now the last change + m_lastChangedIndex = m_nextSampleIndex; + } + + + m_nextSampleIndex ++; +} + +//-***************************************************************************** +template +void SimplePwImpl::setFromPreviousSample +() +{ + + // Make sure we aren't writing more samples than we have times for + // This applies to acyclic sampling only + ABCA_ASSERT( + !m_header->getTimeSampling()->getTimeSamplingType().isAcyclic() || + m_header->getTimeSampling()->getNumStoredTimes() > + m_nextSampleIndex, + "Can not set more samples than we have times for when using " + "Acyclic sampling." ); + + ABCA_ASSERT( m_nextSampleIndex > 0, + "Can't set from previous sample before any samples have been written" ); + + m_nextSampleIndex ++; +} + +//-***************************************************************************** +template +size_t SimplePwImpl::getNumSamples() +{ + return ( size_t )m_nextSampleIndex; +} + +template +void SimplePwImpl::setTimeSamplingIndex +( uint32_t iIndex ) +{ + // will assert if TimeSamplingPtr not found + AbcA::TimeSamplingPtr ts = + m_parent->getObject()->getArchive()->getTimeSampling( + iIndex ); + + ABCA_ASSERT( !ts->getTimeSamplingType().isAcyclic() || + ts->getNumStoredTimes() >= m_nextSampleIndex, + "Already have written more samples than we have times for when using " + "Acyclic sampling." ); + + m_header->setTimeSampling(ts); + m_timeSamplingIndex = iIndex; +} + +//-***************************************************************************** +template +SimplePwImpl::~SimplePwImpl() +{ + // Wrap the whole thing in a try block, so as to prevent + // exceptions from being thrown out of a destructor. + try + { + if ( m_fileDataType >= 0 && m_cleanFileDataType ) + { H5Tclose( m_fileDataType ); } + if ( m_nativeDataType >= 0 && m_cleanNativeDataType ) + { H5Tclose( m_nativeDataType ); } + + // Check validity of the group. + ABCA_ASSERT( m_parentGroup >= 0, "Invalid parent group" ); + + // Close the sampleIGroup if it was open + if ( m_sampleIGroup >= 0 ) + { + // this should never have been openened, if a change was never + // detected. + ABCA_ASSERT( m_firstChangedIndex > 0, "Corrupt SimplePwImpl" ); + H5Gclose( m_sampleIGroup ); + m_sampleIGroup = -1; + } + + + AbcA::ArchiveWriterPtr archive = m_parent->getObject()->getArchive(); + + index_t maxSamples = archive->getMaxNumSamplesForTimeSamplingIndex( + m_timeSamplingIndex ); + + uint32_t numSamples = m_nextSampleIndex; + + // a constant property, we wrote the same sample over and over + if ( m_lastChangedIndex == 0 && m_nextSampleIndex > 0 ) + { + numSamples = 1; + } + + if ( maxSamples < numSamples ) + { + archive->setMaxNumSamplesForTimeSamplingIndex( m_timeSamplingIndex, + numSamples ); + } + + } + catch ( std::exception & exc ) + { + std::cerr << "AbcCoreHDF5::SimplePwImpl::" + << "~SimplePwImpl(): EXCEPTION: " + << exc.what() << std::endl; + } + catch ( ... ) + { + std::cerr << "AbcCoreHDF5::SimplePwImpl::~SimplePwImpl(): " + << "UNKNOWN EXCEPTION: " << std::endl; + } + + m_parentGroup = -1; + m_sampleIGroup = -1; + m_fileDataType = -1; + m_nativeDataType = -1; +} + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/SprImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/SprImpl.h new file mode 100644 index 0000000..0bca6b7 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/SprImpl.h @@ -0,0 +1,105 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_SprImpl_h_ +#define _Alembic_AbcCoreHDF5_SprImpl_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +// The Scalar Property Reader fills up bytes corresponding to memory for +// a single scalar sample at a particular index. +class SprImpl + : public SimplePrImpl + , public Alembic::Util::enable_shared_from_this +{ +public: + SprImpl( AbcA::CompoundPropertyReaderPtr iParent, + H5Node & iParentGroup, + PropertyHeaderPtr iHeader, + uint32_t iNumSamples, + uint32_t iFirstChangedIndex, + uint32_t iLastChangedIndex ) + : SimplePrImpl + ( iParent, iParentGroup, iHeader, iNumSamples, iFirstChangedIndex, + iLastChangedIndex ) + { + if ( m_header->getPropertyType() != AbcA::kScalarProperty ) + { + ABCA_THROW( "Attempted to create a ScalarPropertyReader from a " + "non-scalar property type" ); + } + } + + virtual AbcA::ScalarPropertyReaderPtr asScalarPtr(); + +protected: + friend class SimplePrImpl; + + // This function is called by SimplePrImpl to provide the actual + // property reading. + // It will dispatch its work out to different read utils, based + // on the type of the property. + void readSample( hid_t iGroup, + const std::string &iSampleName, + index_t iSampleIndex, + void *oSampleBytes ); + + //-************************************************************************* + // This function is called by SimplePrImpl, scalar props do not have keys. + bool readKey( hid_t iGroup, + const std::string &iSampleName, + AbcA::ArraySampleKey & oSamplePtr ) { return false; } + +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/SpwImpl.h b/libs/alembic/include/Alembic/AbcCoreHDF5/SpwImpl.h new file mode 100644 index 0000000..2cace9e --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/SpwImpl.h @@ -0,0 +1,123 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_SpwImpl_h_ +#define _Alembic_AbcCoreHDF5_SpwImpl_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +// This type is a no-op. +// It is here to support the template interface which, in order to generalize +// across arrays & scalars, needs a "key" type to compare array samples with. +class ScalarSampleKey +{ +public: + ScalarSampleKey(){} +}; + +//-***************************************************************************** +// Scalar Property Writer. +class SpwImpl + : public SimplePwImpl + , public Alembic::Util::enable_shared_from_this +{ +protected: + friend class CpwData; + + //-************************************************************************* + SpwImpl( AbcA::CompoundPropertyWriterPtr iParent, + hid_t iParentGroup, + const std::string & iName, + const AbcA::MetaData & iMetaData, + const AbcA::DataType & iDataType, + uint32_t iTimeSamplingIndex ); + + AbcA::ScalarPropertyWriterPtr asScalarPtr(); + +public: + virtual ~SpwImpl(); + + //-************************************************************************* + // No-op return of no-op class. + static ScalarSampleKey computeSampleKey( const void *iSamp ) + { + return ScalarSampleKey(); + } + + //-************************************************************************* + bool sameAsPreviousSample( const void *iSamp, + const ScalarSampleKey &iKey ) const + { + // CJH: Could include tolerances here. + return m_previousSample.equalWithRelAbsError( iSamp, + 1.0e-9 ); + } + + //-************************************************************************* + void copyPreviousSample( hid_t iGroup, + const std::string &iSampleName, + index_t iSampleIndex ); + + //-************************************************************************* + void writeSample( hid_t iGroup, + const std::string &iSampleName, + index_t iSampleIndex, + const void *iSamp, + const ScalarSampleKey &iKey ); + +protected: + // Use the AbcCoreAbstract's magnificent "ScalarSample" + // helper class to keep track of our storage. + AbcA::ScalarSample m_previousSample; +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/StringReadUtil.h b/libs/alembic/include/Alembic/AbcCoreHDF5/StringReadUtil.h new file mode 100644 index 0000000..6a986e8 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/StringReadUtil.h @@ -0,0 +1,116 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_StringReadUtil_h_ +#define _Alembic_AbcCoreHDF5_StringReadUtil_h_ + +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +void +ReadString( hid_t iParent, + const std::string &iStringName, + std::string &oString ); + +//-***************************************************************************** +void +ReadWstring( hid_t iParent, + const std::string &iStringName, + std::wstring &oString ); + +//-***************************************************************************** +// For data types with more than one string. +void +ReadStrings( hid_t iParent, + const std::string &iStringsName, + size_t numStrings, + std::string *oStrings ); + +//-***************************************************************************** +// For reading a compacted string array +void +ReadStrings( hid_t iParent, + const std::string &iStringsName, + std::vector < std::string > & oStrings ); + +//-***************************************************************************** +// For data types with more than one wstring +void +ReadWstrings( hid_t iParent, + const std::string &iStringsName, + size_t numStrings, + std::wstring *oStrings ); + +//-***************************************************************************** +AbcA::ArraySamplePtr +ReadStringArray( AbcA::ReadArraySampleCachePtr iCache, + hid_t iParent, + const std::string &iArrayName, + const AbcA::DataType &iDataType ); + +//-***************************************************************************** +AbcA::ArraySamplePtr +ReadWstringArray( AbcA::ReadArraySampleCachePtr iCache, + hid_t iParent, + const std::string &iArrayName, + const AbcA::DataType &iDataType ); + +//-***************************************************************************** +void +ReadStringArray( void * iIntoLocation, + hid_t iParent, + const std::string &iName, + const AbcA::DataType &iDataType ); + +//-***************************************************************************** +void +ReadWstringArray( void * iIntoLocation, + hid_t iParent, + const std::string &iName, + const AbcA::DataType &iDataType ); + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/StringWriteUtil.h b/libs/alembic/include/Alembic/AbcCoreHDF5/StringWriteUtil.h new file mode 100644 index 0000000..9d77c13 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/StringWriteUtil.h @@ -0,0 +1,101 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2011, +// 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_AbcCoreHDF5_StringWriteUtil_h_ +#define _Alembic_AbcCoreHDF5_StringWriteUtil_h_ + +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +void +WriteString( hid_t iGroup, + const std::string &iStringName, + const std::string &iString ); + +//-***************************************************************************** +void +WriteWstring( hid_t iGroup, + const std::string &iStringName, + const std::wstring &iString ); + +//-***************************************************************************** +// For data types with more than one string. +void +WriteStrings( hid_t iGroup, + const std::string &iStringsName, + size_t iNumStrings, + const std::string *iStrings ); + +//-***************************************************************************** +// For data types with more than one wstring +void +WriteWstrings( hid_t iGroup, + const std::string &iStringsName, + size_t numStrings, + const std::wstring *iStrings ); + + +//-***************************************************************************** +WrittenArraySampleIDPtr +WriteStringArray( WrittenArraySampleMap &iMap, + hid_t iGroup, + const std::string &iName, + const AbcA::ArraySample &iSamp, + const AbcA::ArraySample::Key &iKey, + int iCompressionLevel ); + +//-***************************************************************************** +WrittenArraySampleIDPtr +WriteWstringArray( WrittenArraySampleMap &iMap, + hid_t iGroup, + const std::string &iName, + const AbcA::ArraySample &iSamp, + const AbcA::ArraySample::Key &iKey, + int iCompressionLevel ); + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/WriteUtil.h b/libs/alembic/include/Alembic/AbcCoreHDF5/WriteUtil.h new file mode 100644 index 0000000..e07c086 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/WriteUtil.h @@ -0,0 +1,144 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_WriteUtil_h_ +#define _Alembic_AbcCoreHDF5_WriteUtil_h_ + +#include +#include +#include + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +void +WriteReferences( hid_t iParent, + const std::string& iRefName, + size_t iNumRefs, + const void *iRefs ); + +//-***************************************************************************** +WrittenArraySampleMap& GetWrittenArraySampleMap( + AbcA::ArchiveWriterPtr iArchive ); + +//-***************************************************************************** +void +WriteDimensions( hid_t iParent, + const std::string &iName, + const Dimensions &iDims ); + +//-***************************************************************************** +void +WriteKey( hid_t iParent, + const std::string &iAttrName, + const AbcA::ArraySample::Key &iKey ); + +//-***************************************************************************** +void +WriteMetaData( hid_t iParent, + const std::string &iName, + const AbcA::MetaData &iMetaData ); + +//-***************************************************************************** +void +WriteDataToAttr( hid_t iParent, + hid_t iDspace, + const std::string &iAttrName, + hid_t iFileType, + hid_t iNativeType, + const void *iData ); + +//-***************************************************************************** +void +WriteScalar( hid_t iParent, + const std::string &iName, + hid_t iFileType, + hid_t iNativeType, + const void *iData ); + +//-***************************************************************************** +void +WriteSmallArray( hid_t iParent, + const std::string &iName, + hid_t iFileType, + hid_t iNativeType, + size_t iNumVals, + const void *Data ); + +//-***************************************************************************** +void +CopyWrittenArray( hid_t iParent, + const std::string &iName, + WrittenArraySampleIDPtr iRef ); + +//-***************************************************************************** +WrittenArraySampleIDPtr +WriteArray( WrittenArraySampleMap &iMap, + hid_t iGroup, + const std::string &iName, + const AbcA::ArraySample &iSamp, + const AbcA::ArraySample::Key &iKey, + hid_t iFileType, + hid_t iNativeType, + int iCompressionLevel ); + +//-***************************************************************************** +void +WritePropertyInfo( hid_t iGroup, + const AbcA::PropertyHeader &iHeader, + bool isScalarLike, + uint32_t iTimeSamplingIndex, + uint32_t iNumSamples, + uint32_t iFirstChangedIndex, + uint32_t iLastChangedIndex ); + +//-***************************************************************************** +void +WriteTimeSampling( hid_t iGroup, + const std::string &iName, + const AbcA::TimeSampling &iTsmp ); + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif + diff --git a/libs/alembic/include/Alembic/AbcCoreHDF5/WrittenArraySampleMap.h b/libs/alembic/include/Alembic/AbcCoreHDF5/WrittenArraySampleMap.h new file mode 100644 index 0000000..9bac488 --- /dev/null +++ b/libs/alembic/include/Alembic/AbcCoreHDF5/WrittenArraySampleMap.h @@ -0,0 +1,136 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcCoreHDF5_WrittenArraySampleMap_h_ +#define _Alembic_AbcCoreHDF5_WrittenArraySampleMap_h_ + +#include +#include +#include + + +namespace Alembic { +namespace AbcCoreHDF5 { +namespace ALEMBIC_VERSION_NS { + +//-***************************************************************************** +// A Written Array Sample ID is a receipt that contains information that +// refers to the exact location in an HDF5 file that an array sample was written +// to. It also contains the Key of the array sample, so it may be verified. +// +// This object is used to "reuse" an already written array sample by linking +// it from the previous usage. +//-***************************************************************************** +class WrittenArraySampleID +{ +public: + WrittenArraySampleID() + : m_sampleKey() {} + + WrittenArraySampleID( const AbcA::ArraySample::Key &iKey, hid_t iObjLocID ) + : m_sampleKey( iKey ) + { + int strLen = H5Iget_name( iObjLocID, NULL, 0 ); + ABCA_ASSERT( strLen > 0, "WrittenSampleID() passed in bad iObjLocID" ); + + // add 1 to account for the NULL seperator + strLen ++; + + m_objectLocation.resize( strLen ); + H5Iget_name( iObjLocID, &(m_objectLocation[0]), strLen ); + } + + const AbcA::ArraySample::Key &getKey() const { return m_sampleKey; } + + std::string getObjectLocation() const { return m_objectLocation; } + +private: + AbcA::ArraySample::Key m_sampleKey; + std::string m_objectLocation; +}; + +//-***************************************************************************** +typedef Alembic::Util::shared_ptr WrittenArraySampleIDPtr; + +//-***************************************************************************** +// This class handles the mapping. +class WrittenArraySampleMap +{ +protected: + friend class AwImpl; + + WrittenArraySampleMap() {} + +public: + + // Returns 0 if it can't find it + WrittenArraySampleIDPtr find( const AbcA::ArraySample::Key &key ) const + { + Map::const_iterator miter = m_map.find( key ); + if ( miter != m_map.end() ) + { + return (*miter).second; + } + else + { + return WrittenArraySampleIDPtr(); + } + } + + // Store. Will clobber if you've already stored it. + void store( WrittenArraySampleIDPtr r ) + { + if ( !r ) + { + ABCA_THROW( "Invalid WrittenArraySampleIDPtr" ); + } + + m_map[r->getKey()] = r; + } + +protected: + typedef AbcA::UnorderedMapUtil::umap_type Map; + Map m_map; +}; + +} // End namespace ALEMBIC_VERSION_NS + +using namespace ALEMBIC_VERSION_NS; + +} // End namespace AbcCoreHDF5 +} // End namespace Alembic + +#endif diff --git a/libs/alembic/include/Alembic/AbcMaterial/All.h b/libs/alembic/include/Alembic/AbcMaterial/All.h new file mode 100644 index 0000000..c2eb0ae --- /dev/null +++ b/libs/alembic/include/Alembic/AbcMaterial/All.h @@ -0,0 +1,45 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcMaterial_All_h_ +#define _Alembic_AbcMaterial_All_h_ + +#include +#include +#include +#include + +#endif diff --git a/libs/alembic/include/Alembic/AbcMaterial/InternalUtil.h b/libs/alembic/include/Alembic/AbcMaterial/InternalUtil.h new file mode 100644 index 0000000..7117f5c --- /dev/null +++ b/libs/alembic/include/Alembic/AbcMaterial/InternalUtil.h @@ -0,0 +1,63 @@ +//-***************************************************************************** +// +// Copyright (c) 2009-2012, +// 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_AbcMaterial_InternalUtil_h_ +#define _Alembic_AbcMaterial_InternalUtil_h_ + +#include + +namespace Alembic { +namespace AbcMaterial { +namespace ALEMBIC_VERSION_NS { +namespace Util { + +std::string buildTargetName( const std::string & iTarget, + const std::string & iShaderType, + const std::string & iSuffix); + +void validateName( const std::string & iName, + const std::string & iExceptionVariableName ); + +void split_tokens( const std::string & iValue, + std::vector & oResult, + size_t iMaxSplit = 0 ); + +} +} +} +} + +#endif diff --git a/libs/alembic/include/Alembic/Util/Foundation.h b/libs/alembic/include/Alembic/Util/Foundation.h index e8b2263..b159dd0 100644 --- a/libs/alembic/include/Alembic/Util/Foundation.h +++ b/libs/alembic/include/Alembic/Util/Foundation.h @@ -168,6 +168,7 @@ class totally_ordered // inspired by boost::mutex #ifdef _MSC_VER +#define CreateMutex CreateMutexW class mutex : noncopyable { diff --git a/libs/alembic/include/H5Dpublic.h b/libs/alembic/include/H5Dpublic.h index 484b176..c878d4a 100644 --- a/libs/alembic/include/H5Dpublic.h +++ b/libs/alembic/include/H5Dpublic.h @@ -34,12 +34,6 @@ #define H5D_CHUNK_CACHE_NBYTES_DEFAULT ((size_t) -1) #define H5D_CHUNK_CACHE_W0_DEFAULT -1. -/* Property names for H5LTDdirect_chunk_write */ -#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME "direct_chunk_flag" -#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME "direct_chunk_filters" -#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME "direct_chunk_offset" -#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME "direct_chunk_datasize" - /*******************/ /* Public Typedefs */ /*******************/ @@ -107,15 +101,6 @@ extern "C" { typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); -/* Define the operator function pointer for H5Dscatter() */ -typedef herr_t (*H5D_scatter_func_t)(void **src_buf/*out*/, - size_t *src_buf_bytes_used/*out*/, - void *op_data); - -/* Define the operator function pointer for H5Dgather() */ -typedef herr_t (*H5D_gather_func_t)(const void *dst_buf, - size_t dst_buf_bytes_used, void *op_data); - H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id); H5_DLL hid_t H5Dcreate_anon(hid_t file_id, hid_t type_id, hid_t space_id, @@ -140,10 +125,6 @@ H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_ H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf, hid_t buf_type, hid_t space); H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]); -H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, - hid_t dst_space_id, void *dst_buf); -H5_DLL herr_t H5Dgather(hid_t src_space_id, void *src_buf, hid_t type_id, - size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data); H5_DLL herr_t H5Ddebug(hid_t dset_id); /* Symbols defined for compatibility with previous versions of the HDF5 API. diff --git a/libs/alembic/include/H5Epubgen.h b/libs/alembic/include/H5Epubgen.h index 75eca0b..1540b07 100644 --- a/libs/alembic/include/H5Epubgen.h +++ b/libs/alembic/include/H5Epubgen.h @@ -30,7 +30,6 @@ #define H5E_FILE (H5OPEN H5E_FILE_g) #define H5E_SOHM (H5OPEN H5E_SOHM_g) #define H5E_SYM (H5OPEN H5E_SYM_g) -#define H5E_PLUGIN (H5OPEN H5E_PLUGIN_g) #define H5E_VFL (H5OPEN H5E_VFL_g) #define H5E_INTERNAL (H5OPEN H5E_INTERNAL_g) #define H5E_BTREE (H5OPEN H5E_BTREE_g) @@ -58,10 +57,9 @@ H5_DLLVAR hid_t H5E_DATASET_g; /* Dataset */ H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */ H5_DLLVAR hid_t H5E_STORAGE_g; /* Data storage */ -H5_DLLVAR hid_t H5E_FILE_g; /* File accessibilty */ +H5_DLLVAR hid_t H5E_FILE_g; /* File accessability */ H5_DLLVAR hid_t H5E_SOHM_g; /* Shared Object Header Messages */ H5_DLLVAR hid_t H5E_SYM_g; /* Symbol table */ -H5_DLLVAR hid_t H5E_PLUGIN_g; /* Plugin for dynamically loaded library */ H5_DLLVAR hid_t H5E_VFL_g; /* Virtual File Layer */ H5_DLLVAR hid_t H5E_INTERNAL_g; /* Internal error (too specific to document in detail) */ H5_DLLVAR hid_t H5E_BTREE_g; /* B-Tree node */ @@ -219,11 +217,7 @@ H5_DLLVAR hid_t H5E_PATH_g; /* Problem with path to object */ #define H5E_NONE_MINOR (H5OPEN H5E_NONE_MINOR_g) H5_DLLVAR hid_t H5E_NONE_MINOR_g; /* No error */ -/* Plugin errors */ -#define H5E_OPENERROR (H5OPEN H5E_OPENERROR_g) -H5_DLLVAR hid_t H5E_OPENERROR_g; /* Can't open directory or file */ - -/* File accessibilty errors */ +/* File accessability errors */ #define H5E_FILEEXISTS (H5OPEN H5E_FILEEXISTS_g) #define H5E_FILEOPEN (H5OPEN H5E_FILEOPEN_g) #define H5E_CANTCREATE (H5OPEN H5E_CANTCREATE_g) diff --git a/libs/alembic/include/H5FDmpi.h b/libs/alembic/include/H5FDmpi.h index dcb8df9..b9998dd 100644 --- a/libs/alembic/include/H5FDmpi.h +++ b/libs/alembic/include/H5FDmpi.h @@ -55,9 +55,69 @@ typedef enum H5FD_mpio_collective_opt_t { H5FD_MPIO_INDIVIDUAL_IO /*zero is the default*/ } H5FD_mpio_collective_opt_t; + +#ifdef H5_HAVE_PARALLEL + +/* Sub-class the H5FD_class_t to add more specific functions for MPI-based VFDs */ +typedef struct H5FD_class_mpi_t { + H5FD_class_t super; /* Superclass information & methods */ + int (*get_rank)(const H5FD_t *file); /* Get the MPI rank of a process */ + int (*get_size)(const H5FD_t *file); /* Get the MPI size of a communicator */ + MPI_Comm (*get_comm)(const H5FD_t *file); /* Get the communicator for a file */ +} H5FD_class_mpi_t; +#endif /* H5_HAVE_PARALLEL */ + /* Include all the MPI VFL headers */ #include "H5FDmpio.h" /* MPI I/O file driver */ #include "H5FDmpiposix.h" /* MPI/posix I/O file driver */ +/* Macros */ + +/* Single macro to check for all file drivers that use MPI */ +#define IS_H5FD_MPI(file) \ + (IS_H5FD_MPIO(file) || IS_H5FD_MPIPOSIX(file)) + +#ifdef H5_HAVE_PARALLEL +/* ======== Temporary data transfer properties ======== */ +/* Definitions for memory MPI type property */ +#define H5FD_MPI_XFER_MEM_MPI_TYPE_NAME "H5FD_mpi_mem_mpi_type" +#define H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE sizeof(MPI_Datatype) +/* Definitions for file MPI type property */ +#define H5FD_MPI_XFER_FILE_MPI_TYPE_NAME "H5FD_mpi_file_mpi_type" +#define H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE sizeof(MPI_Datatype) + +/* + * The view is set to this value + */ +H5_DLLVAR char H5FD_mpi_native_g[]; + +/* Function prototypes */ +#ifdef __cplusplus +extern "C" { +#endif +/* General routines */ +H5_DLL haddr_t H5FD_mpi_MPIOff_to_haddr(MPI_Offset mpi_off); +H5_DLL herr_t H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/); +H5_DLL herr_t H5FD_mpi_comm_info_dup(MPI_Comm comm, MPI_Info info, + MPI_Comm *comm_new, MPI_Info *info_new); +H5_DLL herr_t H5FD_mpi_comm_info_free(MPI_Comm *comm, MPI_Info *info); +#ifdef NOT_YET +H5_DLL herr_t H5FD_mpio_wait_for_left_neighbor(H5FD_t *file); +H5_DLL herr_t H5FD_mpio_signal_right_neighbor(H5FD_t *file); +#endif /* NOT_YET */ +H5_DLL herr_t H5FD_mpi_setup_collective(hid_t dxpl_id, MPI_Datatype btype, + MPI_Datatype ftype); +H5_DLL herr_t H5FD_mpi_teardown_collective(hid_t dxpl_id); + +/* Driver specific methods */ +H5_DLL int H5FD_mpi_get_rank(const H5FD_t *file); +H5_DLL int H5FD_mpi_get_size(const H5FD_t *file); +H5_DLL MPI_Comm H5FD_mpi_get_comm(const H5FD_t *_file); +#ifdef __cplusplus +} +#endif + +#endif /* H5_HAVE_PARALLEL */ + #endif /* H5FDmpi_H */ diff --git a/libs/alembic/include/H5FDmpio.h b/libs/alembic/include/H5FDmpio.h index f1a68a4..41baf8d 100644 --- a/libs/alembic/include/H5FDmpio.h +++ b/libs/alembic/include/H5FDmpio.h @@ -30,6 +30,9 @@ /* Macros */ +#define IS_H5FD_MPIO(f) /* (H5F_t *f) */ \ + (H5FD_MPIO==H5F_DRIVER_ID(f)) + #ifdef H5_HAVE_PARALLEL /*Turn on H5FDmpio_debug if H5F_DEBUG is on */ #ifdef H5F_DEBUG diff --git a/libs/alembic/include/H5FDmpiposix.h b/libs/alembic/include/H5FDmpiposix.h index fdf30a1..832839e 100644 --- a/libs/alembic/include/H5FDmpiposix.h +++ b/libs/alembic/include/H5FDmpiposix.h @@ -14,7 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Purpose: The public header file for the mpiposix driver. @@ -24,13 +24,16 @@ #define __H5FDmpiposix_H #ifdef H5_HAVE_PARALLEL -# define H5FD_MPIPOSIX (H5FD_mpiposix_init()) +# define H5FD_MPIPOSIX (H5FD_mpiposix_init()) #else -# define H5FD_MPIPOSIX (-1) +# define H5FD_MPIPOSIX (-1) #endif /* Macros */ +#define IS_H5FD_MPIPOSIX(f) /* (H5F_t *f) */ \ + (H5FD_MPIPOSIX==H5F_DRIVER_ID(f)) + #ifdef H5_HAVE_PARALLEL /* Function prototypes */ @@ -50,3 +53,4 @@ H5_DLL herr_t H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/, hbool_t #endif /*H5_HAVE_PARALLEL*/ #endif /* __H5FDmpiposix_H */ + diff --git a/libs/alembic/include/H5FDmulti.h b/libs/alembic/include/H5FDmulti.h index b45a029..c7e54ce 100644 --- a/libs/alembic/include/H5FDmulti.h +++ b/libs/alembic/include/H5FDmulti.h @@ -39,6 +39,9 @@ H5_DLL herr_t H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, H5_DLL herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, hid_t *memb_fapl/*out*/, char **memb_name/*out*/, haddr_t *memb_addr/*out*/, hbool_t *relax/*out*/); +H5_DLL herr_t H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl); +H5_DLL herr_t H5Pget_dxpl_multi(hid_t dxpl_id, hid_t *memb_dxpl/*out*/); + H5_DLL herr_t H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const char *raw_ext, hid_t raw_plist_id); diff --git a/libs/alembic/include/H5FDpublic.h b/libs/alembic/include/H5FDpublic.h index f1b3920..0c5605c 100644 --- a/libs/alembic/include/H5FDpublic.h +++ b/libs/alembic/include/H5FDpublic.h @@ -100,7 +100,7 @@ typedef enum H5F_mem_t H5FD_mem_t; H5FD_MEM_SUPER, /*super*/ \ H5FD_MEM_SUPER, /*btree*/ \ H5FD_MEM_DRAW, /*draw*/ \ - H5FD_MEM_DRAW, /*gheap*/ \ + H5FD_MEM_SUPER, /*gheap*/ \ H5FD_MEM_SUPER, /*lheap*/ \ H5FD_MEM_SUPER /*ohdr*/ \ } @@ -267,7 +267,7 @@ typedef enum { H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, H5FD_FILE_IMAGE_OP_FILE_OPEN, H5FD_FILE_IMAGE_OP_FILE_RESIZE, - H5FD_FILE_IMAGE_OP_FILE_CLOSE + H5FD_FILE_IMAGE_OP_FILE_CLOSE, } H5FD_file_image_op_t; /* Define structure to hold file image callbacks */ diff --git a/libs/alembic/include/H5LTpublic.h b/libs/alembic/include/H5LTpublic.h deleted file mode 100644 index 929c6bd..0000000 --- a/libs/alembic/include/H5LTpublic.h +++ /dev/null @@ -1,370 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef _H5LTpublic_H -#define _H5LTpublic_H - -/* Flag definitions for H5LTopen_file_image() */ -#define H5LT_FILE_IMAGE_OPEN_RW 0x0001 /* Open image for read-write */ -#define H5LT_FILE_IMAGE_DONT_COPY 0x0002 /* The HDF5 lib won't copy */ -/* user supplied image buffer. The same image is open with the core driver. */ -#define H5LT_FILE_IMAGE_DONT_RELEASE 0x0004 /* The HDF5 lib won't */ -/* deallocate user supplied image buffer. The user application is reponsible */ -/* for doing so. */ -#define H5LT_FILE_IMAGE_ALL 0x0007 - -typedef enum H5LT_lang_t { - H5LT_LANG_ERR = -1, /*this is the first*/ - H5LT_DDL = 0, /*for DDL*/ - H5LT_C = 1, /*for C*/ - H5LT_FORTRAN = 2, /*for Fortran*/ - H5LT_NO_LANG = 3 /*this is the last*/ -} H5LT_lang_t; - -#ifdef __cplusplus -extern "C" { -#endif - -/*------------------------------------------------------------------------- - * - * Make dataset functions - * - *------------------------------------------------------------------------- - */ - -H5_HLDLL herr_t H5LTmake_dataset( hid_t loc_id, - const char *dset_name, - int rank, - const hsize_t *dims, - hid_t type_id, - const void *buffer ); - -H5_HLDLL herr_t H5LTmake_dataset_char( hid_t loc_id, - const char *dset_name, - int rank, - const hsize_t *dims, - const char *buffer ); - -H5_HLDLL herr_t H5LTmake_dataset_short( hid_t loc_id, - const char *dset_name, - int rank, - const hsize_t *dims, - const short *buffer ); - -H5_HLDLL herr_t H5LTmake_dataset_int( hid_t loc_id, - const char *dset_name, - int rank, - const hsize_t *dims, - const int *buffer ); - -H5_HLDLL herr_t H5LTmake_dataset_long( hid_t loc_id, - const char *dset_name, - int rank, - const hsize_t *dims, - const long *buffer ); - -H5_HLDLL herr_t H5LTmake_dataset_float( hid_t loc_id, - const char *dset_name, - int rank, - const hsize_t *dims, - const float *buffer ); - -H5_HLDLL herr_t H5LTmake_dataset_double( hid_t loc_id, - const char *dset_name, - int rank, - const hsize_t *dims, - const double *buffer ); - -H5_HLDLL herr_t H5LTmake_dataset_string( hid_t loc_id, - const char *dset_name, - const char *buf ); - - -/*------------------------------------------------------------------------- - * - * Read dataset functions - * - *------------------------------------------------------------------------- - */ - -H5_HLDLL herr_t H5LTread_dataset( hid_t loc_id, - const char *dset_name, - hid_t type_id, - void *buffer ); - -H5_HLDLL herr_t H5LTread_dataset_char( hid_t loc_id, - const char *dset_name, - char *buffer ); - -H5_HLDLL herr_t H5LTread_dataset_short( hid_t loc_id, - const char *dset_name, - short *buffer ); - -H5_HLDLL herr_t H5LTread_dataset_int( hid_t loc_id, - const char *dset_name, - int *buffer ); - -H5_HLDLL herr_t H5LTread_dataset_long( hid_t loc_id, - const char *dset_name, - long *buffer ); - -H5_HLDLL herr_t H5LTread_dataset_float( hid_t loc_id, - const char *dset_name, - float *buffer ); - -H5_HLDLL herr_t H5LTread_dataset_double( hid_t loc_id, - const char *dset_name, - double *buffer ); - -H5_HLDLL herr_t H5LTread_dataset_string( hid_t loc_id, - const char *dset_name, - char *buf ); - -/*------------------------------------------------------------------------- - * - * Query dataset functions - * - *------------------------------------------------------------------------- - */ - - -H5_HLDLL herr_t H5LTget_dataset_ndims( hid_t loc_id, - const char *dset_name, - int *rank ); - -H5_HLDLL herr_t H5LTget_dataset_info( hid_t loc_id, - const char *dset_name, - hsize_t *dims, - H5T_class_t *type_class, - size_t *type_size ); - -H5_HLDLL herr_t H5LTfind_dataset( hid_t loc_id, const char *name ); - - - -/*------------------------------------------------------------------------- - * - * Set attribute functions - * - *------------------------------------------------------------------------- - */ - - -H5_HLDLL herr_t H5LTset_attribute_string( hid_t loc_id, - const char *obj_name, - const char *attr_name, - const char *attr_data ); - -H5_HLDLL herr_t H5LTset_attribute_char( hid_t loc_id, - const char *obj_name, - const char *attr_name, - const char *buffer, - size_t size ); - -H5_HLDLL herr_t H5LTset_attribute_uchar( hid_t loc_id, - const char *obj_name, - const char *attr_name, - const unsigned char *buffer, - size_t size ); - -H5_HLDLL herr_t H5LTset_attribute_short( hid_t loc_id, - const char *obj_name, - const char *attr_name, - const short *buffer, - size_t size ); - -H5_HLDLL herr_t H5LTset_attribute_ushort( hid_t loc_id, - const char *obj_name, - const char *attr_name, - const unsigned short *buffer, - size_t size ); - -H5_HLDLL herr_t H5LTset_attribute_int( hid_t loc_id, - const char *obj_name, - const char *attr_name, - const int *buffer, - size_t size ); - -H5_HLDLL herr_t H5LTset_attribute_uint( hid_t loc_id, - const char *obj_name, - const char *attr_name, - const unsigned int *buffer, - size_t size ); - -H5_HLDLL herr_t H5LTset_attribute_long( hid_t loc_id, - const char *obj_name, - const char *attr_name, - const long *buffer, - size_t size ); - -H5_HLDLL herr_t H5LTset_attribute_long_long( hid_t loc_id, - const char *obj_name, - const char *attr_name, - const long long *buffer, - size_t size ); - -H5_HLDLL herr_t H5LTset_attribute_ulong( hid_t loc_id, - const char *obj_name, - const char *attr_name, - const unsigned long *buffer, - size_t size ); - -H5_HLDLL herr_t H5LTset_attribute_float( hid_t loc_id, - const char *obj_name, - const char *attr_name, - const float *buffer, - size_t size ); - -H5_HLDLL herr_t H5LTset_attribute_double( hid_t loc_id, - const char *obj_name, - const char *attr_name, - const double *buffer, - size_t size ); - -/*------------------------------------------------------------------------- - * - * Get attribute functions - * - *------------------------------------------------------------------------- - */ - -H5_HLDLL herr_t H5LTget_attribute( hid_t loc_id, - const char *obj_name, - const char *attr_name, - hid_t mem_type_id, - void *data ); - -H5_HLDLL herr_t H5LTget_attribute_string( hid_t loc_id, - const char *obj_name, - const char *attr_name, - char *data ); - -H5_HLDLL herr_t H5LTget_attribute_char( hid_t loc_id, - const char *obj_name, - const char *attr_name, - char *data ); - -H5_HLDLL herr_t H5LTget_attribute_uchar( hid_t loc_id, - const char *obj_name, - const char *attr_name, - unsigned char *data ); - -H5_HLDLL herr_t H5LTget_attribute_short( hid_t loc_id, - const char *obj_name, - const char *attr_name, - short *data ); - -H5_HLDLL herr_t H5LTget_attribute_ushort( hid_t loc_id, - const char *obj_name, - const char *attr_name, - unsigned short *data ); - -H5_HLDLL herr_t H5LTget_attribute_int( hid_t loc_id, - const char *obj_name, - const char *attr_name, - int *data ); - -H5_HLDLL herr_t H5LTget_attribute_uint( hid_t loc_id, - const char *obj_name, - const char *attr_name, - unsigned int *data ); - -H5_HLDLL herr_t H5LTget_attribute_long( hid_t loc_id, - const char *obj_name, - const char *attr_name, - long *data ); - -H5_HLDLL herr_t H5LTget_attribute_long_long( hid_t loc_id, - const char *obj_name, - const char *attr_name, - long long *data ); - -H5_HLDLL herr_t H5LTget_attribute_ulong( hid_t loc_id, - const char *obj_name, - const char *attr_name, - unsigned long *data ); - -H5_HLDLL herr_t H5LTget_attribute_float( hid_t loc_id, - const char *obj_name, - const char *attr_name, - float *data ); - -H5_HLDLL herr_t H5LTget_attribute_double( hid_t loc_id, - const char *obj_name, - const char *attr_name, - double *data ); - - -/*------------------------------------------------------------------------- - * - * Query attribute functions - * - *------------------------------------------------------------------------- - */ - - -H5_HLDLL herr_t H5LTget_attribute_ndims( hid_t loc_id, - const char *obj_name, - const char *attr_name, - int *rank ); - -H5_HLDLL herr_t H5LTget_attribute_info( hid_t loc_id, - const char *obj_name, - const char *attr_name, - hsize_t *dims, - H5T_class_t *type_class, - size_t *type_size ); - - - - - -/*------------------------------------------------------------------------- - * - * General functions - * - *------------------------------------------------------------------------- - */ - -H5_HLDLL hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type); -H5_HLDLL herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len); - - -/*------------------------------------------------------------------------- - * - * Utility functions - * - *------------------------------------------------------------------------- - */ - -H5_HLDLL herr_t H5LTfind_attribute( hid_t loc_id, const char *name ); - -H5_HLDLL htri_t H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid); - -/*------------------------------------------------------------------------- - * - * File image operations functions - * - *------------------------------------------------------------------------- - */ - -H5_HLDLL hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/libs/alembic/include/H5Ppublic.h b/libs/alembic/include/H5Ppublic.h index 54999b9..c06ab39 100644 --- a/libs/alembic/include/H5Ppublic.h +++ b/libs/alembic/include/H5Ppublic.h @@ -129,7 +129,8 @@ typedef enum H5D_mpio_actual_chunk_opt_mode_t { */ H5D_MPIO_NO_CHUNK_OPTIMIZATION = 0, H5D_MPIO_LINK_CHUNK, - H5D_MPIO_MULTI_CHUNK + H5D_MPIO_MULTI_CHUNK, + H5D_MPIO_MULTI_CHUNK_NO_OPT } H5D_mpio_actual_chunk_opt_mode_t; typedef enum H5D_mpio_actual_io_mode_t { @@ -152,19 +153,6 @@ typedef enum H5D_mpio_actual_io_mode_t { H5D_MPIO_CONTIGUOUS_COLLECTIVE = 0x4 } H5D_mpio_actual_io_mode_t; -/* Broken collective IO property */ -typedef enum H5D_mpio_no_collective_cause_t { - H5D_MPIO_COLLECTIVE = 0x00, - H5D_MPIO_SET_INDEPENDENT = 0x01, - H5D_MPIO_DATATYPE_CONVERSION = 0x02, - H5D_MPIO_DATA_TRANSFORMS = 0x04, - H5D_MPIO_SET_MPIPOSIX = 0x08, - H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES = 0x10, - H5D_MPIO_POINT_SELECTIONS = 0x20, - H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET = 0x40, - H5D_MPIO_FILTERS = 0x80 -} H5D_mpio_no_collective_cause_t; - /********************/ /* Public Variables */ /********************/ @@ -412,7 +400,6 @@ H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, voi #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode); H5_DLL herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode); -H5_DLL herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, uint32_t *global_no_collective_cause); #endif /* H5_HAVE_PARALLEL */ /* Link creation property list (LCPL) routines */ diff --git a/libs/alembic/include/H5TBpublic.h b/libs/alembic/include/H5TBpublic.h index 874ef20..4dd17bb 100644 --- a/libs/alembic/include/H5TBpublic.h +++ b/libs/alembic/include/H5TBpublic.h @@ -219,10 +219,10 @@ H5_HLDLL herr_t H5TBdelete_field( hid_t loc_id, H5_HLDLL herr_t H5TBAget_title( hid_t loc_id, char *table_title ); -H5_HLDLL htri_t H5TBAget_fill(hid_t loc_id, +H5_HLDLL herr_t H5TBAget_fill( hid_t loc_id, const char *dset_name, hid_t dset_id, - unsigned char *dst_buf); + unsigned char *dst_buf ); #ifdef __cplusplus } diff --git a/libs/alembic/include/H5Tprivate.h b/libs/alembic/include/H5Tprivate.h new file mode 100644 index 0000000..0c96896 --- /dev/null +++ b/libs/alembic/include/H5Tprivate.h @@ -0,0 +1,164 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This file contains private information about the H5T module + */ +#ifndef _H5Tprivate_H +#define _H5Tprivate_H + +/* Get package's public header */ +#include "H5Tpublic.h" + +/* Other public headers needed by this file */ +#include "H5MMpublic.h" /* Memory management */ + +/* Private headers needed by this file */ +#include "H5private.h" /* Generic Functions */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Rprivate.h" /* References */ + +/* Macro for size of temporary buffers to contain a single element */ +#define H5T_ELEM_BUF_SIZE 256 + +/* If the module using this macro is allowed access to the private variables, access them directly */ +#ifdef H5T_PACKAGE +#define H5T_GET_SIZE(T) ((T)->shared->size) +#define H5T_GET_SHARED(T) ((T)->shared) +#define H5T_GET_MEMBER_OFFSET(T, I) ((T)->u.compnd.memb[I].offset) +#define H5T_GET_MEMBER_SIZE(T, I) ((T)->u.compnd.memb[I].shared->size) +#else /* H5T_PACKAGE */ +#define H5T_GET_SIZE(T) (H5T_get_size(T)) +#define H5T_GET_SHARED(T) (H5T_get_shared(T)) +#define H5T_GET_MEMBER_OFFSET(T, I) (H5T_get_member_offset((T), (I))) +#define H5T_GET_MEMBER_SIZE(T, I) (H5T_get_member_size((T), (I))) +#endif /* H5T_PACKAGE */ + +/* Forward references of package typedefs (declared in H5Tpkg.h) */ +typedef struct H5T_t H5T_t; +typedef struct H5T_stats_t H5T_stats_t; +typedef struct H5T_path_t H5T_path_t; + +/* How to copy a datatype */ +typedef enum H5T_copy_t { + H5T_COPY_TRANSIENT, + H5T_COPY_ALL, + H5T_COPY_REOPEN +} H5T_copy_t; + +/* Location of datatype information */ +typedef enum { + H5T_LOC_BADLOC = 0, /* invalid datatype location */ + H5T_LOC_MEMORY, /* data stored in memory */ + H5T_LOC_DISK, /* data stored on disk */ + H5T_LOC_MAXLOC /* highest value (Invalid as true value) */ +} H5T_loc_t; + +/* VL allocation information */ +typedef struct { + H5MM_allocate_t alloc_func; /* Allocation function */ + void *alloc_info; /* Allocation information */ + H5MM_free_t free_func; /* Free function */ + void *free_info; /* Free information */ +} H5T_vlen_alloc_info_t; + +/* Structure for conversion callback property */ +typedef struct H5T_conv_cb_t { + H5T_conv_except_func_t func; + void* user_data; +} H5T_conv_cb_t; + +/* Values for the optimization of compound data reading and writing. They indicate + * whether the fields of the source and destination are subset of each other and + * there is no conversion needed. + */ +typedef enum { + H5T_SUBSET_BADVALUE = -1, /* Invalid value */ + H5T_SUBSET_FALSE = 0, /* Source and destination aren't subset of each other */ + H5T_SUBSET_SRC, /* Source is the subset of dest and no conversion is needed */ + H5T_SUBSET_DST, /* Dest is the subset of source and no conversion is needed */ + H5T_SUBSET_CAP /* Must be the last value */ +} H5T_subset_t; + +typedef struct H5T_subset_info_t { + H5T_subset_t subset; /* See above */ + size_t copy_size; /* Size in bytes, to copy for each element */ +} H5T_subset_info_t; + +/* Forward declarations for prototype arguments */ +struct H5O_t; + +/* The native endianess of the platform */ +H5_DLLVAR H5T_order_t H5T_native_order_g; + +/* Private functions */ +H5_DLL herr_t H5TN_init_interface(void); +H5_DLL herr_t H5T_init(void); +H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method); +H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); +H5_DLL herr_t H5T_close(H5T_t *dt); +H5_DLL H5T_t *H5T_get_super(const H5T_t *dt); +H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal); +H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api); +H5_DLL size_t H5T_get_size(const H5T_t *dt); +H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset); +H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream); +H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt); +H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt); +H5_DLL htri_t H5T_is_immutable(const H5T_t *dt); +H5_DLL htri_t H5T_is_named(const H5T_t *dt); +H5_DLL htri_t H5T_is_relocatable(const H5T_t *dt); +H5_DLL H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst, + const char *name, H5T_conv_t func, hid_t dxpl_id, hbool_t is_api); +H5_DLL hbool_t H5T_path_noop(const H5T_path_t *p); +H5_DLL H5T_bkg_t H5T_path_bkg(const H5T_path_t *p); +H5_DLL H5T_subset_info_t *H5T_path_compound_subset(const H5T_path_t *p); +H5_DLL herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, + size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, + hid_t dset_xfer_plist); +H5_DLL herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *_op_data); +H5_DLL herr_t H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt, hid_t dxpl_id); +H5_DLL herr_t H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_alloc_info); +H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc); +H5_DLL htri_t H5T_is_sensible(const H5T_t *dt); +H5_DLL uint32_t H5T_hash(H5F_t * file, const H5T_t *dt); +H5_DLL herr_t H5T_set_latest_version(H5T_t *dt); +H5_DLL herr_t H5T_patch_file(H5T_t *dt, H5F_t *f); +H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt); + +/* Reference specific functions */ +H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt); + +/* Operations on named datatypes */ +H5_DLL H5T_t *H5T_open(const H5G_loc_t *loc, hid_t dxpl_id); +H5_DLL htri_t H5T_committed(const H5T_t *type); +H5_DLL int H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id); +H5_DLL herr_t H5T_update_shared(H5T_t *type); + +/* Field functions (for both compound & enumerated types) */ +H5_DLL int H5T_get_nmembers(const H5T_t *dt); +H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method); +H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno); + +/* Atomic functions */ +H5_DLL H5T_order_t H5T_get_order(const H5T_t *dt); +H5_DLL size_t H5T_get_precision(const H5T_t *dt); +H5_DLL int H5T_get_offset(const H5T_t *dt); + +/* Fixed-point functions */ +H5_DLL H5T_sign_t H5T_get_sign(H5T_t const *dt); + +#endif /* _H5Tprivate_H */ + diff --git a/libs/alembic/include/H5Zpublic.h b/libs/alembic/include/H5Zpublic.h index 8daa5f4..5d9b5ed 100644 --- a/libs/alembic/include/H5Zpublic.h +++ b/libs/alembic/include/H5Zpublic.h @@ -42,7 +42,6 @@ typedef int H5Z_filter_t; #define H5Z_FILTER_NBIT 5 /*nbit compression */ #define H5Z_FILTER_SCALEOFFSET 6 /*scale+offset compression */ #define H5Z_FILTER_RESERVED 256 /*filter ids below this value are reserved for library use */ - #define H5Z_FILTER_MAX 65535 /*maximum filter id */ /* General macros */ diff --git a/libs/alembic/include/H5pubconf.h b/libs/alembic/include/H5pubconf.h index 954156e..aa77aec 100644 --- a/libs/alembic/include/H5pubconf.h +++ b/libs/alembic/include/H5pubconf.h @@ -1,5 +1,37 @@ -/* src/H5config.h. Generated from H5config.h.in by configure. */ -/* src/H5config.h.in. Generated from configure.ac by autoheader. */ +/* H5pubconf.h Generated By CMake during the configuration */ + +#ifndef H5_CONFIG_H_ +#define H5_CONFIG_H_ + +/* Define if the Windows virtual file driver should be compiled */ +#define H5_HAVE_WINDOWS 1 + +/* Define if using MinGW */ +/* #undef H5_HAVE_MINGW */ + +/* Define if on the Windows platform and default WIN32 API */ +#define H5_HAVE_WIN32_API 1 + +/* Define if using a Windows compiler (i.e. Visual Studio) */ +#define H5_HAVE_VISUAL_STUDIO 1 + +/* Defined if HDF5 was built with CMake AND build as a shared library */ +/* #undef H5_BUILT_AS_DYNAMIC_LIB */ + +/* Defined if HDF5 was built with CMake AND build as a static library */ +#define H5_BUILT_AS_STATIC_LIB 1 + +/* Defined if HDF5 CPP was built with CMake AND build as a shared library */ +/* #undef H5_CPP_BUILT_AS_DYNAMIC_LIB */ + +/* Defined if HDF5 CPP was built with CMake AND build as a static library */ +/* #undef H5_CPP_BUILT_AS_STATIC_LIB */ + +/* Defined if HDF5 HL was built with CMake AND build as a shared library */ +/* #undef H5_HL_BUILT_AS_DYNAMIC_LIB */ + +/* Defined if HDF5 HL was built with CMake AND build as a static library */ +/* #undef H5_HL_BUILT_AS_STATIC_LIB */ /* Define if building universal (internal helper macro) */ /* #undef H5_AC_APPLE_UNIVERSAL_BUILD */ @@ -26,7 +58,7 @@ #define H5_DEFAULT_VFD H5FD_SEC2 /* Define if `dev_t' is a scalar */ -#define H5_DEV_T_IS_SCALAR 1 +/* #undef H5_DEV_T_IS_SCALAR */ /* Define to dummy `main' function (if any) required to link to the Fortran libraries. */ @@ -37,10 +69,10 @@ /* Define to a macro mangling the given C identifier (in lower and upper case), which must not contain underscores, for linking with Fortran. */ -/* #undef H5_FC_FUNC */ +#define H5_FC_FUNC(name,NAME) NAME /* As FC_FUNC, but for C identifiers containing underscores. */ -/* #undef H5_FC_FUNC_ */ +#define H5_FC_FUNC_(name,NAME) NAME /* Define if your system can handle overflow converting floating-point to integer values. */ @@ -52,39 +84,33 @@ /* Define if your system has right maximum convert floating-point to unsigned long long values. */ -#define H5_FP_TO_ULLONG_RIGHT_MAXIMUM 1 +/* #undef H5_FP_TO_ULLONG_RIGHT_MAXIMUM */ /* Define if gettimeofday() populates the tz pointer passed in */ #define H5_GETTIMEOFDAY_GIVES_TZ 1 /* Define to 1 if you have the `alarm' function. */ -#define H5_HAVE_ALARM 1 +/* #undef H5_HAVE_ALARM */ /* Define if the __attribute__(()) extension is present */ -#define H5_HAVE_ATTRIBUTE 1 +/* #undef H5_HAVE_ATTRIBUTE */ /* Define to 1 if you have the `BSDgettimeofday' function. */ /* #undef H5_HAVE_BSDGETTIMEOFDAY */ /* Define if the compiler understands C99 designated initialization of structs and unions */ -#define H5_HAVE_C99_DESIGNATED_INITIALIZER 1 +/* #undef H5_HAVE_C99_DESIGNATED_INITIALIZER */ /* Define if the compiler understands the __func__ keyword */ -#define H5_HAVE_C99_FUNC 1 - -/* Define to 1 if you have the `clock_gettime' function. */ -/* #undef H5_HAVE_CLOCK_GETTIME */ +/* #undef H5_HAVE_C99_FUNC */ /* Define if the function stack tracing code is to be compiled in */ /* #undef H5_HAVE_CODESTACK */ -/* Define if Darwin or Mac OS X */ -#define H5_HAVE_DARWIN 1 - /* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. */ -/* #undef H5_HAVE_DECL_TZNAME */ +#define H5_HAVE_DECL_TZNAME 1 /* Define to 1 if you have the `difftime' function. */ #define H5_HAVE_DIFFTIME 1 @@ -92,11 +118,8 @@ /* Define if the direct I/O virtual file driver should be compiled */ /* #undef H5_HAVE_DIRECT */ -/* Define to 1 if you have the header file. */ -#define H5_HAVE_DIRENT_H 1 - /* Define to 1 if you have the header file. */ -#define H5_HAVE_DLFCN_H 1 +/* #undef H5_HAVE_DLFCN_H */ /* Define to 1 if you have the header file. */ /* #undef H5_HAVE_DMALLOC_H */ @@ -123,28 +146,28 @@ #define H5_HAVE_FILTER_SHUFFLE 1 /* Define if support for szip filter is enabled */ -/* #undef H5_HAVE_FILTER_SZIP */ +#define H5_HAVE_FILTER_SZIP 1 /* Define to 1 if you have the `fork' function. */ -#define H5_HAVE_FORK 1 +/* #undef H5_HAVE_FORK */ /* Define to 1 if you have the `frexpf' function. */ -#define H5_HAVE_FREXPF 1 +/* #undef H5_HAVE_FREXPF */ /* Define to 1 if you have the `frexpl' function. */ -#define H5_HAVE_FREXPL 1 +/* #undef H5_HAVE_FREXPL */ /* Define to 1 if you have the `fseeko' function. */ -#define H5_HAVE_FSEEKO 1 +/* #undef H5_HAVE_FSEEKO */ /* Define to 1 if you have the `fseeko64' function. */ /* #undef H5_HAVE_FSEEKO64 */ /* Define to 1 if you have the `fstat64' function. */ -#define H5_HAVE_FSTAT64 1 +/* #undef H5_HAVE_FSTAT64 */ /* Define to 1 if you have the `ftello' function. */ -#define H5_HAVE_FTELLO 1 +/* #undef H5_HAVE_FTELLO */ /* Define to 1 if you have the `ftello64' function. */ /* #undef H5_HAVE_FTELLO64 */ @@ -156,16 +179,16 @@ #define H5_HAVE_FUNCTION 1 /* Define to 1 if you have the `GetConsoleScreenBufferInfo' function. */ -/* #undef H5_HAVE_GETCONSOLESCREENBUFFERINFO */ +#define H5_HAVE_GETCONSOLESCREENBUFFERINFO 1 /* Define to 1 if you have the `gethostname' function. */ #define H5_HAVE_GETHOSTNAME 1 /* Define to 1 if you have the `getpwuid' function. */ -#define H5_HAVE_GETPWUID 1 +/* #undef H5_HAVE_GETPWUID */ /* Define to 1 if you have the `getrusage' function. */ -#define H5_HAVE_GETRUSAGE 1 +/* #undef H5_HAVE_GETRUSAGE */ /* Define to 1 if you have the `gettextinfo' function. */ /* #undef H5_HAVE_GETTEXTINFO */ @@ -173,6 +196,12 @@ /* Define to 1 if you have the `gettimeofday' function. */ #define H5_HAVE_GETTIMEOFDAY 1 +/* Define to 1 if you have the `gettimeofday' function declared in time.h . */ +/* #undef H5_HAVE_TIME_GETTIMEOFDAY */ + +/* Define to 1 if you have the `gettimeofday' function declared in sys/time.h . */ +/* #undef H5_HAVE_SYS_TIME_GETTIMEOFDAY */ + /* Define to 1 if you have the `get_fpc_csr' function. */ /* #undef H5_HAVE_GET_FPC_CSR */ @@ -187,16 +216,13 @@ /* #undef H5_HAVE_INSTRUMENTED_LIBRARY */ /* Define to 1 if you have the header file. */ -#define H5_HAVE_INTTYPES_H 1 +/* #undef H5_HAVE_INTTYPES_H */ /* Define to 1 if you have the `ioctl' function. */ -#define H5_HAVE_IOCTL 1 +/* #undef H5_HAVE_IOCTL */ /* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_IO_H */ - -/* Define to 1 if you have the `dl' library (-ldl). */ -#define H5_HAVE_LIBDL 1 +#define H5_HAVE_IO_H 1 /* Define to 1 if you have the `dmalloc' library (-ldmalloc). */ /* #undef H5_HAVE_LIBDMALLOC */ @@ -229,10 +255,7 @@ /* #undef H5_HAVE_LIBSOCKET */ /* Define to 1 if you have the `sz' library (-lsz). */ -/* #undef H5_HAVE_LIBSZ */ - -/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ -/* #undef H5_HAVE_LIBWS2_32 */ +#define H5_HAVE_LIBSZ 1 /* Define to 1 if you have the `z' library (-lz). */ #define H5_HAVE_LIBZ 1 @@ -244,10 +267,10 @@ /* #undef H5_HAVE_LSEEK64 */ /* Define to 1 if you have the `lstat' function. */ -#define H5_HAVE_LSTAT 1 +/* #undef H5_HAVE_LSTAT */ /* Define to 1 if you have the header file. */ -#define H5_HAVE_MACH_MACH_TIME_H 1 +/* #undef H5_HAVE_MACH_MACH_TIME_H */ /* Define to 1 if you have the header file. */ #define H5_HAVE_MEMORY_H 1 @@ -273,14 +296,17 @@ /* Define to 1 if you have the header file. */ /* #undef H5_HAVE_PTHREAD_H */ +/* Define to 1 if you have the 'InitOnceExecuteOnce' function. */ +/* #undef H5_HAVE_WIN_THREADS */ + /* Define to 1 if you have the `random' function. */ -#define H5_HAVE_RANDOM 1 +/* #undef H5_HAVE_RANDOM */ /* Define to 1 if you have the `rand_r' function. */ -#define H5_HAVE_RAND_R 1 +/* #undef H5_HAVE_RAND_R */ -/* Define to 1 if you have the `setjmp' function. */ -#define H5_HAVE_SETJMP 1 +/* Define to 1 if you have the `sigsetjmp' function. */ +/* #undef H5_HAVE_SETJMP */ /* Define to 1 if you have the header file. */ #define H5_HAVE_SETJMP_H 1 @@ -288,29 +314,32 @@ /* Define to 1 if you have the `setsysinfo' function. */ /* #undef H5_HAVE_SETSYSINFO */ +/* Define to 1 if you have the `sigaction' function. */ +/* #undef H5_HAVE_SIGACTION */ + /* Define to 1 if you have the `siglongjmp' function. */ -#define H5_HAVE_SIGLONGJMP 1 +/* #undef H5_HAVE_SIGLONGJMP */ /* Define to 1 if you have the `signal' function. */ #define H5_HAVE_SIGNAL 1 /* Define to 1 if you have the `sigprocmask' function. */ -#define H5_HAVE_SIGPROCMASK 1 +/* #undef H5_HAVE_SIGPROCMASK */ /* Define to 1 if you have the `sigsetjmp' function. */ -#define H5_HAVE_SIGSETJMP 1 +/* #undef H5_HAVE_SIGSETJMP */ /* Define to 1 if you have the `snprintf' function. */ -#define H5_HAVE_SNPRINTF 1 +/* #undef H5_HAVE_SNPRINTF */ /* Define to 1 if you have the `srandom' function. */ -#define H5_HAVE_SRANDOM 1 +/* #undef H5_HAVE_SRANDOM */ /* Define to 1 if you have the `stat64' function. */ -#define H5_HAVE_STAT64 1 +/* #undef H5_HAVE_STAT64 */ /* Define if `struct stat' has the `st_blocks' field */ -#define H5_HAVE_STAT_ST_BLOCKS 1 +/* #undef H5_HAVE_STAT_ST_BLOCKS */ /* Define to 1 if you have the header file. */ #define H5_HAVE_STDDEF_H 1 @@ -318,6 +347,9 @@ /* Define to 1 if you have the header file. */ #define H5_HAVE_STDINT_H 1 +/* Define to 1 if you have the header file for Cplusplus. */ +#define H5_HAVE_STDINT_H_CXX 1 + /* Define to 1 if you have the header file. */ #define H5_HAVE_STDLIB_H 1 @@ -325,7 +357,7 @@ #define H5_HAVE_STRDUP 1 /* Define to 1 if you have the header file. */ -#define H5_HAVE_STRINGS_H 1 +/* #undef H5_HAVE_STRINGS_H */ /* Define to 1 if you have the header file. */ #define H5_HAVE_STRING_H 1 @@ -334,16 +366,16 @@ /* #undef H5_HAVE_STRUCT_TEXT_INFO */ /* Define if `struct timezone' is defined */ -#define H5_HAVE_STRUCT_TIMEZONE 1 +/* #undef H5_HAVE_STRUCT_TIMEZONE */ /* Define to 1 if `tm_zone' is a member of `struct tm'. */ -#define H5_HAVE_STRUCT_TM_TM_ZONE 1 +/* #undef H5_HAVE_STRUCT_TM_TM_ZONE */ /* Define if `struct videoconfig' is defined */ /* #undef H5_HAVE_STRUCT_VIDEOCONFIG */ /* Define to 1 if you have the `symlink' function. */ -#define H5_HAVE_SYMLINK 1 +/* #undef H5_HAVE_SYMLINK */ /* Define to 1 if you have the `system' function. */ #define H5_HAVE_SYSTEM 1 @@ -352,16 +384,16 @@ /* #undef H5_HAVE_SYS_FPU_H */ /* Define to 1 if you have the header file. */ -#define H5_HAVE_SYS_IOCTL_H 1 +/* #undef H5_HAVE_SYS_IOCTL_H */ /* Define to 1 if you have the header file. */ /* #undef H5_HAVE_SYS_PROC_H */ /* Define to 1 if you have the header file. */ -#define H5_HAVE_SYS_RESOURCE_H 1 +/* #undef H5_HAVE_SYS_RESOURCE_H */ /* Define to 1 if you have the header file. */ -#define H5_HAVE_SYS_SOCKET_H 1 +/* #undef H5_HAVE_SYS_SOCKET_H */ /* Define to 1 if you have the header file. */ #define H5_HAVE_SYS_STAT_H 1 @@ -372,14 +404,17 @@ /* Define to 1 if you have the header file. */ #define H5_HAVE_SYS_TIMEB_H 1 +/* Define to 1 if you have the header file. */ +#define H5_HAVE_TIME_H 1 + /* Define to 1 if you have the header file. */ -#define H5_HAVE_SYS_TIME_H 1 +/* #undef H5_HAVE_SYS_TIME_H */ /* Define to 1 if you have the header file. */ #define H5_HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_SZLIB_H */ +#define H5_HAVE_SZLIB_H 1 /* Define if we have thread safe support */ /* #undef H5_HAVE_THREADSAFE */ @@ -388,42 +423,42 @@ #define H5_HAVE_TIMEZONE 1 /* Define if the ioctl TIOCGETD is defined */ -#define H5_HAVE_TIOCGETD 1 +/* #undef H5_HAVE_TIOCGETD */ /* Define if the ioctl TIOGWINSZ is defined */ -#define H5_HAVE_TIOCGWINSZ 1 +/* #undef H5_HAVE_TIOCGWINSZ */ /* Define to 1 if you have the `tmpfile' function. */ #define H5_HAVE_TMPFILE 1 /* Define if `tm_gmtoff' is a member of `struct tm' */ -#define H5_HAVE_TM_GMTOFF 1 +/* #undef H5_HAVE_TM_GMTOFF */ /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use `HAVE_STRUCT_TM_TM_ZONE' instead. */ -#define H5_HAVE_TM_ZONE 1 +/* #undef H5_HAVE_TM_ZONE */ /* Define to 1 if you don't have `tm_zone' but do have the external array `tzname'. */ /* #undef H5_HAVE_TZNAME */ /* Define to 1 if you have the header file. */ -#define H5_HAVE_UNISTD_H 1 +/* #undef H5_HAVE_UNISTD_H */ /* Define to 1 if you have the `vasprintf' function. */ -#define H5_HAVE_VASPRINTF 1 +/* #undef H5_HAVE_VASPRINTF */ /* Define to 1 if you have the `vsnprintf' function. */ #define H5_HAVE_VSNPRINTF 1 /* Define to 1 if you have the `waitpid' function. */ -#define H5_HAVE_WAITPID 1 +/* #undef H5_HAVE_WAITPID */ /* Define if your system has window style path name. */ -/* #undef H5_HAVE_WINDOW_PATH */ +#define H5_HAVE_WINDOW_PATH 1 -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_WINSOCK2_H */ +/* Define to 1 if you have the header file. */ +#define H5_HAVE_WINSOCK_H 1 /* Define to 1 if you have the header file. */ #define H5_HAVE_ZLIB_H 1 @@ -479,7 +514,7 @@ /* Define to the sub-directory in which libtool stores uninstalled libraries. */ -#define H5_LT_OBJDIR ".libs/" +/* #undef H5_LT_OBJDIR */ /* Define if the metadata trace file code is to be compiled in */ /* #undef H5_METADATA_TRACE_FILE */ @@ -507,16 +542,16 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.8.11" +#define H5_PACKAGE_STRING "HDF5 1.8.9" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" /* Define to the home page for this package. */ -#define H5_PACKAGE_URL "" +#define H5_PACKAGE_URL "http://www.hdfgroup.org" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.8.11" +#define H5_PACKAGE_VERSION "1.8.9" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -546,7 +581,7 @@ #define H5_SIZEOF_INT8_T 1 /* The size of `int_fast16_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST16_T 2 +#define H5_SIZEOF_INT_FAST16_T 4 /* The size of `int_fast32_t', as computed by sizeof. */ #define H5_SIZEOF_INT_FAST32_T 4 @@ -569,33 +604,52 @@ /* The size of `int_least8_t', as computed by sizeof. */ #define H5_SIZEOF_INT_LEAST8_T 1 +#if !defined(__APPLE__) +/* The size of `size_t', as computed by sizeof. */ +#define H5_SIZEOF_SIZE_T 4 + +/* The size of `ssize_t', as computed by sizeof. */ +#define H5_SIZEOF_SSIZE_T 0 + /* The size of `long', as computed by sizeof. */ #define H5_SIZEOF_LONG 4 +#else + # if defined(__LP64__) && __LP64__ + #define H5_SIZEOF_LONG 8 + #define H5_SIZEOF_SIZE_T 8 + #define H5_SIZEOF_SSIZE_T 8 + # else + #define H5_SIZEOF_LONG 4 + #define H5_SIZEOF_SIZE_T 4 + #define H5_SIZEOF_SSIZE_T 4 + # endif + +#endif + /* The size of `long double', as computed by sizeof. */ -#define H5_SIZEOF_LONG_DOUBLE 16 +#define H5_SIZEOF_LONG_DOUBLE 8 -/* The size of `long long', as computed by sizeof. */ -#define H5_SIZEOF_LONG_LONG 8 +/* Define size of long long and/or __int64 bit integer type only if the type + exists. */ +#if !defined(__APPLE__) + #define H5_SIZEOF_LONG_LONG 8 +#else + #define H5_SIZEOF_LONG_LONG 8 +#endif /* The size of `off64_t', as computed by sizeof. */ #define H5_SIZEOF_OFF64_T 0 /* The size of `off_t', as computed by sizeof. */ -#define H5_SIZEOF_OFF_T 8 +#define H5_SIZEOF_OFF_T 4 /* The size of `ptrdiff_t', as computed by sizeof. */ -#define H5_SIZEOF_PTRDIFF_T 4 +/* #define H5_SIZEOF_PTRDIFF_T */ /* The size of `short', as computed by sizeof. */ #define H5_SIZEOF_SHORT 2 -/* The size of `size_t', as computed by sizeof. */ -#define H5_SIZEOF_SIZE_T 4 - -/* The size of `ssize_t', as computed by sizeof. */ -#define H5_SIZEOF_SSIZE_T 4 - /* The size of `uint16_t', as computed by sizeof. */ #define H5_SIZEOF_UINT16_T 2 @@ -609,7 +663,7 @@ #define H5_SIZEOF_UINT8_T 1 /* The size of `uint_fast16_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST16_T 2 +#define H5_SIZEOF_UINT_FAST16_T 4 /* The size of `uint_fast32_t', as computed by sizeof. */ #define H5_SIZEOF_UINT_FAST32_T 4 @@ -636,7 +690,7 @@ #define H5_SIZEOF_UNSIGNED 4 /* The size of `__int64', as computed by sizeof. */ -#define H5_SIZEOF___INT64 0 +#define H5_SIZEOF___INT64 8 /* Define to 1 if you have the ANSI C header files. */ #define H5_STDC_HEADERS 1 @@ -646,10 +700,10 @@ /* Define if your system supports pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM) call. */ -#define H5_SYSTEM_SCOPE_THREADS 1 +/* #undef H5_SYSTEM_SCOPE_THREADS */ /* Define to 1 if you can safely include both and . */ -#define H5_TIME_WITH_SYS_TIME 1 +/* #undef H5_TIME_WITH_SYS_TIME */ /* Define to 1 if your declares `struct tm'. */ /* #undef H5_TM_IN_SYS_TIME */ @@ -660,7 +714,7 @@ /* Define if your system can convert unsigned long long to long double with correct precision. */ -#define H5_ULLONG_TO_LDOUBLE_PRECISION 1 +/* #undef H5_ULLONG_TO_LDOUBLE_PRECISION */ /* Define if your system accurately converting unsigned long to float values. */ @@ -668,7 +722,7 @@ /* Define if your system can accurately convert unsigned (long) long values to floating-point values. */ -#define H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE 1 +/* #undef H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE */ /* Define using v1.6 public API symbols by default */ /* #undef H5_USE_16_API_DEFAULT */ @@ -679,11 +733,11 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.8.11" +#define VERSION "1.8.9" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ -#define H5_VSNPRINTF_WORKS 1 +/* #undef H5_VSNPRINTF_WORKS */ /* Data accuracy is prefered to speed during data conversions */ #define H5_WANT_DATA_ACCURACY 1 @@ -693,21 +747,23 @@ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 +#if !defined(__APPLE__) +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN # endif #else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 # endif #endif +/* #undef WORDS_BIGENDIAN */ + /* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef H5__FILE_OFFSET_BITS */ +/* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ -/* #undef H5__LARGE_FILES */ +/* #undef _LARGE_FILES */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef H5_const */ @@ -715,7 +771,7 @@ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus -/* #undef H5_inline */ +#define H5_inline __inline #endif /* Define to `long int' if does not define. */ @@ -729,3 +785,9 @@ /* Define to `long' if does not define. */ /* #undef H5_ssize_t */ + +#if defined(__cplusplus) && defined(inline) +#undef inline +#endif + +#endif diff --git a/libs/alembic/include/H5public.h b/libs/alembic/include/H5public.h index b022ca7..bb5895d 100644 --- a/libs/alembic/include/H5public.h +++ b/libs/alembic/include/H5public.h @@ -75,10 +75,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 8 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 11 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 9 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.8.11" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.8.9" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/libs/alembic/include/OpenEXR/IlmBaseConfig.h b/libs/alembic/include/OpenEXR/IlmBaseConfig.h index 98d4e55..3ab0479 100644 --- a/libs/alembic/include/OpenEXR/IlmBaseConfig.h +++ b/libs/alembic/include/OpenEXR/IlmBaseConfig.h @@ -12,5 +12,5 @@ // own semaphore implementation. // -/* #undef HAVE_POSIX_SEMAPHORES */ +#define HAVE_POSIX_SEMAPHORES 1 diff --git a/libs/alembic/include/hdf5_hl.h b/libs/alembic/include/hdf5_hl.h index 4643932..0fff932 100644 --- a/libs/alembic/include/hdf5_hl.h +++ b/libs/alembic/include/hdf5_hl.h @@ -22,7 +22,6 @@ #ifndef _HDF5_HL_H #define _HDF5_HL_H -#include "H5DOpublic.h" /* dataset optimization */ #include "H5DSpublic.h" /* dimension scales */ #include "H5LTpublic.h" /* lite */ #include "H5IMpublic.h" /* image */ diff --git a/libs/alembic/include/ricehdf.h b/libs/alembic/include/ricehdf.h deleted file mode 100644 index c1be7a2..0000000 --- a/libs/alembic/include/ricehdf.h +++ /dev/null @@ -1,86 +0,0 @@ -/*============================================================================== -The SZIP Science Data Lossless Compression Program is Copyright (C) 2001 Science -& Technology Corporation @ UNM. All rights released. Copyright (C) 2003 Lowell -H. Miles and Jack A. Venbrux. Licensed to ICs Corp. for distribution by the -University of Illinois' National Center for Supercomputing Applications as a -part of the HDF data storage and retrieval file format and software library -products package. All rights reserved. Do not modify or use for other -purposes. - -SZIP implements an extended Rice adaptive lossless compression algorithm -for sample data. The primary algorithm was developed by R. F. Rice at -Jet Propulsion Laboratory. - -SZIP embodies certain inventions patented by the National Aeronautics & -Space Administration. United States Patent Nos. 5,448,642, 5,687,255, -and 5,822,457 have been licensed to ICs Corp. for distribution with the -HDF data storage and retrieval file format and software library products. -All rights reserved. - -Revocable (in the event of breach by the user or if required by law), -royalty-free, nonexclusive sublicense to use SZIP decompression software -routines and underlying patents is hereby granted by ICs Corp. to all users -of and in conjunction with HDF data storage and retrieval file format and -software library products. - -Revocable (in the event of breach by the user or if required by law), -royalty-free, nonexclusive sublicense to use SZIP compression software -routines and underlying patents for non-commercial, scientific use only -is hereby granted by ICs Corp. to users of and in conjunction with HDF -data storage and retrieval file format and software library products. - -For commercial use license to SZIP compression software routines and underlying -patents please contact ICs Corp. at ICs Corp., 721 Lochsa Street, Suite 8, -Post Falls, ID 83854. (208) 262-2008. - -==============================================================================*/ -/********************************************************/ -/* defines and declarations to interface to the szip */ -/* functions in file rice.c. */ -/* USE EXTREME CARE WHEN MODIFYING THIS FILE */ -/********************************************************/ -extern int szip_allow_encoding; - -#define SZ_ALLOW_K13_OPTION_MASK 1 -#define SZ_CHIP_OPTION_MASK 2 -#define SZ_EC_OPTION_MASK 4 -#define SZ_LSB_OPTION_MASK 8 -#define SZ_MSB_OPTION_MASK 16 -#define SZ_NN_OPTION_MASK 32 -#define SZ_RAW_OPTION_MASK 128 - -#define SZ_STREAM_ERROR (-1) -#define SZ_MEM_ERROR (-2) -#define SZ_INIT_ERROR (-3) -#define SZ_PARAM_ERROR (-4) -#define SZ_NO_ENCODER_ERROR (-5) - -#define SZ_MAX_BLOCKS_PER_SCANLINE 128 -#define SZ_MAX_PIXELS_PER_BLOCK 32 -#define SZ_MAX_PIXELS_PER_SCANLINE (SZ_MAX_BLOCKS_PER_SCANLINE)*(SZ_MAX_PIXELS_PER_BLOCK) - -long szip_compress_memory( - int options_mask, - int bits_per_pixel, - int pixels_per_block, - int pixels_per_scanline, - const void *in, - long pixels, - char *out); - -long szip_uncompress_memory( - int new_options_mask, - int new_bits_per_pixel, - int new_pixels_per_block, - int new_pixels_per_scanline, - const char *in, - long in_bytes, - void *out, - long out_pixels); - -int szip_check_params( - int bits_per_pixel, - int pixels_per_block, - int pixels_per_scanline, - long image_pixels, - char **msg); diff --git a/libs/alembic/include/szip_adpt.h b/libs/alembic/include/szip_adpt.h index 275f516..2e5a517 100644 --- a/libs/alembic/include/szip_adpt.h +++ b/libs/alembic/include/szip_adpt.h @@ -35,7 +35,7 @@ #if defined(WIN32) && !defined(__MWERKS__) #if defined(_SZDLL_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define __SZ_DLL__ __declspec(dllexport) /*#define __DLLVARH425__ __declspec(dllexport)*/ #elif defined(_SZUSEDLL_) @@ -47,7 +47,7 @@ #endif /* _SZDLL_ */ #else /*WIN32*/ -#define __SZ_DLL__ +#define __SZ_DLL__ extern /*#define __DLLVAR__ extern*/ #endif diff --git a/libs/alembic/lib/osx/libAlembicAbc.a b/libs/alembic/lib/osx/libAlembicAbc.a deleted file mode 100644 index df2cfe6..0000000 Binary files a/libs/alembic/lib/osx/libAlembicAbc.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libAlembicAbcCollection.a b/libs/alembic/lib/osx/libAlembicAbcCollection.a deleted file mode 100644 index de429e2..0000000 Binary files a/libs/alembic/lib/osx/libAlembicAbcCollection.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libAlembicAbcCoreAbstract.a b/libs/alembic/lib/osx/libAlembicAbcCoreAbstract.a deleted file mode 100644 index 807c312..0000000 Binary files a/libs/alembic/lib/osx/libAlembicAbcCoreAbstract.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libAlembicAbcCoreHDF5.a b/libs/alembic/lib/osx/libAlembicAbcCoreHDF5.a deleted file mode 100644 index 100ad09..0000000 Binary files a/libs/alembic/lib/osx/libAlembicAbcCoreHDF5.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libAlembicAbcGeom.a b/libs/alembic/lib/osx/libAlembicAbcGeom.a deleted file mode 100644 index ab95de5..0000000 Binary files a/libs/alembic/lib/osx/libAlembicAbcGeom.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libAlembicAbcMaterial.a b/libs/alembic/lib/osx/libAlembicAbcMaterial.a deleted file mode 100644 index 46c4ae2..0000000 Binary files a/libs/alembic/lib/osx/libAlembicAbcMaterial.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libAlembicUtil.a b/libs/alembic/lib/osx/libAlembicUtil.a deleted file mode 100644 index 209b6d1..0000000 Binary files a/libs/alembic/lib/osx/libAlembicUtil.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libHalf.a b/libs/alembic/lib/osx/libHalf.a deleted file mode 100644 index a6f4448..0000000 Binary files a/libs/alembic/lib/osx/libHalf.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libIex.a b/libs/alembic/lib/osx/libIex.a deleted file mode 100644 index 892ab68..0000000 Binary files a/libs/alembic/lib/osx/libIex.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libIlmThread.a b/libs/alembic/lib/osx/libIlmThread.a deleted file mode 100644 index 9196d8c..0000000 Binary files a/libs/alembic/lib/osx/libIlmThread.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libImath.a b/libs/alembic/lib/osx/libImath.a deleted file mode 100644 index 0195121..0000000 Binary files a/libs/alembic/lib/osx/libImath.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libhdf5.a b/libs/alembic/lib/osx/libhdf5.a deleted file mode 100644 index b65ed6c..0000000 Binary files a/libs/alembic/lib/osx/libhdf5.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libhdf5_hl.a b/libs/alembic/lib/osx/libhdf5_hl.a deleted file mode 100644 index f3101cc..0000000 Binary files a/libs/alembic/lib/osx/libhdf5_hl.a and /dev/null differ diff --git a/libs/alembic/lib/osx/libsz.a b/libs/alembic/lib/osx/libsz.a deleted file mode 100644 index e57884e..0000000 Binary files a/libs/alembic/lib/osx/libsz.a and /dev/null differ diff --git a/libs/alembic/lib/vs/vs.rar b/libs/alembic/lib/vs/vs.rar new file mode 100644 index 0000000..2c32734 Binary files /dev/null and b/libs/alembic/lib/vs/vs.rar differ diff --git a/src/ofxAlembicType.cpp b/src/ofxAlembicType.cpp index 6781fe0..37f107e 100644 --- a/src/ofxAlembicType.cpp +++ b/src/ofxAlembicType.cpp @@ -1,5 +1,11 @@ #include "ofxAlembicType.h" + +#if (_MSC_VER) +#include +#endif + + using namespace ofxAlembic; using namespace Alembic::AbcGeom; @@ -18,7 +24,7 @@ void Points::get(OPointsSchema &schema) const int num = points.size(); vector positions(num); - vector ids(num); + vector<::uint64_t> ids(num); for (int i = 0; i < num; i++) { @@ -67,8 +73,8 @@ void Points::draw() void PolyMesh::get(OPolyMeshSchema &schema) const { vector positions; - vector indexes; - vector counts; + vector <::int32_t> indexes; + vector<::int32_t> counts; vector uvs; vector norms; @@ -253,7 +259,7 @@ void PolyMesh::set(IPolyMeshSchema &schema, float time, const Imath::M44f& trans { const V3f *points = m_meshP->get(); - const int32_t *indices = m_meshIndices->get(); + const ::int32_t *indices = m_meshIndices->get(); V3f dst; vector verts; @@ -338,7 +344,7 @@ void PolyMesh::draw() void Curves::get(OCurvesSchema &schema) const { vector positions; - vector num_vertices; + vector<::int32_t> num_vertices; for (int n = 0; n < curves.size(); n++) { diff --git a/src/ofxAlembicType.h b/src/ofxAlembicType.h index 96e276e..f48db43 100644 --- a/src/ofxAlembicType.h +++ b/src/ofxAlembicType.h @@ -7,6 +7,7 @@ #include "ofxAlembicUtil.h" + namespace ofxAlembic { class PolyMesh;