edgeTraceTypes.hh

Go to the documentation of this file.
1 
6 #ifndef edgeTracetypes_hh
7 #define edgeTracetypes_hh
8 
9 #include <map>
10 #include "geometry/semantics.hh"
11 #include "geometry/connectorSet.hh"
12 #include "geometry/normalVector.hh"
13 #include "toolbox/hashMap.hh"
14 
15 namespace concepts {
16 
24  class EdgeTraceType : public OutputOperator {
25  public:
27 
28  //by default look outward first and use first trace only
30 
31  // Constructor that takes into account a give type
32  EdgeTraceType(const EdgeTraceType& ettype):
33  type_(ettype.type_), normalVectorRule_(ettype.normalVectorRule_->clone()) {}
34 
35 
37  type_(type), normalVectorRule_(normalVectorRule.clone()) {
38  }
39 
40  virtual ~EdgeTraceType();
41 
43  if (&ettype != this) {
44  type_ = ettype.type_;
45  normalVectorRule_.reset(ettype.normalVectorRule_->clone());
46  }
47  return *this;
48  }
49 
51  std::string typeStr() const;
52 
53  enum traceTypes type() const { return type_; }
54 
55  const EdgeNormalVectorRule& rule() const{return *normalVectorRule_;}
56 
57  protected:
58  virtual std::ostream& info(std::ostream& os) const;
59  private :
60  //trace Type
61  enum traceTypes type_;
62  //normalvectorrule
63  std::unique_ptr< concepts::EdgeNormalVectorRule> normalVectorRule_;
64  };
65 
66 
80  class EdgeTraceTypes : public Semantics<EdgeTraceType> {
81  public:
82 
86 
90  virtual ~EdgeTraceTypes();
91 
99  virtual EdgeTraceType operator()(Attribute attrib) const;
100 
101 
102 
112  void add(const Attribute& attrib,const EdgeTraceType& ettObject){
113  edgeTraceTypes_[attrib.attrib()]= ettObject;
114  }
115 
116  void add(const Set<Attribute>& attrib,const EdgeTraceType& ettObject){
117  Set<Attribute>::const_iterator iter = attrib.begin();
118  for( ; iter != attrib.end(); iter++){
119  edgeTraceTypes_[iter->attrib()]= ettObject;
120  }
121  }
122 
126  Set<uint> domain() const {
128  std::map<uint, EdgeTraceType>::const_iterator iter = edgeTraceTypes_.begin();
129  for( ; iter!= edgeTraceTypes_.end();iter++){
130  domain.insert(iter->first);
131  }
132  return domain;
133  }
134 
135  protected:
136  virtual std::ostream& info(std::ostream& os) const;
137  private:
141  mutable std::map<uint, EdgeTraceType> edgeTraceTypes_;
142  };
143 
144 
145 
146 } // namespace concepts
147 
148 #endif // edgeTracetypes_hh
virtual ~EdgeTraceTypes()
Destructor.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
EdgeTraceType & operator=(const EdgeTraceType &ettype)
void add(const Attribute &attrib, const EdgeTraceType &ettObject)
Adds an edge-traceType with this attribute to the list of edge Tracetypes.
uint attrib() const
Returns the attribute.
Definition: connector.hh:38
Set< uint > domain() const
Method returning the domain of the Map.
Set with operations, output operator, and method of the particular element types.
Definition: traces.hh:18
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
std::string typeStr() const
Return the type of the edgeTraceType as output string.
EdgeTraceTypes()
Default constructor.
const EdgeNormalVectorRule & rule() const
std::map< uint, EdgeTraceType > edgeTraceTypes_
Map from Attribute to a EdgeTraceType.
std::unique_ptr< concepts::EdgeNormalVectorRule > normalVectorRule_
EdgeTraceType(const enum traceTypes type, const EdgeNormalVectorRule &normalVectorRule=concepts::EdgeNormalVectorRule())
Base class for defining rules in which direction the normal vector should point for created edges fro...
Definition: normalVector.hh:31
enum traceTypes type() const
An abstract function class to query attributes.
Definition: semantics.hh:22
EdgeTraceType(const EdgeTraceType &ettype)
void add(const Set< Attribute > &attrib, const EdgeTraceType &ettObject)
Class EdgeTraceType holding the information about the TraceType, i.e.
virtual EdgeTraceType operator()(Attribute attrib) const
Application operator.
Class providing an output operator.
Attributes for elements of the topology.
Definition: connector.hh:22
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich