$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r83200 - in sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1: . Syncable
From: afojgo_at_[hidden]
Date: 2013-02-28 10:29:01
Author: jofaber
Date: 2013-02-28 10:28:58 EST (Thu, 28 Feb 2013)
New Revision: 83200
URL: http://svn.boost.org/trac/boost/changeset/83200
Log:
Restructuring the project.
Added:
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Playable.h   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Seans_Magic.h   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Node.h   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Syncable_Concept.h   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Syncable_ModeledBy.h   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Vector.h   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeMerge.h   (contents, props changed)
Removed:
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Tree.h
Text files modified: 
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeMaker.h     |    22 +++++++-------                          
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeSync1.cpp   |    57 ++++++++------------------------------- 
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/std_algorithm.h |     4 ++                                      
   3 files changed, 26 insertions(+), 57 deletions(-)
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Playable.h
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Playable.h	2013-02-28 10:28:58 EST (Thu, 28 Feb 2013)
@@ -0,0 +1,37 @@
+#pragma once
+#include "Syncable_ModeledBy.h"
+
+template<class Uuid = int, class Time = int>
+class Playable
+{
+public:
+  Playable(Uuid uuid = Uuid())
+    : m_uuid(uuid)
+  {  }
+
+  Uuid uuid()const { return m_uuid; }
+  Time time()const { return Time(); } //JODO
+
+private:
+  Uuid m_uuid;
+};
+
+template<class CharType, class CharTraits, class Uuid>
+std::basic_ostream<CharType, CharTraits>&
+operator << (std::basic_ostream<CharType, CharTraits> &stream, Playable<Uuid> const& object)
+{
+  return stream << "Play(" << object.uuid() << ")";
+}
+
+/*
+template<class UuidT, class TimeT> 
+struct Syncable_ModeledBy<Playable<UuidT,TimeT> >
+{
+    static const bool value = true;
+    typedef typename Playable<UuidT> Model;
+    typedef typename Model::Uuid Uuid;
+    typedef typename Model::Time Time;
+    static Uuid uuid(Model const& object){ return object.uuid() };
+    static Time time(Model const& object){ return object.time() };
+};
+*/
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Seans_Magic.h
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Seans_Magic.h	2013-02-28 10:28:58 EST (Thu, 28 Feb 2013)
@@ -0,0 +1,53 @@
+#pragma once
+
+#include <string>
+#include <iostream>
+
+template<class T>
+void draw(const T& x, std::ostream& out, size_t pos)
+{ out << std::string(pos, ' ') << x << std::endl; }
+
+class Object 
+{
+public:
+  template<class Model>
+  Object(Model const& value) : m_value(new Concept_ModeledBy<Model>(value)){ }
+
+  Object(Object const& value) : m_value(value.m_value->copy()){ }
+  Object(Object&& value): m_value(std::move(value.m_value)){};
+  Object& operator = (Object value){ m_value = std::move(value.m_value); return *this; }
+
+  friend void draw(const Object& value, std::ostream& out, size_t pos)
+  { value.m_value->draw_(out, pos); }
+
+private:
+  struct Concept 
+  {   
+    virtual ~Concept() {}
+    virtual Concept* copy() = 0;
+    virtual void draw_(std::ostream&, size_t)const = 0;
+  };
+
+  template<class Model> struct Concept_ModeledBy : Concept 
+  {
+    Concept_ModeledBy(Model const& val) : m_model(val) {}
+    Concept* copy(){ return new Concept_ModeledBy(*this); }
+    void draw_(std::ostream& out, size_t pos)const{ draw(m_model, out, pos); }
+
+    Model m_model;
+  };
+
+private:
+  std::unique_ptr<Concept> m_value;
+};
+
+
+//  30:13 unsave operator= using delete / new. (defects)
+//  30:25 operator= via unique_ptr and reset.
+//  34:15 rewrite assignment using pass by value and move. 
+//  34:48 Pass sink arguments by value.
+//  39:58 Introducing move ctor.
+//  50:10 refactoring: (member) function templates across models
+//  50:19 refactoring local models structs to a template
+//1:06:00 Undo history and copy_on_write
+
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Node.h
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Node.h	2013-02-28 10:28:58 EST (Thu, 28 Feb 2013)
@@ -0,0 +1,126 @@
+#pragma once
+
+#include <iostream>
+#include <string>
+#include "Syncable_ModeledBy.h"
+
+
+template<class ContentT, class UuidT = int, class TimeT = int>
+class Node
+{
+public:
+  typedef ContentT        Content;
+  typedef UuidT           Uuid;
+  typedef TimeT           Time;
+  typedef Vector<Content> ContentVec;
+  typedef Vector<Node>    NodeVec;
+
+  typedef typename ContentVec::const_iterator element_const_iterator;
+  typedef typename ContentVec::iterator element_iterator;
+
+  typedef typename NodeVec::const_iterator node_const_iterator;
+  typedef typename NodeVec::iterator       node_iterator;
+
+  Node( Uuid const& uuid = 0, std::string const& name = std::string()
+      , const ContentVec& content = ContentVec(), const NodeVec& children = NodeVec())
+    : m_uuid(uuid), m_name(name)
+    , m_content(content), m_children(children)
+  {
+    m_time = std::max(m_content.time(), m_children.time());
+  }
+
+  Node(Node const& val) : m_uuid(val.m_uuid), m_time(val.m_time), m_name(val.m_name)
+      , m_content(val.m_content), m_children(val.m_children)
+  {
+      std::cout << "n.c() ";
+  }
+
+  Node(Node&& val) : m_uuid(std::move(val.m_uuid))
+      , m_time(std::move(val.m_time)), m_name(std::move(val.m_name))
+      , m_content(std::move(val.m_content)), m_children(std::move(val.m_children))
+  {
+      std::cout << "n.m() ";
+  }
+
+  Node& operator = (Node val)
+  {
+      m_uuid     = std::move(val.m_uuid);
+      m_time     = std::move(val.m_time);
+      m_name     = std::move(val.m_name);
+      m_content  = std::move(val.m_content);
+      m_children = std::move(val.m_children);
+      std::cout << "n.m= ";
+      return *this; 
+  }
+
+
+  element_const_iterator elements_begin()const { return m_content.begin(); }
+  element_const_iterator elements_end()const   { return m_content.end();   }
+  element_iterator elements_begin()            { return m_content.begin(); }
+  element_iterator elements_end()              { return m_content.end();   }
+  int element_count()const                     { return m_content.size();  }
+
+  node_const_iterator nodes_begin()const       { return m_children.begin(); }
+  node_const_iterator nodes_end()const         { return m_children.end();   }
+  node_iterator nodes_begin()                  { return m_children.begin(); }
+  node_iterator nodes_end()                    { return m_children.end();   }
+  int node_count()const                        { return m_children.size();  }
+
+
+
+  Uuid        uuid()const { return m_uuid; }
+  Time        time()const { return m_time; }
+  std::string name()const { return m_name; }
+
+  Uuid        contentUuid()const { return m_content.uuid(); }
+  Time        contentTime()const { return m_content.time(); }
+  std::string contentName()const { return m_content.name(); }
+
+  Uuid        childrenUuid()const { return m_children.uuid(); }
+  Time        childrenTime()const { return m_children.time(); }
+  std::string childrenName()const { return m_children.name(); }
+
+  void        setUuid(Uuid const& uuid) { m_uuid=uuid; }
+  void        setTime(Time const& time) { m_time=time; }
+  void        setName(std::string& name){ m_name=name; }
+
+  void        setContent(ContentVec content){ m_content = std::move(content); };
+  void        setChildren(NodeVec nodes){ m_children = std::move(nodes); };
+
+  ContentVec content()const  { return m_content;  }
+  NodeVec    children()const { return m_children; }  
+  ContentVec const& ref_content()const  { return m_content;  }
+  NodeVec const&    ref_children()const { return m_children; }  
+
+private:
+  Uuid        m_uuid;
+  Time        m_time;
+  std::string m_name;
+  ContentVec  m_content;
+  NodeVec     m_children;
+};
+
+
+template<class Type>
+void draw(const Node<Type>& obj, std::ostream& out, size_t pos)
+{
+  out << std::string(pos,' ') << "<Node>[" << obj.name() << "](" << obj.uuid() << "," << obj.time() <<")\n";
+
+  draw(obj.ref_content(), out, pos+2);
+  draw(obj.ref_children(), out, pos+2); 
+
+  out << std::string(pos,' ') << "</Node>\n";
+}
+
+
+template<class ContentT,class UuidT, class TimeT> 
+struct Syncable_ModeledBy<Node<ContentT,UuidT,TimeT> >
+{
+    static const bool value = true;
+    typedef typename Node<ContentT,UuidT,TimeT> Model;
+    typedef typename Model::Uuid Uuid;
+    typedef typename Model::Time Time;
+    static Uuid uuid(Model const& object){ return object.uuid(); }
+    static Time time(Model const& object){ return object.time(); }
+};
+
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Syncable_Concept.h
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Syncable_Concept.h	2013-02-28 10:28:58 EST (Thu, 28 Feb 2013)
@@ -0,0 +1,56 @@
+#pragma once
+
+#include <boost/utility/enable_if.hpp>
+#include "Syncable/Syncable_ModeledBy.h"
+
+
+template<class Model>
+typename boost::enable_if<Syncable_ModeledBy<Model>,
+typename Syncable_ModeledBy<Model>::Uuid>::type uuid(Model const& object)
+{
+    return Syncable_ModeledBy<Model>::uuid(object);
+}
+
+template<class Model>
+typename boost::enable_if<Syncable_ModeledBy<Model>,
+typename Syncable_ModeledBy<Model>::Time>::type time(Model const& object)
+{
+    return Syncable_ModeledBy<Model>::time(object);
+}
+
+template<class Model>
+typename boost::enable_if<Syncable_ModeledBy<Model>,
+bool>::type less_for_time(Model const& lhs, Model const& rhs)
+{
+    return time(lhs) < time(rhs);
+}
+
+template<class Model>
+typename boost::enable_if<Syncable_ModeledBy<Model>,
+bool>::type less_for_uuid(Model const& lhs, Model const& rhs)
+{
+    return uuid(lhs) < uuid(rhs);
+}
+
+template<class Syncable>
+struct LessForUuid : std::binary_function<Syncable, Syncable, bool>
+{
+    bool operator()(Syncable const& lhs, Syncable const& rhs)
+    { 
+        return less_for_uuid(lhs, rhs); 
+    }
+};
+
+template<class Syncable>
+struct LessForTime : std::binary_function<Syncable, Syncable, bool>
+{
+    typedef Syncable first_argument_type; 
+    typedef Syncable second_argument_type; 
+
+    bool operator()(Syncable const& lhs, Syncable const& rhs)
+    { 
+        return less_for_time(lhs, rhs); 
+    }
+};
+
+
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Syncable_ModeledBy.h
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Syncable_ModeledBy.h	2013-02-28 10:28:58 EST (Thu, 28 Feb 2013)
@@ -0,0 +1,16 @@
+#pragma once
+
+
+//-----------------------------------------------------------------
+// Concept Syncable something that is universally identifiable
+// and has a timestamp, so it can be synchronized
+template<class ModelT> struct Syncable_ModeledBy
+{
+    static const bool value = false;
+    typedef typename ModelT Model;
+    typedef typename Model::Uuid Uuid;
+    typedef typename Model::Time Time;
+    static Uuid uuid(Model const&);
+    static Time time(Model const&);
+};
+
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Vector.h
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Vector.h	2013-02-28 10:28:58 EST (Thu, 28 Feb 2013)
@@ -0,0 +1,111 @@
+#pragma once
+
+#include <vector>
+#include "Syncable_ModeledBy.h"
+
+
+template<class Type, class UuidT = int, class TimeT = int>
+class Vector
+{
+public:
+  typedef std::vector<Type>                    tVector;
+  typedef UuidT                                Uuid;
+  typedef TimeT                                Time;
+
+  typedef typename tVector::size_type          size_type;
+  typedef typename tVector::value_type         value_type;
+  typedef typename tVector::const_reference    const_reference;
+
+  typedef typename tVector::iterator           iterator;
+  typedef typename tVector::const_iterator     const_iterator;
+
+  Vector(): m_uuid(), m_time(), m_name("empty"), m_vector() {}
+
+  Vector(Uuid const& uuid, Time const& time, std::string const& name)
+    : m_uuid(uuid), m_time(time), m_name(name), m_vector() 
+  {
+  }
+
+  Vector(Vector const& val) : m_vector(val.m_vector)
+    , m_uuid(val.m_uuid)
+    , m_time(val.m_time)
+    , m_name(val.m_name)
+  {
+    std::cout << "c(" << m_vector.size() << ") ";
+  }
+
+  Vector(Vector&& val): m_vector(std::move(val.m_vector))
+    , m_uuid(std::move(val.m_uuid))
+    , m_time(std::move(val.m_time))
+    , m_name(std::move(val.m_name))
+  {
+    std::cout << "m(" << m_vector.size() << ") ";
+  };
+
+  Vector& operator = (Vector val)
+  { 
+    m_uuid   = std::move(val.m_uuid);
+    m_time   = std::move(val.m_time);
+    m_name   = std::move(val.m_name);
+    m_vector = std::move(val.m_vector); 
+    std::cout << "m=" << m_vector.size() << " ";
+    return *this; 
+  }
+  
+  const_iterator begin()const { return m_vector.begin(); }
+  const_iterator end()const   { return m_vector.end(); }
+
+  iterator begin() { return m_vector.begin(); }
+  iterator end()   { return m_vector.end(); }
+
+  void reserve(size_type size){ m_vector.reserve(size); }
+  size_type size()const { return m_vector.size(); }
+
+  void emplace_back(Type val)
+  {
+    m_time = std::move(std::max(m_time, val.time()));
+    m_vector.emplace_back(val); 
+  }
+
+  void push_back(const Type& val)
+  {
+    m_time = std::max(m_time, val.time());
+    m_vector.push_back(val); 
+  }
+
+  Uuid uuid()const { return m_uuid; }
+  Time time()const { return m_time; }
+  std::string name()const { return m_name; }
+
+  void setUuid(Uuid const& uuid){ m_uuid = uuid; }
+  void setTime(Time const& time){ m_time = time; }
+  void setName(std::string const& name){ m_name = name; }
+  void name(std::string const& name)const { m_name = name; }
+
+private:
+  Uuid m_uuid;
+  Time m_time;
+  std::string m_name;
+  tVector m_vector;  
+};
+
+/*CL
+template<class Type, class Uuid, class Time>
+bool operator < (Vector<Type,Uuid,Time> const& lhs, Vector<Type,Uuid,Time> const& rhs)
+{
+  return lhs.uuid() < rhs.uuid();
+}
+*/
+
+
+template<class ElementT, class UuidT, class TimeT> 
+struct Syncable_ModeledBy<Vector<ElementT,UuidT,TimeT> >
+{
+    static const bool value = true;
+    typedef typename Vector<ElementT,UuidT,TimeT> Model;
+    typedef typename Model::Uuid Uuid;
+    typedef typename Model::Time Time;
+    static Uuid uuid(Model const& object){ return object.uuid(); }
+    static Time time(Model const& object){ return object.time(); }
+};
+
Deleted: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Tree.h
==============================================================================
--- sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Tree.h	2013-02-28 10:28:58 EST (Thu, 28 Feb 2013)
+++ (empty file)
@@ -1,431 +0,0 @@
-#pragma once
-
-#include <ostream>
-#include <iterator>
-#include <vector>
-#include <boost/function.hpp>
-#include <boost/utility/enable_if.hpp>
-#include "std_algorithm.h"
-//#include "Object.h"
-
-typedef int tUuid;
-typedef int tTime;
-
-template<class ContentT, class UuidT, class TimeT> class Node;
-
-template<class Uuid, class Time = int>
-class Playable
-{
-public:
-  Playable(Uuid uuid = 0)
-    : m_uuid(uuid)
-  {  }
-
-  Uuid uuid()const { return m_uuid; }
-  Time time()const { return Time(); } //JODO
-
-private:
-  Uuid m_uuid;
-};
-
-
-template<class Uuid, class Time>
-bool operator < (Playable<Uuid,Time> const& lhs, Playable<Uuid,Time> const& rhs)
-{
-  return lhs.time() < rhs.time();
-}
-
-
-template<class Mergable>
-struct Merger
-{
-  Mergable operator()(Mergable const& lhs, Mergable const& rhs)
-  { 
-      return std::move(merge(lhs, rhs)); 
-  }
-};
-
-
-template<class CharType, class CharTraits, class Uuid>
-std::basic_ostream<CharType, CharTraits>&
-operator << (std::basic_ostream<CharType, CharTraits> &stream, Playable<Uuid> const& object)
-{
-  return stream << "Play(" << object.uuid() << ")";
-}
-
-
-template<class Type, class UuidT = int, class TimeT = int>
-struct Vec
-{
-  typedef std::vector<Type>                    tVector;
-  typedef UuidT                                Uuid;
-  typedef TimeT                                Time;
-
-  typedef typename tVector::size_type          size_type;
-  typedef typename tVector::value_type         value_type;
-  //CL typedef Type                                 ValueType;
-  typedef typename tVector::const_reference    const_reference;
-
-  typedef typename tVector::iterator           iterator;
-  typedef typename tVector::const_iterator     const_iterator;
-
-  Vec(): m_uuid(), m_time(), m_name("empty"), m_vector() {}
-
-  Vec(Uuid const& uuid, Time const& time, std::string const& name, size_type capac = 4)
-    : m_uuid(uuid), m_time(time), m_name(name), m_vector(capac) 
-  {
-  }
-
-  Vec(Vec const& val) : m_vector(val.m_vector)
-    , m_uuid(val.m_uuid)
-    , m_time(val.m_time)
-    , m_name(val.m_name)
-  {
-    std::cout << "c() ";
-  }
-
-  Vec(Vec&& val): m_vector(std::move(val.m_vector))
-    , m_uuid(std::move(val.m_uuid))
-    , m_time(std::move(val.m_time))
-    , m_name(std::move(val.m_name))
-  {
-    //std::cout << "m() ";
-  };
-
-  Vec& operator = (Vec val)
-  { 
-    m_uuid   = std::move(val.m_uuid);
-    m_time   = std::move(val.m_time);
-    m_name   = std::move(val.m_name);
-    m_vector = std::move(val.m_vector); 
-    //std::cout << "m= ";
-    return *this; 
-  }
-  
-  const_iterator begin()const { return m_vector.begin(); }
-  const_iterator end()const   { return m_vector.end(); }
-
-  iterator begin() { return m_vector.begin(); }
-  iterator end()   { return m_vector.end(); }
-
-  void reserve(size_type size){ m_vector.reserve(size); }
-  size_type size()const { return m_vector.size(); }
-
-  void emplace_back(const Type& val)
-  {
-    m_time = std::move(std::max(m_time, val.time()));
-    m_vector.emplace_back(val); 
-  }
-
-  void push_back(const Type& val)
-  {
-    //JODO 
-    m_time = std::max(m_time, val.time());
-    m_vector.push_back(val); 
-  }
-
-  Uuid uuid()const { return m_uuid; }
-  Time time()const { return m_time; }
-  std::string name()const { return m_name; }
-
-  void setUuid(Uuid const& uuid){ m_uuid = uuid; }
-  void setTime(Time const& time){ m_time = time; }
-  void setName(std::string const& name){ m_name = name; }
-  void name(std::string const& name)const { m_name = name; }
-
-  Uuid m_uuid;
-  Time m_time;
-  std::string m_name;
-  tVector m_vector;  
-};
-
-template<class Type, class Uuid, class Time>
-bool operator < (Vec<Type,Uuid,Time> const& lhs, Vec<Type,Uuid,Time> const& rhs)
-{
-  return lhs.uuid() < rhs.uuid();
-}
-
-//-----------------------------------------------------------------
-// Concept Dateable something that is universally identifiable
-// and has a timestamp, so it can be synchronized
-template<class ModelT> struct Syncable_ModeledBy
-{
-    static const bool value = false;
-    typedef typename ModelT Model;
-    typedef typename Model::Uuid Uuid;
-    typedef typename Model::Time Time;
-    static Uuid uuid(Model const&);
-    static Time time(Model const&);
-};
-
-template<class UuidT, class TimeT> 
-struct Syncable_ModeledBy<Playable<UuidT,TimeT> >
-{
-    static const bool value = true;
-    typedef typename Playable<UuidT> Model;
-    typedef typename Model::Uuid Uuid;
-    typedef typename Model::Time Time;
-    static Uuid uuid(Model const& object){ return object.uuid() };
-    static Time time(Model const& object){ return object.time() };
-};
-
-template<class ElementT, class UuidT, class TimeT> 
-struct Syncable_ModeledBy<Vec<ElementT,UuidT,TimeT> >
-{
-    static const bool value = true;
-    typedef typename Vec<ElementT,UuidT,TimeT> Model;
-    typedef typename Model::Uuid Uuid;
-    typedef typename Model::Time Time;
-    static Uuid uuid(Model const& object){ return object.uuid(); }
-    static Time time(Model const& object){ return object.time(); }
-};
-
-template<class ContentT,class UuidT, class TimeT> 
-struct Syncable_ModeledBy<Node<ContentT,UuidT,TimeT> >
-{
-    static const bool value = true;
-    typedef typename Node<ContentT,UuidT,TimeT> Model;
-    typedef typename Model::Uuid Uuid;
-    typedef typename Model::Time Time;
-    static Uuid uuid(Model const& object){ return object.uuid(); }
-    static Time time(Model const& object){ return object.time(); }
-};
-
-template<class Model>
-typename boost::enable_if<Syncable_ModeledBy<Model>,
-typename Syncable_ModeledBy<Model>::Uuid>::type uuid(Model const& object)
-{
-    return Syncable_ModeledBy<Model>::uuid(object);
-}
-
-template<class Model>
-typename boost::enable_if<Syncable_ModeledBy<Model>,
-typename Syncable_ModeledBy<Model>::Time>::type time(Model const& object)
-{
-    return Syncable_ModeledBy<Model>::time(object);
-}
-
-template<class Model>
-typename boost::enable_if<Syncable_ModeledBy<Model>,
-bool>::type less_for_time(Model const& lhs, Model const& rhs)
-{
-    return time(lhs) < time(rhs);
-}
-
-template<class Model>
-typename boost::enable_if<Syncable_ModeledBy<Model>,
-bool>::type less_for_uuid(Model const& lhs, Model const& rhs)
-{
-    return uuid(lhs) < uuid(rhs);
-}
-
-template<class Syncable>
-struct LessForUuid : std::binary_function<Syncable, Syncable, bool>
-{
-    bool operator()(Syncable const& lhs, Syncable const& rhs)
-    { 
-        return less_for_uuid(lhs, rhs); 
-    }
-};
-
-template<class Syncable>
-struct LessForTime : std::binary_function<Syncable, Syncable, bool>
-{
-    typedef Syncable first_argument_type; 
-    typedef Syncable second_argument_type; 
-
-    bool operator()(Syncable const& lhs, Syncable const& rhs)
-    { 
-        return less_for_time(lhs, rhs); 
-    }
-};
-
-
-//-----------------------------------------------------------------
-
-template<class ContentT, class UuidT = int, class TimeT = int>
-class Node
-{
-public:
-  typedef ContentT     Content;
-  typedef UuidT        Uuid;
-  typedef TimeT        Time;
-  typedef Vec<Content> ContentVec;
-  typedef Vec<Node>    NodeVec;
-
-  typedef typename ContentVec::const_iterator element_const_iterator;
-  typedef typename ContentVec::iterator element_iterator;
-
-  typedef typename NodeVec::const_iterator node_const_iterator;
-  typedef typename NodeVec::iterator       node_iterator;
-
-  Node( Uuid const& uuid = 0, std::string const& name = std::string()
-      , const ContentVec& content = ContentVec(), const NodeVec& children = NodeVec())
-    : m_uuid(uuid), m_name(name)
-    , m_content(content), m_children(children)
-  {
-    m_time = std::max(m_content.time(), m_children.time());
-  }
-
-  element_const_iterator elements_begin()const { return m_content.begin(); }
-  element_const_iterator elements_end()const   { return m_content.end();   }
-  element_iterator elements_begin()            { return m_content.begin(); }
-  element_iterator elements_end()              { return m_content.end();   }
-  int element_count()const                     { return m_content.size();  }
-
-  node_const_iterator nodes_begin()const       { return m_children.begin(); }
-  node_const_iterator nodes_end()const         { return m_children.end();   }
-  node_iterator nodes_begin()                  { return m_children.begin(); }
-  node_iterator nodes_end()                    { return m_children.end();   }
-  int node_count()const                        { return m_children.size();  }
-
-
-
-  Uuid        uuid()const { return m_uuid; }
-  Time        time()const { return m_time; }
-  std::string name()const { return m_name; }
-
-  Uuid        contentUuid()const { return m_content.uuid(); }
-  Time        contentTime()const { return m_content.time(); }
-  std::string contentName()const { return m_content.name(); }
-
-  Uuid        childrenUuid()const { return m_children.uuid(); }
-  Time        childrenTime()const { return m_children.time(); }
-  std::string childrenName()const { return m_children.name(); }
-
-  void        setUuid(Uuid const& uuid) { m_uuid=uuid; }
-  void        setTime(Time const& time) { m_time=time; }
-  void        setName(std::string& name){ m_name=name; }
-
-  void        setContent(ContentVec content){ m_content = std::move(content); };
-  void        setChildren(NodeVec nodes){ m_children = std::move(nodes); };
-
-  ContentVec content()const  { return m_content;  }
-  NodeVec    children()const { return m_children; }  
-
-private:
-  Uuid        m_uuid;
-  Time        m_time;
-  std::string m_name;
-  ContentVec  m_content;
-  NodeVec     m_children;
-};
-
-
-template<class Type, class Uuid, class Time>
-bool operator < (Node<Type,Uuid,Time> const& lhs, Node<Type,Uuid,Time> const& rhs)
-{
-  return lhs.uuid() < rhs.uuid();
-}
-
-
-
-template<class Type>
-void draw(const Node<Type>& obj, std::ostream& out, size_t pos)
-{
-  out << std::string(pos,' ') << "<Node>[" << obj.name() << "](" << obj.uuid() << "," << obj.time() <<")\n";
-
-  draw(obj.content(), out, pos+2);
-  draw(obj.children(), out, pos+2); 
-
-  out << std::string(pos,' ') << "</Node>\n";
-}
-
-
-template<class Type, class Selector> struct Ordering
-{
-  Ordering(const Selector& select): m_select(select){}
-  bool operator()(Type const& lhs, Type const& rhs){ m_select(lhs) < m_select(rhs); }
-  Selector m_select;
-};
-
-template<class Type>
-Node<Type> merge(const Node<Type>& lhs, const Node<Type>& rhs)
-{
-  typedef typename Node<Type>::ContentVec ContentVec;
-  Node<Type> merged;
-  merged.setUuid(lhs.uuid());
-  merged.setTime(std::max(lhs.time(), rhs.time()));
-  merged.setName(lhs.name());
-
-  merged.setContent(mergeElements(lhs, rhs));
-  merged.setChildren(mergeNodes(lhs, rhs));
-
-  return std::move(merged);
-}
-
-
-template<class Type>
-typename Node<Type>::ContentVec mergeElements(Node<Type>const& lhs, Node<Type>const& rhs)
-{
-  typedef Node<Type>::ContentVec  Elements;
-  typedef Elements::value_type    Element;
-
-  Elements merged;
-  merged.reserve(lhs.element_count() + rhs.element_count());
-  merged.setUuid(lhs.contentUuid());
-  merged.setName(lhs.contentName());
-  merged.setTime(std::max(lhs.contentTime(), rhs.contentTime()));
-
-  std::general_union( lhs.elements_begin(), lhs.elements_end()
-                    , rhs.elements_begin(), rhs.elements_end()
-                    , std::back_inserter(merged)
-                    , LessForUuid<Element>()
-                    , std::Maximum<LessForTime<Element> >() 
-                    );
-
-  return std::move(merged);
-}
-
-
-template<class Type>
-typename Node<Type>::NodeVec mergeNodes(Node<Type>const& lhs, Node<Type>const& rhs)
-{
-  typedef Node<Type>::NodeVec Nodes;
-  typedef typename Nodes::value_type NodeType;
-
-  Nodes merged;
-  merged.reserve(lhs.node_count() + rhs.node_count());
-  merged.setUuid(lhs.childrenUuid());
-  merged.setName(lhs.childrenName());
-  merged.setTime(std::max(lhs.childrenTime(), rhs.childrenTime()));
-  
-  std::general_union( lhs.nodes_begin(), lhs.nodes_end()
-                    , rhs.nodes_begin(), rhs.nodes_end()
-                    , std::back_inserter(merged)
-                    , LessForUuid<NodeType>()
-                    , Merger<NodeType>()
-                    );
-                    
-  return std::move(merged);
-}
-
-
-template<class Type>
-void sort(Node<Type>& val)
-{
-  typedef typename Node<Type>::ContentVec ContentVec;
-  Node<Type> sorted;
-
-  sortElements(val);
-  sortNodes(val);
-}
-
-template<class Type> struct Sorter
-{
-  void operator()(Type& value){ sort(value); }
-};
-
-template<class Type>
-void sortElements(Node<Type>& val)
-{
-  std::sort( val.elements_begin(), val.elements_end(), LessForUuid<Type>());
-}
-
-template<class Type>
-void sortNodes(Node<Type>& val)
-{
-  std::for_each(val.nodes_begin(), val.nodes_end(), Sorter<Node<Type> >());
-  std::sort( val.nodes_begin(), val.nodes_end(), LessForUuid<Node<Type> >());
-}
-
Modified: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeMaker.h
==============================================================================
--- sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeMaker.h	(original)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeMaker.h	2013-02-28 10:28:58 EST (Thu, 28 Feb 2013)
@@ -1,15 +1,16 @@
 #pragma once
 
-#include "Tree.h"
-
-typedef Vec<Playable<int> >   Playlist;
-typedef Vec<Playlist>         Playlists;
-typedef Vec<Node<Playlist> >  NodeList;
+#include "Syncable/Vector.h"
+#include "Syncable/Node.h"
+#include "Syncable/Playable.h"
+
+typedef Vector<Playable<int> >   Playlist;
+typedef Vector<Playlist>         Playlists;
+typedef Vector<Node<Playlist> >  NodeList;
 
 
 Playlists content_1(int uuid, std::string const& name)
 {
-
       Playlist pl1(3, 2, " pl_1 ");
         pl1.emplace_back(Playable<int>(11));
 
@@ -20,7 +21,6 @@
   Playlists pls1(uuid, 0, name);
     pls1.emplace_back(std::move(pl1));
     pls1.emplace_back(std::move(pl2));
-    //pls1.emplace_back(Playlist(3, 2, " pl_1 ").emplace_back(Playable<int>(11)));
 
   return std::move(pls1);
 }
@@ -38,17 +38,17 @@
         pl2.emplace_back(Playable<int>(21));
 
   Playlists pls1(uuid, 0, name);
-    pls1.emplace_back(pl1);
-    pls1.emplace_back(pl2);
+    pls1.emplace_back(std::move(pl1));
+    pls1.emplace_back(std::move(pl2));
 
   return std::move(pls1);
 }
 
 NodeList children_0(int uuid, int time, std::string const& name, Playlists pls)
 {
-      Node<Playlist> node(6, "node_1", pls);
+      //CL Node<Playlist> node(6, "node_1", pls);
   NodeList nodes1(uuid, time, " nodes_1 ");
-      nodes1.emplace_back(node);
+      nodes1.emplace_back(Node<Playlist>(6, "node_1", std::move(pls)));
   return std::move(nodes1);
 }
 
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeMerge.h
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeMerge.h	2013-02-28 10:28:58 EST (Thu, 28 Feb 2013)
@@ -0,0 +1,115 @@
+#pragma once
+
+#include <ostream>
+#include <iterator>
+#include "std_algorithm.h"
+
+#include "Syncable/Syncable_Concept.h"
+#include "Syncable/Vector.h"
+#include "Syncable/Node.h"
+#include "Syncable/Playable.h"
+
+template<class Mergable>
+struct Merger
+{
+  Mergable operator()(Mergable const& lhs, Mergable const& rhs)
+  { 
+      return std::move(merge(lhs, rhs)); 
+  }
+};
+
+template<class Type, class UuidT, class TimeT>
+Node<Type,UuidT,TimeT>
+merge(Node<Type,UuidT,TimeT>const& lhs, Node<Type,UuidT,TimeT>const& rhs)
+{
+  typedef typename Node<Type,UuidT,TimeT> NodeT;
+  typedef typename NodeT::ContentVec ContentVec;
+  NodeT merged;
+  merged.setUuid(lhs.uuid());
+  merged.setTime(std::max(lhs.time(), rhs.time()));
+  merged.setName(lhs.name());
+
+  merged.setContent(mergeElements(lhs, rhs));
+  merged.setChildren(mergeNodes(lhs, rhs));
+
+  return std::move(merged);
+}
+
+
+template<class Type, class UuidT, class TimeT>
+typename Node<Type,UuidT,TimeT>::ContentVec
+mergeElements(Node<Type,UuidT,TimeT>const& lhs, Node<Type,UuidT,TimeT>const& rhs)
+{
+  typedef typename Node<Type,UuidT,TimeT> NodeT;
+  typedef NodeT::ContentVec               Elements;
+  typedef Elements::value_type            Element;
+
+  Elements merged;
+  merged.reserve(lhs.element_count() + rhs.element_count());
+  merged.setUuid(lhs.contentUuid());
+  merged.setName(lhs.contentName());
+  merged.setTime(std::max(lhs.contentTime(), rhs.contentTime()));
+
+  std::general_union( lhs.elements_begin(), lhs.elements_end()
+                    , rhs.elements_begin(), rhs.elements_end()
+                    , std::back_inserter(merged)
+                    , LessForUuid<Element>()
+                    , std::Maximum<LessForTime<Element> >() 
+                    );
+
+  return std::move(merged);
+}
+
+
+template<class Type, class UuidT, class TimeT>
+typename Node<Type,UuidT,TimeT>::NodeVec
+mergeNodes(Node<Type,UuidT,TimeT>const& lhs, Node<Type,UuidT,TimeT>const& rhs)
+{
+  typedef Node<Type>::NodeVec Nodes;
+  typedef typename Nodes::value_type NodeType;
+
+  Nodes merged;
+  merged.reserve(lhs.node_count() + rhs.node_count());
+  merged.setUuid(lhs.childrenUuid());
+  merged.setName(lhs.childrenName());
+  merged.setTime(std::max(lhs.childrenTime(), rhs.childrenTime()));
+  
+  std::general_union( lhs.nodes_begin(), lhs.nodes_end()
+                    , rhs.nodes_begin(), rhs.nodes_end()
+                    , std::back_inserter(merged)
+                    , LessForUuid<NodeType>()
+                    , Merger<NodeType>()
+                    );
+                    
+  return std::move(merged);
+}
+
+
+template<class Type, class UuidT, class TimeT>
+void sort(Node<Type,UuidT,TimeT>& value)
+{
+  typedef Node<Type,UuidT,TimeT> NodeT;
+  typedef typename NodeT::ContentVec ContentVec;
+
+  sortElements(value);
+  sortNodes(value);
+}
+
+template<class Type> struct Sorter
+{
+  void operator()(Type& value){ sort(value); }
+};
+
+template<class Type, class UuidT, class TimeT>
+void sortElements(Node<Type,UuidT,TimeT>& value)
+{
+  std::sort( value.elements_begin(), value.elements_end(), LessForUuid<Type>() );
+}
+
+template<class Type, class UuidT, class TimeT>
+void sortNodes(Node<Type,UuidT,TimeT>& value)
+{
+  std::for_each( value.nodes_begin(), value.nodes_end(), Sorter<Node<Type> >() );
+  std::sort( value.nodes_begin(), value.nodes_end(), LessForUuid<Node<Type> >() );
+}
+
Modified: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeSync1.cpp
==============================================================================
--- sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeSync1.cpp	(original)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeSync1.cpp	2013-02-28 10:28:58 EST (Thu, 28 Feb 2013)
@@ -4,53 +4,26 @@
 #include "stdafx.h"
 #include <iostream>
 
-#include "Object.h"
-#include "Tree.h"
+#include "TreeMerge.h"
 #include "TreeMaker.h"
 
-typedef std::vector<object> collection;
-typedef collection::iterator       coll_iter;
-typedef collection::const_iterator coll_citer;
 
+template<class T>
+void draw(const T& x, std::ostream& out, size_t pos)
+{ out << std::string(pos, ' ') << x << std::endl; }
 
-template<class Type>
-std::string type_name(Type const& value)
-{
-  return typeid(value).name();
-}
-
-void draw(const int& val, std::ostream& out, size_t pos)
-{ 
-  out << std::string(pos, ' ') << "int: " << val << std::endl; 
-}
-
-void draw(const double& val, std::ostream& out, size_t pos)
-{ 
-  out << std::string(pos, ' ') << "dbl: " << val << std::endl; 
-}
-
-void draw(const collection& col, std::ostream& out, size_t pos)
-{
-  out << std::string(pos,' ') << "<collection>\n";
-  for(coll_citer it = col.begin(); it != col.end(); ++it)
-    draw(*it, out, pos+2);
-
-  out << std::string(pos,' ') << "</collection>\n";
-}
 
 template<class Type>
-void draw(const Vec<Type>& obj, std::ostream& out, size_t pos)
+void draw(const Vector<Type>& obj, std::ostream& out, size_t pos)
 {
-  typedef typename Vec<Type>::const_iterator citer;
+  typedef typename Vector<Type>::const_iterator citer;
   out << std::string(pos,' ') 
-    //<< type_name(obj) << "{\n";
-    << "<Vec>[" << obj.name() << "](" << obj.uuid() << ","  << obj.time() << ")\n";
+    << "<Vector>[" << obj.name() << "](" << obj.uuid() << ","  << obj.time() << ")\n";
   for(citer it = obj.begin(); it != obj.end(); ++it)
     draw(*it, out, pos+2);
 
   out << std::string(pos,' ') 
-    //<< "}\n";
-    << "</Vec>\n";
+    << "</Vector>\n";
 }
 
 
@@ -59,15 +32,6 @@
 {
   std::cout << "Hello concept\n";
 
-  collection coll;
-
-  coll.push_back(42);
-
-
-  Playlists content1   = content_1(4, " pls_1 ");
-
-
-  /*
   //--- Nodes -----------------------
   Playlists content1   = content_1(4, " pls_1 ");
   NodeList  children1  = children_0(5, 6, "children_1", content1);
@@ -82,7 +46,9 @@
 
   draw(node1, std::cout, 0);
 
+  std::cout << ">>sort(node1) ========================================\n";
   sort(node1);
+  std::cout << "\n<<sort(node1) ========================================\n";
   sort(node2);
   std::cout << "node1 ========================================\n";
   draw(node1, std::cout, 0);
@@ -90,10 +56,11 @@
   draw(node2, std::cout, 0);
 
   
+  std::cout << "\n>>merge ========================================\n";
   Node<Playlist> merged = merge(node1, node2);
+  std::cout << "\n<<merge ========================================\n";
   std::cout << "merged ========================================\n";
   draw(merged, std::cout, 0);
-  */
 
   return 0;
 }
Modified: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/std_algorithm.h
==============================================================================
--- sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/std_algorithm.h	(original)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/std_algorithm.h	2013-02-28 10:28:58 EST (Thu, 28 Feb 2013)
@@ -44,7 +44,9 @@
   typedef typename Less::first_argument_type first_argument_type;
 
   Comparable operator()(Comparable const& lhs, Comparable const& rhs)
-  { return Less()(lhs,rhs) ? rhs : lhs; }
+  { 
+      return Less()(lhs,rhs) ? rhs : lhs; 
+  }
 };