Salome HOME
Implementation of the "21046: EDF 1610 GUI: To be able to change the width of the...
[modules/geom.git] / src / GEOM_I_Superv / GEOM_List_i.hh
1 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef __GEOM_LIST_I_H__
24 #define __GEOM_LIST_I_H__
25
26 #include "GEOM_I_Superv.hxx"
27
28 // IDL headers
29 #include <SALOMEconfig.h>
30 #include CORBA_SERVER_HEADER(GEOM_Superv)
31
32 #include "GEOM_Gen_i.hh"
33 #include "utilities.h"
34
35 template <class Type>
36 class GEOM_I_SUPERV_EXPORT GEOM_List_i : 
37   public virtual POA_GEOM::GEOM_List,
38   public virtual PortableServer::RefCountServantBase
39 {
40 public:
41   GEOM_List_i();
42   GEOM_List_i(const Type& theListToCopy);
43   ~GEOM_List_i();
44
45   const Type& GetList();
46
47   template <class ElemType>
48   void AddObject(ElemType theObject);
49
50 private:
51   Type myGOList;
52 };
53
54 //=============================================================================
55 //  constructor:
56 //=============================================================================
57 template <class Type>
58 GEOM_List_i<Type>::GEOM_List_i()
59 {
60   MESSAGE("GEOM_List_i::GEOM_List_i");
61   //create an empty list
62   myGOList.length(0);
63 }
64
65 //=============================================================================
66 //  constructor:
67 //=============================================================================
68 template <class Type>
69 GEOM_List_i<Type>::GEOM_List_i(const Type& theListToCopy)
70 {
71   int aLength = theListToCopy.length();
72   myGOList.length(aLength);
73   for (int i = 0; i < aLength; i++)
74     myGOList[i] = theListToCopy[i];
75 }
76
77 //=============================================================================
78 //  destructor:
79 //=============================================================================
80 template <class Type>
81 GEOM_List_i<Type>::~GEOM_List_i()
82 {
83   MESSAGE("GEOM_List_i::~GEOM_List_i");
84 }
85
86 //=============================================================================
87 //  GetList:
88 //=============================================================================
89 template <class Type>
90 const Type& GEOM_List_i<Type>::GetList()
91 {
92   MESSAGE("GEOM_List_i::GetList()");
93   return myGOList;
94 }
95
96 //=============================================================================
97 //  AddObject:
98 //=============================================================================
99 template <class Type>
100 template <class ElemType>
101 void GEOM_List_i<Type>::AddObject(ElemType theObject)
102 {
103   MESSAGE("GEOM_List_i::AddObject(...)");
104   int aLength = myGOList.length();
105   myGOList.length(aLength+1);
106   myGOList[aLength] = theObject;
107 }
108
109 #endif