|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67536 - in sandbox/SOC/2010/bit_masks: boost/integer boost/integer/packet lib/integer/test lib/integer/test/packet
From: bbartmanboost_at_[hidden]
Date: 2011-01-01 09:25:37
Author: bbartman
Date: 2011-01-01 09:25:35 EST (Sat, 01 Jan 2011)
New Revision: 67536
URL: http://svn.boost.org/trac/boost/changeset/67536
Log:
working on packet template which is to serve as a tuple which is more than an integral value in length.
Added:
sandbox/SOC/2010/bit_masks/boost/integer/packet/byte_order.hpp (contents, props changed)
sandbox/SOC/2010/bit_masks/boost/integer/packet/endian_types.hpp (contents, props changed)
sandbox/SOC/2010/bit_masks/boost/integer/packet/field.hpp (contents, props changed)
sandbox/SOC/2010/bit_masks/boost/integer/packet/template_macros.hpp (contents, props changed)
Text files modified:
sandbox/SOC/2010/bit_masks/boost/integer/packet.hpp | 10 ++++++++--
sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 1 +
sandbox/SOC/2010/bit_masks/lib/integer/test/packet/packet_test.cpp | 8 +++++---
3 files changed, 14 insertions(+), 5 deletions(-)
Modified: sandbox/SOC/2010/bit_masks/boost/integer/packet.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/packet.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/packet.hpp 2011-01-01 09:25:35 EST (Sat, 01 Jan 2011)
@@ -5,10 +5,16 @@
#ifndef BOOST_INTEGER_BITFIELD_PACKET_HPP
#define BOOST_INTEGER_BITFIELD_PACKET_HPP
+#include <boost/integer/packet/byte_order.hpp>
+#include <boost/integer/packet/field.hpp>
+#include <boost/integer/packet/template_macros.hpp>
-namespace boost {
+namespace boost { namespace bitfields {
+template <BOOST_PACKET_TEMPLATE_PARAMETER_SEQUENCE()>
+class packet { };
-} // end boost
+
+}} // end boost::bitfields
#endif
Added: sandbox/SOC/2010/bit_masks/boost/integer/packet/byte_order.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bit_masks/boost/integer/packet/byte_order.hpp 2011-01-01 09:25:35 EST (Sat, 01 Jan 2011)
@@ -0,0 +1,43 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_INTEGER_PACKET_BYTE_ORDER_HPP
+#define BOOST_INTEGER_PACKET_BYTE_ORDER_HPP
+#include <cstddef>
+
+namespace boost { namespace bitfields {
+
+/** Represents the order of bytes for a perticular endianness. */
+/** The goal is to supply as many ways of representing byte order as reasonable
+ * such that when used it make the interface look the way the user would like.
+ */
+
+template <std::size_t ByteOrder> struct byte_order;
+
+template <
+ std::size_t ByteOne,
+ std::size_t ByteTwo
+>
+struct byte_order_2bytes;
+
+template <
+ std::size_t ByteOne,
+ std::size_t ByteTwo,
+ std::size_t ByteThree
+>
+struct byte_order_3bytes;
+
+template <
+ std::size_t ByteOne,
+ std::size_t ByteTwo,
+ std::size_t ByteThree,
+ std::size_t ByteFour
+>
+struct byte_order_4bytes;
+
+
+}} // end boost::bitfields
+
+#endif
Added: sandbox/SOC/2010/bit_masks/boost/integer/packet/endian_types.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bit_masks/boost/integer/packet/endian_types.hpp 2011-01-01 09:25:35 EST (Sat, 01 Jan 2011)
@@ -0,0 +1,13 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+namespace boost { namespace bitfields {
+
+/** types used to represent/denote endianness of a filed within a packet. */
+struct little_endian;
+struct big_endian;
+struct native_endian;
+
+}} // end boost::bitfields;
Added: sandbox/SOC/2010/bit_masks/boost/integer/packet/field.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bit_masks/boost/integer/packet/field.hpp 2011-01-01 09:25:35 EST (Sat, 01 Jan 2011)
@@ -0,0 +1,53 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <cstddef>
+
+namespace boost { namespace bitfields {
+/** Different fields types which can be used to create/denote the layout of the
+ * packet.
+ */
+template <typename Type, std::size_t SizeInBytes, typename Endianness>
+struct field;
+
+/** Field of bits. */
+template <typename Type, std::size_t SizeInBits>
+struct bitfield;
+
+/** Creates an in accessable region of bytes. Size given in bytes. */
+template <std::size_t SizeInBytes>
+struct reserved_field;
+
+/** Creates region in bits which prevents prevents access to that region the
+ * size is given in bits.
+ */
+template <std::size_t SizeInBits>
+struct reserved_bitfield;
+
+/** Creates a field that acts as a bit set. */
+template <std::size_t SizeInBits, typename Endianness>
+struct bitset_field;
+
+/** Need to think about this more and make sure that I can actually enforce
+ * endianness of an array.
+ */
+template <typename BufferType, std::size_t Length, typename Endianness>
+struct buffer;
+
+/** Used to denote information being moved by a packet this gives direct access
+ * to the underlying data. The size of the payload is given at compile time.
+ */
+template <typename T, std::size_t Bytes>
+struct static_payload;
+
+/** Paload which size is given at runtime. */
+template <typename T>
+struct dynamic_payload;
+
+/** */
+template <std::size_t Size>
+struct string_buffer;
+
+}} // end boost::bitfields
Added: sandbox/SOC/2010/bit_masks/boost/integer/packet/template_macros.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bit_masks/boost/integer/packet/template_macros.hpp 2011-01-01 09:25:35 EST (Sat, 01 Jan 2011)
@@ -0,0 +1,30 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_INTEGER_PACKET_TEMPLATE_EXPANTION_MACROS_HPP
+#define BOOST_INTEGER_PACKET_TEMPLATE_EXPANTION_MACROS_HPP
+
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+
+#define BOOST_PACKET_SIZE_MAX 10
+
+/** Helps create the T1, ... TN.
+ * DATA is T,
+ * COUNT is N,
+ */
+#define BOOST_PACKET_TEMPLATE_PARAMETER(z,COUNT,DATA) \
+ DATA ## COUNT
+
+/**
+ *
+ */
+#define BOOST_PACKET_TEMPLATE_PARAMETER_SEQUENCE() \
+ BOOST_PP_ENUM( BOOST_PACKET_SIZE_MAX,\
+ BOOST_PACKET_TEMPLATE_PARAMETER, \
+ typename T )
+
+
+#endif
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 2011-01-01 09:25:35 EST (Sat, 01 Jan 2011)
@@ -80,5 +80,6 @@
[ run bitfield_vector_testing/mask_creator_test.cpp ]
[ run bitfield_vector_testing/iterator_base_test.cpp ]
[ run bitfield_vector_testing/bitfield_vector_iterator_test.cpp ]
+ [ run packet/packet_test.cpp ]
;
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/packet/packet_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/packet/packet_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/packet/packet_test.cpp 2011-01-01 09:25:35 EST (Sat, 01 Jan 2011)
@@ -3,7 +3,9 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/integet/packet.hpp>
-
-
+#include <boost/integer/packet.hpp>
+#include "packet_test_utility.hpp"
+int main() {
+ return boost::report_errors();
+}
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