Back to index

salome-geom  6.5.0
GEOM_List_i.hh
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef __GEOM_LIST_I_H__
00024 #define __GEOM_LIST_I_H__
00025 
00026 #include "GEOM_I_Superv.hxx"
00027 
00028 // IDL headers
00029 #include <SALOMEconfig.h>
00030 #include CORBA_SERVER_HEADER(GEOM_Superv)
00031 
00032 #include "GEOM_Gen_i.hh"
00033 #include "utilities.h"
00034 
00035 template <class Type>
00036 class GEOM_I_SUPERV_EXPORT GEOM_List_i : 
00037   public virtual POA_GEOM::GEOM_List,
00038   public virtual PortableServer::RefCountServantBase
00039 {
00040 public:
00041   GEOM_List_i();
00042   GEOM_List_i(const Type& theListToCopy);
00043   ~GEOM_List_i();
00044 
00045   const Type& GetList();
00046 
00047   template <class ElemType>
00048   void AddObject(ElemType theObject);
00049 
00050 private:
00051   Type myGOList;
00052 };
00053 
00054 //=============================================================================
00055 //  constructor:
00056 //=============================================================================
00057 template <class Type>
00058 GEOM_List_i<Type>::GEOM_List_i()
00059 {
00060   MESSAGE("GEOM_List_i::GEOM_List_i");
00061   //create an empty list
00062   myGOList.length(0);
00063 }
00064 
00065 //=============================================================================
00066 //  constructor:
00067 //=============================================================================
00068 template <class Type>
00069 GEOM_List_i<Type>::GEOM_List_i(const Type& theListToCopy)
00070 {
00071   int aLength = theListToCopy.length();
00072   myGOList.length(aLength);
00073   for (int i = 0; i < aLength; i++)
00074     myGOList[i] = theListToCopy[i];
00075 }
00076 
00077 //=============================================================================
00078 //  destructor:
00079 //=============================================================================
00080 template <class Type>
00081 GEOM_List_i<Type>::~GEOM_List_i()
00082 {
00083   MESSAGE("GEOM_List_i::~GEOM_List_i");
00084 }
00085 
00086 //=============================================================================
00087 //  GetList:
00088 //=============================================================================
00089 template <class Type>
00090 const Type& GEOM_List_i<Type>::GetList()
00091 {
00092   MESSAGE("GEOM_List_i::GetList()");
00093   return myGOList;
00094 }
00095 
00096 //=============================================================================
00097 //  AddObject:
00098 //=============================================================================
00099 template <class Type>
00100 template <class ElemType>
00101 void GEOM_List_i<Type>::AddObject(ElemType theObject)
00102 {
00103   MESSAGE("GEOM_List_i::AddObject(...)");
00104   int aLength = myGOList.length();
00105   myGOList.length(aLength+1);
00106   myGOList[aLength] = theObject;
00107 }
00108 
00109 #endif