VR-Forces 4.6 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
geometry
ssFunctor.h
Go to the documentation of this file.
1
/*********************************************************************
2
** Copyright (c) 2005 MAK Technologies, Inc.
3
** All rights reserved.
4
*********************************************************************/
5
/*********************************************************************
6
** $RCSfile: ssFunctor.h,v $ $Revision: 1.1 $ $State: Exp $
7
*********************************************************************/
8
#ifndef ssFunctor_H_
9
#define ssFunctor_H_
10
11
#include "
geometry/spatialSubdivision.h
"
12
13
//
14
// This is the base class for spatial subdivision related functors.
15
// For efficiency and flexibility, the spatial subdivision intersectors use
16
// functors as a parameter to some of their intersection functions. The functors
17
// are applied to the intersection results, with the intersector determining the
18
// specific parameters.
19
// For more information on the usage of the functors, see the specific
20
// spatial subdivision intersectors.
21
22
// IMPORTANT:
23
// The functors are different from standard library functors in two important ways.
24
// 1) The SS Functors return value expresses whether or not the functors are done
25
// processing, @b not whether or not an error occurred. When an intersector is
26
// applying the functor to the intersection results, a return value of true
27
// means that the intersector no longer needs to apply the functor.
28
// The benefit of this is efficiency - functors that have found what they are looking
29
// for (or whatever else signals done processing) do have to be applied anymore.
30
// The drawback of this approach is a slightly tighter coupling between the
31
// ss intersectors and the functors (the functors know more about the intersectors
32
// then they should.
33
//
34
// With regards to error handling, either the functors should be designed to
35
// not have errors (other than a few exceptional cases, such as out of memory),
36
// or some other error handling mechanism should be used (exceptions, internal
37
// error state, etc.)
38
//
39
// 2) The functors expect themselves to be passed by @ reference. This is very
40
// important as it is different from the standard practice of passing functors
41
// by value. This is done because of the need for some functors to maintain complicated
42
// internal state, which makes copying inefficient and lifecycle management of hte
43
// internal state, such as by using pointers, complicated.
44
//
45
template
<
typename
S,
typename
T>
46
class
DtSsFunctor
47
{
48
public
:
49
DtSsFunctor
();
50
virtual
~DtSsFunctor
();
51
52
// @returns Always returns true as this functor does nothing.
53
virtual
bool
operator()
(S& item, T& item2);
54
55
private
:
56
// not implemented
57
DtSsFunctor
(
const
DtSsFunctor
& original);
58
DtSsFunctor
&
operator=
(
const
DtSsFunctor
& original);
59
60
};
61
62
//------------------------------------------------------
63
// INLINE METHODS
64
//------------------------------------------------------
65
template
<
typename
S,
typename
T>
66
DtSsFunctor<S, T>::DtSsFunctor
()
67
{
68
}
69
70
template
<
typename
S,
typename
T>
71
DtSsFunctor<S, T>::~DtSsFunctor
()
72
{
73
}
74
75
template
<
typename
S,
typename
T>
76
bool
DtSsFunctor<S, T>::operator()
(S& item, T& item2)
77
{
78
return
true
;
79
};
80
81
82
#endif
83
84
Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (
www.mak.com
)