VR-Forces 4.3 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
examples
addCommModel
myCommsModel.h
Go to the documentation of this file.
1
/*******************************************************************************
2
** Copyright (c) 2011 MAK Technologies, Inc.
3
** All rights reserved.
4
*******************************************************************************/
5
/*******************************************************************************
6
** $RCSfile: myCommsModel.h,v $ $Revision: 1.1 $ $State: Exp $
7
** Created: 9/16/11 MEM
8
*******************************************************************************/
9
10
//\file myCommsModel.h
11
//\brief An implementation of DtCommModel that models a simple radio model,
12
//\using signal interaction as the network transport type.
13
//\Will check the range between the sender and receiver. If the power of the sender's
14
//\radio is too weak for the range then the receiver will not get the message.
15
16
#pragma once
17
18
#include "
vrfobjcore/simpleRadioCommModel.h
"
19
20
const
char
MyCommModelType
[] =
"my-comm-model"
;
21
22
class
MyCommModel
:
public
DtSimpleRadioCommModel
23
{
24
private
:
25
//Not implemented.
27
MyCommModel
();
28
MyCommModel
(
const
MyCommModel
& orig);
29
MyCommModel
&
operator=
(
const
MyCommModel
& orig);
31
32
protected
:
33
//Use the create() method instead of calling the constructor.
34
MyCommModel
(
DtCommModelCreationParams
& params);
35
//Virtual init() called from the create() method.
36
//Calls createTransporter() to set myTransporter.
37
virtual
bool
init
();
38
39
public
:
40
//Static creator function that can be registered with factories.
41
//Calls the constructor, and init() on the new instance before returning it.
42
//The params passed in are those read in from the commModelParams.mtl file for your simulation
43
//model set. If you'd like to add to these derive a new commModelDescriptor.
44
static
DtCommModel
*
create
(
DtCommModelCreationParams
& params);
45
46
virtual
~MyCommModel
();
47
48
//\return MyCommModelType.
49
//Type strings for default commModel subclasses are defined in
50
//commModelTypes.h. Returns MyCommModelType.This is the string that is added to the commModelParams.mtl
51
//configuration file for the simulation model set being used. Make sure the string returned here
52
//matches what is in that file.
53
virtual
DtString
type
()
const
;
54
55
//Overridden from base to set the ReadyToSend status of the radio to
56
//true as soon as it registers.
57
virtual
void
registerRadio
(
DtVrfRadio
* radio);
58
59
protected
:
60
61
//Checks the connectivity of the radios for delivery of message.
62
//\return True if the message is allowed to be delivered, or false
63
//of the sender/receiver radios are not connected.
64
//Results will vary, depending on the current connection mode specified
65
//in the descriptor--default connection modes are "all"--you can send to any entity regardless of force,
66
//"force"--you can send to anyone in your force type, or "aggregate"--you can only send to those in your
67
//same echelon, same aggregate.
68
//For this example we will simply do a range check and see if the receiver is
69
//within the power range of the sender's radio.
70
virtual
bool
checkRadioConnectivity
(
DtVrfObject
* sender,
DtVrfObject
* receiver);
71
72
protected
:
73
74
};
75
Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (
www.mak.com
)