0024911: Avoid using virtual functions in NCollection classes
[occt.git] / src / NCollection / NCollection_DefineHArray1.hxx
1 // Created on: 2002-04-29
2 // Created by: Alexander KARTOMIN (akm)
3 // Copyright (c) 2002-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 //            Automatically created from NCollection_HArray1.hxx by GAWK
17
18 #ifndef NCollection_DefineHArray1_HeaderFile
19 #define NCollection_DefineHArray1_HeaderFile
20
21 #include <Standard_DefineHandle.hxx>
22 #include <NCollection_DefineArray1.hxx>
23 #include <MMgt_TShared.hxx>
24
25 //      Declaration of Array1 class managed by Handle
26
27 #define DEFINE_HARRAY1(HClassName, _Array1Type_)                               \
28 \
29 class HClassName : public _Array1Type_,                                        \
30                    public MMgt_TShared {                                       \
31  public:                                                                       \
32    DEFINE_STANDARD_ALLOC                                                       \
33    DEFINE_NCOLLECTION_ALLOC                                                    \
34    inline                     HClassName    (const Standard_Integer theLower,  \
35                                              const Standard_Integer theUpper); \
36    inline                     HClassName    (const _Array1Type_&);             \
37    inline const _Array1Type_& Array1        () const;                          \
38    inline _Array1Type_&       ChangeArray1  ();                                \
39    DEFINE_STANDARD_RTTI (HClassName)                                           \
40 };                                                                             \
41                                                                                \
42 DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared)                              \
43                                                                                \
44 inline HClassName::HClassName (const Standard_Integer theLower,                \
45                                const Standard_Integer theUpper) :              \
46        _Array1Type_ (theLower,theUpper),                                       \
47        MMgt_TShared() {}                                                       \
48                                                                                \
49 inline HClassName::HClassName (const _Array1Type_& theOther) :                 \
50        _Array1Type_(theOther),                                                 \
51        MMgt_TShared() {}                                                       \
52                                                                                \
53 inline const _Array1Type_& HClassName::Array1 () const                         \
54 { return * (const _Array1Type_ *) this; }                                      \
55                                                                                \
56 inline _Array1Type_& HClassName::ChangeArray1 ()                               \
57 { return * (_Array1Type_ *) this; }                                            \
58
59 #define IMPLEMENT_HARRAY1(HClassName)                                          \
60 IMPLEMENT_STANDARD_HANDLE  (HClassName, MMgt_TShared)                          \
61 IMPLEMENT_STANDARD_RTTIEXT (HClassName, MMgt_TShared)
62
63 #endif