VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
setSpeedAndHeading.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2006 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: setSpeedAndHeading.h,v $ $Revision: 1.3 $ $State: Exp $
7 *******************************************************************************/
8 #pragma once
9 
11 #include <vlpi/netStructs.h>
12 #include <readerWriter/rwReal.h>
14 
15 namespace vrfAddSetExample
16 {
17  //class DtSetSpeedAndHeadingRequest:
18  //
19  //Instances of DtSetSpeedAndHeading are an example of a new kind of set that tells
20  //an entity to set their current speed and heading.
21 
22  //DtSetSpeedAndHeadingString must be a unique string representing the set
23  //(existing string types are defined in msgTypes.h).
24  const DtSetMessageType DtSetSpeedAndHeadingType("set-speed-and-heading");
25 
26  //DtSetSpeedAndHeadingMenuItemIdName must be a unique string identifying the
27  //DtSetSpeedAndHeadingMenuItem object, which inherits from DtVrfTaskSetMenuItem
28  const char DtSetSpeedAndHeadingMenuItemIdName[] = "DtSetSpeedAndHeadingMenuItem";
29 
31  {
32 
33  public:
34 
35  //default constructor
37 
38  //constructor;
39  //If you have a request 'put' itself, the writeName will preface it.
40  DtSetSpeedAndHeadingRequest(const DtString & writeName,
41  DtReaderWriterRegistry * parentRegistry = 0);
42 
43  //copy constructor
45  orig, DtReaderWriterRegistry * parentRegistry = 0);
46 
47  //assignment operator
49 
50  virtual ~DtSetSpeedAndHeadingRequest() override;
51 
52  //Returns DtSetSpeedAndHeadingRequestType.
53  virtual const DtSetMessageType& type() const override;
54 
55  //Creates a copy of the request.
56  virtual DtSetDataRequest * clone(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0) const override;
57 
58  //Get a readable string representation of this setDataRequest.
59  virtual DtString stringRep() const override;
60 
61  //In meters/second.
62  virtual DtReal speed() const;
63  virtual void setSpeed(DtReal speed);
64 
65  //In radians
66  virtual DtReal heading() const;
67  virtual void setHeading(DtReal heading);
68 
69  //Returns the size of the full network representation
70  //padded to an 8-byte boundary.
71  virtual int netRepSize() const override;
72 
73  //Fills in the task from the network buffer.
74  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
75 
76  //Fills in the network buffer (created by base class setDataRequest) with
77  //the set data request contents.
78  virtual bool setToNet() override;
79 
80  static DtSetDataRequest * creator();
81 
82  protected:
83 
86  };
87 }
88 
89 
const DtSetMessageType DtSetSpeedAndHeadingType("set-speed-and-heading")
DtRwReal myHeading
Definition: setSpeedAndHeading.h:85
Definition: readerWriterRegistry.h:39
Definition: setSpeedAndHeading.h:30
virtual int netRepSize() const override
DtRwReal mySpeed
Definition: setSpeedAndHeading.h:84
DtSetDataRequest is an abstract base class from which real setDataRequests can derive. It manages the read/write capability; derived classes need only use and register read/writatble data types for derived information.
Definition: setDataRequest.h:41
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize) override
Sets the contents of this set request based on the network buffer. Base class does nothing and return...
virtual const DtSetMessageType & type() const override
What kind of setDataRequest am I? (from radioMsgTypes.h). Returns a string representing the kind of d...
virtual bool setToNet() override
Sets netRep buffer to the contents of this set request. Base class does nothing and returns true...
const char DtSetSpeedAndHeadingMenuItemIdName[]
Definition: setSpeedAndHeading.h:28
Define constants for types of tasks, sets, admin messages, reports, and sim commands (all sent via ra...
const DtSetSpeedAndHeadingRequest & operator=(const DtSetSpeedAndHeadingRequest &orig)
virtual DtSetDataRequest * clone(const DtString &name, DtReaderWriterRegistry *parentRegistry=0) const override
Make a copy of this request. Returns a pointer to a newly created copy of this data request...
Description: Readable, Writable DtReal (double)
Definition: rwReal.h:27
virtual void setHeading(DtReal heading)
virtual DtString stringRep() const override
Get a readable string representation of this setDataRequest. Returns a human readable string represen...
virtual DtSymbolString name() const
Accessor for name of this readable/writable object.

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)