$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r83049 - in sandbox/icl/libs/xplore/value_sem: . TreeSync1 TreeSync1/TreeSync1
From: afojgo_at_[hidden]
Date: 2013-02-20 11:46:29
Author: jofaber
Date: 2013-02-20 11:46:27 EST (Wed, 20 Feb 2013)
New Revision: 83049
URL: http://svn.boost.org/trac/boost/changeset/83049
Log:
Tree via value semantics
Added:
   sandbox/icl/libs/xplore/value_sem/   (props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/   (props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/   (props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1.sln   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Object.h   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/ReadMe.txt   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Tree.h   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeSync1.cpp   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeSync1.vcproj   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/stdafx.cpp   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/stdafx.h   (contents, props changed)
   sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/targetver.h   (contents, props changed)
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1.sln
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1.sln	2013-02-20 11:46:27 EST (Wed, 20 Feb 2013)
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TreeSync1", "TreeSync1\TreeSync1.vcproj", "{12A9496D-1829-410E-9F6E-76908EFF025A}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{12A9496D-1829-410E-9F6E-76908EFF025A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{12A9496D-1829-410E-9F6E-76908EFF025A}.Debug|Win32.Build.0 = Debug|Win32
+		{12A9496D-1829-410E-9F6E-76908EFF025A}.Release|Win32.ActiveCfg = Release|Win32
+		{12A9496D-1829-410E-9F6E-76908EFF025A}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Object.h
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Object.h	2013-02-20 11:46:27 EST (Wed, 20 Feb 2013)
@@ -0,0 +1,56 @@
+#pragma once
+
+#include <string>
+#include <iostream>
+#include <boost/smart_ptr/shared_ptr.hpp>
+
+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(const Model& x) : m_object(new model<Model>(x)){ }
+
+  object(const object& x) : m_object(x.m_object->copy()){ }
+
+  object& operator = (const object& x)
+  { m_object.reset(x.m_object->copy()); return *this; }
+
+  friend void draw(const object& x, std::ostream& out, size_t pos)
+  { 
+    x.m_object->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 model : concept 
+  {
+    model( const Model& x) : m_model(x) {}
+    concept* copy(){ return new model(*this); }
+    void draw_(std::ostream& out, size_t pos)const
+    { 
+      draw(m_model, out, pos); 
+    }
+
+    Model m_model;
+  };
+
+private:
+  boost::shared_ptr<concept> m_object;
+};
+
+
+//30:25 operator= via unique_ptr.
+//50:10 refactoring: (member) function templates across models
+//50:19 refactoring local models structs to a template
\ No newline at end of file
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/ReadMe.txt
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/ReadMe.txt	2013-02-20 11:46:27 EST (Wed, 20 Feb 2013)
@@ -0,0 +1,33 @@
+========================================================================
+    CONSOLE APPLICATION : TreeSync1 Project Overview
+========================================================================
+
+AppWizard has created this TreeSync1 application for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your TreeSync1 application.
+
+
+TreeSync1.vcproj
+    This is the main project file for VC++ projects generated using an Application Wizard.
+    It contains information about the version of Visual C++ that generated the file, and
+    information about the platforms, configurations, and project features selected with the
+    Application Wizard.
+
+TreeSync1.cpp
+    This is the main application source file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+    These files are used to build a precompiled header (PCH) file
+    named TreeSync1.pch and a precompiled types file named StdAfx.obj.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" comments to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Tree.h
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Tree.h	2013-02-20 11:46:27 EST (Wed, 20 Feb 2013)
@@ -0,0 +1,83 @@
+#pragma once
+
+#include <ostream>
+#include <vector>
+#include "Object.h"
+
+typedef int tUuid;
+typedef int tTime;
+
+template<class Uuid>
+class Playable
+{
+public:
+  Playable(Uuid uuid)
+    : m_uuid(uuid)
+  {  }
+
+  Uuid uuid()const { return m_uuid; }
+
+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() << ")";
+}
+
+typedef std::vector<Playable<tUuid> > tPlaylist;
+
+struct PlayableTag{};
+
+template<class Type>
+struct Vec
+{
+  typedef std::vector<object>     tVector;
+  typedef tVector::iterator       iterator;
+  typedef tVector::const_iterator const_iterator;
+  typedef tVector::value_type     value_type;
+
+  const_iterator begin()const { return m_vector.begin(); }
+  const_iterator end()const   { return m_vector.end(); }
+
+  void push_back(const Type& val){ m_vector.push_back(val); }
+
+  tVector m_vector;  
+};
+
+
+
+template<class Content>
+class Node
+{
+public:
+  typedef Vec<Content> ContentVec;
+  typedef Vec<Node>    NodeVec;
+
+
+  Node(const ContentVec& content = ContentVec(), const NodeVec& children = NodeVec())
+    : m_content(content), m_children(children)
+  {  }
+
+  ContentVec content()const  { return m_content;  }
+  NodeVec    children()const { return m_children; }  
+
+private:
+  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>\n";
+
+  draw(obj.content(), out, pos+2);
+  draw(obj.children(), out, pos+2); 
+
+  out << std::string(pos,' ') << "</Node>\n";
+}
+
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeSync1.cpp
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeSync1.cpp	2013-02-20 11:46:27 EST (Wed, 20 Feb 2013)
@@ -0,0 +1,79 @@
+// TreeSync1.cpp : Defines the entry point for the console application.
+//
+
+#include "stdafx.h"
+#include <iostream>
+
+#include "Object.h"
+#include "Tree.h"
+
+typedef std::vector<object> collection;
+typedef collection::iterator       coll_iter;
+typedef collection::const_iterator coll_citer;
+
+typedef Vec<Playable<int> >   Playlist;
+typedef Vec<Playlist>         Playlists;
+typedef Vec<Node<Playlist> >  NodeList;
+
+
+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>& col, std::ostream& out, size_t pos)
+{
+  out << std::string(pos,' ') << "<Vec>\n";
+  for(coll_citer it = col.begin(); it != col.end(); ++it)
+    draw(*it, out, pos+2);
+
+  out << std::string(pos,' ') << "</Vec>\n";
+}
+
+int _tmain(int argc, _TCHAR* argv[])
+{
+  std::cout << "Hello concept\n";
+
+  collection coll;
+
+  Playlist pl1;
+  pl1.push_back(Playable<int>(43));
+  pl1.push_back(Playable<int>(44));
+
+  Playlist pl2;
+  pl2.push_back(Playable<int>(53));
+  pl2.push_back(Playable<int>(54));
+  //draw(pl, std::cout, 0);
+
+  Playlists pls1;
+  pls1.push_back(pl1);
+  Playlists pls2;
+  pls2.push_back(pl2);
+
+  Node<Playlist> node1(pls1);
+  NodeList nodes1;
+  nodes1.push_back(node1);
+  Node<Playlist> node2(pls2, nodes1);
+  
+  coll.push_back(node1);
+  coll.push_back(node2);
+  draw(coll, std::cout, 0);
+
+	return 0;
+}
+
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeSync1.vcproj
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/TreeSync1.vcproj	2013-02-20 11:46:27 EST (Wed, 20 Feb 2013)
@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="TreeSync1"
+	ProjectGUID="{12A9496D-1829-410E-9F6E-76908EFF025A}"
+	RootNamespace="TreeSync1"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="C:\NIBuild\3rdparty\boost-1.51.0-R4"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="C:\NIBuild\3rdparty\boost-1.51.0-R4"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\stdafx.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\TreeSync1.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/stdafx.cpp
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/stdafx.cpp	2013-02-20 11:46:27 EST (Wed, 20 Feb 2013)
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// TreeSync1.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/stdafx.h
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/stdafx.h	2013-02-20 11:46:27 EST (Wed, 20 Feb 2013)
@@ -0,0 +1,15 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#include "targetver.h"
+
+#include <stdio.h>
+#include <tchar.h>
+
+
+
+// TODO: reference additional headers your program requires here
Added: sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/targetver.h
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/targetver.h	2013-02-20 11:46:27 EST (Wed, 20 Feb 2013)
@@ -0,0 +1,13 @@
+#pragma once
+
+// The following macros define the minimum required platform.  The minimum required platform
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run 
+// your application.  The macros work by enabling all features available on platform versions up to and 
+// including the version specified.
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef _WIN32_WINNT            // Specifies that the minimum required platform is Windows Vista.
+#define _WIN32_WINNT 0x0600     // Change this to the appropriate value to target other versions of Windows.
+#endif
+