![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2002 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: retreatTask.h,v $ $Revision: 1.4 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00009 #ifndef DtRetreatTask_H_ 00010 #define DtRetreatTask_H_ 00011 00012 #include "vrftasks/simTask.h" 00013 #include <vlutil/vlNetTypes.h> 00014 #include "vrfutil/rwString.h" 00015 #include "vrftasks/radioMsgTypes.h" 00016 00017 //class DtRetreatTask: 00018 // 00019 //Instances of DtRetreatTask are an example of a new kind of task that tells 00020 //an entity to either "retreat-immediately", or "hold-ground" (and retreat 00021 //only if you come under fire). 00022 00023 //This number is used to identify the type of DtSimTask, and is returned 00024 //by DtRetreatTask::type(). To be sure that it doesn't conflict with any 00025 //existing types use a number greater than MIN_USER_RADIO_MESSAGE_TYPE as 00026 //defined in radioMsgTypes.h. 00027 const int DtRetreatTaskType = MIN_USER_RADIO_MESSAGE_TYPE + 1; 00028 00029 //DtRetreatTaskTypeString must be a unique string representing the task 00030 //(existing string types are defined in msgTypes.h). 00031 const char DtRetreatTaskTypeString[] = "retreat-task"; 00032 00033 class DtRetreatTask : public DtSimTask 00034 { 00035 public: 00036 00037 //default constructor 00038 DtRetreatTask(); 00039 00040 //constructor 00041 DtRetreatTask(const DtString & writeName, 00042 DtReaderWriterRegistry * parentRegistry = 0); 00043 00044 //destructor 00045 virtual ~DtRetreatTask(); 00046 00047 //copy constructor - not implemented 00048 DtRetreatTask(const DtString & writeName, const 00049 DtRetreatTask & orig, DtReaderWriterRegistry * 00050 parentRegistry = 0); 00051 00052 //assignment operator - not implemented 00053 DtRetreatTask& operator=(const DtRetreatTask& orig); 00054 00055 //Returns DtRetreatTaskType (defined above). 00056 virtual int type() const; 00057 00058 //Creates a copy of the task. 00059 virtual DtSimTask * clone(const DtString & name, 00060 DtReaderWriterRegistry * parentRegistry = 0) const; 00061 00062 //Get a readable string representation of this task. 00063 virtual DtString stringRep() const; 00064 00065 //A character string representing the kind of retreat task. The allowed 00066 //retreat task strings are "retreat-immediately" and "hold-ground". 00067 virtual const DtString & retreatKind() const; 00068 virtual void setRetreatKind(const DtString & retreatKind); 00069 00070 //Returns the size of the full network representation 00071 //padded to an 8-byte boundary. Be sure to call the base class's 00072 //netRepSize() and add the returned value in computation of overall size 00073 //of network representation. 00074 virtual int netRepSize() const; 00075 00076 //Fills in the task from the network buffer. Be sure to call down to the 00077 //base class's setFromNet() to ensure that the entire message is set from 00078 //the network representation. 00079 virtual bool setFromNet(const char* contentBuffer, 00080 unsigned contentSize); 00081 00082 //Fills in the network buffer (created by base class simTask) with the 00083 //task contents. Be sure to call down to base class's setToNet() to ensure 00084 //complete contents of the message are set in the network representation. 00085 virtual bool setToNet(); 00086 00087 static DtSimTask * creator(); 00088 00089 protected: 00090 00091 DtRwString myRetreatKind; 00092 }; 00093 00094 #endif 00095