VR-Forces 4.7 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
vrfExtObjects
radioMessageReceivedHandler.h
Go to the documentation of this file.
1
/****************************************************************************
2
* Copyright (c) 2017 VT MAK
3
* All rights reserved.
4
****************************************************************************/
5
9
10
#pragma once
11
12
#include <
vrfExtObjects/dllExport.h
>
13
#include <
vrfExtProtocol/ifRadioMessageReceived.h
>
14
#include <vl/exerciseConn.h>
15
#include <vl/dataInteraction.h>
16
#include <vector>
17
18
typedef
void (*
DtRadioMessageReceivedHandlerCallback
) (
DtIfRadioMessageReceived
msg,
void
* usr);
19
20
class
DT_DLL_vrfExtObjects
DtRadioMessageReceivedHandler
21
{
22
public
:
23
24
// Default constructor does not fully initialize itself. Must call initialize() to complete
25
// the initialization process.
26
DtRadioMessageReceivedHandler
();
27
28
// Default destructor does remove all callbacks upon destruction so there is no need to
29
// explicitly remove a callback.
30
virtual
~
DtRadioMessageReceivedHandler
();
31
32
// Initializes the instance. Will do nothing if already initialized. Thus you can't
33
// replace the exercise connection this is using. Auto-registers for this message type
34
// once it is initialized. This message type being one of DtIfRadioMessageReceived.
35
virtual
void
initialize(DtExerciseConn* exConn);
36
37
// Adds a callback function to the list of callbacks. Your function and class are passed
38
// in as the two arguments (respectively) and will get invoked when a message of this
39
// specific type comes in on the network.
40
virtual
void
addCallback(
DtRadioMessageReceivedHandlerCallback
cBackFunc,
void
* usr);
41
42
// Removes a callback function from the list of callbacks. Your function and class
43
// that you passed in to add the callback can be used to remove it from the list.
44
// An explicit removal is not required upon termination of the program as it will
45
// clean itself up when this gets destroyed.
46
virtual
void
removeCallback(
DtRadioMessageReceivedHandlerCallback
cBackFunc,
void
* usr);
47
48
// Publishes a DtIfRadioMessageReceived message to the network. Since this class handles
49
// receiving messages of this type, it also handles sending them. This makes it easy to
50
// send and receive messages of this type.
51
virtual
bool
publishRadioMessageReceivedMessage(
DtIfRadioMessageReceived
msg);
52
53
protected
:
54
55
// Callback function registered to receive data interactions on the network
56
static
void
dataInteractionCallbackFunction(DtDataInteraction* interaction,
void
* usr);
57
58
// Where the data interaction is processed
59
virtual
void
processDataInteraction(DtDataInteraction* interaction);
60
61
// Where the callback functions registered to this class are called.
62
virtual
void
invokeCallbacks(
DtIfRadioMessageReceived
msg);
63
64
DtExerciseConn*
myExerciseConnection
;
65
std::vector<std::pair<void*, DtRadioMessageReceivedHandlerCallback> >
myCallbacks
;
66
67
};
Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (
www.mak.com
)