VR-Forces 4.5 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
vrfutil
propertyInterface.h
Go to the documentation of this file.
1
/*******************************************************************************
2
** Copyright (c) 2013 MAK Technologies, Inc.
3
** All rights reserved.
4
*******************************************************************************/
5
8
9
#pragma once
10
11
#include <
vrfutil/vrfutilDefines.h
>
12
#include <
vrfutil/rwBoolean.h
>
13
#include <
vrfutil/rwString.h
>
14
#include <
vrfutil/rwInt.h
>
15
#include <
vrfutil/rwReal.h
>
16
#include <
vrfutil/rwVector.h
>
17
#include <
vrfutil/readerWriterFactory.h
>
18
#include <vlutil/vlTime.h>
19
20
#include <string>
21
23
class
DtPropertyInterface
24
{
25
public
:
26
enum
MergeFlags
27
{
28
Replace
= 0x00000001,
29
MinimalSimilarityCheck
= 0x00000002,
30
RollUp
= 0x00000004,
31
32
33
AddMissing
= 0x00000008
34
};
35
36
virtual
~DtPropertyInterface
() {};
37
41
virtual
char
*
encode
(
char
*)
const
= 0;
42
44
virtual
const
char
*
decode
(
const
char
*) = 0;
45
47
virtual
void
getSize
(
int
&
size
)
const
= 0;
48
50
virtual
int
hlaAlignment
()
const
= 0;
51
53
virtual
const
char
*
propertyType
()
const
= 0;
54
55
virtual
DtString
stringRep
(
const
DtString
& root =
""
)
const
= 0;
56
57
int
getSize
()
const
58
{
59
int
size
= 0;
60
getSize
(size);
61
62
return
size
;
63
}
64
68
virtual
DtReaderWriter
*
readerWriter
() = 0;
69
virtual
const
DtReaderWriter
*
readerWriter
()
const
= 0;
71
74
virtual
bool
isSimilarProperty
(
const
DtPropertyInterface
* rhs)
const
75
{
76
return
(std::string(rhs->
propertyType
()) == std::string(
propertyType
()));
77
}
78
90
virtual
bool
merge
(
const
DtPropertyInterface
& target,
MergeFlags
,
91
const
DtMergePath
& path =
DtMergePath
(),
const
std::set<DtString>& ignore = std::set<DtString>()) = 0;
92
94
virtual
DtlObjPtr
getData
(DtlObjPtr args,
const
DtReaderWriter::SearchPaths
& searchPaths,
95
const
DtVariableBindingsList
& variableBindings) = 0;
96
98
virtual
void
reset
() = 0;
99
};
100
103
template
<
typename
_RwType>
104
class
DtRwProperty
:
public
_RwType,
public
DtPropertyInterface
105
{
106
private
:
108
DtRwProperty
();
109
110
public
:
111
112
DtRwProperty
(
const
DtString
& name,
DtReaderWriterRegistry
* parentRegistry = 0);
113
DtRwProperty
(
const
DtString
& name,
const
DtRwProperty
& orig,
114
DtReaderWriterRegistry
* parentRegistry = 0);
115
DtRwProperty
&
operator=
(
const
DtRwProperty
& orig);
116
virtual
~DtRwProperty
();
117
121
virtual
char
*
encode
(
char
*)
const
;
122
124
virtual
const
char
*
decode
(
const
char
*);
125
126
virtual
DtString
stringRep
(
const
DtString
& root =
""
)
const
;
127
129
virtual
void
getSize
(
int
&
size
)
const
;
130
131
virtual
int
hlaAlignment
()
const
;
132
134
virtual
const
char
*
propertyType
()
const
;
135
136
virtual
DtlObjPtr
getData
(DtlObjPtr args,
const
DtReaderWriter::SearchPaths
& searchPaths,
137
const
DtVariableBindingsList
& variableBindings);
138
140
virtual
bool
merge
(
const
DtPropertyInterface
& target,
MergeFlags
,
141
const
DtMergePath
& path =
DtMergePath
(),
const
std::set<DtString>& ignore = std::set<DtString>());
142
145
virtual
DtReaderWriter
*
readerWriter
();
146
virtual
const
DtReaderWriter
*
readerWriter
()
const
;
148
151
virtual
DtPropertyInterface
*
property
();
152
virtual
const
DtPropertyInterface
*
property
()
const
;
154
156
virtual
void
recordUpdateTime
()
const
;
157
159
virtual
bool
wasUpdatedSince
(
DtTime
t)
const
;
160
161
virtual
void
reset
();
162
163
protected
:
164
165
DtClock
myClock
;
166
mutable
DtTime
myUpdateTime
;
167
168
};
169
174
template
<
typename
_RwType>
175
class
DtRwPropertyWithThreshold
:
public
DtRwProperty
<_RwType>
176
{
177
private
:
179
DtRwPropertyWithThreshold
();
180
181
public
:
182
183
DtRwPropertyWithThreshold
(
const
DtString
& name,
DtReaderWriterRegistry
* parentRegistry = 0);
184
DtRwPropertyWithThreshold
(
const
DtString
& name,
const
DtRwPropertyWithThreshold
& orig,
185
DtReaderWriterRegistry
* parentRegistry = 0);
186
DtRwPropertyWithThreshold
&
operator=
(
const
DtRwPropertyWithThreshold
& orig);
187
virtual
~DtRwPropertyWithThreshold
();
188
193
virtual
char
*
encode
(
char
*)
const
;
194
198
virtual
bool
wasUpdatedSince
(
DtTime
t)
const
;
199
201
virtual
void
enableThresholding
(
bool
enable);
202
206
virtual
void
setThreshold
(
double
percentage);
207
210
static
void
setDefaultThreshold
(
double
percentage);
211
216
virtual
void
setMaxUpdateInterval
(
DtTime
interval);
217
220
static
void
setDefaultMaxUpdateInterval
(
DtTime
interval);
221
230
virtual
void
setMaxUnchangedUpdateInterval
(
DtTime
interval);
231
234
static
void
setDefaultMaxUnchangedUpdateInterval
(
DtTime
interval);
235
236
protected
:
237
239
bool
myThresholdingEnabled
;
240
242
mutable
_RwType
myLastEncodedValue
;
243
245
mutable
DtTime
myLastEncodeTime
;
246
247
static
double
myDefaultThreshold
;
248
double
myThreshold
;
249
250
static
DtTime
myDefaultMaxUpdateInterval
;
251
DtTime
myMaxUpdateInterval
;
252
253
static
DtTime
myDefaultMaxUnchangedUpdateInterval
;
254
DtTime
myMaxUnchangedUpdateInterval
;
255
};
256
257
class
DT_DLL_vrfutil
DtRwPropertyString
:
public
DtRwProperty
<DtRwString>
258
{
259
public
:
260
DtRwPropertyString
(
const
DtString
& name,
DtReaderWriterRegistry
* parentRegistry = 0);
261
DtRwPropertyString
(
const
DtString
& name,
const
DtRwPropertyString
& orig,
262
DtReaderWriterRegistry
* parentRegistry = 0);
263
DtRwPropertyString
(
const
DtRwPropertyString
& orig,
264
DtReaderWriterRegistry
* parentRegistry = 0);
265
266
DtRwPropertyString
&
operator=
(
const
DtRwPropertyString
& orig);
267
268
virtual
~
DtRwPropertyString
();
269
};
270
271
class
DT_DLL_vrfutil
DtRwPropertyBoolean
:
public
DtRwProperty
<DtRwBoolean>
272
{
273
public
:
274
DtRwPropertyBoolean
(
const
DtString
& name,
DtReaderWriterRegistry
* parentRegistry = 0);
275
DtRwPropertyBoolean
(
const
DtString
& name,
const
DtRwPropertyBoolean
& orig,
276
DtReaderWriterRegistry
* parentRegistry = 0);
277
DtRwPropertyBoolean
(
const
DtRwPropertyBoolean
& orig,
278
DtReaderWriterRegistry
* parentRegistry = 0);
279
DtRwPropertyBoolean
&
operator=
(
const
DtRwPropertyBoolean
& orig);
280
virtual
~
DtRwPropertyBoolean
();
281
};
282
283
class
DT_DLL_vrfutil
DtRwPropertyInt
:
public
DtRwPropertyWithThreshold
<DtRwInt>
284
{
285
public
:
286
DtRwPropertyInt
(
const
DtString
& name,
DtReaderWriterRegistry
* parentRegistry = 0);
287
DtRwPropertyInt
(
const
DtString
& name,
const
DtRwPropertyInt
& orig,
288
DtReaderWriterRegistry
* parentRegistry = 0);
289
DtRwPropertyInt
(
const
DtRwPropertyInt
& orig,
290
DtReaderWriterRegistry
* parentRegistry = 0);
291
DtRwPropertyInt
&
operator=
(
const
DtRwPropertyInt
& orig);
292
virtual
~
DtRwPropertyInt
();
293
};
294
295
class
DT_DLL_vrfutil
DtRwPropertyReal
:
public
DtRwPropertyWithThreshold
<DtRwReal>
296
{
297
public
:
298
DtRwPropertyReal
(
const
DtString
& name,
DtReaderWriterRegistry
* parentRegistry = 0);
299
DtRwPropertyReal
(
const
DtString
& name,
const
DtRwPropertyReal
& orig,
300
DtReaderWriterRegistry
* parentRegistry = 0);
301
DtRwPropertyReal
(
const
DtRwPropertyReal
& orig,
302
DtReaderWriterRegistry
* parentRegistry = 0);
303
DtRwPropertyReal
&
operator=
(
const
DtRwPropertyReal
& orig);
304
virtual
~
DtRwPropertyReal
();
305
};
306
307
class
DT_DLL_vrfutil
DtRwPropertyVector
:
public
DtRwPropertyWithThreshold
<DtRwVector>
308
{
309
public
:
310
DtRwPropertyVector
(
const
DtString
& name,
DtReaderWriterRegistry
* parentRegistry = 0);
311
DtRwPropertyVector
(
const
DtString
& name,
const
DtRwPropertyVector
& orig,
312
DtReaderWriterRegistry
* parentRegistry = 0);
313
DtRwPropertyVector
(
const
DtRwPropertyVector
& orig,
314
DtReaderWriterRegistry
* parentRegistry = 0);
315
DtRwPropertyVector
&
operator=
(
const
DtRwPropertyVector
& orig);
316
virtual
~
DtRwPropertyVector
();
317
};
318
319
320
class
DT_DLL_vrfutil
DtRwPropertyOffsetVector
:
public
DtRwPropertyWithThreshold
<DtRwOffsetVector>
321
{
322
public
:
323
DtRwPropertyOffsetVector
(
const
DtString
& name,
DtReaderWriterRegistry
* parentRegistry = 0);
324
DtRwPropertyOffsetVector
(
const
DtString
& name,
const
DtRwPropertyOffsetVector
& orig,
325
DtReaderWriterRegistry
* parentRegistry = 0);
326
DtRwPropertyOffsetVector
(
const
DtRwPropertyOffsetVector
& orig,
327
DtReaderWriterRegistry
* parentRegistry = 0);
328
DtRwPropertyOffsetVector
&
operator=
(
const
DtRwPropertyOffsetVector
& orig);
329
virtual
~
DtRwPropertyOffsetVector
();
330
};
Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (
www.mak.com
)