|
|
|||
File indexing completed on 2026-09-28 09:20:58
0001 // Copyright (c) 2002-2024 OPEN CASCADE SAS 0002 // 0003 // This file is part of Open CASCADE Technology software library. 0004 // 0005 // This library is free software; you can redistribute it and/or modify it under 0006 // the terms of the GNU Lesser General Public License version 2.1 as published 0007 // by the Free Software Foundation, with special exception defined in the file 0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0009 // distribution for complete text of the license and disclaimer of any warranty. 0010 // 0011 // Alternatively, this file may be used under the terms of Open CASCADE 0012 // commercial license or contractual agreement. 0013 0014 #ifndef NCollection_HArray1_HeaderFile 0015 #define NCollection_HArray1_HeaderFile 0016 0017 #include <NCollection_Array1.hxx> 0018 #include <Standard_Type.hxx> 0019 #include <Standard_Transient.hxx> 0020 0021 //! Template class for Handle-managed 1D arrays. 0022 //! Inherits from both NCollection_Array1<TheItemType> and Standard_Transient, 0023 //! providing reference-counted array functionality. 0024 template <typename TheItemType> 0025 class NCollection_HArray1 : public NCollection_Array1<TheItemType>, public Standard_Transient 0026 { 0027 public: 0028 DEFINE_STANDARD_ALLOC 0029 DEFINE_NCOLLECTION_ALLOC 0030 0031 typedef NCollection_Array1<TheItemType> Array1Type; 0032 typedef TheItemType value_type; 0033 0034 public: 0035 //! Default constructor. 0036 NCollection_HArray1() 0037 : Array1Type() 0038 { 0039 } 0040 0041 //! Constructor with bounds. 0042 //! @param theLower lower bound of the array 0043 //! @param theUpper upper bound of the array 0044 NCollection_HArray1(const int theLower, const int theUpper) 0045 : Array1Type(theLower, theUpper) 0046 { 0047 } 0048 0049 //! Constructor with bounds and initial value. 0050 //! @param theLower lower bound of the array 0051 //! @param theUpper upper bound of the array 0052 //! @param theValue initial value for all elements 0053 NCollection_HArray1(const int theLower, const int theUpper, const TheItemType& theValue) 0054 : Array1Type(theLower, theUpper) 0055 { 0056 Array1Type::Init(theValue); 0057 } 0058 0059 //! Constructor from C array. 0060 //! @param theBegin reference to the first element of a C array 0061 //! @param theLower lower bound of the array 0062 //! @param theUpper upper bound of the array 0063 //! @param theUseBuffer flag indicating whether to use external buffer (must be explicit) 0064 explicit NCollection_HArray1(const TheItemType& theBegin, 0065 const int theLower, 0066 const int theUpper, 0067 const bool theUseBuffer) 0068 : Array1Type(theBegin, theLower, theUpper, theUseBuffer) 0069 { 0070 } 0071 0072 //! Copy constructor from array. 0073 //! @param theOther the array to copy from 0074 NCollection_HArray1(const Array1Type& theOther) 0075 : Array1Type(theOther) 0076 { 0077 } 0078 0079 //! Returns const reference to the underlying array. 0080 const Array1Type& Array1() const noexcept { return *this; } 0081 0082 //! Returns mutable reference to the underlying array. 0083 Array1Type& ChangeArray1() noexcept { return *this; } 0084 0085 DEFINE_STANDARD_RTTI_INLINE(NCollection_HArray1, Standard_Transient) 0086 }; 0087 0088 #endif // NCollection_HArray1_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|