0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / NCollection / NCollection_AlignedAllocator.hxx
CommitLineData
acc62560 1// Created on: 2014-03-31
2// Created by: Kirill Gavrilov
3// Copyright (c) 2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef NCollection_AlignedAllocator_HeaderFile
17#define NCollection_AlignedAllocator_HeaderFile
18
19#include <NCollection_BaseAllocator.hxx>
20#include <Standard.hxx>
21
22//! NCollection allocator with managed memory alignment capabilities.
23class NCollection_AlignedAllocator : public NCollection_BaseAllocator
24{
25public:
26
27 //! Constructor. The alignment should be specified explicitly:
28 //! 16 bytes for SSE instructions
29 //! 32 bytes for AVX instructions
30 Standard_EXPORT NCollection_AlignedAllocator (const size_t theAlignment);
31
32 //! Allocate memory with given size. Returns NULL on failure.
79104795 33 Standard_EXPORT virtual void* Allocate (const size_t theSize) Standard_OVERRIDE;
acc62560 34
35 //! Free a previously allocated memory.
79104795 36 Standard_EXPORT virtual void Free (void* thePtr) Standard_OVERRIDE;
acc62560 37
38private:
39
40 NCollection_AlignedAllocator (const NCollection_AlignedAllocator& );
41 NCollection_AlignedAllocator& operator= (const NCollection_AlignedAllocator& );
42
43protected:
44
45 size_t myAlignment; //!< alignment in bytes
46
47public:
48
92efcf78 49 DEFINE_STANDARD_RTTIEXT(NCollection_AlignedAllocator,NCollection_BaseAllocator)
acc62560 50
51};
52
53// Definition of HANDLE object using Standard_DefineHandle.hxx
54DEFINE_STANDARD_HANDLE (NCollection_AlignedAllocator, NCollection_BaseAllocator)
55
56#endif // NCollection_AlignedAllocator_HeaderFile