12 template <
class N,
class E>
18 typedef std::map< segment_type, set< segment_type > >
paths_type;
28 void stream(std::ostream&);
42 template <
class N,
class M>
43 std::ostream & operator<<(std::ostream & os, const pair<N,M> &
p)
45 os <<
p.first <<
":" <<
p.second;
93 template <
class N,
class E>
99 typename result_type::iterator rit = tres.begin();
100 for (; rit!=tres.end(); ++rit) {
102 typename std::vector<segment_type>::reverse_iterator pit = rit->rbegin();
103 typename std::vector<segment_type>::reverse_iterator pend = rit->rend();
105 std::vector<N>
v(1,(*rit)[0].
first);
108 for(; pit!=pend; ++pit) {
109 v.push_back(pit->second);
124 template <
class N,
class E>
127 typename paths_type::const_iterator git = paths_.find(ft);
128 if (git==paths_.end()) {
133 std::vector<segment_type>
v;
134 v.push_back(git->first);
145 int u = result.size();
148 for (i=0; i<u; ++
i) {
150 if (upd_seg.first!=upd_seg.second)
174 template <
class N,
class E>
180 const set<segment_type> & segs = paths_.find(s)->second;
181 typename set<segment_type>::const_iterator segit = segs.begin();
183 if (segs.size()==0) {
184 cerr <<
"you should never get here: GraphPath::update(...)" << std::endl;
191 std::vector<segment_type> temp_pth = result[u];
193 for (; segit!=segs.end(); ++segit) {
194 std::vector<segment_type>
v = temp_pth;
198 temp_pth.push_back(*segs.begin());
203 template <
class N,
class E>
215 template <
class N,
class E>
221 pair<bool,graph<N,E>::neighbour_range> childRange = g.nodes(n);
222 if (!childRange.first)
226 typename set< pair<N,E> >::const_iterator nit = childRange.second.first;
227 for(; nit!=childRange.second.second; ++nit)
228 children.insert(nit->first);
231 typename set<N>::iterator cit = children.
begin();
232 for(; cit!=children.end(); ++cit) {
235 set< segment_type >
temp;
239 paths_.insert(std::make_pair(key,temp));
240 findSegments(n,temp);
241 typename set< segment_type >::iterator sit = temp.begin();
242 for (; sit!=temp.end(); ++sit) {
243 if (sit->first != key.second)
244 paths_[
segment_type(sit->first,key.second)].insert(*sit);
249 for(cit=children.begin();cit!=children.end();++cit) {
256 template <
class N,
class E>
259 typename paths_type::iterator pit = paths_.begin();
260 for (; pit!=paths_.end(); ++pit) {
261 if (pit->first.second == n)
262 result.insert(pit->first);
266 template <
class N,
class E>
269 typename paths_type::iterator it = paths_.begin();
270 for(; it!=paths_.end(); ++it) {
271 os <<
"[" << it->first.first <<
"->" << it->first.second <<
"] : ";
272 typename set<segment_type>::iterator sit = it->second.begin();
274 for(; sit!=it->second.end();++sit) {
275 os <<
" [" << sit->first <<
"->" << sit->second <<
"] ";
277 os <<
" >" << std::endl;
bool fromTo(const N &from, const N &to, std::vector< std::vector< N > > &result) const
void stream(std::ostream &)
void findSegments(const N &n, set< segment_type > &result)
std::map< segment_type, set< segment_type > > paths_type
std::vector< pair< N, N > > chain_type
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
pair< N, N > segment_type
set< std::vector< N > > paths_set
static std::string from(" from ")
std::vector< std::vector< segment_type > > result_type
void update(segment_type &s, result_type &r, int pos) const
void calcPaths(const graph< N, E > &g, const N &root)
bool paths2(const segment_type &ft, result_type &result) const
GraphPath(const graph< N, E > &g, const N &root)
string root
initialization