1 // Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : test_DataIdContainer.cxx
24 // Author : Eric Fayolle (EDF)
26 // Modified by : $LastChangedBy$
27 // Date : $LastChangedDate: 2007-03-01 15:07:46 +0100 (jeu, 01 mar 2007) $
30 #include "CalciumCouplingPolicy.hxx"
32 #include "CalciumProvidesPort.hxx"
33 #include "CalciumException.hxx"
35 using namespace CalciumTypes;
37 class TEST1 : public CalciumCouplingPolicy {
44 CORBA::Long time=1,tag=1;
45 typedef CalciumCouplingPolicy::DataIdContainer DataIdContainer;
46 typedef CalciumCouplingPolicy::DataId DataId;
48 DataId dataId(time,tag); //potentiellement avec un troisième paramètre
50 DataIdContainer dataIds(dataId,*this);
52 DataIdContainer::iterator dataIdIt = dataIds.begin();
55 for (;dataIdIt != dataIds.end();++dataIdIt) {
56 std::cout << "(*dataIdIt) must be equal to given dataId parameter : " << *dataIdIt;
57 std::cout << " == " << dataId << " : " << (ret = (*dataIdIt == dataId)) << std::endl;
59 } catch(const CalciumException & ex) {
61 std::cout << ex.what() << std::endl;
67 class TEST2 : public CalciumCouplingPolicy {
73 // Doit filtrer le mode de dépendance temporel car le mode est
77 CORBA::Long time=1,tag=1;
78 typedef CalciumCouplingPolicy::DataIdContainer DataIdContainer;
79 typedef CalciumCouplingPolicy::DataId DataId;
81 DataId dataId(time,tag); //potentiellement avec un troisième paramètre
82 setDependencyType(ITERATION_DEPENDENCY);
83 DataIdContainer dataIds(dataId,*this);
86 DataIdContainer::iterator dataIdIt = dataIds.begin();
89 for (;dataIdIt != dataIds.end();++dataIdIt) {
90 std::cout << "(*dataIdIt) must be equal to given dataId parameter : " << *dataIdIt ;
91 std::cout << " == " << DataId(0,tag) << " : " << (ret = (*dataIdIt == DataId(0,tag))) << std::endl;
98 class TEST3 : public CalciumCouplingPolicy {
104 // Doit filtrer le mode de dépendance temporel car le mode est
108 CORBA::Long time=1,tag=1;
109 typedef CalciumCouplingPolicy::DataIdContainer DataIdContainer;
110 typedef CalciumCouplingPolicy::DataId DataId;
112 DataId dataId(time,tag); //potentiellement avec un troisième paramètre
113 setDependencyType(TIME_DEPENDENCY);
114 DataIdContainer dataIds(dataId,*this);
117 DataIdContainer::iterator dataIdIt = dataIds.begin();
119 if (!dataIds.empty())
120 for (;dataIdIt != dataIds.end();++dataIdIt) {
121 std::cout << "(*dataIdIt) must be equal to given dataId parameter : " << *dataIdIt ;
122 std::cout << " == " << DataId(time,0) << " : " << (ret = (*dataIdIt == DataId(time,0))) << std::endl;
132 return !test1.ret+!test2.ret+!test3.ret;