|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63320 - in sandbox/variadic_templates/boost/composite_storage: . buffers methods type_traits
From: cppljevans_at_[hidden]
Date: 2010-06-25 14:41:28
Author: cppljevans
Date: 2010-06-25 14:41:28 EDT (Fri, 25 Jun 2010)
New Revision: 63320
URL: http://svn.boost.org/trac/boost/changeset/63320
Log:
no comments
Added:
sandbox/variadic_templates/boost/composite_storage/buffers/
sandbox/variadic_templates/boost/composite_storage/buffers/char_buf.hpp (contents, props changed)
sandbox/variadic_templates/boost/composite_storage/buffers/rval_ref_buf.hpp (contents, props changed)
sandbox/variadic_templates/boost/composite_storage/methods/
sandbox/variadic_templates/boost/composite_storage/methods/all_of.hpp (contents, props changed)
sandbox/variadic_templates/boost/composite_storage/type_traits/
Text files modified:
sandbox/variadic_templates/boost/composite_storage/functor_indexed.hpp | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
Added: sandbox/variadic_templates/boost/composite_storage/buffers/char_buf.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/composite_storage/buffers/char_buf.hpp 2010-06-25 14:41:28 EDT (Fri, 25 Jun 2010)
@@ -0,0 +1,101 @@
+//char buffers, aligned and not aligned.
+#ifndef BOOST_COMPOSITE_STORAGE_BUFFERS_CHAR_BUF_HPP_INCLUDED
+#define BOOST_COMPOSITE_STORAGE_BUFFERS_CHAR_BUF_HPP_INCLUDED
+// (C) Copyright Larry Evans 2010.
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+//====================================================================
+#include <boost/aligned_storage.hpp>
+
+namespace boost
+{
+namespace composite_storage
+{
+namespace buffers
+{
+
+enum is_aligned
+{ yes_aligned
+, not_aligned
+};
+
+ template
+ < std::size_t Size
+ , std::size_t Align
+ , is_aligned IsAligned=yes_aligned
+ >
+ struct
+char_buf
+{
+ char_buf( void)
+ {}
+ char_buf( char_buf const&)
+ {}
+ void
+ operator=( char_buf const&)
+ {}
+ char const*
+ address(void)const
+ {
+ void const*p=buffer.address();
+ return static_cast<char const*>(p);
+ }
+ char*
+ address(void)
+ {
+ void*p=buffer.address();
+ return static_cast<char*>(p);
+ }
+ private:
+ ::boost::aligned_storage
+ < Size
+ , Align
+ >
+ buffer
+ ;
+};
+
+ template
+ < std::size_t Size
+ , std::size_t Align //only used by specialization of layout::alignment_of
+ >
+ struct
+char_buf
+ < Size
+ , Align
+ , not_aligned
+ >
+{
+ char_buf( void)
+ {}
+ char_buf( char_buf const&)
+ {}
+ void
+ operator=( char_buf const&)
+ {}
+ char const*
+ address(void)const
+ {
+ return buffer;
+ }
+ char*
+ address(void)
+ {
+ return buffer;
+ }
+ private:
+ char buffer[Size]
+ ;
+};
+
+}//exit buffers namespace
+
+}//exit composite_storage namespace
+}//exit boost namespace
+#include <boost/composite_storage/buffers/rval_ref_buf.hpp>
+#include <boost/composite_storage/type_traits/remove_cv_ref.hpp>
+#endif
Added: sandbox/variadic_templates/boost/composite_storage/buffers/rval_ref_buf.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/composite_storage/buffers/rval_ref_buf.hpp 2010-06-25 14:41:28 EDT (Fri, 25 Jun 2010)
@@ -0,0 +1,44 @@
+//wrapper class to flag buffer as rval reference.
+#ifndef BOOST_COMPOSITE_STORAGE_BUFFERS_RVAL_REF_BUF_HPP_INCLUDED
+#define BOOST_COMPOSITE_STORAGE_BUFFERS_RVAL_REF_BUF_HPP_INCLUDED
+// (C) Copyright Larry Evans 2010.
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+//====================================================================
+
+namespace boost
+{
+namespace composite_storage
+{
+namespace buffers
+{
+
+struct rval_ref_buf
+//Purpose:
+// Flag that the buffer for this composite
+// is an rvalue-reference:
+//MaintenanceNote.2010-03-26:
+// Tried just passing char&& as buffer type; however,
+// this lead to all kinds of difficulty because
+// calls to std::move were required many places.
+// Also, for some reason, in assign_one template,
+// the FrBuffer was 'char' instead of 'char&&' and
+// I tried everything to get it to 'char&&' but
+// nothing worked.
+//
+{
+ rval_ref_buf(char*a_buf)
+ : my_buf(a_buf)
+ {}
+ char*my_buf;
+};
+
+}//exit buffers namespace
+}//exit composite_storage namespace
+}//exit boost namespace
+#endif
+
Modified: sandbox/variadic_templates/boost/composite_storage/functor_indexed.hpp
==============================================================================
--- sandbox/variadic_templates/boost/composite_storage/functor_indexed.hpp (original)
+++ sandbox/variadic_templates/boost/composite_storage/functor_indexed.hpp 2010-06-25 14:41:28 EDT (Fri, 25 Jun 2010)
@@ -1,6 +1,14 @@
//
#ifndef BOOST_COMPOSITE_STORAGE_FUNCTOR_INDEXED_HPP_INCLUDED
#define BOOST_COMPOSITE_STORAGE_FUNCTOR_INDEXED_HPP_INCLUDED
+// (C) Copyright Larry Evans 2010.
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+//====================================================================
//[switch #includes
// These are from:
//
Added: sandbox/variadic_templates/boost/composite_storage/methods/all_of.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/composite_storage/methods/all_of.hpp 2010-06-25 14:41:28 EDT (Fri, 25 Jun 2010)
@@ -0,0 +1,173 @@
+//methods common to composites with all_of* tags.
+#ifndef BOOST_COMPOSITE_STORAGE_METHODS_ALL_OF_HPP_INCLUDED
+#define BOOST_COMPOSITE_STORAGE_METHODS_ALL_OF_HPP_INCLUDED
+// (C) Copyright Larry Evans 2010.
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+//====================================================================
+#include <boost/mpl/range_c.hpp>
+#include <boost/mpl/next.hpp>
+#include <boost/mpl/for_each.hpp>
+#include <boost/composite_storage/enum_base.hpp>
+
+namespace boost
+{
+namespace composite_storage
+{
+namespace methods
+{
+
+ template
+ < typename Layout
+ , typename IndexBegin
+ >
+ struct
+all_of
+{
+ typedef
+ IndexBegin
+ index_begin
+ ;
+ typedef
+ typename mpl::next<typename Layout::index_part>::type
+ index_end
+ ;
+ typedef typename
+ enum_base<IndexBegin>::type
+ index_type
+ ;
+ typedef typename
+ mpl::range_c
+ < index_type
+ , index_begin::value
+ , index_end::value
+ >::type
+ indices
+ ;
+ template
+ < typename FrBuffer
+ >
+ struct
+ ctor_default_one
+ {
+
+ FrBuffer
+ my_buffer
+ ;
+ ctor_default_one(FrBuffer a_buffer)
+ : my_buffer(a_buffer)
+ {}
+ template
+ < class Index
+ >
+ void
+ operator()(Index index)const
+ {
+ Layout::inject_default(index,my_buffer);
+ }
+
+ };
+ template
+ < typename FrBuffer
+ >
+ static
+ void
+ ctor_default_all(FrBuffer buffer)
+ //Call default construct for all components.
+ {
+ ctor_default_one<FrBuffer> constructor(buffer);
+ mpl::for_each<indices>(constructor);
+ };
+ template
+ < typename FrBuffer
+ >
+ struct
+ ctor_copy_one
+ {
+
+ char*
+ my_to_buffer
+ ;
+ FrBuffer
+ my_fr_buffer
+ ;
+ ctor_copy_one(char* a_to_buffer, FrBuffer a_fr_buffer)
+ : my_to_buffer(a_to_buffer)
+ , my_fr_buffer(a_fr_buffer)
+ {}
+ template
+ < class Index
+ >
+ void
+ operator()(Index index)const
+ {
+ Layout::inject(index,my_to_buffer,Layout::project(index,my_fr_buffer));
+ }
+
+ };
+ template
+ < typename FrBuffer
+ >
+ static
+ void
+ ctor_copy_all(char* to_buffer, FrBuffer fr_buffer)
+ //Call copy construct for all components in to_buffer
+ //from corresponding components in fr_buffer.
+ {
+ ctor_copy_one<FrBuffer> constructor(to_buffer, fr_buffer);
+ mpl::for_each<indices>(constructor);
+ };
+ template
+ < typename FrBuffer
+ >
+ struct
+ assign_one
+ {
+
+ char*
+ my_to_buffer
+ ;
+ FrBuffer
+ my_fr_buffer
+ ;
+ assign_one(char* a_to_buffer, FrBuffer a_fr_buffer)
+ : my_to_buffer(a_to_buffer)
+ , my_fr_buffer(a_fr_buffer)
+ {}
+ template
+ < class Index
+ >
+ void
+ operator()(Index index)const
+ {
+ Layout::project(index,my_to_buffer)
+ = Layout::project
+ ( index
+ , my_fr_buffer
+ );
+ }
+
+ };
+ template
+ < typename FrBuffer
+ >
+ static
+ void
+ assign_all(char*to_buffer, FrBuffer fr_buffer)
+ //Call assignment operator for all components in to_buffer
+ //from corresponding components in fr_buffer.
+ {
+ assign_one<FrBuffer> constructor(to_buffer, fr_buffer);
+ mpl::for_each<indices>(constructor);
+ };
+};
+
+}//exit methods namespace
+
+}//exit composite_storage namespace
+}//exit boost namespace
+#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk