MAK RTIspy API Documentation for HLA Evolved
lrcConsoleLogXmlBlock.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  ** Copyright (c) 2006 MaK Technologies, Inc.
00003  ** All rights reserved.
00004  *********************************************************************/
00005 /*******************************************************************************
00006  ** $RCSfile: lrcConsoleLogXmlBlock.h,v $ $Revision: 1.6 $ $State: Exp $
00007  *******************************************************************************/
00008 #ifndef DtLrcConsoleLogXmlBlock_H_
00009 #define DtLrcConsoleLogXmlBlock_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 <vector>
00022 
00023 // Define the XML tags used by this block
00024 DtDECLARE_SPY_XML_TAG( DtLrcConsoleLogXmlTag );
00025 DtDECLARE_SPY_XML_TAG( DtLrcConsoleLogEventXmlTag );
00026 DtDECLARE_SPY_XML_TAG( DtLrcConsoleLogEventTimeXmlTag );
00027 DtDECLARE_SPY_XML_TAG( DtLrcConsoleLogEventDescriptionXmlTag );
00028 DtDECLARE_SPY_XML_TAG( DtLrcConsoleLogEventIsRtiAmbXmlTag );
00029 DtDECLARE_SPY_XML_TAG( DtLrcConsoleLogEventIsExceptionXmlTag );
00030 DtDECLARE_SPY_XML_TAG( DtLrcConsoleLogStartIndexXmlTag );
00031 DtDECLARE_SPY_XML_TAG( DtLrcConsoleLogStopIndexXmlTag );
00032 DtDECLARE_SPY_XML_TAG( DtLrcConsoleLogStartTimeXmlTag );
00033 DtDECLARE_SPY_XML_TAG( DtLrcConsoleLogStopTimeXmlTag );
00034 
00035 
00036                       
00037 class DtLrcConsoleLogXmlBlock;
00038 class DtLrcConsoleLogEventXmlBlock;
00039 
00040 typedef DtBoost::shared_ptr<DtLrcConsoleLogXmlBlock> DtLrcConsoleLogXmlBlockSP;
00041 typedef DtBoost::weak_ptr<DtLrcConsoleLogXmlBlock>   DtLrcConsoleLogXmlBlockWP;
00042 typedef DtBoost::shared_ptr<DtLrcConsoleLogEventXmlBlock> DtLrcConsoleLogEventXmlBlockSP;
00043 typedef DtBoost::weak_ptr<DtLrcConsoleLogEventXmlBlock>   DtLrcConsoleLogEventXmlBlockWP;
00044 
00045 
00046 // The DtLrcConsoleLogEventXmlBlock holds a single log event (usually either a service call,
00047 // callback, or exception)
00048 class DT_DLL_WWW DtLrcConsoleLogEventXmlBlock : public DtSpyXmlBlock
00049 {
00050 public:
00051    
00052    static DtSpyXmlBlockSP create( DtNodeAndParentPair xmlNodeAndParent );
00053 
00054 public:
00055    DtLrcConsoleLogEventXmlBlock( DtEnvValueSP existingNode, DtEnvValueSP root );
00056    DtLrcConsoleLogEventXmlBlock( DtTime time, bool isRtiAmbCall, bool isException,
00057       const DtString& description, DtEnvValueSP root );
00058    virtual ~DtLrcConsoleLogEventXmlBlock();
00059 
00060    // Time of the event
00061    inline DtTime time() const;
00062 
00063    // Is this an RTI Amb Call (else its a fedAmbCall)
00064    inline bool isRtiAmbCall() const;
00065 
00066    // Is this a thrown exception?
00067    inline bool isException() const;
00068 
00069    // Log text for the event
00070    inline DtString description() const;
00071 
00072 protected:
00073    
00074    DtSpyXmlBlockElement< double, true > myTime;
00075    DtSpyXmlBlockElement< bool, true > myIsRtiAmbCall;
00076    DtSpyXmlBlockElement< bool, true > myIsException;
00077    DtSpyXmlBlockElement< DtString, true > myDescription;
00078 };
00079 
00080 
00081 // The DtLrcConsoleLogXmlBlock holds a complete list of logged events
00082 class DT_DLL_WWW DtLrcConsoleLogXmlBlock : public DtSpyXmlBlock
00083 {
00084 public:
00085    typedef std::vector< DtLrcConsoleLogEventXmlBlockSP > LrcConsoleLogEventXmlBlockList;
00086 
00087    static DtSpyXmlBlockSP create( DtNodeAndParentPair xmlNodeAndParent );
00088 
00089 public:
00090    DtLrcConsoleLogXmlBlock( DtEnvValueSP existingNode, DtEnvValueSP root );
00091    DtLrcConsoleLogXmlBlock( DtEnvValueSP root );
00092    virtual ~DtLrcConsoleLogXmlBlock();
00093 
00094    // Add and Remove from the log 
00095    virtual DtLrcConsoleLogEventXmlBlockSP addEvent( DtTime time, bool isRtiAmbCall,
00096       bool isException, const DtString& description );
00097    virtual DtLrcConsoleLogEventXmlBlockSP removeEvent( DtTime time );
00098    virtual void removeEvent( DtLrcConsoleLogEventXmlBlockSP eventSP );
00099    
00100    // List the logged events
00101    inline const LrcConsoleLogEventXmlBlockList& events() const;
00102 
00103    // Set/Get the start index (index in total log of first event in this segment)
00104    // - must be set after adding all events if this is not the complete log
00105    inline void setStartIndex( unsigned int startIndex );
00106    inline unsigned int startIndex() const;
00107 
00108 
00109    // Set/Get the stop index (index in total log of last event in this segment)
00110    // - must be set after adding all events if this is not the complete log
00111    inline void setStopIndex( unsigned int startIndex );
00112    inline unsigned int stopIndex() const;
00113 
00114    // Get the start time ( time stamp of first event in this segment )
00115    inline DtTime startTime() const;
00116 
00117    // Get the stop time ( time stamp of last event in this segment )
00118    inline DtTime stopTime() const;
00119 
00120 protected:
00121 
00122    DtSpyXmlBlockElement< unsigned int, true > myStartIndex;
00123    DtSpyXmlBlockElement< unsigned int, true > myStopIndex;
00124    DtSpyXmlBlockElement< double, true > myStartTime;
00125    DtSpyXmlBlockElement< double, true > myStopTime;
00126 
00127    // Local cached pointers to children for faster lookups
00128    LrcConsoleLogEventXmlBlockList myEvents;
00129 };
00130 
00131 DtTime DtLrcConsoleLogEventXmlBlock::time() const { return myTime; }
00132 bool DtLrcConsoleLogEventXmlBlock::isRtiAmbCall() const { return myIsRtiAmbCall; }
00133 bool DtLrcConsoleLogEventXmlBlock::isException() const { return myIsException; }
00134 DtString DtLrcConsoleLogEventXmlBlock::description() const { return myDescription; }
00135 void DtLrcConsoleLogXmlBlock::setStartIndex( unsigned int startIndex ) { myStartIndex = startIndex; }
00136 unsigned int DtLrcConsoleLogXmlBlock::startIndex() const { return myStartIndex; }
00137 void DtLrcConsoleLogXmlBlock::setStopIndex( unsigned int stopIndex ) { myStopIndex = stopIndex; }
00138 unsigned int DtLrcConsoleLogXmlBlock::stopIndex() const { return myStopIndex; }
00139 DtTime DtLrcConsoleLogXmlBlock::startTime() const { return myStartTime; }
00140 DtTime DtLrcConsoleLogXmlBlock::stopTime() const { return myStopTime; }
00141 const DtLrcConsoleLogXmlBlock::LrcConsoleLogEventXmlBlockList& DtLrcConsoleLogXmlBlock::events() const
00142 {
00143     return myEvents;
00144 }
00145 
00146 #endif // DtLrcConsoleLogXmlBlock_H_
00147 

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)