VR-Forces Development_Version 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
include
vrfExtObjects
radioMessageReceivedHandler.h
Go to the documentation of this file.
1
/*******************************************************************************
2
** Copyright (c) 2012 MAK Technologies, Inc.
3
** All rights reserved.
4
*******************************************************************************/
5
9
10
#pragma once
11
12
#include <
vrfExtObjects/vrfExtObjectsDefines.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
// Default constructor does not fully initialize itself. Must call initialize() to complete
24
// the initialization process.
25
DtRadioMessageReceivedHandler
();
26
27
// Default destructor does remove all callbacks upon destruction so there is no need to
28
// explicitly remove a callback.
29
virtual
~
DtRadioMessageReceivedHandler
();
30
31
// Initializes the instance. Will do nothing if already initialized. Thus you can't
32
// replace the exercise connection this is using. Auto-registers for this message type
33
// once it is initialized. This message type being one of DtIfRadioMessageReceived.
34
virtual
void
initialize(DtExerciseConn* exConn);
35
36
// Adds a callback function to the list of callbacks. Your function and class are passed
37
// in as the two arguments (respectively) and will get invoked when a message of this
38
// specific type comes in on the network.
39
virtual
void
addCallback(
DtRadioMessageReceivedHandlerCallback
cBackFunc,
void
* usr);
40
41
// Removes a callback function from the list of callbacks. Your function and class
42
// that you passed in to add the callback can be used to remove it from the list.
43
// An explicit removal is not required upon termination of the program as it will
44
// clean itself up when this gets destroyed.
45
virtual
void
removeCallback(
DtRadioMessageReceivedHandlerCallback
cBackFunc,
void
* usr);
46
47
// Publishes a DtIfRadioMessageReceived message to the network. Since this class handles
48
// receiving messages of this type, it also handles sending them. This makes it easy to
49
// send and receive messages of this type.
50
virtual
bool
publishRadioMessageReceivedMessage(
DtIfRadioMessageReceived
msg);
51
52
protected
:
53
// Callback function registered to receive data interactions on the network
54
static
void
dataInteractionCallbackFunction(DtDataInteraction* interaction,
void
* usr);
55
56
// Where the data interaction is processed
57
virtual
void
processDataInteraction(DtDataInteraction* interaction);
58
59
// Where the callback functions registered to this class are called.
60
virtual
void
invokeCallbacks(
DtIfRadioMessageReceived
msg);
61
62
DtExerciseConn*
myExerciseConnection
;
63
std::vector<std::pair<void*, DtRadioMessageReceivedHandlerCallback> >
myCallbacks
;
64
};
Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (
www.mak.com
)