VR-Forces 4.0.4 Class Documentation
examples/addSet/addSetSim/setSpeedAndHeading.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2006 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: setSpeedAndHeading.h,v $ $Revision: 1.3 $ $State: Exp $
00007 *******************************************************************************/
00008 
00009 #ifndef SETSPEEDANDHEADING_H_
00010 #define SETSPEEDANDHEADING_H_
00011 
00012 #include "vrftasks/setDataReq.h"
00013 #include <vlpi/NetStructs.h>
00014 #include "vrfutil/rwReal.h"
00015 #include "vrftasks/radioMsgTypes.h"
00016 
00017 namespace vrfAddSetExample
00018 {
00019    //class DtSetSpeedAndHeadingRequest:
00020    //
00021    //Instances of DtSetSpeedAndHeading are an example of a new kind of set that tells
00022    //an entity to set their current speed and heading.
00023 
00024    //This number is used to identify the type of DtSetDataRequest, and is returned
00025    //by DtSetSpeedAndHeading::type(). To be sure that it doesn't conflict with any 
00026    //existing types use a number greater than MIN_USER_RADIO_MESSAGE_TYPE as 
00027    //defined in radioMsgTypes.h. 
00028    const int DtSetSpeedAndHeadingRequestType = MIN_USER_RADIO_MESSAGE_TYPE + 52;
00029 
00030    //DtSetSpeedAndHeadingString must be a unique string representing the set 
00031    //(existing string types are defined in msgTypes.h).
00032    const char DtSetSpeedAndHeadingString[] = "set-speed-and-heading";
00033 
00034    //DtSetSpeedAndHeadingMenuItemIdName must be a unique string identifying the 
00035    //DtSetSpeedAndHeadingMenuItem object, which inherits from DtVrfTaskSetMenuItem
00036    const char DtSetSpeedAndHeadingMenuItemIdName[] = "DtSetSpeedAndHeadingMenuItem";
00037 
00038    //This struct is the network representation of a set speed and heading set.
00039    struct DtNetSetSpeedAndHeadingRequest
00040    {
00041    DtNetFloat64 mySpeed;
00042    DtNetFloat64 myHeading;
00043    };
00044 
00045    class DtSetSpeedAndHeadingRequest : public DtSetDataRequest
00046    {
00047 
00048    public:
00049 
00050       //default constructor
00051    DtSetSpeedAndHeadingRequest();
00052 
00053       //constructor; 
00054       //If you have a request 'put' itself, the writeName will preface it.
00055    DtSetSpeedAndHeadingRequest(const DtString & writeName, 
00056       DtReaderWriterRegistry * parentRegistry = 0);
00057 
00058       //copy constructor
00059    DtSetSpeedAndHeadingRequest(const DtString & writeName, const DtSetSpeedAndHeadingRequest &
00060       orig, DtReaderWriterRegistry * parentRegistry = 0);
00061 
00062       //assignment operator
00063    const DtSetSpeedAndHeadingRequest & operator=(const DtSetSpeedAndHeadingRequest & orig);
00064 
00065    virtual ~DtSetSpeedAndHeadingRequest();
00066 
00067       //Returns DtSetSpeedAndHeadingRequestType.
00068    virtual int type() const;
00069 
00070       //Creates a copy of the request.
00071    virtual DtSetDataRequest * clone(const DtString & name, 
00072       DtReaderWriterRegistry * parentRegistry = 0) const;
00073 
00074       //Get a readable string representation of this setDataRequest.
00075    virtual DtString stringRep() const;
00076 
00077       //In meters/second.
00078    virtual DtReal speed() const;
00079    virtual void setSpeed(DtReal speed);
00080 
00081       //In radians
00082    virtual DtReal heading() const;
00083    virtual void setHeading(DtReal heading);
00084 
00085       //Returns the size of the full network representation 
00086       //padded to an 8-byte boundary.
00087    virtual int netRepSize() const;
00088 
00089       //Fills in the task from the network buffer.
00090    virtual bool setFromNet(const char* contentBuffer, 
00091       unsigned contentSize);
00092 
00093       //Fills in the network buffer (created by base class setDataRequest) with 
00094       //the set data request contents.
00095    virtual bool setToNet();
00096 
00097    static DtSetDataRequest * creator();
00098 
00099    protected:
00100 
00101    DtRwReal mySpeed;
00102    DtRwReal myHeading;
00103    };
00104 }
00105 #endif
00106 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)