فهرست منبع

Getting rid of xcschemes.
Renaming project to rotate.
Expand proxying to work for subsets of a rotate.
Eliminate dummy fields.

Samuel Jaffe 8 سال پیش
والد
کامیت
2fc52930dd

+ 0 - 142
datamodel.xcodeproj/project.pbxproj

@@ -1,142 +0,0 @@
-// !$*UTF8*$!
-{
-	archiveVersion = 1;
-	classes = {
-	};
-	objectVersion = 46;
-	objects = {
-
-/* Begin PBXFileReference section */
-		0E9E98B11BBC8A02004FFE25 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
-		0E9E98B21BBC8A03004FFE25 /* rotate.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = rotate.hpp; sourceTree = "<group>"; };
-		0E9E98B61BBC8A35004FFE25 /* rotate_tc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rotate_tc.h; sourceTree = "<group>"; };
-		0E9E98B71BBC8DB8004FFE25 /* rotate_tc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rotate_tc.cpp; sourceTree = "<group>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXGroup section */
-		0E9E98AB1BBC8A02004FFE25 = {
-			isa = PBXGroup;
-			children = (
-				0E9E98B11BBC8A02004FFE25 /* Makefile */,
-				0E9E98B21BBC8A03004FFE25 /* rotate.hpp */,
-				0E9E98B61BBC8A35004FFE25 /* rotate_tc.h */,
-				0E9E98B71BBC8DB8004FFE25 /* rotate_tc.cpp */,
-			);
-			sourceTree = "<group>";
-		};
-/* End PBXGroup section */
-
-/* Begin PBXLegacyTarget section */
-		0E9E98B01BBC8A02004FFE25 /* datamodel */ = {
-			isa = PBXLegacyTarget;
-			buildArgumentsString = "$(ACTION)";
-			buildConfigurationList = 0E9E98B31BBC8A03004FFE25 /* Build configuration list for PBXLegacyTarget "datamodel" */;
-			buildPhases = (
-			);
-			buildToolPath = /usr/bin/make;
-			buildWorkingDirectory = "/Users/leumasjaffe/Documents/Programming/XTools Workspace/C:C++/misc/datamodel";
-			dependencies = (
-			);
-			name = datamodel;
-			passBuildSettingsInEnvironment = 1;
-			productName = datamodel;
-		};
-/* End PBXLegacyTarget section */
-
-/* Begin PBXProject section */
-		0E9E98AC1BBC8A02004FFE25 /* Project object */ = {
-			isa = PBXProject;
-			attributes = {
-			};
-			buildConfigurationList = 0E9E98AF1BBC8A02004FFE25 /* Build configuration list for PBXProject "datamodel" */;
-			compatibilityVersion = "Xcode 3.2";
-			developmentRegion = English;
-			hasScannedForEncodings = 0;
-			knownRegions = (
-				en,
-			);
-			mainGroup = 0E9E98AB1BBC8A02004FFE25;
-			projectDirPath = "";
-			projectRoot = "";
-			targets = (
-				0E9E98B01BBC8A02004FFE25 /* datamodel */,
-			);
-		};
-/* End PBXProject section */
-
-/* Begin XCBuildConfiguration section */
-		0E9E98AD1BBC8A02004FFE25 /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
-				COPY_PHASE_STRIP = NO;
-				GCC_WARN_ABOUT_RETURN_TYPE = YES;
-				GCC_WARN_UNUSED_VARIABLE = YES;
-				ONLY_ACTIVE_ARCH = YES;
-				SDKROOT = macosx10.6;
-			};
-			name = Debug;
-		};
-		0E9E98AE1BBC8A02004FFE25 /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
-				COPY_PHASE_STRIP = YES;
-				GCC_WARN_ABOUT_RETURN_TYPE = YES;
-				GCC_WARN_UNUSED_VARIABLE = YES;
-				SDKROOT = macosx10.6;
-			};
-			name = Release;
-		};
-		0E9E98B41BBC8A03004FFE25 /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-				DEBUGGING_SYMBOLS = YES;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = "";
-				PRODUCT_NAME = datamodel;
-			};
-			name = Debug;
-		};
-		0E9E98B51BBC8A03004FFE25 /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = "";
-				PRODUCT_NAME = datamodel;
-			};
-			name = Release;
-		};
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
-		0E9E98AF1BBC8A02004FFE25 /* Build configuration list for PBXProject "datamodel" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				0E9E98AD1BBC8A02004FFE25 /* Debug */,
-				0E9E98AE1BBC8A02004FFE25 /* Release */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Release;
-		};
-		0E9E98B31BBC8A03004FFE25 /* Build configuration list for PBXLegacyTarget "datamodel" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				0E9E98B41BBC8A03004FFE25 /* Debug */,
-				0E9E98B51BBC8A03004FFE25 /* Release */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Release;
-		};
-/* End XCConfigurationList section */
-	};
-	rootObject = 0E9E98AC1BBC8A02004FFE25 /* Project object */;
-}

+ 0 - 80
datamodel.xcodeproj/xcuserdata/leumasjaffe.xcuserdatad/xcschemes/datamodel.xcscheme

@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Scheme
-   LastUpgradeVersion = "0700"
-   version = "1.3">
-   <BuildAction
-      parallelizeBuildables = "YES"
-      buildImplicitDependencies = "YES">
-      <BuildActionEntries>
-         <BuildActionEntry
-            buildForTesting = "YES"
-            buildForRunning = "YES"
-            buildForProfiling = "YES"
-            buildForArchiving = "YES"
-            buildForAnalyzing = "YES">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "0E9E98B01BBC8A02004FFE25"
-               BuildableName = "datamodel"
-               BlueprintName = "datamodel"
-               ReferencedContainer = "container:datamodel.xcodeproj">
-            </BuildableReference>
-         </BuildActionEntry>
-      </BuildActionEntries>
-   </BuildAction>
-   <TestAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES">
-      <Testables>
-      </Testables>
-      <AdditionalOptions>
-      </AdditionalOptions>
-   </TestAction>
-   <LaunchAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      launchStyle = "0"
-      useCustomWorkingDirectory = "NO"
-      ignoresPersistentStateOnLaunch = "NO"
-      debugDocumentVersioning = "YES"
-      debugServiceExtension = "internal"
-      allowLocationSimulation = "YES">
-      <MacroExpansion>
-         <BuildableReference
-            BuildableIdentifier = "primary"
-            BlueprintIdentifier = "0E9E98B01BBC8A02004FFE25"
-            BuildableName = "datamodel"
-            BlueprintName = "datamodel"
-            ReferencedContainer = "container:datamodel.xcodeproj">
-         </BuildableReference>
-      </MacroExpansion>
-      <AdditionalOptions>
-      </AdditionalOptions>
-   </LaunchAction>
-   <ProfileAction
-      buildConfiguration = "Release"
-      shouldUseLaunchSchemeArgsEnv = "YES"
-      savedToolIdentifier = ""
-      useCustomWorkingDirectory = "NO"
-      debugDocumentVersioning = "YES">
-      <MacroExpansion>
-         <BuildableReference
-            BuildableIdentifier = "primary"
-            BlueprintIdentifier = "0E9E98B01BBC8A02004FFE25"
-            BuildableName = "datamodel"
-            BlueprintName = "datamodel"
-            ReferencedContainer = "container:datamodel.xcodeproj">
-         </BuildableReference>
-      </MacroExpansion>
-   </ProfileAction>
-   <AnalyzeAction
-      buildConfiguration = "Debug">
-   </AnalyzeAction>
-   <ArchiveAction
-      buildConfiguration = "Release"
-      revealArchiveInOrganizer = "YES">
-   </ArchiveAction>
-</Scheme>

+ 0 - 22
datamodel.xcodeproj/xcuserdata/leumasjaffe.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>SchemeUserState</key>
-	<dict>
-		<key>datamodel.xcscheme</key>
-		<dict>
-			<key>orderHint</key>
-			<integer>8</integer>
-		</dict>
-	</dict>
-	<key>SuppressBuildableAutocreation</key>
-	<dict>
-		<key>0E9E98B01BBC8A02004FFE25</key>
-		<dict>
-			<key>primary</key>
-			<true/>
-		</dict>
-	</dict>
-</dict>
-</plist>

+ 0 - 80
datamodel.xcodeproj/xcuserdata/samjaffe.xcuserdatad/xcschemes/datamodel.xcscheme

@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Scheme
-   LastUpgradeVersion = "0720"
-   version = "1.3">
-   <BuildAction
-      parallelizeBuildables = "YES"
-      buildImplicitDependencies = "YES">
-      <BuildActionEntries>
-         <BuildActionEntry
-            buildForTesting = "YES"
-            buildForRunning = "YES"
-            buildForProfiling = "YES"
-            buildForArchiving = "YES"
-            buildForAnalyzing = "YES">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "0E9E98B01BBC8A02004FFE25"
-               BuildableName = "datamodel"
-               BlueprintName = "datamodel"
-               ReferencedContainer = "container:datamodel.xcodeproj">
-            </BuildableReference>
-         </BuildActionEntry>
-      </BuildActionEntries>
-   </BuildAction>
-   <TestAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES">
-      <Testables>
-      </Testables>
-      <AdditionalOptions>
-      </AdditionalOptions>
-   </TestAction>
-   <LaunchAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      launchStyle = "0"
-      useCustomWorkingDirectory = "NO"
-      ignoresPersistentStateOnLaunch = "NO"
-      debugDocumentVersioning = "YES"
-      debugServiceExtension = "internal"
-      allowLocationSimulation = "YES">
-      <MacroExpansion>
-         <BuildableReference
-            BuildableIdentifier = "primary"
-            BlueprintIdentifier = "0E9E98B01BBC8A02004FFE25"
-            BuildableName = "datamodel"
-            BlueprintName = "datamodel"
-            ReferencedContainer = "container:datamodel.xcodeproj">
-         </BuildableReference>
-      </MacroExpansion>
-      <AdditionalOptions>
-      </AdditionalOptions>
-   </LaunchAction>
-   <ProfileAction
-      buildConfiguration = "Release"
-      shouldUseLaunchSchemeArgsEnv = "YES"
-      savedToolIdentifier = ""
-      useCustomWorkingDirectory = "NO"
-      debugDocumentVersioning = "YES">
-      <MacroExpansion>
-         <BuildableReference
-            BuildableIdentifier = "primary"
-            BlueprintIdentifier = "0E9E98B01BBC8A02004FFE25"
-            BuildableName = "datamodel"
-            BlueprintName = "datamodel"
-            ReferencedContainer = "container:datamodel.xcodeproj">
-         </BuildableReference>
-      </MacroExpansion>
-   </ProfileAction>
-   <AnalyzeAction
-      buildConfiguration = "Debug">
-   </AnalyzeAction>
-   <ArchiveAction
-      buildConfiguration = "Release"
-      revealArchiveInOrganizer = "YES">
-   </ArchiveAction>
-</Scheme>

+ 0 - 22
datamodel.xcodeproj/xcuserdata/samjaffe.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>SchemeUserState</key>
-	<dict>
-		<key>datamodel.xcscheme</key>
-		<dict>
-			<key>orderHint</key>
-			<integer>11</integer>
-		</dict>
-	</dict>
-	<key>SuppressBuildableAutocreation</key>
-	<dict>
-		<key>0E9E98B01BBC8A02004FFE25</key>
-		<dict>
-			<key>primary</key>
-			<true/>
-		</dict>
-	</dict>
-</dict>
-</plist>

+ 78 - 66
rotate.hpp

@@ -1,15 +1,19 @@
+
+#pragma once
 #include <vector>
 #include <cstdlib>
-#include <boost/preprocessor.hpp>
-
-template <typename T, typename I, I T::*mem>
-struct access {
-  using value_type = I;
-  using access_type = T;
-  
-  value_type& get(access_type& t) const { return t.*mem; }
-  value_type const& get(access_type const& t) const { return t.*mem; }
-};
+#include <boost/preprocessor/seq/for_each.hpp>
+
+namespace data {
+  template <typename T, typename I, I T::*mem>
+  struct access {
+    using value_type = I;
+    using access_type = T;
+    
+    value_type& get(access_type& t) const { return t.*mem; }
+    value_type const& get(access_type const& t) const { return t.*mem; }
+  };
+}
 
 template <typename T, typename...Members>
 class rotate;
@@ -22,10 +26,10 @@ public:
   using value_type = typename Member::value_type;
   using data_type = std::vector<value_type>;
   
-  value_type&       get(size_t n, Member) { return rotated_.at(n); }
-  value_type const& get(size_t n, Member) const { return rotated_.at(n); }
+  inline value_type&       get(size_t n, Member)       { return rotated_.at(n); }
+  inline value_type const& get(size_t n, Member) const { return rotated_.at(n); }
   
-  data_type const&  get(Member) const { return rotated_; }
+  inline data_type const&  get(Member) const { return rotated_; }
 
 protected:
   void push_back(T const& t) {
@@ -40,8 +44,9 @@ template <typename T, typename Member0, typename...Members>
 class rotate<T, Member0, Members...> : public rotate<T, Member0>, public rotate<T, Members...> {
 public:
   proxy<T, Member0, Members...> get(size_t n);
+  template <typename...Proxied> proxy<T, Proxied...> getp(size_t n);
 
-  void push_back(T const& t) {
+  inline void push_back(T const& t) {
     rotate<T, Member0>::push_back(t);
     rotate<T, Members...>::push_back(t);
   }
@@ -52,17 +57,29 @@ public:
 
 #define PROXY_ELEMENT(T, elem) decltype(T::elem)& elem
 #define PROXY_MEMBER(r, T, elem) PROXY_ELEMENT(T, elem);
-#define PROXY_CONSTR(r, T, elem) BOOST_PP_CAT(PROXY_ELEMENT(T, elem),_),
-#define PROXY_INIT(r, T, elem) elem(BOOST_PP_CAT(elem,_)),
+#define PROXY_CONSTR(T, elem) BOOST_PP_CAT(PROXY_ELEMENT(T, elem),_)
+#define PROXY_CONSTR_J(r, T, elem) , PROXY_CONSTR(T, elem)
+#define PROXY_INIT(T, elem) elem(BOOST_PP_CAT(elem,_))
+#define PROXY_INIT_J(r, T, elem) , PROXY_INIT(T, elem)
 #define PROXY_SET(r, t, elem) t.elem = elem;
+#define PROXY_RSET(r, t, elem) elem = t.elem;
 
-#define proxy_t(T, mseq) proxy<T BOOST_PP_SEQ_FOR_EACH(ROTATE_ACCESS, T, mseq)>
+#define proxy_t(T, mseq) proxy<T, rotate_members(T, mseq)>
 
 #define ROTATE_PROXY(T, mseq) \
   template<> class proxy_t(T, mseq) { \
   public: \
-    proxy(BOOST_PP_SEQ_FOR_EACH(PROXY_CONSTR, T, mseq) bool) \
-    : BOOST_PP_SEQ_FOR_EACH(PROXY_INIT, T, mseq) dummy(false) {} \
+    proxy(PROXY_CONSTR(T, BOOST_PP_SEQ_HEAD(mseq)) \
+      BOOST_PP_SEQ_FOR_EACH(PROXY_CONSTR_J, T, BOOST_PP_SEQ_TAIL(mseq))) \
+    : PROXY_INIT(T, BOOST_PP_SEQ_HEAD(mseq)) \
+      BOOST_PP_SEQ_FOR_EACH(PROXY_INIT_J, T, BOOST_PP_SEQ_TAIL(mseq)) \
+    { \
+    } \
+    \
+    proxy & operator=( T const & obj ) { \
+      BOOST_PP_SEQ_FOR_EACH(PROXY_RSET, obj, mseq) \
+      return *this; \
+    } \
     \
     explicit operator T() const { \
       T t; \
@@ -71,62 +88,57 @@ public:
     } \
     \
     BOOST_PP_SEQ_FOR_EACH(PROXY_MEMBER, T, mseq) \
-    bool dummy; \
   }
 
-#define ROTATE_ACCESS(r, T, elem) ,access_t(T, elem)
-#define PROXY_ASSIGN(r, T, elem) rotate<T, access_t(T, elem)>::get(n, access_t(T, elem)()),
+#define ROTATE_ACCESS(T, elem) access_t(T, elem)
+#define ROTATE_ACCESS_J(r, T, elem) ,ROTATE_ACCESS(T, elem)
+#define PROXY_ASSIGN(T, elem) rotate<T, access_t(T, elem)>::get(n, access_t(T, elem)())
+#define PROXY_ASSIGN_J(r, T, elem) ,PROXY_ASSIGN(T, elem)
 
-#define rotate_t(T, mseq) rotate<T BOOST_PP_SEQ_FOR_EACH(ROTATE_ACCESS, T, mseq)>
-#define access_t(T, M) access<T, decltype(T::M), &T::M>
+#define rotate_members(T, mseq) ROTATE_ACCESS(T, BOOST_PP_SEQ_HEAD(mseq)) \
+  BOOST_PP_SEQ_FOR_EACH(ROTATE_ACCESS_J, T, BOOST_PP_SEQ_TAIL(mseq))
+#define rotate_t(T, mseq) rotate<T, rotate_members(T, mseq)>
+#define access_t(T, M) data::access<T, decltype(T::M), &T::M>
 
 //#define DEFINE_ROTATE_NAME(name, T, mseq) \
-//  using name = rotate_t(T, mseq); \
 //  ROTATE_PROXY(T, mseq); \
-//  template <typename T, typename M0, typename...Ms> \
-//  proxy<T, M0, Ms...> rotate<T, M0, Ms...>::get(size_t n) { \
-//    return proxy<T, M0, Ms...>{BOOST_PP_SEQ_FOR_EACH(PROXY_ASSIGN, T, mseq) false}; \
+//  class name : public rotate_t(T, mseq) { \
+//  public:\
+//    proxy_t(T, mseq) get(size_t n) { \
+//      return proxy_t(T, mseq){ \
+//        PROXY_ASSIGN(T, BOOST_PP_SEQ_HEAD(mseq)) \
+//        BOOST_PP_SEQ_FOR_EACH(PROXY_ASSIGN_J, T, BOOST_PP_SEQ_TAIL(mseq)) \
+//      }; \
+//    } \
+//    using rotate_t(T, mseq)::get; \
 //  }
 
 #define DEFINE_ROTATE_NAME(name, T, mseq) \
   ROTATE_PROXY(T, mseq); \
-  class name : public rotate_t(T, mseq) { \
-  public:\
-    proxy_t(T, mseq) get(size_t n) { \
-    return proxy_t(T, mseq){BOOST_PP_SEQ_FOR_EACH(PROXY_ASSIGN, T, mseq) false}; \
-    } \
-    using rotate_t(T, mseq)::get; \
+  using name##_proxy = proxy_t(T, mseq); \
+  template <> \
+  proxy_t(T, mseq) rotate_t(T, mseq)::get(size_t n) { \
+    return proxy_t(T, mseq){ \
+      PROXY_ASSIGN(T, BOOST_PP_SEQ_HEAD(mseq)) \
+      BOOST_PP_SEQ_FOR_EACH(PROXY_ASSIGN_J, T, BOOST_PP_SEQ_TAIL(mseq)) \
+    }; \
+  } \
+  using name = rotate_t(T, mseq)
+
+#define DEFINE_PROXY_NAME( name, T, mseq ) \
+  ROTATE_PROXY( T, mseq ); \
+  using name = proxy_t( T, mseq );
+
+#define DEFINE_PROXY_CONVERSION(T, mseq1, mseq2) \
+  template <> \
+  template <> \
+  proxy_t(T, mseq2) rotate_t(T, mseq1)::getp(size_t n) { \
+    return proxy_t(T, mseq2){ \
+      PROXY_ASSIGN(T, BOOST_PP_SEQ_HEAD(mseq2)) \
+      BOOST_PP_SEQ_FOR_EACH(PROXY_ASSIGN_J, T, BOOST_PP_SEQ_TAIL(mseq2)) \
+    }; \
   }
 
-#define DEFINE_ROTATE(T, mseq) DEFINE_ROTATE_NAME(T##_rotate, T, mseq)
-
-//#include <iostream>
-//
-//struct particle {
-//  int x, y, dx, dy;
-//  char color;
-//};
-//
-//DEFINE_ROTATE(particle, (color)(x)(y)(dx)(dy))
-//
-//int main(int argc, char const *argv[]) {
-//  (void) argc;
-//  (void) argv;
-//  particle p{0, 0, 0, 0, 0};
-//  particle_rotate pr;
-//  pr.push_back(p);
-//
-//  {
-//    proxy<particle> pp = pr.get(0);
-//    pp.x = 5;
-//  }
-//
-//  {
-//    proxy<particle> pp = pr.get(0);
-//    std::cout << pp.x << std::endl;
-//    particle copy = particle(pp);
-//    std::cout << copy.x << std::endl;
-//  }
-//  
-//  return 0;
-//}
+#define DEFINE_ROTATE(T, mseq) \
+  using T##_proxy = proxy_t(T, mseq); \
+  DEFINE_ROTATE_NAME(T##_rotate, T, mseq)

+ 15 - 2
rotate_tc.h

@@ -74,13 +74,16 @@ DEFINE_ROTATE(RenderInfo, (material)(texture_size)(bottom_left)(bottom_right)(to
 
 DEFINE_ROTATE_NAME(simple_rotate, RenderInfo, (material)(texture_size)(center)(object_size));
 
+DEFINE_PROXY_NAME( RenderInfo_position_proxy, RenderInfo, (center)(object_size) );
+DEFINE_PROXY_CONVERSION( RenderInfo, (material)(texture_size)(center)(object_size), (center)(object_size) );
+
 class rotate_TestSuite : public CxxTest::TestSuite {
 public:
   void test_proxy1() const {
     RenderInfo_rotate rdata;
     RenderInfo info{{5, 6}, {1, 1}};
     rdata.push_back(info);
-    auto proxy = rdata.get(0);
+    RenderInfo_proxy proxy = rdata.get(0);
     TS_ASSERT_EQUALS(info.texture_size, proxy.texture_size);
     TS_ASSERT_EQUALS(info.bottom_left, proxy.bottom_left);
     TS_ASSERT_EQUALS(info.bottom_right, proxy.bottom_right);
@@ -92,7 +95,7 @@ public:
     simple_rotate rdata;
     RenderInfo info{{5, 6}, {1, 1}};
     rdata.push_back(info);
-    auto proxy = rdata.get(0);
+    simple_rotate_proxy proxy = rdata.get(0);
     TS_ASSERT_EQUALS(info.texture_size, proxy.texture_size);
     TS_ASSERT_EQUALS(info.center, proxy.center);
     TS_ASSERT_EQUALS(info.object_size, proxy.object_size);
@@ -106,6 +109,16 @@ public:
     rdata.push_back(infos[2]);
     TS_ASSERT_EQUALS(rdata.get(access_t(RenderInfo, center){}), (std::vector<Point>{{1,2},{0,3},{4,3.2}}));
   }
+  
+  void test_datamodel_multiproxy() const {
+    simple_rotate rdata;
+    RenderInfo info{{5, 6}, {1, 1}};
+    rdata.push_back(info);
+    RenderInfo_position_proxy proxy = rdata.getp<rotate_members(RenderInfo, (center)(object_size))>(0);
+    TS_ASSERT_EQUALS( sizeof(proxy), sizeof(Point&)+sizeof(Dimension&) );
+    TS_ASSERT_EQUALS(info.center, proxy.center);
+    TS_ASSERT_EQUALS(info.object_size, proxy.object_size);
+  }
 private:
   
 };

+ 326 - 0
rotate.xcodeproj/project.pbxproj

@@ -0,0 +1,326 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		CD0C76D01E2AB8F10096E269 /* rotate_tc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0E9E98B71BBC8DB8004FFE25 /* rotate_tc.cpp */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		CD0C76C61E2AB8DF0096E269 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = /usr/share/man/man1/;
+			dstSubfolderSpec = 0;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 1;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		0E9E98B11BBC8A02004FFE25 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
+		0E9E98B21BBC8A03004FFE25 /* rotate.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = rotate.hpp; sourceTree = "<group>"; };
+		0E9E98B61BBC8A35004FFE25 /* rotate.t.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rotate.t.h; sourceTree = "<group>"; };
+		0E9E98B71BBC8DB8004FFE25 /* rotate_tc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rotate_tc.cpp; sourceTree = "<group>"; };
+		CD0C76C81E2AB8DF0096E269 /* rotate_tc */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = rotate_tc; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		CD0C76C51E2AB8DF0096E269 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		0E9E98AB1BBC8A02004FFE25 = {
+			isa = PBXGroup;
+			children = (
+				0E9E98B11BBC8A02004FFE25 /* Makefile */,
+				0E9E98B21BBC8A03004FFE25 /* rotate.hpp */,
+				0E9E98B61BBC8A35004FFE25 /* rotate.t.h */,
+				0E9E98B71BBC8DB8004FFE25 /* rotate_tc.cpp */,
+				CD0C76C91E2AB8DF0096E269 /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		CD0C76C91E2AB8DF0096E269 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				CD0C76C81E2AB8DF0096E269 /* rotate_tc */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXLegacyTarget section */
+		0E9E98B01BBC8A02004FFE25 /* rotate */ = {
+			isa = PBXLegacyTarget;
+			buildArgumentsString = "$(ACTION)";
+			buildConfigurationList = 0E9E98B31BBC8A03004FFE25 /* Build configuration list for PBXLegacyTarget "rotate" */;
+			buildPhases = (
+			);
+			buildToolPath = /usr/bin/make;
+			buildWorkingDirectory = "/Users/leumasjaffe/Documents/Programming/XTools Workspace/C:C++/misc/datamodel";
+			dependencies = (
+			);
+			name = rotate;
+			passBuildSettingsInEnvironment = 1;
+			productName = datamodel;
+		};
+/* End PBXLegacyTarget section */
+
+/* Begin PBXNativeTarget section */
+		CD0C76C71E2AB8DF0096E269 /* rotate_tc */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = CD0C76CF1E2AB8DF0096E269 /* Build configuration list for PBXNativeTarget "rotate_tc" */;
+			buildPhases = (
+				CD0C76D11E2AC29B0096E269 /* ShellScript */,
+				CD0C76C41E2AB8DF0096E269 /* Sources */,
+				CD0C76C51E2AB8DF0096E269 /* Frameworks */,
+				CD0C76C61E2AB8DF0096E269 /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = rotate_tc;
+			productName = rotate_tc;
+			productReference = CD0C76C81E2AB8DF0096E269 /* rotate_tc */;
+			productType = "com.apple.product-type.tool";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		0E9E98AC1BBC8A02004FFE25 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0720;
+				TargetAttributes = {
+					CD0C76C71E2AB8DF0096E269 = {
+						CreatedOnToolsVersion = 7.2.1;
+					};
+				};
+			};
+			buildConfigurationList = 0E9E98AF1BBC8A02004FFE25 /* Build configuration list for PBXProject "rotate" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 0E9E98AB1BBC8A02004FFE25;
+			productRefGroup = CD0C76C91E2AB8DF0096E269 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				0E9E98B01BBC8A02004FFE25 /* rotate */,
+				CD0C76C71E2AB8DF0096E269 /* rotate_tc */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXShellScriptBuildPhase section */
+		CD0C76D11E2AC29B0096E269 /* ShellScript */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+				"$(SRCROOT)/rotate.t.h",
+			);
+			outputPaths = (
+				"$(SRCROOT)/rotate_tc.cpp",
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "cxxtestgen --error-printer -o rotate_tc.cpp rotate.t.h";
+		};
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		CD0C76C41E2AB8DF0096E269 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				CD0C76D01E2AB8F10096E269 /* rotate_tc.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		0E9E98AD1BBC8A02004FFE25 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				ENABLE_TESTABILITY = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				ONLY_ACTIVE_ARCH = YES;
+				SDKROOT = macosx;
+			};
+			name = Debug;
+		};
+		0E9E98AE1BBC8A02004FFE25 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				SDKROOT = macosx;
+			};
+			name = Release;
+		};
+		0E9E98B41BBC8A03004FFE25 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				PRODUCT_NAME = rotate;
+			};
+			name = Debug;
+		};
+		0E9E98B51BBC8A03004FFE25 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				PRODUCT_NAME = rotate;
+			};
+			name = Release;
+		};
+		CD0C76CD1E2AB8DF0096E269 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CODE_SIGN_IDENTITY = "-";
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				ENABLE_TESTABILITY = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				HEADER_SEARCH_PATHS = (
+					/usr/local/include,
+					/opt/local/include,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.10;
+				MTL_ENABLE_DEBUG_INFO = YES;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = macosx;
+			};
+			name = Debug;
+		};
+		CD0C76CE1E2AB8DF0096E269 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CODE_SIGN_IDENTITY = "-";
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				ENABLE_NS_ASSERTIONS = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				HEADER_SEARCH_PATHS = (
+					/usr/local/include,
+					/opt/local/include,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.10;
+				MTL_ENABLE_DEBUG_INFO = NO;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = macosx;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		0E9E98AF1BBC8A02004FFE25 /* Build configuration list for PBXProject "rotate" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				0E9E98AD1BBC8A02004FFE25 /* Debug */,
+				0E9E98AE1BBC8A02004FFE25 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		0E9E98B31BBC8A03004FFE25 /* Build configuration list for PBXLegacyTarget "rotate" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				0E9E98B41BBC8A03004FFE25 /* Debug */,
+				0E9E98B51BBC8A03004FFE25 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		CD0C76CF1E2AB8DF0096E269 /* Build configuration list for PBXNativeTarget "rotate_tc" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				CD0C76CD1E2AB8DF0096E269 /* Debug */,
+				CD0C76CE1E2AB8DF0096E269 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 0E9E98AC1BBC8A02004FFE25 /* Project object */;
+}

+ 0 - 49
rotate_tc.cpp

@@ -1,49 +0,0 @@
-/* Generated file, do not edit */
-
-#ifndef CXXTEST_RUNNING
-#define CXXTEST_RUNNING
-#endif
-
-#define _CXXTEST_HAVE_STD
-#include <cxxtest/TestListener.h>
-#include <cxxtest/TestTracker.h>
-#include <cxxtest/TestRunner.h>
-#include <cxxtest/RealDescriptions.h>
-#include <cxxtest/TestMain.h>
-#include <cxxtest/ErrorPrinter.h>
-
-int main( int argc, char *argv[] ) {
- int status;
-    CxxTest::ErrorPrinter tmp;
-    CxxTest::RealWorldDescription::_worldName = "cxxtest";
-    status = CxxTest::Main< CxxTest::ErrorPrinter >( tmp, argc, argv );
-    return status;
-}
-bool suite_rotate_TestSuite_init = false;
-#include "rotate_tc.h"
-
-static rotate_TestSuite suite_rotate_TestSuite;
-
-static CxxTest::List Tests_rotate_TestSuite = { 0, 0 };
-CxxTest::StaticSuiteDescription suiteDescription_rotate_TestSuite( "rotate_tc.h", 77, "rotate_TestSuite", suite_rotate_TestSuite, Tests_rotate_TestSuite );
-
-static class TestDescription_suite_rotate_TestSuite_test_proxy1 : public CxxTest::RealTestDescription {
-public:
- TestDescription_suite_rotate_TestSuite_test_proxy1() : CxxTest::RealTestDescription( Tests_rotate_TestSuite, suiteDescription_rotate_TestSuite, 79, "test_proxy1" ) {}
- void runTest() { suite_rotate_TestSuite.test_proxy1(); }
-} testDescription_suite_rotate_TestSuite_test_proxy1;
-
-static class TestDescription_suite_rotate_TestSuite_test_proxy2 : public CxxTest::RealTestDescription {
-public:
- TestDescription_suite_rotate_TestSuite_test_proxy2() : CxxTest::RealTestDescription( Tests_rotate_TestSuite, suiteDescription_rotate_TestSuite, 91, "test_proxy2" ) {}
- void runTest() { suite_rotate_TestSuite.test_proxy2(); }
-} testDescription_suite_rotate_TestSuite_test_proxy2;
-
-static class TestDescription_suite_rotate_TestSuite_test_datamodel_center : public CxxTest::RealTestDescription {
-public:
- TestDescription_suite_rotate_TestSuite_test_datamodel_center() : CxxTest::RealTestDescription( Tests_rotate_TestSuite, suiteDescription_rotate_TestSuite, 101, "test_datamodel_center" ) {}
- void runTest() { suite_rotate_TestSuite.test_datamodel_center(); }
-} testDescription_suite_rotate_TestSuite_test_datamodel_center;
-
-#include <cxxtest/Root.cpp>
-const char* CxxTest::RealWorldDescription::_worldName = "cxxtest";