susy_cfa
b611ccad937ea179f86a1f5663960264616c0a20
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
inc
cut.hpp
Go to the documentation of this file.
1
#ifndef H_CUT
2
#define H_CUT
3
4
#include "
small_tree.hpp
"
5
6
// Allows selection of different cut comparisons
7
enum
InequalityType
{
8
kNotEqual
= -3,
9
kLess
= -2,
10
kLessEqual
= -1,
11
kEqual
= 0,
12
kGreater
= 1,
13
kGreaterEqual
= 2
14
};
15
16
// Pointers to the base class can be stored in containers (e.g. vectors). Selection of the template derived class is done automatically by dynamic dispatch
17
struct
CutBase
{
18
CutBase
();
19
CutBase
(
small_tree
const
* tree,
20
InequalityType
compare =
kGreaterEqual
);
21
22
virtual
bool
Pass
()
const
;
23
operator
bool();
24
25
small_tree
const
*
tree_
;
26
InequalityType
compare_
;
27
28
virtual
~CutBase
();
29
};
30
31
// The actual implementation for each type is done in this template class
32
template
<
typename
T>
33
struct
Cut
:
public
CutBase
{
34
typedef
T
ReturnType
;
35
typedef
const
ReturnType& (
small_tree
::*
FunctionPtrType
)()
const
;
36
37
Cut
();
38
Cut
(
small_tree
const
* tree,
39
FunctionPtrType func,
40
const
ReturnType &cut_val,
41
InequalityType
compare =
kGreaterEqual
);
42
43
bool
Pass
()
const
;
44
45
ReturnType
cut_val_
;
46
FunctionPtrType
func_
;
47
};
48
49
// Some convenience functions for making new cuts without specifying the type
50
template
<
typename
T>
51
Cut<T>
MakeCut
(
small_tree
const
* tree,
52
const
T& (
small_tree
::* func)()
const
,
53
const
T &cut_val,
54
InequalityType
compare =
kGreaterEqual
);
55
56
template
<
typename
T>
57
Cut<T>
*
NewCut
(
small_tree
const
* tree,
58
const
T& (
small_tree
::* func)()
const
,
59
const
T &cut_val,
60
InequalityType
compare =
kGreaterEqual
);
61
62
#include "
cut_impl.hpp
"
63
64
#endif
InequalityType
InequalityType
Definition:
cut.hpp:7
kLessEqual
Definition:
cut.hpp:10
CutBase::compare_
InequalityType compare_
Definition:
cut.hpp:26
CutBase::tree_
small_tree const * tree_
Definition:
cut.hpp:25
kNotEqual
Definition:
cut.hpp:8
small_tree.hpp
kGreater
Definition:
cut.hpp:12
Cut::func_
FunctionPtrType func_
Definition:
cut.hpp:46
CutBase::Pass
virtual bool Pass() const
Definition:
cut.cpp:16
Cut::cut_val_
ReturnType cut_val_
Definition:
cut.hpp:45
Cut
Definition:
cut.hpp:33
CutBase::CutBase
CutBase()
Definition:
cut.cpp:5
CutBase::~CutBase
virtual ~CutBase()
Definition:
cut.cpp:24
CutBase
Definition:
cut.hpp:17
NewCut
Cut< T > * NewCut(small_tree const *tree, const T &(small_tree::*func)() const, const T &cut_val, InequalityType compare=kGreaterEqual)
Definition:
cut_impl.hpp:48
Cut::ReturnType
T ReturnType
Definition:
cut.hpp:34
kLess
Definition:
cut.hpp:9
Cut::FunctionPtrType
const ReturnType &(small_tree::* FunctionPtrType)() const
Definition:
cut.hpp:35
kEqual
Definition:
cut.hpp:11
kGreaterEqual
Definition:
cut.hpp:13
MakeCut
Cut< T > MakeCut(small_tree const *tree, const T &(small_tree::*func)() const, const T &cut_val, InequalityType compare=kGreaterEqual)
Definition:
cut_impl.hpp:40
small_tree
Definition:
small_tree.hpp:14
cut_impl.hpp
Generated by
1.8.11