Point Cloud Library (PCL)
1.9.1
ml
include
pcl
ml
dt
decision_tree.h
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2010-2011, Willow Garage, Inc.
6
*
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of Willow Garage, Inc. nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*
36
*/
37
38
#ifndef PCL_ML_DT_DECISION_TREE
39
#define PCL_ML_DT_DECISION_TREE
40
41
#include <
pcl/common/common.h
>
42
43
#include <istream>
44
#include <ostream>
45
46
namespace
pcl
47
{
48
49
/** \brief Class representing a decision tree. */
50
template
<
class
NodeType>
51
class
PCL_EXPORTS
DecisionTree
52
{
53
54
public
:
55
56
/** \brief Constructor. */
57
DecisionTree
() : root_ () {}
58
/** \brief Destructor. */
59
virtual
60
~DecisionTree
() {}
61
62
/** \brief Sets the root node of the tree.
63
* \param[in] root The root node.
64
*/
65
void
66
setRoot
(
const
NodeType & root)
67
{
68
root_ = root;
69
}
70
71
/** \brief Returns the root node of the tree. */
72
NodeType &
73
getRoot
()
74
{
75
return
root_;
76
}
77
78
/** \brief Serializes the decision tree.
79
* \param[out] stream The destination for the serialization.
80
*/
81
void
82
serialize
(::std::ostream & stream)
const
83
{
84
root_.serialize (stream);
85
}
86
87
/** \brief Deserializes the decision tree.
88
* \param[in] stream The source for the deserialization.
89
*/
90
void
deserialize
(::std::istream & stream)
91
{
92
root_.deserialize (stream);
93
}
94
95
private
:
96
97
/** \brief The root node of the decision tree. */
98
NodeType root_;
99
100
};
101
102
103
}
104
105
#endif
pcl
This file defines compatibility wrappers for low level I/O functions.
Definition:
convolution.h:45
pcl::DecisionTree::getRoot
NodeType & getRoot()
Returns the root node of the tree.
Definition:
decision_tree.h:73
common.h
pcl::DecisionTree::serialize
void serialize(::std::ostream &stream) const
Serializes the decision tree.
Definition:
decision_tree.h:82
pcl::DecisionTree
Class representing a decision tree.
Definition:
decision_tree.h:51
pcl::DecisionTree::deserialize
void deserialize(::std::istream &stream)
Deserializes the decision tree.
Definition:
decision_tree.h:90
pcl::DecisionTree::DecisionTree
DecisionTree()
Constructor.
Definition:
decision_tree.h:57
pcl::DecisionTree::~DecisionTree
virtual ~DecisionTree()
Destructor.
Definition:
decision_tree.h:60
pcl::DecisionTree::setRoot
void setRoot(const NodeType &root)
Sets the root node of the tree.
Definition:
decision_tree.h:66