MTC
limit_solutions.h
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * * Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following
13  * disclaimer in the documentation and/or other materials provided
14  * with the distribution.
15  * * Neither the name of the copyright holders nor the names of its
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *********************************************************************/
32 /* Authors: Joseph Moore */
33 
34 #pragma once
35 
36 #include <moveit/task_constructor/container.h>
37 
38 namespace moveit {
39 namespace task_constructor {
40 namespace stages {
41 
48 {
49 public:
50  LimitSolutions(const std::string& name = "LimitSolutions", Stage::pointer&& child = Stage::pointer());
51 
52  void reset() override;
53  bool canCompute() const override;
54  void compute() override;
55  void onNewSolution(const SolutionBase& s) override;
56 
57  void setMaxSolutions(uint32_t max_solutions) { setProperty("max_solutions", max_solutions); }
58 
59 private:
60  ordered<const SolutionBase*> upstream_solutions_;
61  uint32_t forwarded_solutions;
62 };
63 } // namespace stages
64 } // namespace task_constructor
65 } // namespace moveit
abstract base class for solutions (primitive and sequences)
Definition: storage.h:269
void setProperty(const std::string &name, const boost::any &value)
Set a previously declared property to a new value.
Definition: stage.cpp:443
Definition: container.h:214
Definition: limit_solutions.h:48
void onNewSolution(const SolutionBase &s) override
called by a (direct) child when a new solution becomes available
Definition: limit_solutions.cpp:56
void reset() override
reset stage, clearing all solutions, interfaces, inherited properties.
Definition: limit_solutions.cpp:50
ordered<ValueType> provides an adapter for a std::list to allow sorting.
Definition: cost_queue.h:30