VR-Exchange 2.2 API Documentation
statisticsReportMessage.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2013 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <namespace.h>
13 
14 #include <portal/pControlMessage.h>
15 
16 #include <broker/frameTimer.h>
17 
18 namespace MAKVrExchange
19 {
20 
23  class DT_DLL_LIBPORTAL DtStatisticsReportMessage
24  : public DtPortalControlMessageTemplate<DtStatisticsReportMessageKind>
25  {
26  public:
27 
30 
32  typedef void (*StatisticsReportMessageCallbackType) (
33  const DtStatisticsReportMessage& message, void* userData );
34 
38  {
40  StatisticsField( const DtString& name, double val,
41  const DtString& unitStr = "", const DtString& descStr = "" )
42  : displayName( name )
43  , description( descStr )
44  , units( unitStr )
45  , value( val )
46  {
47  }
48 
51  bool operator < ( const StatisticsField& other ) const
52  {
53  return ( displayName < other.displayName );
54  }
55 
59  double value;
60 
61  };
62 
64  typedef std::vector<StatisticsField> FieldEntryVector;
65 
66  public:
67 
68  // Creator.
69  static DtPortalMessage* create();
70 
71  // CTOR.
73 
74  // Copy CTOR.
76 
77  // Virtual DTOR.
78  virtual ~DtStatisticsReportMessage();
79 
80  // Assignment operator.
82 
83  // Computes the encoded size of the message.
84  virtual unsigned int netSize() const;
85 
86  // Writes the message to the given buffer.
87  virtual void writeSelfToBuffer( void* buffer ) const;
88 
89  // Reads the message from the given buffer.
90  virtual void readSelfFromBuffer( const void* buffer );
91 
92  // Prints the contents of the message to the given stream.
93  virtual std::ostream& printDataToStream( std::ostream& stream ) const;
94 
95  // Add the given callback to be called when message is sent.
96  static void addCallback( DtPortalConnection* connection,
97  StatisticsReportMessageCallbackType callbackFunction, void* userData );
98 
99  // Remove the given callback so it's not called when message is sent.
100  static void removeCallback( DtPortalConnection* connection,
101  StatisticsReportMessageCallbackType callbackFunction, void* userData );
102 
105 
107  DtDEC_ATTRIBUTE( FieldEntryVector, FieldEntries, fieldEntries );
108 
110  DtDEC_ATTRIBUTE( DtTime, ReportingInterval, reportingInterval );
111 
113 
114  };
115 
116 }

Document ID: Generated on Mon Apr 15 17:15:50 EDT 2013 from SVN revision 126154
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)