CCAFFEINE  0.8.8
BblConnectionEventListener.h
00001 #ifndef __BBLCONNECTIONEVENTLISTENER_H__
00002 #define __BBLCONNECTIONEVENTLISTENER_H__
00003 
00004 class BblConnectionEventListener
00005 : public virtual ccafeopq::connectionevents::ConnectionEventListener
00006 {
00007   
00008 private:
00009 
00010   gov::cca::ports::EventType type;
00011   gov::cca::ports::ConnectionEventListener l;
00012 
00013 public:
00014   BblConnectionEventListener(gov::cca::ports::EventType type_,
00015                                gov::cca::ports::ConnectionEventListener l_) {
00016     type = type_;
00017     l = l_;
00018   }
00019   virtual ~BblConnectionEventListener(){}
00020 
00021   virtual void connectionActivity( ccafeopq::connectionevents::ConnectionEvent_shared evt) {
00022     ::gov::cca::ports::EventType typ = gov::cca::ports::EventType_Error;
00023     if(evt->connected()) {
00024       typ = gov::cca::ports::EventType_Connected;
00025     } else if(evt->disconnected()) {
00026       typ = gov::cca::ports::EventType_Disconnected;
00027     }
00028     if(typ != type) {
00029       return;
00030     }
00031     
00032     // yes, this is the only way to tunnel shared pointers through babel
00033     // but it is possible.
00034     void * vp = 0;
00035     vp = evt->getOpqTypeMapSharedPtrAddress(); // fixme
00036     ::ccaffeine::TypeMap ctm = ccaffeine::TypeMap::_create();
00037     ctm.initialize(vp);
00038 
00039     ccaffeine::ports::ConnectionEvent bblEvt;
00040     bblEvt.initialize(typ, ctm);
00041     l.connectionActivity(bblEvt);
00042   }
00043 
00044 };
00045 
00046 #endif // __BBLCONNECTIONEVENTLISTENER_H__