PlannerDataVertexAnnotated.cpp
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2019, University of Stuttgart
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the University of Stuttgart nor the names
18  * of its contributors may be used to endorse or promote products
19  * derived from this software without specific prior written
20  * permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
36 /* Author: Andreas Orthey */
37 #include <ompl/geometric/planners/quotientspace/datastructures/PlannerDataVertexAnnotated.h>
38 
39 ompl::base::PlannerDataVertexAnnotated::PlannerDataVertexAnnotated(const State *st, int tag)
40  : PlannerDataVertex(st, tag)
41 {
42 }
43 
44 ompl::base::PlannerDataVertexAnnotated::PlannerDataVertexAnnotated(const PlannerDataVertexAnnotated &rhs)
45  : PlannerDataVertex(rhs.state_, rhs.tag_)
46 {
47  level_ = rhs.getLevel();
48  maxLevel_ = rhs.getMaxLevel();
49  component_ = rhs.getComponent();
50  path_ = rhs.getPath();
51  stateQuotientSpace_ = rhs.getQuotientState();
52 }
53 
55 {
56  return new PlannerDataVertexAnnotated(*this);
57 }
58 
59 void ompl::base::PlannerDataVertexAnnotated::setComponent(unsigned int component)
60 {
61  component_ = component;
62 }
63 
64 unsigned int ompl::base::PlannerDataVertexAnnotated::getComponent() const
65 {
66  return component_;
67 }
68 
69 void ompl::base::PlannerDataVertexAnnotated::setLevel(unsigned int level)
70 {
71  level_ = level;
72 }
73 
74 unsigned int ompl::base::PlannerDataVertexAnnotated::getLevel() const
75 {
76  return level_;
77 }
78 
79 void ompl::base::PlannerDataVertexAnnotated::setMaxLevel(unsigned int level)
80 {
81  maxLevel_ = level;
82 }
83 
84 unsigned int ompl::base::PlannerDataVertexAnnotated::getMaxLevel() const
85 {
86  return maxLevel_;
87 }
88 
89 void ompl::base::PlannerDataVertexAnnotated::setPath(std::vector<int> path)
90 {
91  path_ = path;
92 }
93 
94 std::vector<int> ompl::base::PlannerDataVertexAnnotated::getPath() const
95 {
96  return path_;
97 }
98 
100 {
101  return state_;
102 }
103 
104 const ompl::base::State *ompl::base::PlannerDataVertexAnnotated::getQuotientState() const
105 {
106  return stateQuotientSpace_;
107 }
108 
109 void ompl::base::PlannerDataVertexAnnotated::setQuotientState(const State *s)
110 {
111  stateQuotientSpace_ = s;
112 }
113 
114 void ompl::base::PlannerDataVertexAnnotated::setState(State *s)
115 {
116  state_ = s;
117 }
118 
120 {
121  return (lhs.getLevel() == rhs.getLevel() && lhs.getState() == rhs.getState() && lhs.getPath() == rhs.getPath());
122 }
123 
124 std::ostream &operator<<(std::ostream &out, const ompl::base::PlannerDataVertexAnnotated &v)
125 {
126  out << "AnnotatedVertex";
127  out << " ->level " << v.getLevel() << "/" << v.getMaxLevel();
128  out << " ->component " << v.getComponent();
129  out << std::endl;
130  return out;
131 }
Definition of an abstract state.
Definition: State.h:114
virtual PlannerDataVertex * clone() const override
Return a clone of this object, allocated from the heap.
friend std::ostream & operator<<(std::ostream &out, const QuotientSpace &qtnt)
Write class to stream (use as std::cout << *this << std::endl) Actual implementation is in void print...
An annotated vertex, adding information about its level in the quotient-space hiearchy,...
unsigned int level_
Level in sequence of quotient-spaces.
virtual const ompl::base::State * getState() const override
Retrieve the state associated with this vertex.
Base class for a vertex in the PlannerData structure. All derived classes must implement the clone an...
Definition: PlannerData.h:123