Salome HOME
a9280c671817992aa0df263e7631ccbc28d02972
[modules/kernel.git] / src / DSC / DSC_User / Datastream / Palm / test_DataIdContainer.cxx
1 // Copyright (C) 2007-2023  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, or (at your option) any later version.
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 //  File   : test_DataIdContainer.cxx
24 //  Author : Eric Fayolle (EDF)
25 //  Module : KERNEL
26 //
27 #include "PalmCouplingPolicy.hxx"
28
29 #include "palm_data_short_port_provides.hxx"
30
31 //using namespace PalmCouplingPolicy;
32
33 class TEST1 : public PalmCouplingPolicy {
34 public:
35   TEST1() {
36
37   std::cout << "------------  TEST1 --------------" << std::endl;
38
39   // int ret=0;
40   
41   CORBA::Long time=1,tag=1;
42   typedef PalmCouplingPolicy::DataIdContainer DataIdContainer;  
43   typedef PalmCouplingPolicy::DataId          DataId;
44     
45   DataId          dataId(time,tag);   //potentiellement avec un troisième paramètre
46   //std::vector<CORBA::Long> a(1,time);std::vector<CORBA::Long> b(1,tag);
47   //DataIdContainer dataIds(a,b);   
48
49   std::cout << "-------- MARK 1 --"<< dataId <<"----------------" << std::endl;
50    
51   filtre_conversion * f_time = get_filtre_convert_TIME();
52   filtre_conversion * f_tag =  get_filtre_convert_TAG(); 
53
54   // On accepte les temps de 1 à 100 sans conversion
55   filtre_elementaire * f_time_el = new filtre_elementaire(1, 100);
56   f_time->config_elementaire(*f_time_el);
57
58   // On accepte que les tags 1 et ce sans conversion
59   filtre_elementaire * f_time_tag = new filtre_elementaire(1);
60   f_tag->config_elementaire(*f_time_tag);
61
62   DataIdContainer dataIds(dataId,*this);   
63
64   DataIdContainer::iterator dataIdIt = dataIds.begin();
65
66   if (!dataIds.empty())
67     for (;dataIdIt != dataIds.end();++dataIdIt) {
68       std::cout << "-------- MARK 2 --"<< *dataIdIt <<"----------------" << std::endl;
69
70     }
71   }
72 };
73
74 class TEST2 : public PalmCouplingPolicy {
75 public:
76   TEST2() {
77  
78     std::cout << "------------  TEST2 --------------" << std::endl;
79
80     // int ret=0;
81   
82   CORBA::Long time=1,tag=1;
83   typedef PalmCouplingPolicy::DataIdContainer DataIdContainer;  
84   typedef PalmCouplingPolicy::DataId          DataId;
85     
86   DataId          dataId(time,tag);   //potentiellement avec un troisième paramètre
87   //std::vector<CORBA::Long> a(1,time);std::vector<CORBA::Long> b(1,tag);
88   //DataIdContainer dataIds(a,b);   
89
90   std::cout << "-------- MARK 1 --"<< dataId <<"----------------" << std::endl;
91
92   filtre_conversion * f_time = get_filtre_convert_TIME();
93   filtre_conversion * f_tag =  get_filtre_convert_TAG(); 
94   
95   
96   filtre_elementaire * f_time_2 = new filtre_elementaire(1);
97   filtre_elementaire * g_time_2 = new filtre_elementaire(2);
98   f_time->config_elementaire(*f_time_2, *g_time_2);
99   filtre_elementaire * f_time_3 = new filtre_elementaire(1);
100   f_time->config_elementaire(*f_time_3);
101
102   // On accepte que les tags 1 et ce sans conversion
103   filtre_elementaire * f_time_tag = new filtre_elementaire(1);
104   f_time_tag = new filtre_elementaire(1);
105   f_tag->config_elementaire(*f_time_tag);
106
107    
108   DataIdContainer dataIds(dataId,*this);   
109
110   DataIdContainer::iterator dataIdIt = dataIds.begin();
111
112   if (!dataIds.empty())
113     for (;dataIdIt != dataIds.end();++dataIdIt) {
114       std::cout << "-------- MARK 2 --"<< *dataIdIt <<"----------------" << std::endl;
115
116     }
117   }
118 };
119
120 int main() {
121   TEST1 test1;
122   TEST2 test2;
123 }
124