Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-10 09:17:28

0001 // Created on: 2014-03-31
0002 // Created by: Kirill Gavrilov
0003 // Copyright (c) 2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef NCollection_AlignedAllocator_HeaderFile
0017 #define NCollection_AlignedAllocator_HeaderFile
0018 
0019 #include <NCollection_BaseAllocator.hxx>
0020 #include <Standard.hxx>
0021 
0022 //! NCollection allocator with managed memory alignment capabilities.
0023 class NCollection_AlignedAllocator : public NCollection_BaseAllocator
0024 {
0025 public:
0026   //! Constructor. The alignment should be specified explicitly:
0027   //! 16 bytes for SSE instructions
0028   //! 32 bytes for AVX instructions
0029   Standard_EXPORT NCollection_AlignedAllocator(const size_t theAlignment);
0030 
0031   //! Allocate memory with given size. Returns NULL on failure.
0032   Standard_EXPORT virtual void* Allocate(const size_t theSize) Standard_OVERRIDE;
0033 
0034   //! Allocate memory with given size. Returns NULL on failure.
0035   void* AllocateOptimal(const size_t theSize) Standard_OVERRIDE { return Allocate(theSize); }
0036 
0037   //! Free a previously allocated memory.
0038   Standard_EXPORT virtual void Free(void* thePtr) Standard_OVERRIDE;
0039 
0040 private:
0041   NCollection_AlignedAllocator(const NCollection_AlignedAllocator&);
0042   NCollection_AlignedAllocator& operator=(const NCollection_AlignedAllocator&);
0043 
0044 protected:
0045   size_t myAlignment; //!< alignment in bytes
0046 
0047 public:
0048   DEFINE_STANDARD_RTTIEXT(NCollection_AlignedAllocator, NCollection_BaseAllocator)
0049 };
0050 
0051 // Definition of HANDLE object using Standard_DefineHandle.hxx
0052 DEFINE_STANDARD_HANDLE(NCollection_AlignedAllocator, NCollection_BaseAllocator)
0053 
0054 #endif // NCollection_AlignedAllocator_HeaderFile