create_artag_hrm_dict.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <fstream>
3 #include <sstream>
4 #include <stdint.h>
5 #include <vector>
6 #include <bitset>
7 
8 #define MSize 6
9 #define NBITS 36
10 
11 using namespace std;
12 int main(int argc,char **argv){
13 
14  if (argc!=2){cerr<<"Usage in.c "<<endl;return -1;}
15  std::ifstream file(argv[1]);
16  std::vector<uint64_t> tags;
17  std::vector< bitset<NBITS> > bits;
18 
19  while(!file.eof()){
20  string line;
21  std::getline(file,line);
22  bool start=0;
23  string number;
24  for(int i=0;i<line.size();i++)
25  if (line[i]=='=') start=1;
26  else{
27  if( start==1 && line[i]!=';' && line[i]!='U' && line[i]!='L')
28  number.push_back(line[i]);
29  }
30 
31  if(number.size()!=0){
32  stringstream sstr;sstr<<number;
33  uint64_t unumber;
34  sstr>>std::hex>>unumber;
35  tags.push_back(unumber);
36  bits.push_back(bitset<NBITS>(unumber));
37  }
38  };
39  //now,create the codes
40  cout<<"vector<uint64_t> codes={";
41  for(int i=0;i<bits.size();i++){
42  uint64_t code=bits[i].to_ullong();
43  cout<<"0x"<<std::hex<<code<<"UL";
44  if (i<bits.size()-1)cout<<",";
45 
46  }
47  cout<<"};";
48 
49 
50 }
int main(int argc, char **argv)


tuw_aruco
Author(s): Lukas Pfeifhofer
autogenerated on Mon Jun 10 2019 15:40:47