ImplicitShapeModel.hpp
Go to the documentation of this file.
1 
18 #pragma once
19 
20 #include <boost/shared_ptr.hpp>
21 #include <set>
22 #include <map>
23 
24 #include "common_type/Pattern.hpp"
26 
27 namespace ISM
28 {
29 
30 using std::endl;
31 
33 {
34  std::map<std::string, PatternPtr> patternDefinitions;
35  std::map<std::string, std::vector<VoteSpecifierPtr> > voteSpecifiersPerObject;
36  std::set<std::string> objectTypes;
37 
39  ImplicitShapeModel(std::map<std::string, PatternPtr> patternDefinitions,
40  std::map<std::string, std::vector<VoteSpecifierPtr> > voteSpecifiersPerObject,
41  std::set<std::string> objectTypes) : patternDefinitions(patternDefinitions),
42  voteSpecifiersPerObject(voteSpecifiersPerObject),
43  objectTypes(objectTypes) {}
44 
45  static bool sortVoteSpecPtrAscAlpha(const VoteSpecifierPtr& lhs, const VoteSpecifierPtr& rhs)
46  {
47  std::stringstream ssl;
48  std::stringstream ssr;
49  ssl << lhs;
50  ssr << rhs;
51  return ssl.str() < ssr.str();
52  }
53 
54  std::string toString()
55  {
56  std::stringstream strm;
57  strm << "PatternDefinitions:" << std::endl;
58  for(auto& strPatPair : patternDefinitions)
59  {
60  strm << strPatPair.first << " : " << strPatPair.second << endl;
61  }
62  strm << endl;
63 
64  strm << "VoteSpecifiersPerObject:" << std::endl;
65  for(auto& strVsVecPair : voteSpecifiersPerObject)
66  {
67  strm << strVsVecPair.first << " :" << endl;
68  std::vector<VoteSpecifierPtr> vs = strVsVecPair.second;
69  std::sort(vs.begin(), vs.end(), sortVoteSpecPtrAscAlpha);
70  for(auto& v : vs)
71  {
72  strm << v << endl;
73  }
74  strm << endl;
75  }
76  strm << endl;
77 
78 
79  strm << "ObjectTypes:" << std::endl;
80  for(auto& ot : objectTypes)
81  {
82  strm << ot << endl;
83  }
84  strm << endl;
85 
86  return strm.str();
87  }
88 
89 }; typedef boost::shared_ptr<ImplicitShapeModel> IsmPtr;
90 
91 }
std::map< std::string, std::vector< VoteSpecifierPtr > > voteSpecifiersPerObject
std::map< std::string, PatternPtr > patternDefinitions
std::set< std::string > objectTypes
ImplicitShapeModel(std::map< std::string, PatternPtr > patternDefinitions, std::map< std::string, std::vector< VoteSpecifierPtr > > voteSpecifiersPerObject, std::set< std::string > objectTypes)
static bool sortVoteSpecPtrAscAlpha(const VoteSpecifierPtr &lhs, const VoteSpecifierPtr &rhs)
boost::shared_ptr< ImplicitShapeModel > IsmPtr
boost::shared_ptr< VoteSpecifier > VoteSpecifierPtr
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