Guitar
variables.hpp
Go to the documentation of this file.
1 
36 /* If you use this library, you must include dtl.hpp only. */
37 
38 #ifndef DTL_VARIABLES_H
39 #define DTL_VARIABLES_H
40 
41 #include <vector>
42 #include <list>
43 #include <string>
44 #include <algorithm>
45 #include <iostream>
46 
47 namespace dtl {
48 
49  using std::vector;
50  using std::string;
51  using std::pair;
52  using std::ostream;
53  using std::list;
54  using std::for_each;
55  using std::distance;
56  using std::fill;
57  using std::cout;
58  using std::endl;
59  using std::rotate;
60  using std::swap;
61  using std::max;
62 
66  const string version = "1.20";
67 
71  typedef int edit_t;
72  const edit_t SES_DELETE = -1;
73  const edit_t SES_COMMON = 0;
74  const edit_t SES_ADD = 1;
75 
79 #define SES_MARK_DELETE "-"
80 #define SES_MARK_COMMON " "
81 #define SES_MARK_ADD "+"
82 
86  typedef struct eleminfo {
87  long long beforeIdx; // index of prev sequence
88  long long afterIdx; // index of after sequence
89  edit_t type; // type of edit(Add, Delete, Common)
90  bool operator==(const eleminfo& other) const{
91  return (this->beforeIdx == other.beforeIdx && this->afterIdx == other.afterIdx && this->type == other.type);
92  }
93  } elemInfo;
94 
95  const long long DTL_SEPARATE_SIZE = 3;
96  const long long DTL_CONTEXT_SIZE = 3;
97 
101  typedef struct Point {
102  long long x; // x cordinate
103  long long y; // y cordinate
104  long long k; // vertex
105  } P;
106 
110  const unsigned long long MAX_CORDINATES_SIZE = 2000000;
111 
112  typedef vector< long long > editPath;
113  typedef vector< P > editPathCordinates;
114 
118  template <typename sesElem>
119  struct uniHunk {
120  long long a, b, c, d; // @@ -a,b +c,d @@
121  vector< sesElem > common[2]; // anteroposterior commons on changes
122  vector< sesElem > change; // changes
123  long long inc_dec_count; // count of increace and decrease
124  };
125 
126 #define dtl_typedefs(elem, sequence) \
127  typedef pair< elem, elemInfo > sesElem; \
128  typedef vector< sesElem > sesElemVec; \
129  typedef vector< uniHunk< sesElem > > uniHunkVec; \
130  typedef list< elem > elemList; \
131  typedef vector< elem > elemVec; \
132  typedef typename uniHunkVec::iterator uniHunkVec_iter; \
133  typedef typename sesElemVec::iterator sesElemVec_iter; \
134  typedef typename elemList::iterator elemList_iter; \
135  typedef typename sequence::iterator sequence_iter; \
136  typedef typename sequence::const_iterator sequence_const_iter; \
137  typedef typename elemVec::iterator elemVec_iter;
138 
139 
140 }
141 
142 #endif // DTL_VARIABLES_H
dtl::uniHunk::common
vector< sesElem > common[2]
Definition: variables.hpp:121
dtl::eleminfo::afterIdx
long long afterIdx
Definition: variables.hpp:88
dtl::DTL_CONTEXT_SIZE
const long long DTL_CONTEXT_SIZE
Definition: variables.hpp:96
dtl::Point::x
long long x
Definition: variables.hpp:102
dtl::SES_ADD
const edit_t SES_ADD
Definition: variables.hpp:74
dtl::uniHunk::b
long long b
Definition: variables.hpp:120
dtl::DTL_SEPARATE_SIZE
const long long DTL_SEPARATE_SIZE
Definition: variables.hpp:95
dtl::editPathCordinates
vector< P > editPathCordinates
Definition: variables.hpp:113
dtl::uniHunk::c
long long c
Definition: variables.hpp:120
dtl::edit_t
int edit_t
Definition: variables.hpp:71
dtl::uniHunk::inc_dec_count
long long inc_dec_count
Definition: variables.hpp:123
dtl::uniHunk::d
long long d
Definition: variables.hpp:120
dtl::SES_DELETE
const edit_t SES_DELETE
Definition: variables.hpp:72
dtl::SES_COMMON
const edit_t SES_COMMON
Definition: variables.hpp:73
dtl::Point::y
long long y
Definition: variables.hpp:103
dtl::eleminfo
Definition: variables.hpp:86
dtl::uniHunk::a
long long a
Definition: variables.hpp:120
dtl
Definition: Diff.hpp:41
dtl::Point::k
long long k
Definition: variables.hpp:104
dtl::uniHunk
Definition: variables.hpp:119
dtl::eleminfo::type
edit_t type
Definition: variables.hpp:89
dtl::P
struct dtl::Point P
dtl::eleminfo::beforeIdx
long long beforeIdx
Definition: variables.hpp:87
dtl::uniHunk::change
vector< sesElem > change
Definition: variables.hpp:122
dtl::MAX_CORDINATES_SIZE
const unsigned long long MAX_CORDINATES_SIZE
Definition: variables.hpp:110
dtl::editPath
vector< long long > editPath
Definition: variables.hpp:112
dtl::eleminfo::operator==
bool operator==(const eleminfo &other) const
Definition: variables.hpp:90
dtl::Point
Definition: variables.hpp:101
dtl::version
const string version
Definition: variables.hpp:66
dtl::elemInfo
struct dtl::eleminfo elemInfo