test

Dependents:   BLE_PowerBank_HeyFaradey

Fork of BLE_API by Bluetooth Low Energy

Revision:
879:4de7fb4da6ca
Parent:
873:2e1a7bcf6590
Child:
881:853f1df9e30a
diff -r 83ebee4b8890 -r 4de7fb4da6ca ble/FunctionPointerWithContext.h
--- a/ble/FunctionPointerWithContext.h	Tue Nov 03 12:51:25 2015 +0000
+++ b/ble/FunctionPointerWithContext.h	Tue Nov 03 13:21:02 2015 +0000
@@ -19,6 +19,8 @@
 
 #include <string.h>
 
+
+
 /** A class for storing and calling a pointer to a static or member void function
  *  which takes a context.
  */
@@ -105,10 +107,10 @@
     template<typename T>
     static void membercaller(pFunctionPointerWithContext_t self, ContextType context) {
         if (self->_memberFunctionAndPointer._object) {
-            T *o = static_cast<T *>(self->_memberFunctionAndPointer._object);
+            T *o = static_cast<T *>(self->_memberFunctionAndPointer._object);        
             void (T::*m)(ContextType);
             memcpy((char*) &m, self->_memberFunctionAndPointer._memberFunction, sizeof(m));
-            (o->*m)(context);
+            (o->*m)(context);            
         }
     }
 
@@ -120,9 +122,9 @@
 
     struct MemberFunctionAndPtr {
         /*
-         * forward declaration of a class and a member function to this class.
-         * Because the compiler doesn't know anything about the forwarded member
-         * function, it will always use the biggest size and the biggest alignment
+         * forward declaration of a class and a member function to this class. 
+         * Because the compiler doesn't know anything about the forwarded member 
+         * function, it will always use the biggest size and the biggest alignment 
          * that a member function can take for objects of type UndefinedMemberFunction.
          */
         class UndefinedClass;
@@ -131,17 +133,17 @@
         void* _object;
         union {
             char _memberFunction[sizeof(UndefinedMemberFunction)];
-            UndefinedMemberFunction _alignment;
+            UndefinedMemberFunction _alignment;            
         };
     };
 
     union {
         pvoidfcontext_t _function;                      /**< static function pointer - NULL if none attached */
-        /**
-         * object this pointer and pointer to member -
-         * _memberFunctionAndPointer._object will be NULL if none attached
-         */
-        MemberFunctionAndPtr _memberFunctionAndPointer;
+        /** 
+         * object this pointer and pointer to member - 
+         * _memberFunctionAndPointer._object will be NULL if none attached 
+         */        
+        MemberFunctionAndPtr _memberFunctionAndPointer;      
     };
 
     void (*_caller)(FunctionPointerWithContext*, ContextType);