7ed7467d |
1 | // Copyright (c) 2015 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
14 | |
15 | #ifndef _StdLPersistent_PColStd_HArray1_HeaderFile |
16 | #define _StdLPersistent_PColStd_HArray1_HeaderFile |
17 | |
18 | #include <StdLPersistent_PColStd_HArray1Base.hxx> |
19 | |
20 | #include <StdObjMgt_ReadData.hxx> |
21 | |
22 | #include <NCollection_Handle.hxx> |
23 | #include <NCollection_Array1.hxx> |
24 | |
25 | #include <Standard_TypeDef.hxx> |
26 | |
27 | class StdObjMgt_Persistent; |
28 | |
29 | |
30 | template <class Type> |
31 | class StdLPersistent_PColStd_HArray1 : public StdLPersistent_PColStd_HArray1Base |
32 | { |
33 | public: |
34 | //! Get the value. |
35 | const NCollection_Array1<Type>& Array() const { return *myArray; } |
36 | |
37 | protected: |
38 | virtual void CreateArray (const Standard_Integer theLowerBound, |
39 | const Standard_Integer theUpperBound) |
40 | { |
41 | myArray = new NCollection_Array1<Type> (theLowerBound, theUpperBound); |
42 | } |
43 | |
44 | virtual void ReadValue (StdObjMgt_ReadData& theReadData, |
45 | const Standard_Integer theIndex) |
46 | { |
47 | Type aValue; |
48 | theReadData >> aValue; |
49 | myArray->SetValue (theIndex, aValue); |
50 | } |
51 | |
52 | private: |
53 | NCollection_Handle<NCollection_Array1<Type>> myArray; |
54 | }; |
55 | |
56 | typedef StdLPersistent_PColStd_HArray1<Standard_Integer> |
57 | StdLPersistent_PColStd_HArray1OfInteger; |
58 | |
59 | typedef StdLPersistent_PColStd_HArray1<Handle(StdObjMgt_Persistent)> |
60 | StdLPersistent_PDF_HAttributeArray1; |
61 | |
62 | #endif |