MAK RTIspy API Documentation for HLA 1.3
forwarderObserverMgr.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2008 MaK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: forwarderObserverMgr.h,v $ $Revision: 1.13 $ $State: Exp $
00007 *******************************************************************************/
00008 
00011 
00012 #ifndef DtRtiForwarderObserverMgr_H_
00013 #define DtRtiForwarderObserverMgr_H_
00014 
00015 #include "rtiMsConfig.h"
00016 #include "rtiMsg.h"
00017 #include "rtiMsgCbMgr.h"
00018 #include "forwarderNode.h"
00019 #include "forwarderPort.h"
00020 #include <vlutil/vlSmartPointers.h>
00021 #include <vlutil/vlTime.h>
00022 #include <vlutil/vlInetAddr.h>
00023 #include <map>
00024 #include <list>
00025 
00028 class DtRtiMsgForwarder;
00029 class DtFedForwarder;
00030 class DtRtiForwarderObserver;
00031 class DtTickWithForwarderCallbackInfo;
00032 
00033 
00035 typedef void (*DtForwarderPortCbFn)(const MAKRti::DtString&, unsigned int, MAKRti::DtInetAddr);
00036 
00037 
00038 class DtForwarderPortCbInfo
00039 {
00040 public:
00041    DtForwarderPortCbInfo( DtForwarderPortCbFn fcn, 
00042       DtRtiForwarderObserver* observer,
00043       const MAKRti::DtString& connName, 
00044       unsigned int connID,
00045       MAKRti::DtInetAddr connAddr ) :
00046    myFcn(fcn),
00047    myObserver(observer),
00048    myConnName(connName),
00049    myConnID(connID),
00050    myConnAddr(connAddr){}
00051    ~DtForwarderPortCbInfo() {}
00052 
00053    bool operator<(const DtForwarderPortCbInfo& other) const
00054    {
00055       return (  (myObserver == other.myObserver && myFcn < other.myFcn) ||
00056                 myObserver < other.myObserver );
00057    }
00058    DtForwarderPortCbFn myFcn;
00059    DtRtiForwarderObserver* myObserver;
00060    const MAKRti::DtString& myConnName;
00061    unsigned int myConnID;
00062    MAKRti::DtInetAddr myConnAddr;
00063 };
00064 
00065 class DtMsgCbInfo {
00066 public:
00067    DtMsgCbInfo( DtRtiMsgKind msgKind, DtRtiMsgCbMgr::DtCallbackFcn fcn,
00068       DtRtiForwarderObserver* observer, bool isMomCallback ) :
00069       myMsgKind( msgKind ), myFcn( fcn ), myObserver( observer ), 
00070       myIsMomCallback( isMomCallback ) {}
00071    ~DtMsgCbInfo() {}
00072 
00073    bool operator<(const DtMsgCbInfo& other) const
00074    {
00075       return ( myMsgKind < other.myMsgKind ||
00076          ( myMsgKind == other.myMsgKind && myFcn < other.myFcn ) ||
00077          ( myMsgKind == other.myMsgKind && myFcn == other.myFcn && myObserver < other.myObserver ) );
00078    }
00079 
00080    DtRtiMsgKind myMsgKind; 
00081    DtRtiMsgCbMgr::DtCallbackFcn myFcn;
00082    DtRtiForwarderObserver* myObserver;
00083    bool myIsMomCallback;
00084 };
00085 
00088 class DT_DLL_FORWARDER DtRtiForwarderObserverMgr
00089 {
00090 
00091 public:
00092 
00094    DtRtiForwarderObserverMgr();
00095 
00097    virtual ~DtRtiForwarderObserverMgr();
00098 
00100    virtual void setForwarderNode( DtBoost::shared_ptr<DtForwarderNode> forwarder);
00101 
00103    virtual void addObserver( DtBoost::shared_ptr<DtRtiForwarderObserver> observer );
00104 
00106    virtual void removeObserver( DtBoost::shared_ptr<DtRtiForwarderObserver> observer );
00107 
00109    virtual void removeAllObservers();
00110 
00112    virtual void addRtiMsgCallback( DtRtiMsgKind msgKind, 
00113       DtRtiMsgCbMgr::DtCallbackFcn fcn, DtRtiForwarderObserver* observer,
00114       bool isMomCallback );
00115 
00117    virtual void removeRtiMsgCallback( DtRtiMsgKind msgKind, 
00118       DtRtiMsgCbMgr::DtCallbackFcn fcn, DtRtiForwarderObserver* observer,
00119       bool isMomCallback );
00120 
00122    static int clientToForwarderConnectionEstablished( 
00123       const MAKRti::DtString& connName, unsigned int connID, const DtInetAddrAndPort& connAddr, void* usr );
00124    virtual int clientToForwarderConnectionEstablished( 
00125       const MAKRti::DtString& connName, unsigned int connID, const DtInetAddrAndPort& connAddr );
00126 
00128    static int clientToForwarderConnectionLost( 
00129       const MAKRti::DtString& connName, unsigned int connID, const DtInetAddrAndPort& connAddr, void* usr );
00130    virtual int clientToForwarderConnectionLost( 
00131       const MAKRti::DtString& connName, unsigned int connID, const DtInetAddrAndPort& connAddr );
00132 
00134    static void clientToForwarderFederateJoined( 
00135       const MAKRti::DtString& connName, const MAKRti::DtString& connType,
00136       const MAKRti::DtString& federationName,
00137       unsigned int connID, unsigned int fedHandle,
00138       const DtInetAddrAndPort& connAddr, const MAKRti::DtString& hostName, 
00139       unsigned int procesId, const MAKRti::DtString& processName,
00140       const MAKRti::DtString& commandArgs, DtHlaVersionId hlaVersion,
00141       void* usr );
00142    virtual void clientToForwarderFederateJoined( 
00143       const MAKRti::DtString& connName, const MAKRti::DtString& connType,
00144       const MAKRti::DtString& federationName,
00145       unsigned int connID, unsigned int fedHandle,
00146       const DtInetAddrAndPort& connAddr, const MAKRti::DtString& hostName,
00147       unsigned int procesId, const MAKRti::DtString& processName,
00148       const MAKRti::DtString& commandArgs, DtHlaVersionId hlaVersion);
00149 
00150    static int clientToForwarderSocketQueueUpdate( 
00151       unsigned int connId, int connQueueStatus, void* usr );
00152    virtual int clientToForwarderSocketQueueUpdate(
00153       unsigned int connId, int connQueueStatus );
00154 
00156    static void clientToForwarderFederateLost( 
00157       const MAKRti::DtString& connName, const MAKRti::DtString& connType,
00158       unsigned int connID, unsigned int fedHandle,
00159       const DtInetAddrAndPort& connAddr, void* usr );
00160    virtual void clientToForwarderFederateLost( 
00161       const MAKRti::DtString& connName, const MAKRti::DtString& connType,
00162       unsigned int connID, unsigned int fedHandle,
00163       const DtInetAddrAndPort& connAddr );
00164 
00166    static int forwarderToForwarderExecConnected( 
00167       const MAKRti::DtString& connName, unsigned int connID,
00168       const DtInetAddrAndPort& connAddr, const MAKRti::DtString& connHost,
00169       bool fullyCompliant, void* usr );
00170    virtual int forwarderToForwarderExecConnected( 
00171       const MAKRti::DtString& connName, unsigned int connID,
00172       const DtInetAddrAndPort& connAddr, const MAKRti::DtString& connHost,
00173       bool fullyCompliant ); 
00174 
00176    static int forwarderToForwarderExecLost( 
00177       const MAKRti::DtString& connName, unsigned int connID,
00178       const DtInetAddrAndPort& connAddr, void* usr );
00179    virtual int forwarderToForwarderExecLost( 
00180       const MAKRti::DtString& connName, unsigned int connID,
00181       const DtInetAddrAndPort& connAddr );
00182 
00184    static int clientToForwarderExecConnected( 
00185       const MAKRti::DtString& connName, unsigned int connID,
00186       const DtInetAddrAndPort& connAddr, const MAKRti::DtString& hostName,
00187       bool fullyCompliant, void* usr );
00188    virtual int clientToForwarderExecConnected( 
00189       const MAKRti::DtString& connName, unsigned int connID,
00190       const DtInetAddrAndPort& connAddr, const MAKRti::DtString& hostName,
00191       bool fullyCompliant );
00192 
00194    static int clientToForwarderExecLost( 
00195       const MAKRti::DtString& connName, unsigned int connID,
00196       const DtInetAddrAndPort& connAddr, void* usr );
00197    virtual int clientToForwarderExecLost( 
00198       const MAKRti::DtString& connName, unsigned int connID,
00199       const DtInetAddrAndPort& connAddr );
00200 
00202    static int forwarderToForwarderConnectionEstablished( 
00203       const MAKRti::DtString& connName, unsigned int connID,
00204       const DtInetAddrAndPort& connAddr, void* usr );
00205    virtual int forwarderToForwarderConnectionEstablished( 
00206       const MAKRti::DtString& connName, unsigned int connID,
00207       const DtInetAddrAndPort& connAddr );
00208 
00210    static int forwarderToForwarderConnectionLost( 
00211       const MAKRti::DtString& connName, unsigned int connID,
00212       const DtInetAddrAndPort& connAddr, void* usr );
00213    virtual int forwarderToForwarderConnectionLost( 
00214       const MAKRti::DtString& connName, unsigned int connID,
00215       const DtInetAddrAndPort& connAddr );
00216 
00219    static void waitingForFowrarderConnections( 
00220       const DtForwarderPort::DtConnAndNameMap& allNeededFws,
00221       const DtForwarderPort::DtConnAndNameMap& stillNeededFws, void* usr );
00222    virtual void waitingForFowrarderConnections(
00223       const DtForwarderPort::DtConnAndNameMap& allNeededFws,
00224       const DtForwarderPort::DtConnAndNameMap& stillNeededFws );
00225 
00228    static void notWaitingForFowrarderConnections( void* usr );
00229    virtual void notWaitingForFowrarderConnections();
00230 
00231 
00234    virtual void addTickCallback( DtTickCbFn fcn, DtRtiForwarderObserver* observer, 
00235       MAKRti::DtTime interval );
00236 
00238    virtual void removeTickCallback( DtTickCbFn fcn, DtRtiForwarderObserver* observer );
00239 
00240 
00242    virtual unsigned long connectionId() const;
00243    virtual const DtInetAddrAndPort& connectionAddr() const;
00244    virtual MAKRti::DtString connectionName() const;
00245 
00246 protected:
00247    
00249    DtRtiForwarderObserverMgr( const DtRtiForwarderObserverMgr& orig );
00250 
00252    DtRtiForwarderObserverMgr& operator=( const DtRtiForwarderObserverMgr& orig );
00253 
00254 protected:
00255 
00256    typedef std::set<DtMsgCbInfo> DtMsgCbSet;
00257    typedef std::set<DtTickCallbackInfo> DtTickCbSet;
00258    typedef std::set<DtForwarderPortCbInfo> DtForwarderPortCbSet;
00259    typedef std::list< DtBoost::shared_ptr<DtRtiForwarderObserver> > DtForwarderObsList;
00260 
00262    DtBoost::shared_ptr<DtForwarderNode> myForwarder;
00263 
00265    DtForwarderObsList myObservers;
00266 
00268    DtMsgCbSet myMsgCbSet;
00269 
00271    DtTickCbSet myTickCbSet;
00272 
00273 
00274 };
00275 
00276 
00277 #endif //! DtRtiForwarderObserverMgr_H_
00278 
00279 

Document ID: Generated on Thu Jun 14 14:15:04 EDT 2012 from SVN revision 116116
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)