Version: 6.3.1

src/GEOM_I_Superv/GEOM_List_i.hh

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 // IDL headers
00027 #include <SALOMEconfig.h>
00028 #include CORBA_SERVER_HEADER(GEOM_Superv)
00029 
00030 #include "GEOM_Gen_i.hh"
00031 #include "utilities.h"
00032 
00033 template <class Type>
00034 class GEOM_List_i : 
00035   public virtual POA_GEOM::GEOM_List,
00036   public virtual PortableServer::RefCountServantBase
00037 {
00038 public:
00039   GEOM_List_i();
00040   GEOM_List_i(const Type& theListToCopy);
00041   ~GEOM_List_i();
00042 
00043   const Type& GetList();
00044 
00045   template <class ElemType>
00046   void AddObject(ElemType theObject);
00047 
00048 private:
00049   Type myGOList;
00050 };
00051 
00052 //=============================================================================
00053 //  constructor:
00054 //=============================================================================
00055 template <class Type>
00056 GEOM_List_i<Type>::GEOM_List_i()
00057 {
00058   MESSAGE("GEOM_List_i::GEOM_List_i");
00059   //create an empty list
00060   myGOList.length(0);
00061 }
00062 
00063 //=============================================================================
00064 //  constructor:
00065 //=============================================================================
00066 template <class Type>
00067 GEOM_List_i<Type>::GEOM_List_i(const Type& theListToCopy)
00068 {
00069   int aLength = theListToCopy.length();
00070   myGOList.length(aLength);
00071   for (int i = 0; i < aLength; i++)
00072     myGOList[i] = theListToCopy[i];
00073 }
00074 
00075 //=============================================================================
00076 //  destructor:
00077 //=============================================================================
00078 template <class Type>
00079 GEOM_List_i<Type>::~GEOM_List_i()
00080 {
00081   MESSAGE("GEOM_List_i::~GEOM_List_i");
00082 }
00083 
00084 //=============================================================================
00085 //  GetList:
00086 //=============================================================================
00087 template <class Type>
00088 const Type& GEOM_List_i<Type>::GetList()
00089 {
00090   MESSAGE("GEOM_List_i::GetList()");
00091   return myGOList;
00092 }
00093 
00094 //=============================================================================
00095 //  AddObject:
00096 //=============================================================================
00097 template <class Type>
00098 template <class ElemType>
00099 void GEOM_List_i<Type>::AddObject(ElemType theObject)
00100 {
00101   MESSAGE("GEOM_List_i::AddObject(...)");
00102   int aLength = myGOList.length();
00103   myGOList.length(aLength+1);
00104   myGOList[aLength] = theObject;
00105 }
00106 
00107 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS