1 // Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : test_DataIdContainer.cxx
23 // Author : Eric Fayolle (EDF)
25 // Modified by : $LastChangedBy$
26 // Date : $LastChangedDate: 2007-03-01 15:07:46 +0100 (jeu, 01 mar 2007) $
29 #include "CalciumCouplingPolicy.hxx"
31 #include "CalciumProvidesPort.hxx"
32 #include "CalciumException.hxx"
34 using namespace CalciumTypes;
36 class TEST1 : public CalciumCouplingPolicy {
43 CORBA::Long time=1,tag=1;
44 typedef CalciumCouplingPolicy::DataIdContainer DataIdContainer;
45 typedef CalciumCouplingPolicy::DataId DataId;
47 DataId dataId(time,tag); //potentiellement avec un troisième paramètre
49 DataIdContainer dataIds(dataId,*this);
51 DataIdContainer::iterator dataIdIt = dataIds.begin();
54 for (;dataIdIt != dataIds.end();++dataIdIt) {
55 std::cout << "(*dataIdIt) must be equal to given dataId parameter : " << *dataIdIt;
56 std::cout << " == " << dataId << " : " << (ret = (*dataIdIt == dataId)) << std::endl;
58 } catch(const CalciumException & ex) {
60 std::cout << ex.what() << std::endl;
66 class TEST2 : public CalciumCouplingPolicy {
72 // Doit filtrer le mode de dépendance temporel car le mode est
76 CORBA::Long time=1,tag=1;
77 typedef CalciumCouplingPolicy::DataIdContainer DataIdContainer;
78 typedef CalciumCouplingPolicy::DataId DataId;
80 DataId dataId(time,tag); //potentiellement avec un troisième paramètre
81 setDependencyType(ITERATION_DEPENDENCY);
82 DataIdContainer dataIds(dataId,*this);
85 DataIdContainer::iterator dataIdIt = dataIds.begin();
88 for (;dataIdIt != dataIds.end();++dataIdIt) {
89 std::cout << "(*dataIdIt) must be equal to given dataId parameter : " << *dataIdIt ;
90 std::cout << " == " << DataId(0,tag) << " : " << (ret = (*dataIdIt == DataId(0,tag))) << std::endl;
97 class TEST3 : public CalciumCouplingPolicy {
103 // Doit filtrer le mode de dépendance temporel car le mode est
107 CORBA::Long time=1,tag=1;
108 typedef CalciumCouplingPolicy::DataIdContainer DataIdContainer;
109 typedef CalciumCouplingPolicy::DataId DataId;
111 DataId dataId(time,tag); //potentiellement avec un troisième paramètre
112 setDependencyType(TIME_DEPENDENCY);
113 DataIdContainer dataIds(dataId,*this);
116 DataIdContainer::iterator dataIdIt = dataIds.begin();
118 if (!dataIds.empty())
119 for (;dataIdIt != dataIds.end();++dataIdIt) {
120 std::cout << "(*dataIdIt) must be equal to given dataId parameter : " << *dataIdIt ;
121 std::cout << " == " << DataId(time,0) << " : " << (ret = (*dataIdIt == DataId(time,0))) << std::endl;
131 return !test1.ret+!test2.ret+!test3.ret;