0024023: Revamp the OCCT Handle -- ambiguity
[occt.git] / src / NCollection / NCollection_DefineHSequence.hxx
1 // Created on: 2001-01-29
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2001-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_HSequence.hxx by GAWK
17
18 #ifndef NCollection_DefineHSequence_HeaderFile
19 #define NCollection_DefineHSequence_HeaderFile
20
21 #include <Standard_Type.hxx>
22 #include <NCollection_DefineSequence.hxx>
23 #include <MMgt_TShared.hxx>
24
25 //      Declaration of Sequence class managed by Handle
26
27 #define DEFINE_HSEQUENCE(HClassName, _SequenceType_)                           \
28 class HClassName : public _SequenceType_, public MMgt_TShared {                \
29  public:                                                                       \
30    DEFINE_STANDARD_ALLOC                                                       \
31    DEFINE_NCOLLECTION_ALLOC                                                    \
32    HClassName () {}                                                            \
33    HClassName (const _SequenceType_& theOther) : _SequenceType_(theOther) {}   \
34    const _SequenceType_& Sequence () const { return *this; }                   \
35    void Append (const _SequenceType_::value_type& theItem) {                   \
36      _SequenceType_::Append (theItem);                                         \
37    }                                                                           \
38    void Append (_SequenceType_& theSequence) {                                 \
39      _SequenceType_::Append (theSequence);                                     \
40    }                                                                           \
41    _SequenceType_& ChangeSequence ()       { return *this; }                   \
42    template <class T>                                                          \
43    void Append (const Handle(T)& theOther,                                     \
44                 typename std::enable_if<std::is_base_of<HClassName, T>::value>::type * = 0) { \
45      _SequenceType_::Append (theOther->ChangeSequence());                      \
46    }                                                                           \
47    DEFINE_STANDARD_RTTI (HClassName, MMgt_TShared)                             \
48 }; \
49 DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared) 
50
51 #define IMPLEMENT_HSEQUENCE(HClassName)                                        
52
53
54
55 #endif