VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
myCommsModel.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 //\file myCommsModel.h
7 //\brief An implementation of DtCommModel that models a simple radio model,
8 //\using signal interaction as the network transport type.
9 //\Will check the range between the sender and receiver. If the power of the sender's
10 //\radio is too weak for the range then the receiver will not get the message.
11 
12 #pragma once
13 
15 
16 const char MyCommModelType[] = "my-comm-model";
17 
19 {
20 private:
21  //Not implemented.
23  MyCommModel();
24  MyCommModel(const MyCommModel& orig);
25  MyCommModel& operator=(const MyCommModel& orig);
27 
28 protected:
29  //Use the create() method instead of calling the constructor.
31  //Virtual init() called from the create() method.
32  //Calls createTransporter() to set myTransporter.
33  virtual bool init();
34 
35 public:
36  //Static creator function that can be registered with factories.
37  //Calls the constructor, and init() on the new instance before returning it.
38  //The params passed in are those read in from the commModelParams.mtl file for your simulation
39  //model set. If you'd like to add to these derive a new commModelDescriptor.
41 
42  virtual ~MyCommModel();
43 
44  //\return MyCommModelType.
45  //Type strings for default commModel subclasses are defined in
46  //commModelTypes.h. Returns MyCommModelType.This is the string that is added to the commModelParams.mtl
47  //configuration file for the simulation model set being used. Make sure the string returned here
48  //matches what is in that file.
49  virtual DtString type() const;
50 
51  //Overridden from base to set the ReadyToSend status of the radio to
52  //true as soon as it registers.
53  virtual void registerRadio(DtVrfRadio* radio);
54 
55 protected:
56 
57  //Checks the connectivity of the radios for delivery of message.
58  //\return True if the message is allowed to be delivered, or false
59  //of the sender/receiver radios are not connected.
60  //Results will vary, depending on the current connection mode specified
61  //in the descriptor--default connection modes are "all"--you can send to any entity regardless of force,
62  //"force"--you can send to anyone in your force type, or "aggregate"--you can only send to those in your
63  //same echelon, same aggregate.
64  //For this example we will simply do a range check and see if the receiver is
65  //within the power range of the sender's radio.
66  virtual bool checkRadioConnectivity(DtSimObjectReference sender, DtSimObjectReference receiver) const override;
67 
68 protected:
69 
70 };
71 
Structure of data passed to the DtRadio constructor.
Definition: commModel.h:27
An implementation of DtCommModel that models a simple radio model, using signal interaction as the ne...
Definition: simpleRadioCommModel.h:32
virtual DtString type() const
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
Base class for all communication models in VR-Forces. A DtCommModel is the central point for modeling...
Definition: commModel.h:58
Definition: myCommsModel.h:18
virtual void registerRadio(DtVrfRadio *radio)
Overridden from base to set the ReadyToSend status of the radio to true as soon as it registers...
virtual ~MyCommModel()
MyCommModel & operator=(const MyCommModel &orig)
static DtCommModel * create(DtCommModelCreationParams &params)
const char MyCommModelType[]
Definition: myCommsModel.h:16
virtual bool checkRadioConnectivity(DtSimObjectReference sender, DtSimObjectReference receiver) const override
Checks the connectivity of the radios for delivery of message.
Base class for any radios on VrfObjects. A DtVrfRadio acts as the interface between an entity and a D...
Definition: vrfRadio.h:41
virtual bool init()
Virtual init() called from the create() method. Calls createTransporter() to set myTransporter.

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)