connectorSequence.hh

Go to the documentation of this file.
1 
6 #ifndef ConnectorSequence_hh
7 #define ConnectorSequence_hh
8 
9 #include "connector.hh"
10 #include "toolbox/sequence.hh"
11 
12 namespace concepts {
13 
14  // ************************************************** Sequence<const Key*> **
15 
16  template<>
17  class Sequence<const Key*> : public BaseSequence<const Key*> {
18  public:
19  Sequence() : BaseSequence<const Key*>() {}
20  template<class F>
21  Sequence(const F& seq) : BaseSequence<const Key*>(seq) {}
22  virtual ~Sequence() {}
23 
25  };
26 
27  // ******************************************* Sequence<const Connector0*> **
28 
29  template<>
30  class Sequence<const Connector0*> :
32  public:
33  Sequence() : BaseSequence<const Connector0*>() {}
34  template<class F>
35  Sequence(const F& seq) : BaseSequence<const Connector0*>(seq) {}
36  virtual ~Sequence() {}
37 
39  };
40 
41  // ************************************************* Sequence<Connector0*> **
42 
43  template<>
45  public:
47  template<class F>
48  Sequence(const F& seq) : BaseSequence<Connector0*>(seq) {}
49  virtual ~Sequence() {}
50 
52  };
53 
54  // ******************************************* Sequence<const Connector1*> **
55 
56  template<>
57  class Sequence<const Connector1*> :
59  public:
60  Sequence() : BaseSequence<const Connector1*>() {}
61  template<class F>
62  Sequence(const F& seq) : BaseSequence<const Connector1*>(seq) {}
63  virtual ~Sequence() {}
64 
68  };
69 
70  // ************************************************* Sequence<Connector1*> **
71 
72  template<>
74  public:
76  template<class F>
77  Sequence(const F& seq) : BaseSequence<Connector1*>(seq) {}
78  virtual ~Sequence() {}
79 
83  };
84 
85  // ******************************************* Sequence<const Connector2*> **
86 
87  template<>
88  class Sequence<const Connector2*> :
90  public:
91  Sequence() : BaseSequence<const Connector2*>() {}
92  template<class F>
93  Sequence(const F& seq) : BaseSequence<const Connector2*>(seq) {}
94  virtual ~Sequence() {}
95 
98  Sequence<Connector1*> edge(uint i) const;
100  };
101 
102  // ************************************************* Sequence<Connector2*> **
103 
104  template<>
106  public:
108  template<class F>
109  Sequence(const F& seq) : BaseSequence<Connector2*>(seq) {}
110  virtual ~Sequence() {}
111 
116  };
117 
118  // ********************************************************* allConnectors **
119 
125  template<class F, class G>
126  Sequence<G*> allConnectors(const F& cntr, G* (F::*fun)(uint) const) {
127  Sequence<G*> seq;
128  G* cntri; // connectors inside cntr
129  uint i = 0;
130  while ((cntri = (cntr.*fun)(i++)) != 0) seq.push_back(cntri);
131  return seq;
132  }
133 
134 } // namespace concepts
135 
136 #endif // ConnectorSequence_hh
137 
Sequence< G * > allConnectors(const F &cntr, G *(F::*fun)(uint) const)
Return all connectors of a particular type of another connector, e.g.
Sequence< Connector0 * > vertex(uint i) const
Sequence< const Connector2 * > child(uint i) const
Sequence< const Key * > key() const
Sequence< const Connector1 * > child(uint i) const
Sequence< Connector0 * > vertex(uint i) const
Sequence< Connector0 * > vertex(uint i) const
Sequence< const Key * > key() const
Sequence< uint > key() const
Sequence< const Connector1 * > child(uint i) const
Sequence< Connector1 * > edge(uint i) const
A 2D element of the topology.
Definition: connector.hh:226
Sequence with operations, output operator, and method of the particular element types.
Definition: sequence.hh:39
Sequence< const Key * > key() const
Sequence< Connector1 * > edge(uint i) const
Sequence< const Key * > key() const
Sequence< const Connector2 * > child(uint i) const
Sequence< Connector0 * > vertex(uint i) const
A 1D element of the topology.
Definition: connector.hh:182
Key class.
Definition: connector.hh:53
Sequence< const Key * > key() const
Sequence< const Key * > key() const
A 0D element of the topology.
Definition: connector.hh:147
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