Back to index

salome-kernel  6.5.0
test_DataIdContainer.cxx
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 //  File   : test_DataIdContainer.cxx
00024 //  Author : Eric Fayolle (EDF)
00025 //  Module : KERNEL
00026 //
00027 #include "PalmCouplingPolicy.hxx"
00028 
00029 #include "palm_data_short_port_provides.hxx"
00030 
00031 //using namespace PalmCouplingPolicy;
00032 
00033 class TEST1 : public PalmCouplingPolicy {
00034 public:
00035   TEST1() {
00036 
00037   std::cout << "------------  TEST1 --------------" << std::endl;
00038 
00039   // int ret=0;
00040   
00041   CORBA::Long time=1,tag=1;
00042   typedef PalmCouplingPolicy::DataIdContainer DataIdContainer;  
00043   typedef PalmCouplingPolicy::DataId          DataId;
00044     
00045   DataId          dataId(time,tag);   //potentiellement avec un troisième paramètre
00046   //std::vector<CORBA::Long> a(1,time);std::vector<CORBA::Long> b(1,tag);
00047   //DataIdContainer dataIds(a,b);   
00048 
00049   std::cout << "-------- MARK 1 --"<< dataId <<"----------------" << std::endl;
00050    
00051   filtre_conversion * f_time = get_filtre_convert_TIME();
00052   filtre_conversion * f_tag =  get_filtre_convert_TAG(); 
00053 
00054   // On accepte les temps de 1 à 100 sans conversion
00055   filtre_elementaire * f_time_el = new filtre_elementaire(1, 100);
00056   f_time->config_elementaire(*f_time_el);
00057 
00058   // On accepte que les tags 1 et ce sans conversion
00059   filtre_elementaire * f_time_tag = new filtre_elementaire(1);
00060   f_tag->config_elementaire(*f_time_tag);
00061 
00062   DataIdContainer dataIds(dataId,*this);   
00063 
00064   DataIdContainer::iterator dataIdIt = dataIds.begin();
00065 
00066   if (!dataIds.empty())
00067     for (;dataIdIt != dataIds.end();++dataIdIt) {
00068       std::cout << "-------- MARK 2 --"<< *dataIdIt <<"----------------" << std::endl;
00069 
00070     }
00071   }
00072 };
00073 
00074 class TEST2 : public PalmCouplingPolicy {
00075 public:
00076   TEST2() {
00077  
00078     std::cout << "------------  TEST2 --------------" << std::endl;
00079 
00080     // int ret=0;
00081   
00082   CORBA::Long time=1,tag=1;
00083   typedef PalmCouplingPolicy::DataIdContainer DataIdContainer;  
00084   typedef PalmCouplingPolicy::DataId          DataId;
00085     
00086   DataId          dataId(time,tag);   //potentiellement avec un troisième paramètre
00087   //std::vector<CORBA::Long> a(1,time);std::vector<CORBA::Long> b(1,tag);
00088   //DataIdContainer dataIds(a,b);   
00089 
00090   std::cout << "-------- MARK 1 --"<< dataId <<"----------------" << std::endl;
00091 
00092   filtre_conversion * f_time = get_filtre_convert_TIME();
00093   filtre_conversion * f_tag =  get_filtre_convert_TAG(); 
00094   
00095   
00096   filtre_elementaire * f_time_2 = new filtre_elementaire(1);
00097   filtre_elementaire * g_time_2 = new filtre_elementaire(2);
00098   f_time->config_elementaire(*f_time_2, *g_time_2);
00099   filtre_elementaire * f_time_3 = new filtre_elementaire(1);
00100   f_time->config_elementaire(*f_time_3);
00101 
00102   // On accepte que les tags 1 et ce sans conversion
00103   filtre_elementaire * f_time_tag = new filtre_elementaire(1);
00104   f_time_tag = new filtre_elementaire(1);
00105   f_tag->config_elementaire(*f_time_tag);
00106 
00107    
00108   DataIdContainer dataIds(dataId,*this);   
00109 
00110   DataIdContainer::iterator dataIdIt = dataIds.begin();
00111 
00112   if (!dataIds.empty())
00113     for (;dataIdIt != dataIds.end();++dataIdIt) {
00114       std::cout << "-------- MARK 2 --"<< *dataIdIt <<"----------------" << std::endl;
00115 
00116     }
00117   }
00118 };
00119 
00120 int main() {
00121   TEST1 test1;
00122   TEST2 test2;
00123 };
00124