Index: src/dgp/boubble.hh
===================================================================
--- src/dgp/boubble.hh	(revision 3b02b04ff9c7c3446ca477cd84c2bc7f737c38b4)
+++ src/dgp/boubble.hh	(revision 519eaf508529829bbfe93c12c3e94f44afccf5ed)
@@ -24,18 +24,22 @@
 {
 public:
-  Boubble(list<Role> u, list<Role> d, LongRel l, int s=-1);
-  Boubble(const char* pathstr, const char* l, int s=-1);
-  //  Boubble(const Boubble& b) {_src=b._src; _upath=b._upath; _dpath=b._dpath; _rel=b._rel; };
-
-  Dir dir();
-  LongRel rel();
-  int src();
+  Boubble() {};
+  Boubble(list<Role> u, list<Role> d, LongRel l, int s=-1, bool r=false);
+  Boubble(const char* pathstr, const char* l, int s=-1, bool r=false);
+  //Boubble(const Boubble& b) {_src=b._src; _upath=b._upath; _dpath=b._dpath; _rel=b._rel; _reverse=b._reverse; };
+
+  Dir dir() const;
+  LongRel rel() const;
+  int src() const;
   void src(int s);
+  bool reverse() const;
+  void reverse(bool b);
 
   Role next();
 
   Boubble* step(Role r, Dir d);
-  
-  bool is_at_target();
+  Boubble* reversed();
+  
+  bool is_at_target() const;
 
   bool operator==(Boubble const& b) const;
@@ -52,4 +56,5 @@
   list<Role>           _dpath;
   LongRel              _rel;
+  bool                 _reverse;
 
 };
@@ -58,10 +63,11 @@
 
 inline
-Boubble::Boubble(list<Role> u, list<Role> d, LongRel l, int s) : _upath(u), _dpath(d), _rel(l), _src(s) {}
-
-//----------------------------------------------------------------------------------------------------
-
-inline
-Boubble::Boubble(const char* pathstr, const char* l, int s)
+Boubble::Boubble(list<Role> u, list<Role> d, LongRel l, int s, bool r)
+  : _upath(u), _dpath(d), _rel(l), _src(s), _reverse(r) {}
+
+//----------------------------------------------------------------------------------------------------
+
+inline
+Boubble::Boubble(const char* pathstr, const char* l, int s, bool r)
 {
   Dir dir = UP;
@@ -83,10 +89,11 @@
   _rel = LongRel(l);
   _src = s;
-}
-
-//----------------------------------------------------------------------------------------------------
-
-inline
-Dir Boubble::dir()
+  _reverse = r;
+}
+
+//----------------------------------------------------------------------------------------------------
+
+inline
+Dir Boubble::dir() const
 { 
   if(!_upath.empty())
@@ -100,5 +107,5 @@
 
 inline
-LongRel Boubble::rel()
+LongRel Boubble::rel() const
 { return _rel; }
 
@@ -106,5 +113,5 @@
 
 inline
-int Boubble::src()
+int Boubble::src() const
 { return _src; }
 
@@ -114,4 +121,16 @@
 void Boubble::src(int s)
 { _src=s; }
+
+//----------------------------------------------------------------------------------------------------
+
+inline
+bool Boubble::reverse() const
+{ return _reverse; }
+
+//----------------------------------------------------------------------------------------------------
+
+inline
+void Boubble::reverse(bool b)
+{ _reverse=b; }
 
 //----------------------------------------------------------------------------------------------------
@@ -134,5 +153,5 @@
   if(d==UP && !_upath.empty() && _upath.front() == r)
     {
-      Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src);
+      Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src,_reverse);
       newboubble->_upath.pop_front();
       return newboubble;
@@ -141,5 +160,5 @@
   if(d==DOWN && _upath.empty() && !_dpath.empty() && _dpath.front() == r)
     {
-      Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src);
+      Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src,_reverse);
       newboubble->_dpath.pop_front();
       return newboubble;
@@ -151,5 +170,17 @@
 
 inline
-bool Boubble::is_at_target()
+Boubble* Boubble::reversed()
+{
+  Boubble* newboubble = new Boubble(_dpath,_upath,_rel,-1,!_reverse);
+  newboubble->_upath.reverse();
+  newboubble->_dpath.reverse();
+  // cout << *this << "-----" << *newboubble << endl;
+  return newboubble;
+}
+
+//----------------------------------------------------------------------------------------------------
+
+inline
+bool Boubble::is_at_target() const
 { return _upath.empty() && _dpath.empty(); }
 
@@ -208,4 +239,6 @@
   o << b._rel.str();
   o << "]";
+  if(b.reverse()) o << "!";
+  return o;
 }
 
