MIRA
Link.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2013,
3  Neuroinformatics and Cognitive Robotics Labs at TU Ilmenau, Germany
4 
5 All rights reserved.
6 
7 Copying, resale, or redistribution, with or without modification, is strictly
8 prohibited.
9 
10 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
11 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
12 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
13 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
14 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES,
15 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 */
17 
26 #pragma once
27 
28 #include <topomap/TopoMapFwd.h>
29 #include <topomap/GraphElement.h>
30 
31 namespace viros { namespace topomap {
32 
34 
35 class Link : public GraphElement
36 {
37 public:
38 
69  enum Type
70  {
71  INTERLINK = 0,
75  };
76 
77 protected:
78  friend class TopoMap;
79 
80 public:
81  Link();
82  Link(Type type, GatewayNodePtr from, GatewayNodePtr to, bool bidirectional = true, double costs = 0.0);
83 
84  static LinkPtr create() {
85  return boost::make_shared<Link>();
86  }
87 
88  static LinkPtr create(Type type, GatewayNodePtr from, GatewayNodePtr to, bool bidirectional = true, double costs = 0.0) {
89  return boost::make_shared<Link>(type, from, to, bidirectional, costs);
90  }
91 
92 public:
93 
94  template<typename Reflector>
95  void reflect(Reflector& r)
96  {
97  r.member("Type", mType, "");
98  r.member("From", mFrom, "");
99  r.member("To", mTo, "");
100  r.member("Bidirectional", bidirectional, "");
101  r.member("Costs", costs, "");
102  }
103 
104 
105  GatewayNodePtr from() const { return mFrom; }
106  GatewayNodePtr to() const { return mTo; }
107 
108 
109  bool isBidirectional() const { return bidirectional; }
110 
111  Type type() const { return mType; }
112 
113 public:
114 
116  double costs;
117 
118 private:
119 
120  Type mType;
121  GatewayNodePtr mFrom;
122  GatewayNodePtr mTo;
123 };
124 
125 std::ostream& operator<<(std::ostream& os, const Link& link);
126 
128 
129 } } // namespace
boost::shared_ptr< Link > LinkPtr
Definition: TopoMapFwd.h:89
boost::shared_ptr< GatewayNode > GatewayNodePtr
Definition: TopoMapFwd.h:87
Definition: TopoMap.h:36
empty base class for all graph elements (Nodes, GatewayNodes and Links)
Definition: GraphElement.h:40
std::ostream & operator<<(std::ostream &os, const GatewayNode &gatewayNode)
Definition: MetricCostmapTopoMapPlanner.h:45
Forward decls.