ConnectivityChecker.hpp
Go to the documentation of this file.
1 
18 #pragma once
19 
20 #include <boost/shared_ptr.hpp>
21 #include <map>
22 #include <set>
23 #include <stack>
24 #include <vector>
25 
26 namespace ISM {
27 
29 {
30  public:
31  ConnectivityChecker(std::map<std::string, unsigned int> numObjectsPerPattern);
32  bool isConnected(std::vector<bool> bitvector, const std::string& patternName);
33 
34  private:
35  struct Relation
36  {
37  unsigned int x, y;
38 
39  unsigned int getNeighbour(unsigned int z)
40  {
41  if (z == x)
42  {
43  return y;
44  } else {
45  return x;
46  }
47  }
48  };
49 
50  std::map<std::string, unsigned int> mNumObjectsPerPattern;
51  std::map<std::string, std::vector<Relation>> mRelationsPerPattern;
52 
53  std::set<unsigned int> mVisited;
54  std::stack<unsigned int> mToVisit;
55 
56  void checkNeighbour(const std::string& patternName, unsigned int from, unsigned int index, std::vector<bool> bitvector);
57  void visitNeighbours(const std::string& patternName, unsigned int from, std::vector<bool> bitvector);
58 
59 }; typedef boost::shared_ptr<ConnectivityChecker> ConnectivityCheckerPtr;
60 
61 }
62 
63 
bool isConnected(std::vector< bool > bitvector, const std::string &patternName)
unsigned int getNeighbour(unsigned int z)
std::stack< unsigned int > mToVisit
boost::shared_ptr< ConnectivityChecker > ConnectivityCheckerPtr
void visitNeighbours(const std::string &patternName, unsigned int from, std::vector< bool > bitvector)
std::string patternName
std::map< std::string, std::vector< Relation > > mRelationsPerPattern
void checkNeighbour(const std::string &patternName, unsigned int from, unsigned int index, std::vector< bool > bitvector)
ConnectivityChecker(std::map< std::string, unsigned int > numObjectsPerPattern)
std::map< std::string, unsigned int > mNumObjectsPerPattern
std::set< unsigned int > mVisited
this namespace contains all generally usable classes.


asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:40