OSDN Git Service

operator/bit/bitwise.hpp Add.
authormyun2 <myun2@nwhite.info>
Wed, 6 Jun 2012 17:48:26 +0000 (02:48 +0900)
committermyun2 <myun2@nwhite.info>
Wed, 6 Jun 2012 17:48:26 +0000 (02:48 +0900)
roast/include/roast/adapter/operator/arith/add_sub.hpp [deleted file]
roast/include/roast/adapter/operator/bit/bitwise.hpp [new file with mode: 0644]
roast/include/roast/adapter/operator/operator_adapter.hpp

diff --git a/roast/include/roast/adapter/operator/arith/add_sub.hpp b/roast/include/roast/adapter/operator/arith/add_sub.hpp
deleted file mode 100644 (file)
index c07b106..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-//     Roast+ License
-
-/*
-*/
-#ifndef __SFJP_ROAST__adapter__add_sub_HPP__
-#define __SFJP_ROAST__adapter__add_sub_HPP__
-
-#include "roast/adapter/operator/arith/inc_decl.hpp"
-
-namespace roast
-{
-       namespace adapter
-       {
-               namespace op
-               {
-                       /////////////////////////////////////////////////////////////////////////
-                       
-                       template <typename _Base, typename _ValueType, typename _FacadeType>
-                       class add_sub  : public inc_decl<_Base, _ValueType, _FacadeType>
-                       {
-                       private:
-                               _ValueType& m_value;
-                       public:
-                               add_sub(_ValueType& value) : m_value(value), inc_decl<_Base, _ValueType, _FacadeType>(value) {}
-                       
-                               _FacadeType& operator +=(int n){ m_value+=n; return _facade_ref(); }
-                               _FacadeType& operator -=(int n){ m_value-=n; return _facade_ref(); }
-                               _FacadeType operator +(int n){ _Facade work=_facade_ref(); work+=n; return work; }
-                               _FacadeType operator -(int n){ _Facade work=_facade_ref(); work-=n; return work; }
-                       };
-               }
-       }
-}
-
-#endif//__SFJP_ROAST__adapter__add_sub_HPP__
diff --git a/roast/include/roast/adapter/operator/bit/bitwise.hpp b/roast/include/roast/adapter/operator/bit/bitwise.hpp
new file mode 100644 (file)
index 0000000..4da4505
--- /dev/null
@@ -0,0 +1,100 @@
+//     Roast+ License
+
+/*
+*/
+#ifndef __SFJP_ROAST__adapter__operator__bit__bitwise_HPP__
+#define __SFJP_ROAST__adapter__operator__bit__bitwise_HPP__
+
+#include "roast/adapter/operator/bit/and.hpp"
+#include "roast/adapter/operator/bit/or.hpp"
+#include "roast/adapter/operator/bit/xor.hpp"
+#include "roast/adapter/operator/bit/not.hpp"
+
+#include "roast/adapter/operator/bit/lshift.hpp"
+#include "roast/adapter/operator/bit/rshift.hpp"
+
+namespace roast
+{
+       namespace adapter
+       {
+               /////////////////////////////////////////////////////////////////////////
+               
+               //      Bit AND, OR, XOR, NOT
+               template <typename _Facade, typename _ValueType>
+               class bit_logical_adapter :
+                       public bit_and_adapter<_Facade, _ValueType>,
+                       public bit_or_adapter<_Facade, _ValueType>,
+                       public bit_xor_adapter<_Facade, _ValueType>,
+                       public bit_not_adapter<_ValueType>
+               {};
+               
+               /////////////
+               
+               template <typename _Facade, typename _ValueType>
+               class value_bit_logical_adapter : 
+                       public value_bit_and_adapter<_Facade, _ValueType>,
+                       public value_bit_or_adapter<_Facade, _ValueType>,
+                       public value_bit_xor_adapter<_Facade, _ValueType>,
+                       public value_bit_not_adapter<_Facade, _ValueType>
+               {
+               public:
+                       value_bit_logical_adapter(_ValueType& value_ref) :
+                               value_bit_and_adapter<_Facade, _ValueType>(value_ref),
+                               value_bit_or_adapter<_Facade, _ValueType>(value_ref),
+                               value_bit_xor_adapter<_Facade, _ValueType>(value_ref),
+                               value_bit_not_adapter<_Facade, _ValueType>(value_ref)
+                               {}
+               };
+               
+               /////////////////////////////////////////////////////////////////////////
+               
+               //      Bit Shift
+               template <typename _Facade, typename _ValueType>
+               class bit_shift_adapter :
+                       public lshift_adapter<_Facade, _ValueType>,
+                       public rshift_adapter<_Facade, _ValueType>
+               {};
+               
+               ///////////////////////////////////////////////
+               
+               template <typename _Facade, typename _ValueType>
+               class value_bit_shift_adapter : 
+                       public value_lshift_adapter<_Facade, _ValueType>,
+                       public value_rshift_adapter<_Facade, _ValueType>
+               {
+               public:
+                       value_bit_shift_adapter(_ValueType& value_ref) :
+                               value_lshift_adapter<_Facade, _ValueType>(value_ref),
+                               value_rshift_adapter<_Facade, _ValueType>(value_ref)
+                               {}
+               };
+               
+               /////////////////////////////////////////////////////////////////////////
+               
+               //      Full Bit Operators
+               template <typename _Facade, typename _ValueType>
+               class full_bitwise_adapter :
+                       public bit_logical_adapter<_Facade, _ValueType>,
+                       public bit_shift_adapter<_Facade, _ValueType>
+               {};
+               
+               ///////////////////////////////////////////////
+               
+               template <typename _Facade, typename _ValueType>
+               class value_full_bitwise_adapter : 
+                       public value_bit_logical_adapter<_Facade, _ValueType>,
+                       public value_bit_shift_adapter<_Facade, _ValueType>
+               {
+               public:
+                       value_full_bitwise_adapter(_ValueType& value_ref) :
+                               value_bit_logical_adapter<_Facade, _ValueType>(value_ref),
+                               value_bit_shift_adapter<_Facade, _ValueType>(value_ref)
+                               {}
+               };
+               
+               /////////////////////////////////////////////////////////////////////////
+       }
+       using namespace adapter;
+}
+
+#endif//__SFJP_ROAST__adapter__operator__bit__bitwise_HPP__
index eacf5a4..5d9d9a6 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "roast/_common.hpp"
 #include "roast/adapter/operator/arith/arith.hpp"
+#include "roast/adapter/operator/bit/bitwise.hpp"
 
 #include "roast/adapter/operator/indirection.hpp"
 #include "roast/adapter/operator/arrow.hpp"