MAK RTIspy API Documentation for HLA 1.3
msgStatsXmlBlock.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  ** Copyright (c) 2006 MaK Technologies, Inc.
00003  ** All rights reserved.
00004  *********************************************************************/
00005 /*******************************************************************************
00006  ** $RCSfile: msgStatsXmlBlock.h,v $ $Revision: 1.7 $ $State: Exp $
00007  *******************************************************************************/
00008 #ifndef DtMsgStatsXmlBlock_H_
00009 #define DtMsgStatsXmlBlock_H_
00010 
00011 #include <rtiMsConfig.h>
00012 #include "spyXmlBlock.h"
00013 #include <mtl/env.h>
00014 #include "statisticsXmlBlock.h"
00015 #include "msgStatsXmlBlock.h"
00016 #include "rtiMsg.h"
00017 
00018 #include <vlutil/vlString.h>
00019 #include <vlutil/vlSmartPointers.h>
00020 
00021 // Define the XML tags used by this block
00022 DtDECLARE_SPY_XML_TAG( DtMsgStatsXmlTag );
00023 DtDECLARE_SPY_XML_TAG( DtMsgStatsSentMsgCountXmlTag );
00024 DtDECLARE_SPY_XML_TAG( DtMsgStatsReadMsgCountXmlTag );
00025 DtDECLARE_SPY_XML_TAG( DtMsgStatsSentMsgKindXmlTag );
00026 //DtDECLARE_SPY_XML_TAG( DtMsgStatsOverheadPerMsgXmlTag );
00027 //DtDECLARE_SPY_XML_TAG( DtMsgStatsOverheadPercentXmlTag );
00028                       
00029 class DtMsgStatsXmlBlock;
00030 typedef DtBoost::shared_ptr<DtMsgStatsXmlBlock> DtMsgStatsXmlBlockSP;
00031 typedef DtBoost::weak_ptr<DtMsgStatsXmlBlock>   DtMsgStatsXmlBlockWP;
00032 
00033 // The DtMsgStatsXmlBlock holds statistics about a single message kind
00034 class DT_DLL_WWW DtMsgStatsXmlBlock : public DtSpyXmlBlock
00035 {
00036 public:
00037 
00038    // Creator method
00039    static DtSpyXmlBlockSP create( DtNodeAndParentPair xmlNodeAndParent );
00040 
00041 public:
00042    
00043    // Ctor to build from XML data
00044    DtMsgStatsXmlBlock( DtEnvValueSP existingNode, DtEnvValueSP root );
00045 
00046    // Ctor to build from C++ data
00047    DtMsgStatsXmlBlock( DtRtiMsgKind msgKind, DtEnvValueSP root );
00048    virtual ~DtMsgStatsXmlBlock();
00049 
00050    // Reset data to initial state
00051    virtual void reset();
00052 
00053    // Record a new sent message's stats
00054    virtual void recordSentMsg( unsigned int msgBytes, double sendTime );
00055 
00056    // Record a new read message's stats
00057    virtual void recordReadMsg( unsigned int msgBytes, double readTime );   
00058 
00059    // Get the kind of message
00060    inline DtRtiMsgKind kind() const;
00061 
00062    // Get the current sent message stats
00063    inline unsigned int sendCount() const;
00064    inline DtStatisticsXmlBlock<unsigned int>::BlockSP sentBytes() const;
00065    inline DtStatisticsXmlBlock<double>::BlockSP sendTime() const;
00066 
00067    // Get the current received message stats
00068    inline unsigned int readCount() const;
00069    inline DtStatisticsXmlBlock<unsigned int>::BlockSP readBytes() const;
00070    inline DtStatisticsXmlBlock<double>::BlockSP readTime() const;
00071    
00072 protected:
00073 
00074    DtSpyXmlBlockElement< unsigned int, true > myMsgKind;
00075 
00076    DtSpyXmlBlockElement< unsigned int, true > mySentMsgCount;
00077    DtStatisticsXmlBlock<unsigned int>::BlockWP mySentBytes;
00078    DtStatisticsXmlBlock<double>::BlockWP mySendTime;
00079    
00080    DtSpyXmlBlockElement< unsigned int, true > myReadMsgCount;
00081    DtStatisticsXmlBlock<unsigned int>::BlockWP myReadBytes;
00082    DtStatisticsXmlBlock<double>::BlockWP myReadTime;
00083 
00084    //DtSpyXmlBlockElement< DtMsgStatsOverheadPerMsgXmlTag, unsigned int, true > myOverheadPerMsg;
00085    //DtSpyXmlBlockElement< DtMsgStatsOverheadPercentXmlTag, double, true > myOverheadPercent;
00086 };
00087 
00088 
00089 DtRtiMsgKind DtMsgStatsXmlBlock::kind() const
00090 {
00091    return static_cast<DtRtiMsgKind>( (unsigned int) myMsgKind );
00092 }
00093 
00094 unsigned int DtMsgStatsXmlBlock::sendCount() const
00095 {
00096    return mySentMsgCount;
00097 }
00098 
00099 DtStatisticsXmlBlock<unsigned int>::BlockSP DtMsgStatsXmlBlock::sentBytes() const
00100 {
00101    return mySentBytes.lock();
00102 }
00103 
00104 DtStatisticsXmlBlock<double>::BlockSP DtMsgStatsXmlBlock::sendTime() const
00105 {
00106    return mySendTime.lock();
00107 }
00108 
00109 unsigned int DtMsgStatsXmlBlock::readCount() const
00110 {
00111    return myReadMsgCount;
00112 }
00113 
00114 DtStatisticsXmlBlock<unsigned int>::BlockSP DtMsgStatsXmlBlock::readBytes() const
00115 {
00116    return myReadBytes.lock();
00117 }
00118 
00119 DtStatisticsXmlBlock<double>::BlockSP DtMsgStatsXmlBlock::readTime() const
00120 {
00121    return myReadTime.lock();
00122 }
00123 
00124 #endif // DtMsgStatsXmlBlock_H_
00125 

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)