Changeset 519eaf5 for src/dgp/boubble.hh
- Timestamp:
- 03/30/14 23:59:06 (11 years ago)
- Branches:
- master
- Children:
- 0a58b3f
- Parents:
- f924e4b
- git-author:
- Tomasz Obrebski <obrebski@…> (03/30/14 23:59:06)
- git-committer:
- Tomasz Obrebski <obrebski@…> (03/30/14 23:59:06)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/dgp/boubble.hh
r3b02b04 r519eaf5 24 24 { 25 25 public: 26 Boubble(list<Role> u, list<Role> d, LongRel l, int s=-1); 27 Boubble(const char* pathstr, const char* l, int s=-1); 28 // Boubble(const Boubble& b) {_src=b._src; _upath=b._upath; _dpath=b._dpath; _rel=b._rel; }; 29 30 Dir dir(); 31 LongRel rel(); 32 int src(); 26 Boubble() {}; 27 Boubble(list<Role> u, list<Role> d, LongRel l, int s=-1, bool r=false); 28 Boubble(const char* pathstr, const char* l, int s=-1, bool r=false); 29 //Boubble(const Boubble& b) {_src=b._src; _upath=b._upath; _dpath=b._dpath; _rel=b._rel; _reverse=b._reverse; }; 30 31 Dir dir() const; 32 LongRel rel() const; 33 int src() const; 33 34 void src(int s); 35 bool reverse() const; 36 void reverse(bool b); 34 37 35 38 Role next(); 36 39 37 40 Boubble* step(Role r, Dir d); 38 39 bool is_at_target(); 41 Boubble* reversed(); 42 43 bool is_at_target() const; 40 44 41 45 bool operator==(Boubble const& b) const; … … 52 56 list<Role> _dpath; 53 57 LongRel _rel; 58 bool _reverse; 54 59 55 60 }; … … 58 63 59 64 inline 60 Boubble::Boubble(list<Role> u, list<Role> d, LongRel l, int s) : _upath(u), _dpath(d), _rel(l), _src(s) {} 61 62 //---------------------------------------------------------------------------------------------------- 63 64 inline 65 Boubble::Boubble(const char* pathstr, const char* l, int s) 65 Boubble::Boubble(list<Role> u, list<Role> d, LongRel l, int s, bool r) 66 : _upath(u), _dpath(d), _rel(l), _src(s), _reverse(r) {} 67 68 //---------------------------------------------------------------------------------------------------- 69 70 inline 71 Boubble::Boubble(const char* pathstr, const char* l, int s, bool r) 66 72 { 67 73 Dir dir = UP; … … 83 89 _rel = LongRel(l); 84 90 _src = s; 85 } 86 87 //---------------------------------------------------------------------------------------------------- 88 89 inline 90 Dir Boubble::dir() 91 _reverse = r; 92 } 93 94 //---------------------------------------------------------------------------------------------------- 95 96 inline 97 Dir Boubble::dir() const 91 98 { 92 99 if(!_upath.empty()) … … 100 107 101 108 inline 102 LongRel Boubble::rel() 109 LongRel Boubble::rel() const 103 110 { return _rel; } 104 111 … … 106 113 107 114 inline 108 int Boubble::src() 115 int Boubble::src() const 109 116 { return _src; } 110 117 … … 114 121 void Boubble::src(int s) 115 122 { _src=s; } 123 124 //---------------------------------------------------------------------------------------------------- 125 126 inline 127 bool Boubble::reverse() const 128 { return _reverse; } 129 130 //---------------------------------------------------------------------------------------------------- 131 132 inline 133 void Boubble::reverse(bool b) 134 { _reverse=b; } 116 135 117 136 //---------------------------------------------------------------------------------------------------- … … 134 153 if(d==UP && !_upath.empty() && _upath.front() == r) 135 154 { 136 Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src );155 Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src,_reverse); 137 156 newboubble->_upath.pop_front(); 138 157 return newboubble; … … 141 160 if(d==DOWN && _upath.empty() && !_dpath.empty() && _dpath.front() == r) 142 161 { 143 Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src );162 Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src,_reverse); 144 163 newboubble->_dpath.pop_front(); 145 164 return newboubble; … … 151 170 152 171 inline 153 bool Boubble::is_at_target() 172 Boubble* Boubble::reversed() 173 { 174 Boubble* newboubble = new Boubble(_dpath,_upath,_rel,-1,!_reverse); 175 newboubble->_upath.reverse(); 176 newboubble->_dpath.reverse(); 177 // cout << *this << "-----" << *newboubble << endl; 178 return newboubble; 179 } 180 181 //---------------------------------------------------------------------------------------------------- 182 183 inline 184 bool Boubble::is_at_target() const 154 185 { return _upath.empty() && _dpath.empty(); } 155 186 … … 208 239 o << b._rel.str(); 209 240 o << "]"; 241 if(b.reverse()) o << "!"; 242 return o; 210 243 } 211 244
Note: See TracChangeset
for help on using the changeset viewer.