VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
mySimCommand.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2006 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 
7 //\file consoleMessageCommand.h
8 //\brief DtConsoleMessageCommand.
9 
10 #pragma once
11 
12 #include "vrfplan/simCommand.h"
13 #include <readerWriter/rwString.h>
14 #include <vlutil/vlPrint.h>
16 
17 const DtSimCommandMessageType MySimCommandType("my-sim-command");
18 
19 //\brief DtSimCommand which causes a console message to be printed.
20 //This command will simply print a message to the back-end console
21 
22 class MySimCommand : public DtSimCommand
23 {
24 public:
25  //Default constructor
26  MySimCommand();
27 
28  //Usual constructor
29  MySimCommand(const DtString& writeName,
30  DtReaderWriterRegistry* parentRegistry = NULL);
31 
32  //copy constructor
33  MySimCommand(const DtString & writeName, const MySimCommand& orig,
34  DtReaderWriterRegistry* parentRegistry = NULL);
35 
36  //destructor
37  virtual ~MySimCommand() override;
38 
39  //assignment operator
40  MySimCommand& operator=(const MySimCommand& orig);
41 
42  //\return MySimCommandType.
43  virtual const DtSimCommandMessageType& type() const override;
44 
45  //\return A new instance of this class, copied from the original.
46  virtual DtSimCommand * clone(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0) const override;
47 
48  //Message to print to console
50  virtual DtString messageText() const;
51  virtual void setMessageText(const DtString& text);
53 
54  //Text representation of this command.
55  virtual DtString stringRep() const override;
56 
57  //\copydoc DtSimCommand::netRepSize()
58  virtual int netRepSize() const override;
59 
60  //\copydoc DtSimCommand::setFromNet()
61  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
62 
63  //\copydoc DtSimCommand::setToNet()
64  virtual bool setToNet() override;
65 
66  //Returns a new instance of this class.
67  static DtSimCommand* creator();
68 
69 protected:
71 };
72 
virtual const DtSimCommandMessageType & type() const override
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize) override
Sets mySubsimCommand member from the incoming contentBuffer (cast to type DtNetSimSimCommand). Derived classes should call down to this function first, and then extract their own data starting at the location contentBuffer + DtSimCommand::netRepSize().
virtual bool setToNet() override
Calls netRep() to create the network buffer. Casts the resulting myNetRep to type DtNetSimSimCommand*...
virtual int netRepSize() const override
Returns the size in bytes of the network representation of the class. This is the size in bytes of th...
Description: Readable, Writable DtString Variable substitutions are done on this object when it is re...
Definition: rwString.h:20
Definition: readerWriterRegistry.h:39
virtual ~MySimCommand() override
virtual void setMessageText(const DtString &text)
MySimCommand & operator=(const MySimCommand &orig)
static DtSimCommand * creator()
Definition: mySimCommand.h:22
virtual DtString messageText() const
const DtSimCommandMessageType MySimCommandType("my-sim-command")
Define constants for types of tasks, sets, admin messages, reports, and sim commands (all sent via ra...
DtSimCommand is an abstract base class from which commands can derive. It manages the read/write capa...
Definition: simCommand.h:32
virtual DtString stringRep() const override
Returns a human-readable string representation of the command. This string representation is used to ...
virtual DtSimCommand * clone() const
Version of clone that preserves the existing name, and assigns a null parent registry.
DtRwString myMessageText
Definition: mySimCommand.h:70
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)