MAK RTIspy API Documentation for HLA 1.3
lrcObjInterStatsXmlBlock.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  ** Copyright (c) 2006 MaK Technologies, Inc.
00003  ** All rights reserved.
00004  *********************************************************************/
00005 /*******************************************************************************
00006  ** $RCSfile: lrcObjInterStatsXmlBlock.h,v $ $Revision: 1.8 $ $State: Exp $
00007  *******************************************************************************/
00008 #ifndef DtLrcObjInterStatsXmlBlock_H_
00009 #define DtLrcObjInterStatsXmlBlock_H_
00010 
00011 #include <rtiMsConfig.h>
00012 #include "spyXmlBlock.h"
00013 #include "objIntStatsXmlBlock.h"
00014 #include <mtl/env.h>
00015 #include "webSpyUtils.h"
00016 
00017 #include <vlutil/vlFedTarget.h>
00018 #include <vlutil/vlString.h>
00019 #include <vlutil/vlFilename.h>
00020 #include <vlutil/vlSmartPointers.h>
00021 
00022 #include <iosfwd>
00023 #include <map>
00024 
00025 // Define the XML tags used by this block
00026 DtDECLARE_SPY_XML_TAG( DtLrcObjInterStatsXmlTag );
00027 DtDECLARE_SPY_XML_TAG( DtLrcObjIntStatsTimeStampXmlTag );
00028 
00029 class DtLrcObjInterStatsXmlBlock;
00030 typedef DtBoost::shared_ptr<DtLrcObjInterStatsXmlBlock> DtLrcObjInterStatsXmlBlockSP;
00031 typedef DtBoost::weak_ptr<DtLrcObjInterStatsXmlBlock>   DtLrcObjInterStatsXmlBlockWP;
00032 
00033 // The DtLrcObjInterStatsXmlBlock holds the current statistics for the objects and interactions
00034 // known by a given LRC
00035 class DT_DLL_WWW DtLrcObjInterStatsXmlBlock : public DtSpyXmlBlock
00036 {
00037 public:
00038    typedef std::map< unsigned long, DtObjIntStatsXmlBlockSP > ObjectInstancesByHandleMap;
00039    typedef std::map< unsigned long, DtObjIntStatsXmlBlockSP > InteractionClassesByHandleMap;
00040    
00041    static DtSpyXmlBlockSP create( DtNodeAndParentPair xmlNodeAndParent );
00042 
00043 public:
00044    DtLrcObjInterStatsXmlBlock( DtEnvValueSP existingNode, DtEnvValueSP root );
00045    DtLrcObjInterStatsXmlBlock( DtEnvValueSP root );
00046    virtual ~DtLrcObjInterStatsXmlBlock();
00047 
00048    // Reset all values to zero
00049    virtual void reset();
00050    
00051    // Add a new object (registered or discovered)
00052    virtual void addObject( bool isRegistered, unsigned int objHandle, unsigned int classHandle );
00053 
00054    // Record statistics about an update message
00055    void recordUpdate( bool isSent, unsigned int msgSize, double time, unsigned int handle );
00056    
00057    // Record statistics about an interaction message   
00058    void recordInteraction( bool isSent, unsigned int msgSize, double time, unsigned int handle );
00059 
00060    // Record that an object has been deleted
00061    void recordDeletion( unsigned int handle );
00062 
00063    // Record that an object has been removed
00064    void recordRemoval( unsigned int handle );
00065 
00066    // Get a pointer to the current statistics for a specific object instance
00067    const DtObjIntStatsXmlBlockSP objectStats( unsigned int handle ) const;
00068 
00069    // Get a pointer to the current statistics for a specific interaction class
00070    const DtObjIntStatsXmlBlockSP interactionStats( unsigned int handle ) const;
00071 
00072 
00073    // Access the complete list of RTI objects
00074    inline const ObjectInstancesByHandleMap& objects() const;
00075    
00076    // Access the complete list of RTI interactions
00077    inline const InteractionClassesByHandleMap& interactions() const;
00078 
00079    // Timestamp access
00080    inline void setTimeStamp();
00081    inline DtTime timeStamp() const;
00082    
00083 protected:
00084 
00085    DtClock myClock;
00086    DtSpyXmlBlockElement< double, true > myTimestamp;
00087    ObjectInstancesByHandleMap myObjects;
00088    InteractionClassesByHandleMap myInteractions;
00089 };
00090 
00091 inline void DtLrcObjInterStatsXmlBlock::setTimeStamp()
00092 {
00093    myTimestamp = myClock.absRealTime();
00094 }
00095 
00096 inline DtTime DtLrcObjInterStatsXmlBlock::timeStamp() const
00097 {
00098    return myTimestamp;
00099 }
00100 
00101 inline const DtLrcObjInterStatsXmlBlock::ObjectInstancesByHandleMap& DtLrcObjInterStatsXmlBlock::objects() const
00102 {
00103    return myObjects;
00104 }
00105 
00106 inline const DtLrcObjInterStatsXmlBlock::InteractionClassesByHandleMap& DtLrcObjInterStatsXmlBlock::interactions() const
00107 {
00108    return myInteractions;
00109 }
00110 
00111 
00112 #endif // DtLrcObjInterStatsXmlBlock_H_
00113 

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)