VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ifSnapshotsResponse.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include "vrfmsgs/vrfmsgsDefines.h"
12 #include "vrfmsgs/ifStatus.h"
13 #include <vlutil/vlString.h>
15 
16 
24 
26 {
27 public:
28 
29  struct Snapshot
30  {
31  Snapshot() : simTime(0), isPeriodic(false), SnapshotId(-1) {};
32  Snapshot(const Snapshot& orig)
33  : simTime(orig.simTime), SnapshotId(orig.SnapshotId),
34  isPeriodic(orig.isPeriodic) {};
35 
36  virtual ~Snapshot() {};
37 
38  bool operator==(const Snapshot& rhs) const
39  {
40  return ((simTime == rhs.simTime) &&
41  (SnapshotId == rhs.SnapshotId) &&
42  (isPeriodic == rhs.isPeriodic));
43  }
44 
45  bool operator!=(const Snapshot& rhs) const { return !(*this == rhs); }
46 
47  double simTime;
48  bool isPeriodic;
50  };
51 
52  typedef std::map<int, Snapshot> SnapshotStatus;
53 
54 public:
55 
58 
60  virtual ~DtIfSnapshotsResponse() override;
61 
64 
67 
69  virtual int type() const override;
70 
71  virtual DtSimInterfaceContent * clone() const override;
72 
73  virtual int netRepSize() const override;
74  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
75  virtual bool setToNet() override;
76 
77  virtual void printDataToString(DtString& str) override;
78 
79  static DtSimInterfaceContent* creator();
80 
83  virtual const SnapshotStatus& snapshots() const;
84  virtual void addSnapshot(int id, double simTime, bool isPeriodic);
85  virtual void setSnapshots(const SnapshotStatus&);
86  virtual void removeSnapshot(int id);
87  virtual void removeAllBut(int id);
88  virtual void clear();
90 
91  virtual void setBaseSnapshotTime(double);
92  virtual void clearBaseSnapshot();
93  double baseSnapshotTime() const { return myBaseSnapshotTime; };
94  bool hasBaseSnapshot() const { return myHasBaseSnapshot; };
95 
96 protected:
97  SnapshotStatus mySnapshots;
100 };
101 
102 namespace DtBufferSerialize
103 {
106 
110  DT_DLL_vrfmsgs char *encode(const DtIfSnapshotsResponse::Snapshot& messagePtr, char *buffer);
111 
115  DT_DLL_vrfmsgs const char *decode(DtIfSnapshotsResponse::Snapshot& messagePtr, const char *buffer);
116 }
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize)
Definition: simInterfaceContent.h:78
virtual int netRepSize() const
Definition: simInterfaceContent.h:76
double simTime
Definition: ifSnapshotsResponse.h:47
DT_DLL_readerWriter int getSize(const DtString &val)
The number of bytes required to encode the value.
#define DT_DLL_vrfmsgs
This file is used to determine how to build.
Definition: vrfmsgsDefines.h:28
virtual int type() const =0
double myBaseSnapshotTime
Definition: ifSnapshotsResponse.h:98
Snapshot(const Snapshot &orig)
Definition: ifSnapshotsResponse.h:32
bool operator==(const Snapshot &rhs) const
Definition: ifSnapshotsResponse.h:38
bool isPeriodic
Definition: ifSnapshotsResponse.h:48
int SnapshotId
Definition: ifSnapshotsResponse.h:49
virtual ~Snapshot()
Definition: ifSnapshotsResponse.h:36
virtual void printDataToString(DtString &str)
Definition: ifSnapshotsResponse.h:29
class DtIfSnapshotsResponse:
Definition: ifSnapshotsResponse.h:25
const DtSimInterfaceContent & operator=(const DtSimInterfaceContent &orig)
DT_DLL_readerWriter char * encode(const DtFilename &val, char *buffer)
Serializes the provided value val into buffer. buffer must have at least the number of bytes returned...
Snapshot()
Definition: ifSnapshotsResponse.h:31
double baseSnapshotTime() const
Definition: ifSnapshotsResponse.h:93
bool operator!=(const Snapshot &rhs) const
Definition: ifSnapshotsResponse.h:45
virtual bool setToNet()
Definition: simInterfaceContent.h:83
Definition: simInterfaceContent.h:45
DT_DLL_readerWriter const char * decode(DtString &val, const char *buffer)
Decodes a value from buffer and places the result in val of the type specified by val...
virtual DtSimInterfaceContent * clone() const =0
bool myHasBaseSnapshot
Definition: ifSnapshotsResponse.h:99
std::map< int, Snapshot > SnapshotStatus
Definition: ifSnapshotsResponse.h:52

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)