30 #ifndef _PALM_COUPLING_POLICIES_HXX_
31 #define _PALM_COUPLING_POLICIES_HXX_
33 #include <SALOMEconfig.h>
35 #include <omniORB4/CORBA.h>
37 #include "DataIdFilter.hxx"
38 #include "DisplayPair.hxx"
39 #include "CouplingPolicy.hxx"
59 typedef CORBA::Long TimeType;
60 typedef CORBA::Long TagType;
61 typedef std::pair < TimeType , TagType > DataId;
62 typedef InternalDataIdContainer < TimeType , TagType > DataIdContainer;
64 TimeType getTime(
const DataId &dataId)
const {
return dataId.first;}
65 TagType getTag (
const DataId &dataId)
const {
return dataId.second;}
69 template <
typename T_TIME,
typename T_TAG >
class InternalDataIdContainer {
71 std::vector<T_TIME> _lTime;
72 std::vector<T_TAG> _lTag;
76 InternalDataIdContainer() {}
79 typedef DataId value_type;
82 typedef value_type & reference;
83 typedef value_type
const & const_reference;
88 std::cout <<
"----Cst ---- InternalDataIdContainer(const DataId & dataId..) " << dataId <<std::endl;
89 policy.filtre_convert_TIME.applique_filtre_conversion(dataId.first, _lTime);
91 for(std::vector<CORBA::Long>::iterator i=_lTime.begin();i!=_lTime.end();++i)
92 std::cout <<
"_lTime["<< c++ <<
"] : " << *i << std::endl;
93 policy.filtre_convert_TAG.applique_filtre_conversion(dataId.second, _lTag);
95 for(std::vector<CORBA::Long>::iterator i=_lTag.begin();i!=_lTag.end();++i)
96 std::cout <<
"_lTag["<< c++ <<
"] : " << *i << std::endl;
101 _lTime(lTime),_lTag(lTag) {}
106 _lTime(pc._lTime), _lTag(pc._lTag) {}
110 InternalDataIdContainer & operator=(
const InternalDataIdContainer & pc) {
111 if (
this != &pc) { _lTime=pc._lTime; _lTag=pc._lTag; }
115 virtual ~InternalDataIdContainer() {}
117 iterator begin() {
return iterator(*
this); }
118 iterator end() {
return iterator(*
this,_lTime.end(),_lTag.end()); }
121 bool empty()
const {
return _lTime.empty() || _lTag.empty(); }
124 template <
typename TTIME,
typename TTAG>
class DataIdIterator {
128 typedef typename std::vector<TTIME>::const_iterator ItTime;
129 typedef typename std::vector<TTAG >::const_iterator ItTag;
134 const InternalDataIdContainer<TTIME,TTAG> & _pc;
141 DataIdIterator(
const InternalDataIdContainer<TTIME,TTAG> & pc):
142 _pc(pc),_itTime(pc._lTime.begin()),_itTag(pc._lTag.begin()) {}
143 DataIdIterator(
const InternalDataIdContainer<TTIME,TTAG> & pc, ItTime itTime, ItTag itTag):
144 _pc(pc),_itTime(itTime),_itTag(itTag) {}
146 DataIdIterator(
const DataIdIterator & dIt):
147 _pc(dIt._pc),_itTime(dIt._itTime),_itTag(dIt._itTag) {}
152 DataIdIterator & operator=(
const DataIdIterator & dIt) {
154 _pc=dIt._pc;_itTime=dIt._itTime;_itTag=dIt._itTag;
159 DataId operator*()
const {
160 std::cout <<
"-------- operator*(), *_itTime : " << *_itTime <<
" *_itTag " << *_itTag <<std::endl;
161 return DataId(*_itTime,*_itTag); }
163 bool operator==(
const DataIdIterator & dIt)
const {
164 return (_itTime == dIt._itTime) && (_itTag == dIt._itTag) && (&_pc == &dIt._pc);
167 bool operator!=(
const DataIdIterator & dIt)
const {
168 return (_itTime != dIt._itTime) || (_itTag != dIt._itTag) || (&_pc != &dIt._pc);
172 DataIdIterator & operator++() {
173 if ( _itTag != _pc._lTag.end() ) {
175 if (_itTag != _pc._lTag.end() )
return *
this;
177 if ( _itTime != _pc._lTime.end() ) {
179 if (_itTime != _pc._lTime.end() ) _itTag=_pc._lTag.begin();
185 DataIdIterator operator++(
int fake) {
186 DataIdIterator tmpIt=*
this; ++*
this;
return tmpIt;