MAK RTIspy API Documentation for HLA 1516
wwwRequestXmlBlock.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  ** Copyright (c) 2006 MaK Technologies, Inc.
00003  ** All rights reserved.
00004  *********************************************************************/
00005 /*******************************************************************************
00006  ** $RCSfile: wwwRequestXmlBlock.h,v $ $Revision: 1.10 $ $State: Exp $
00007  *******************************************************************************/
00008 #ifndef DtWwwRequestXmlBlock_H_
00009 #define DtWwwRequestXmlBlock_H_
00010 
00011 #include <rtiMsConfig.h>
00012 #include "spyXmlBlock.h"
00013 #include <mtl/env.h>
00014 #include "webSpyUtils.h"
00015 
00016 #include <vlutil/vlString.h>
00017 #include <vlutil/vlFilename.h>
00018 #include <vlutil/vlSmartPointers.h>
00019 
00020 #include <iosfwd>
00021 #include <map>
00022 
00023 // Define the XML tags used by this block
00024 DtDECLARE_SPY_XML_TAG( DtWwwRequestXmlTag );
00025 DtDECLARE_SPY_XML_TAG( DtWwwRequestParamXmlTag );
00026 DtDECLARE_SPY_XML_TAG( DtRequestParamValueXmlTag );
00027 DtDECLARE_SPY_XML_TAG( DtRequestIdXmlTag );
00028 DtDECLARE_SPY_XML_TAG( DtRequestComponentLinkXmlTag );
00029 DtDECLARE_SPY_XML_TAG( DtRequestConnectionIdXmlTag );
00030 DtDECLARE_SPY_XML_TAG( DtRequestProxiedXmlTag );
00031 DtDECLARE_SPY_XML_TAG( DtRequestFederationHandleXmlTag );
00032 DtDECLARE_SPY_XML_TAG( DtRequestFederateHandleXmlTag );
00033 DtDECLARE_SPY_XML_TAG( DtRequestStateTypeXmlTag );
00034                       
00035 class DtWwwRequestXmlBlock;
00036 class DtWwwRequestParamXmlBlock;
00037 typedef DtBoost::shared_ptr<DtWwwRequestXmlBlock> DtWwwRequestXmlBlockSP;
00038 typedef DtBoost::weak_ptr<DtWwwRequestXmlBlock>   DtWwwRequestXmlBlockWP;
00039 typedef DtBoost::shared_ptr<DtWwwRequestParamXmlBlock> DtWwwRequestParamXmlBlockSP;
00040 typedef DtBoost::weak_ptr<DtWwwRequestParamXmlBlock>   DtWwwRequestParamXmlBlockWP;
00041 
00042 
00043 // The DtWwwRequestParamXmlBlock holds a single name/value pair for a WWW request message
00044 // Helper class to DtWwwRequestXmlBlock.
00045 class DT_DLL_WWW DtWwwRequestParamXmlBlock : public DtSpyXmlBlock
00046 {
00047 public:
00048    
00049    static DtSpyXmlBlockSP create( DtNodeAndParentPair xmlNodeAndParent );
00050 
00051 public:
00052    DtWwwRequestParamXmlBlock( DtEnvValueSP existingNode, DtEnvValueSP root );
00053    DtWwwRequestParamXmlBlock( const DtString& name, const DtString& val, DtEnvValueSP root );
00054    virtual ~DtWwwRequestParamXmlBlock();
00055 
00056    virtual void setVal( const DtString& val );
00057    virtual DtString val() const;
00058    
00059 protected:
00060 
00061    // NOTE: use name "Val" since "Value" is heavily overloaded and will cause problems
00062    DtSpyXmlBlockElement< DtString, true > myVal;    
00063 };
00064 
00065 
00066 // The DtWwwRequestXmlBlock holds a complete WWW request message
00067 class DT_DLL_WWW DtWwwRequestXmlBlock : public DtSpyXmlBlock
00068 {
00069 public:
00070    typedef std::set< DtWwwRequestParamXmlBlockSP > WwwRequestParamXmlBlockSet;
00071 
00072    static DtSpyXmlBlockSP create( DtNodeAndParentPair xmlNodeAndParent );
00073 
00074 public:
00075    DtWwwRequestXmlBlock( DtEnvValueSP existingNode, DtEnvValueSP root );
00076    DtWwwRequestXmlBlock( DtWebSpyUtils::WwwControlMsgCommandId id, unsigned long link,
00077       unsigned long connId, unsigned long federationHandle, unsigned long federateHandle,
00078       unsigned long requestType, bool proxied, DtEnvValueSP root );
00079    virtual ~DtWwwRequestXmlBlock();
00080 
00081    // Add and Remove parameters from the list
00082    virtual DtWwwRequestParamXmlBlockSP addParameter( const DtString& name, const DtString& val );
00083    virtual DtWwwRequestParamXmlBlockSP removeParameter( const DtString& name );
00084    virtual void removeParameter( DtWwwRequestParamXmlBlockSP paramSP );
00085 
00086    // The value of a specific parameter by name
00087    // returns null string if parameter not found
00088    DtString getParamValue( const DtString& paramName );
00089 
00090    // List the request parameters
00091    virtual WwwRequestParamXmlBlockSet params();
00092 
00093    inline DtWebSpyUtils::WwwControlMsgCommandId commandId();
00094    inline unsigned long componentLink();
00095    inline unsigned long connectionId();
00096    inline unsigned long federationHandle();
00097    inline unsigned long federateHandle();
00098    inline unsigned long requestType();
00099    inline bool isProxied();
00100 
00101 protected:
00102 
00103    DtSpyXmlBlockElement< unsigned long, true > myRequestId; 
00104    DtSpyXmlBlockElement< unsigned long, true >  myLink;
00105    DtSpyXmlBlockElement< unsigned long, true > myConnId;
00106    DtSpyXmlBlockElement< unsigned long, true > myFedex;
00107    DtSpyXmlBlockElement< unsigned long, true > myFed;
00108    DtSpyXmlBlockElement< unsigned long, true > myRequestType;
00109    DtSpyXmlBlockElement< unsigned int, true> myProxied;
00110 };
00111 
00112 inline DtWebSpyUtils::WwwControlMsgCommandId DtWwwRequestXmlBlock::commandId()
00113 {
00114    return static_cast<DtWebSpyUtils::WwwControlMsgCommandId>( (unsigned long) myRequestId );
00115 }
00116 
00117 inline unsigned long DtWwwRequestXmlBlock::componentLink() { return myLink; }
00118 inline unsigned long DtWwwRequestXmlBlock::connectionId() { return myConnId; }
00119 inline unsigned long DtWwwRequestXmlBlock::federationHandle() { return myFedex; }
00120 inline unsigned long DtWwwRequestXmlBlock::federateHandle() { return myFed; }
00121 inline unsigned long DtWwwRequestXmlBlock::requestType() { return myRequestType; }
00122 inline bool          DtWwwRequestXmlBlock::isProxied() { return (bool)myProxied; }
00123 
00124 
00125 #endif // DtWwwRequestXmlBlock_H_
00126 

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)