MAK RTIspy API Documentation for HLA 1.3
webSpyUtils.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  ** Copyright (c) 2005 MaK Technologies, Inc.
00003  ** All rights reserved.
00004  *********************************************************************/
00005 /*******************************************************************************
00006  ** $RCSfile: webSpyUtils.h,v $ $Revision: 1.20 $ $State: Exp $
00007  *******************************************************************************/
00010 
00011 #ifndef DtWebSpyUtils_H_
00012 #define DtWebSpyUtils_H_
00013 
00014 #include <rtiMsConfig.h>
00015 #include <RIDparams.h>
00016 #include <vlutil/vlTime.h>
00017 #include <vlutil/vlString.h>
00018 #include <vlutil/vlFilename.h>
00019 #include <vector>
00020 #include <map>
00023 class DT_DLL_WWW DtWebSpyUtils
00024 {
00025 public: 
00027    enum WwwControlMsgCommandId
00028    {
00029       DtTypeInfoCntlMsg,
00030       DtRequestStateUpdateMsg,
00031       DtLrcLogEventsMsg,
00032       DtDeleteFederateCmdMsg,
00033       DtDestroyFederationCmdMsg,
00034       DtChangeRidParamMsg,
00035       DtUndiscoverObjectMsg,
00036       DtNetworkMapMsg,
00037       DtUnknownCntlMsg
00038    };
00040    enum ConnectionType
00041    {
00042       DtRtiExecConnection = 0,
00043       DtLrcConnection,
00044       DtForwarderConnection,
00045       DtRtiExecConnectionLightweight,
00046       DtLrcConnectionLightweight,
00047       DtUnknownConnectionType
00048    };
00050    enum StateComponentType
00051    {
00052       DtBaseStateType = 0,
00053       DtFomStateType,
00054       DtRidStateType,
00055       DtPubSubStateType,
00056       DtOwnershipStateType,
00057       DtInteractionStateType,
00058       DtObjectInterStatsStateType,
00059       DtApiStatsStateType,
00060       DtMessageStatsStateType,
00061       DtNetworkMapStateType
00062    };
00065    class DT_DLL_WWW ConnectionIdentifier
00066    {
00067    public:
00069       ConnectionIdentifier();
00072       ConnectionIdentifier( unsigned long connId, ConnectionType connType,
00073          const MAKRti::DtString& description, bool forwardingEnabled = false );
00074 
00076       ConnectionIdentifier( const ConnectionIdentifier& orig );
00077       
00079       ~ConnectionIdentifier();
00080 
00082       ConnectionIdentifier& operator=( const ConnectionIdentifier& orig );
00083 
00084       bool operator==( const ConnectionIdentifier& other ) const;
00085       bool operator<( const ConnectionIdentifier& other ) const;
00086 
00087       inline unsigned long id() const;
00088       inline ConnectionType type() const;
00089       inline bool forwarding() const;
00090       inline const MAKRti::DtString& description() const;
00091 
00092    protected:
00093 
00094       unsigned long  myConnId;
00095       ConnectionType myConnType;
00096       bool           myForwardingEnabled;
00097       MAKRti::DtString       myConnectionDescription;
00098    };
00099 
00105    class DT_DLL_WWW ConnectionState
00106    {
00107    public:
00109       typedef std::pair< MAKRti::DtTime, MAKRti::DtString > ComponentStateUpdateTimePair;
00110 
00112       ConnectionState();
00113 
00117       ConnectionState( std::auto_ptr<MAKRti::DtString> currentState,
00118          StateComponentType stateType, unsigned long componentId = 0 );
00119 
00121       ConnectionState( const ConnectionState& orig );
00122 
00124       ConnectionState& operator=( const ConnectionState& orig );
00125 
00127       virtual ~ConnectionState();
00128 
00130       void setComponentState( unsigned long componentId, StateComponentType stateType,
00131          std::auto_ptr<MAKRti::DtString> currentState, bool overwriteNotAppend = true );
00132 
00134       std::vector< unsigned long > componentIds() const;
00135 
00137       std::vector< StateComponentType > stateTypes( unsigned long componentId ) const;
00138 
00141       MAKRti::DtTime timeOfLastComponentUpdate( unsigned long componentId, StateComponentType stateType ) const;
00142 
00145       ComponentStateUpdateTimePair componentState( unsigned long componentId, StateComponentType stateType ) const;
00146 
00149       bool removeComponent( unsigned long componentId );
00150 
00153       std::auto_ptr< MAKRti::DtString > removeComponentStateType( unsigned long componentId, StateComponentType stateType );
00154 
00158       void merge( std::auto_ptr< ConnectionState > connState, bool overwriteNotAppend = true );
00159 
00160 
00161    
00162    protected:
00163       
00164       typedef std::pair< MAKRti::DtTime, MAKRti::DtString* > StateUpdateTimePair;
00165       typedef std::map< StateComponentType, StateUpdateTimePair > StateTypeToStateMap;
00166       typedef std::map< unsigned long, StateTypeToStateMap > ComponentStateMap;
00167 
00168       MAKRti::DtClock myClock;
00169       ComponentStateMap myComponents;
00170    };
00171   
00172    static DtRIDParameters& params(); 
00173    static const MAKRti::DtString& uninitializedPageHTML();
00174    
00175    static MAKRti::DtFilename getPathToHtmlRoot( const MAKRti::DtFilename& subDir = "" );   
00176    
00177    static MAKRti::DtFilename pathSeparator();
00178    static bool readTextFileIntoString( const MAKRti::DtFilename& pathToFile, MAKRti::DtString& target );
00179    static bool readBinaryFileIntoBuffer( const MAKRti::DtFilename& pathToFile, std::vector<char>& target );
00180    static void setPathToXmlPage( MAKRti::DtString& page, const MAKRti::DtString& pathToXmlPage );
00181 
00182    static bool isValidBinaryFileType( const MAKRti::DtFilename& filename );
00183    static bool isValidTextFileType( const MAKRti::DtFilename& filename );
00184    static const MAKRti::DtString& htmlContentTypeForFile( const MAKRti::DtFilename& filename );
00185 
00186    static const MAKRti::DtString& connectionTypeString( ConnectionType connType );
00187 
00188 protected:
00189 
00190    static void initialize();
00191    static MAKRti::DtFilename* thePathToHtmlRoot;
00192    static bool theInitializationComplete;
00193    static std::map< MAKRti::DtString, MAKRti::DtString >* theBinaryFileTypesToContentTypeMap;
00194    static std::map< MAKRti::DtString, MAKRti::DtString >* theTextFileTypesToContentTypeMap;
00195 };
00196 
00197 
00198 unsigned long DtWebSpyUtils::ConnectionIdentifier::id() const
00199 {
00200    return myConnId;
00201 }
00202 
00203 DtWebSpyUtils::ConnectionType DtWebSpyUtils::ConnectionIdentifier::type() const
00204 {
00205    return myConnType;
00206 }
00207 
00208 bool DtWebSpyUtils::ConnectionIdentifier::forwarding() const
00209 {
00210    return myForwardingEnabled;
00211 }
00212 
00213 const MAKRti::DtString& DtWebSpyUtils::ConnectionIdentifier::description() const
00214 {
00215    return myConnectionDescription;
00216 }
00217 
00218 #endif //! DtWebSpyUtils_H_
00219 

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)