Back to index

salome-kernel  6.5.0
Public Member Functions | Public Attributes
CalciumCouplingPolicy::DisconnectProcessor< DataManipulator > Struct Template Reference

#include <CalciumCouplingPolicy.hxx>

Collaboration diagram for CalciumCouplingPolicy::DisconnectProcessor< DataManipulator >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DisconnectProcessor (const CalciumCouplingPolicy &couplingPolicy)
template<typename Container , typename DataId >
bool apply (Container &storedDatas, const DataId &expectedDataId, typename Container::iterator &wDataIt1) const

Public Attributes

const CalciumCouplingPolicy_couplingPolicy

Detailed Description

template<typename DataManipulator>
struct CalciumCouplingPolicy::DisconnectProcessor< DataManipulator >

Definition at line 479 of file CalciumCouplingPolicy.hxx.


Constructor & Destructor Documentation

template<typename DataManipulator >
CalciumCouplingPolicy::DisconnectProcessor< DataManipulator >::DisconnectProcessor ( const CalciumCouplingPolicy couplingPolicy) [inline]

Definition at line 483 of file CalciumCouplingPolicy.hxx.

                                                                   :
    _couplingPolicy(couplingPolicy) {};

Member Function Documentation

template<typename DataManipulator >
template<typename Container , typename DataId >
bool CalciumCouplingPolicy::DisconnectProcessor< DataManipulator >::apply ( Container &  storedDatas,
const DataId expectedDataId,
typename Container::iterator &  wDataIt1 
) const [inline]

Definition at line 487 of file CalciumCouplingPolicy.hxx.

                                                           {

    typedef typename Container::key_type   key_type;
    typedef typename Container::value_type value_type;
    typedef typename Container::iterator   iterator;

    // Pas de traitement particulier a effectuer
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK1 ("<< _couplingPolicy._disconnectDirective<<") --------" << std::endl;
#endif
    if ( (_couplingPolicy._disconnectDirective) == (CalciumTypes::UNDEFINED_DIRECTIVE) ) return false;
  
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK2 --------" << std::endl;
#endif

    // TODO : Ds GenericPort::next il faut convertir en CPSTOPSEQ
    if ( _couplingPolicy._disconnectDirective == CalciumTypes::CP_ARRET )
      throw(CalciumException(CalciumTypes::CPINARRET,LOC(OSS()<< "CP_ARRET directive" 
                                           << " interrupts all further data reading")));
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK3 --------" << std::endl;
#endif


    // S'il n'y a plus de données indique que l'on a pas pu effectuer de traitement
    // TODO : Dans la gestion des niveaux il faut peut être interdire un niveau ==  0
    if ( storedDatas.empty() ) 
      throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "CP_CONT directive" 
                                          << " is active but no data is available.")));
    
    // expectedDataId n'a ni été trouvé dans storedDataIds ni encadré mais il se peut
    // qu'en mode itératif il ne soit pas plus grand que le plus grand DataId stocké auquel
    // cas on doit renvoyer une expection car on n'est plus connecté et on ne pourra jamais
    // fournir de données pour ce dataId.
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK4  " << expectedDataId <<" --------" << std::endl;
#endif

    // >= expectedDataId
    iterator it1 = storedDatas.lower_bound(expectedDataId);
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK5  " << std::endl;
    for (iterator it=storedDatas.begin();it!=storedDatas.end();++it)
      std::cout <<" "<<(*it).first ;
    std::cout <<std::endl;
#endif

    // TODO : Il faut en fait renvoyer le plus proche cf IT ou DT
    if (it1 == storedDatas.end())
      throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "CP_CONT directive" 
                                          << " is active but the requested dataId is less or equal to the last one received.")));
  
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK6 " << std::endl;
#endif

    wDataIt1 = storedDatas.end();
    --wDataIt1;
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor, CP_CONT : " << (*wDataIt1).first << std::endl;
#endif

    return true;
  }

Member Data Documentation

template<typename DataManipulator >
const CalciumCouplingPolicy& CalciumCouplingPolicy::DisconnectProcessor< DataManipulator >::_couplingPolicy

Definition at line 481 of file CalciumCouplingPolicy.hxx.


The documentation for this struct was generated from the following file: