VR-Forces 4.1 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
include
vrvCore
DtAgentManagerInterface.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 2010 MAK Technologies, Inc.
3
** All rights reserved.
4
******************************************************************************/
5
/******************************************************************************
6
** $RCSfile: DtAgentManagerInterface.h,v $ $Revision: 1.23 $ $State: Exp $
7
******************************************************************************/
8
12
13
#pragma once
14
15
#include <
vrvCore/vrvCore.h
>
16
#include <
vrvCore/DtUniqueID.h
>
17
#include <
vrvUtil/DtMessage.h
>
18
19
#include <boost/signal.hpp>
20
21
#include <list>
22
#include <map>
23
#include <string>
24
#include <vector>
25
26
namespace
makVrv
27
{
28
class
DtMessage;
29
class
DtAgent;
30
class
DtAgentFactory;
31
34
class
DT_DLL_VRVCORE
DtAgentManagerInterface
35
{
36
public
:
37
//The scene manager (typically will need to interact directly with
39
friend
class
DtAgentManager
;
40
41
//Allow base Driver access to Master Scene, used to call protected functions.
42
friend
class
DtAgent
;
43
46
static
const
double
IgnoreSimulationTime
;
47
49
DtAgentManagerInterface
(
const
DtAgentFactory
* factory,
50
unsigned
char
myNamespaceId);
51
53
virtual
~
DtAgentManagerInterface
();
54
56
inline
DtUniqueID
createNewUniqueId()
57
{
58
++myFreeID;
59
//Clear most significant byte and place namespace id there.
60
return
(myFreeID & 0x00FFFFFFFFFFFFFFULL) | (myNamespaceId << 56);
61
}
62
64
static
inline
unsigned
char
namespaceFromUniqueId(
DtUniqueID
id
)
65
{
66
return
(
unsigned
char
) (
id
>> 56);
67
}
68
69
unsigned
char
namespaceId()
const
;
70
72
inline
bool
uniqueIdFromAgentManagerInterface(
const
DtUniqueID
&
id
)
const
73
{
74
return
namespaceId() ==
DtAgentManagerInterface::namespaceFromUniqueId
(
id
);
75
}
76
79
inline
unsigned
int
createNewCallID()
80
{
81
return
++myUpdateCallIndex;
82
}
83
86
virtual
DtAgent
* createNewObject(
const
std::string& objectClass,
bool
bDistribute);
87
91
virtual
void
recreateObject(
DtAgent
* proxy);
92
94
bool
encodeUpdate(
DtMessage
& masterMsg,
DtMessage
& distributedMsg,
double
simulationTime );
95
99
virtual
void
tick() = 0;
100
101
protected
:
102
105
void
deleteObject(
DtAgent
*);
106
108
void
queueObjectForUpdate(
DtAgent
*
object
);
109
110
protected
:
111
112
struct
IndexedMessage
113
{
114
unsigned
int
index
;
115
DtMessage
message
;
116
bool
distributeMessage
;
117
118
static
inline
bool
sortCriteria(
const
IndexedMessage
& a,
const
IndexedMessage
& b)
119
{
120
return
a.
index
< b.
index
;
121
}
122
};
123
typedef
std::list<IndexedMessage>
OrderedCallList
;
124
126
typedef
std::list<DtAgent*>
AgentList
;
127
128
DtUniqueID
myNamespaceId
;
129
DtUniqueID
myFreeID
;
130
unsigned
int
myUpdateCallIndex
;
131
AgentList
myUpdatedObjects
;
132
AgentList
myToBeDeletedObjects
;
133
//Pointer to constant Driver Factory.
134
const
DtAgentFactory
*
myDriverFactory
;
135
OrderedCallList
myMasterList
;
136
};
137
}
Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (
www.mak.com
)