Replaced boost::function with Dali::Callback 41/36141/4
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 2 Mar 2015 17:25:43 +0000 (17:25 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 3 Mar 2015 12:20:52 +0000 (12:20 +0000)
Change-Id: I5b930e1e54006876e330842397baecb8ce8ca882

32 files changed:
adaptors/base/interfaces/trigger-event-factory-interface.h
adaptors/common/abort-handler.cpp
adaptors/common/abort-handler.h
adaptors/common/adaptor-impl.cpp
adaptors/common/adaptor-impl.h
adaptors/common/adaptor.cpp
adaptors/common/adaptor.h
adaptors/common/application-impl.cpp
adaptors/common/application-impl.h
adaptors/common/callback-manager.h
adaptors/common/ecore-callback-manager.cpp
adaptors/common/ecore-callback-manager.h
adaptors/common/events/gesture-manager.cpp
adaptors/common/file-descriptor-monitor.cpp
adaptors/common/file-descriptor-monitor.h
adaptors/common/framework.h
adaptors/common/trigger-event-factory.cpp
adaptors/common/trigger-event-factory.h
adaptors/common/trigger-event.cpp
adaptors/common/trigger-event.h
adaptors/public-api/adaptor-framework/accessibility-manager.h
adaptors/public-api/adaptor-framework/application.cpp
adaptors/public-api/adaptor-framework/application.h
adaptors/public-api/adaptor-framework/clipboard-event-notifier.h
adaptors/public-api/adaptor-framework/drag-and-drop-detector.h
adaptors/public-api/adaptor-framework/orientation.h
adaptors/public-api/adaptor-framework/style-monitor.h
adaptors/public-api/adaptor-framework/tilt-sensor.h
adaptors/tizen/framework-tizen.cpp
adaptors/ubuntu/framework-ubuntu.cpp
adaptors/wayland/imf-manager-impl-wl.cpp
adaptors/x11/imf-manager-impl-x.cpp

index c1b7856..1c249d9 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
+#include <dali/public-api/signals/callback.h>
 
 // INTERNAL INCLUDES
 #include <base/interfaces/trigger-event-interface.h>
@@ -44,10 +44,11 @@ public:
 
   /**
    * @brief Create a new concrete implementation of the event trigger interface.
-   * @param functor the function to call when interface->Trigger() is called
+   * @param callback called when interface->Trigger() is called
    * @return pointer to a new trigger event
+   * @note Ownership of callback should be taken over by deriving classes
    */
-  virtual TriggerEventInterface* CreateTriggerEvent( boost::function<void()> functor,
+  virtual TriggerEventInterface* CreateTriggerEvent( CallbackBase* callback,
                                                      TriggerEventInterface::Options options = TriggerEventInterface::NONE) = 0;
   /**
    * @brief destroy a trigger event
index eea7ec6..ed4d09e 100644 (file)
@@ -18,6 +18,9 @@
 // CLASS HEADER
 #include "abort-handler.h"
 
+// EXTERNAL INCLUDES
+#include <cstring>
+
 namespace Dali
 {
 namespace Internal
@@ -27,7 +30,7 @@ namespace Adaptor
 
 AbortHandler* AbortHandler::gInstance(NULL);
 
-AbortHandler::AbortHandler(boost::function<void(void)> callback)
+AbortHandler::AbortHandler( CallbackBase* callback )
 : mSignalMask( 0 ),
   mCallback( callback )
 {
@@ -39,6 +42,8 @@ AbortHandler::AbortHandler(boost::function<void(void)> callback)
 
 AbortHandler::~AbortHandler()
 {
+  delete mCallback;
+
   int signum;
   for ( signum = 1; signum < _NSIG; signum++ )
   {
@@ -75,7 +80,7 @@ void AbortHandler::SignalHandler( int signum )
   {
     if( gInstance->mCallback )
     {
-      gInstance->mCallback();
+      CallbackBase::Execute( *gInstance->mCallback );
     }
   }
 }
index af53864..df2b619 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <signal.h>
+#include <dali/public-api/signals/callback.h>
 
 // INTERNAL INCLUDES
 #include "application.h"
@@ -46,8 +47,9 @@ public:
   /**
    * Constructor
    * @param[in] callback The function to call when abort signals occur
+   * @note The ownership of callback is passed onto this class.
    */
-  AbortHandler(boost::function<void(void)> callback);
+  AbortHandler( CallbackBase* callback );
 
   /**
    * Destructor
@@ -90,7 +92,7 @@ private:
   SignalHandlerFuncPtr        mSignalOldHandlers[_NSIG-1];
   unsigned long long          mSignalMask;
 
-  boost::function<void(void)> mCallback;
+  CallbackBase*               mCallback;
 
   static AbortHandler*        gInstance;
 };
index d12bb01..f614faa 100644 (file)
@@ -260,7 +260,7 @@ void Adaptor::Initialize(Dali::Configuration::ContextLoss configuration)
 
   mObjectProfiler = new ObjectProfiler();
 
-  mNotificationTrigger = new TriggerEvent( boost::bind(&Adaptor::ProcessCoreEvents, this) );
+  mNotificationTrigger = new TriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ) );
 
   mVSyncMonitor = new VSyncMonitor;
 
@@ -593,27 +593,27 @@ Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
   return mTtsPlayers[mode];
 }
 
-bool Adaptor::AddIdle(boost::function<void(void)> callBack)
+bool Adaptor::AddIdle( CallbackBase* callback )
 {
   bool idleAdded(false);
 
   // Only add an idle if the Adaptor is actually running
   if( RUNNING == mState )
   {
-    idleAdded = mCallbackManager->AddCallback(callBack, CallbackManager::IDLE_PRIORITY);
+    idleAdded = mCallbackManager->AddCallback( callback, CallbackManager::IDLE_PRIORITY );
   }
 
   return idleAdded;
 }
 
-bool Adaptor::CallFromMainLoop(boost::function<void(void)> callBack)
+bool Adaptor::CallFromMainLoop( CallbackBase* callback )
 {
   bool callAdded(false);
 
   // Only allow the callback if the Adaptor is actually running
   if ( RUNNING == mState )
   {
-    callAdded = mCallbackManager->AddCallback(callBack, CallbackManager::DEFAULT_PRIORITY);
+    callAdded = mCallbackManager->AddCallback( callback, CallbackManager::DEFAULT_PRIORITY );
   }
 
   return callAdded;
@@ -814,7 +814,7 @@ void Adaptor::RequestProcessEventsOnIdle()
   // and we haven't installed the idle notification
   if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState ) )
   {
-    mNotificationOnIdleInstalled = AddIdle( boost::bind( &Adaptor::ProcessCoreEventsFromIdle, this ) );
+    mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ) );
   }
 }
 
index a3ce04c..ad7d100 100644 (file)
  */
 
 // EXTERNAL INCLUDES
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-#include <boost/thread.hpp>
-
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/common/view-mode.h>
 #include <dali/public-api/math/rect.h>
+#include <dali/public-api/signals/callback.h>
 #include <dali/integration-api/render-controller.h>
 
 // INTERNAL INCLUDES
@@ -193,12 +190,12 @@ public: // AdaptorInternalServices implementation
   /**
    * @copydoc Dali::Adaptor::AddIdle()
    */
-  virtual bool AddIdle( boost::function<void(void)> callBack );
+  virtual bool AddIdle( CallbackBase* callback );
 
   /**
    * @copydoc Internal::Framework::CallFromMainLoop()
    */
-  virtual bool CallFromMainLoop(boost::function<void(void)> callBack);
+  virtual bool CallFromMainLoop( CallbackBase* callback );
 
 public:
 
index 7eecd5b..b71b210 100644 (file)
@@ -71,9 +71,9 @@ void Adaptor::Stop()
   mImpl->Stop();
 }
 
-bool Adaptor::AddIdle( boost::function<void(void)> callBack )
+bool Adaptor::AddIdle( CallbackBase* callback )
 {
-  return mImpl->AddIdle(callBack);
+  return mImpl->AddIdle( callback );
 }
 
 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
index 41da540..ab5997a 100644 (file)
@@ -19,8 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
-
+#include <dali/public-api/signals/callback.h>
 #include <dali/public-api/signals/dali-signal.h>
 #include <dali/public-api/math/rect.h>
 #include <dali/public-api/events/touch-event.h>
@@ -167,8 +166,10 @@ public:
    *
    * @param[in]  callBack  The function to call.
    * @return true if added successfully, false otherwise
+   *
+   * @note Ownership of the callback is passed onto this class.
    */
-  bool AddIdle( boost::function<void(void)> callBack );
+  bool AddIdle( CallbackBase* callback );
 
   /**
    * @brief Get the render surface the adaptor is using to render to.
index 6b288b5..eac238e 100644 (file)
@@ -155,7 +155,7 @@ void Application::Lower()
 void Application::Quit()
 {
   // Actually quit the application.
-  AddIdle(boost::bind(&Application::QuitFromMainLoop, this));
+  AddIdle( MakeCallback( this, &Application::QuitFromMainLoop ) );
 }
 
 void Application::QuitFromMainLoop()
@@ -172,7 +172,7 @@ void Application::QuitFromMainLoop()
 
 void Application::OnInit()
 {
-  mFramework->AddAbortCallback(boost::bind(&Application::QuitFromMainLoop, this));
+  mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) );
 
   CreateWindow();
   CreateAdaptor();
@@ -262,9 +262,9 @@ void Application::OnResize(Dali::Adaptor& adaptor)
   mResizeSignal.Emit( application );
 }
 
-bool Application::AddIdle(boost::function<void(void)> callBack)
+bool Application::AddIdle( CallbackBase* callback )
 {
-  return mAdaptor->AddIdle(callBack);
+  return mAdaptor->AddIdle( callback );
 }
 
 Dali::Adaptor& Application::GetAdaptor()
index 7dc75f6..919a7e3 100644 (file)
  */
 
 // EXTERNAL INCLUDES
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-#include <boost/thread.hpp>
-
 #include <dali/public-api/math/rect.h>
 #include <dali/public-api/object/base-object.h>
 
@@ -100,7 +96,7 @@ public:
   /**
    * @copydoc Dali::Application::AddIdle()
    */
-  bool AddIdle(boost::function<void(void)> callBack);
+  bool AddIdle( CallbackBase* callback );
 
   /**
    * @copydoc Dali::Application::GetAdaptor();
index b666366..f6f4cec 100644 (file)
@@ -19,8 +19,8 @@
  */
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
 #include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/signals/callback.h>
 
 namespace Dali
 {
@@ -39,8 +39,6 @@ class CallbackManager
 
 public:
 
-    typedef boost::function<void(void)> Callback;   ///< Callback typedef
-
     /**
      * Determines the priority of the call back
      */
@@ -77,7 +75,7 @@ public:
      * @param priority call back priority
      * @return true on success
      */
-    virtual bool AddCallback( Callback callback, Priority priority ) = 0;
+    virtual bool AddCallback( CallbackBase* callback, Priority priority ) = 0;
 
     /**
      * Adds a call back asynchronously to handle an event.
@@ -86,7 +84,7 @@ public:
      * @param callback custom call back function
      * @return true on success
      */
-    virtual bool AddEventCallback( Callback callback, int type, EventControl control ) = 0;
+    virtual bool AddEventCallback( CallbackBase* callback, int type, EventControl control ) = 0;
 
     /**
      * Starts the callback manager.
index d8cb4f8..e5dc5d3 100644 (file)
@@ -52,20 +52,30 @@ struct CallbackData
   /**
    * Constructor
    */
-  CallbackData(CallbackManager::Callback callback, CallbackType type):
-     mCallback(callback),
+  CallbackData( CallbackBase* callback, CallbackType type )
+  :  mCallback(callback),
      mType(type),
      mIdler(NULL),
      mPriority(CallbackManager::DEFAULT_PRIORITY),
      mExecute(true),
      mEventHandler(NULL),
      mEvent(0),
-     mEventControl(CallbackManager::CALLBACK_PASS_ON)
+     mEventControl(CallbackManager::CALLBACK_PASS_ON),
+     mRemoveFromContainerFunction(NULL)
   {
   }
 
+  /**
+   * Destructor
+   */
+  ~CallbackData()
+  {
+    delete mCallback;
+    delete mRemoveFromContainerFunction;
+  }
+
   // Data
-  CallbackManager::Callback       mCallback;      ///< call back
+  CallbackBase*                   mCallback;      ///< call back
   CallbackType                    mType;          ///< type of call back
 
     // Data for idle / default call backs
@@ -78,10 +88,7 @@ struct CallbackData
   int                             mEvent;         ///< ecore event id
   CallbackManager::EventControl   mEventControl;  ///< event control
 
-  // function typedef to remove the callbackdata from the callback container
-  typedef boost::function<void(CallbackData *)>  RemoveFromContainerFunction;
-
-  RemoveFromContainerFunction     mRemoveFromContainerFunction;
+  CallbackBase*                   mRemoveFromContainerFunction; ///< Called to remove the callbackdata from the callback container
 };
 
 namespace
@@ -95,10 +102,10 @@ Eina_Bool IdleCallback(void *data)
   CallbackData *callbackData = static_cast<CallbackData *>(data);
 
   // remove callback data from the container first in case our callback tries to modify the container
-  callbackData->mRemoveFromContainerFunction(callbackData);
+  CallbackBase::Execute( *callbackData->mRemoveFromContainerFunction, callbackData );
 
   // run the function
-  callbackData->mCallback();
+  CallbackBase::Execute( *callbackData->mCallback );
 
   // remove the idle call back
   ecore_idler_del(callbackData->mIdler);
@@ -122,10 +129,10 @@ Eina_Bool EventHandler(void *data, int type, void *event)
   DALI_ASSERT_ALWAYS( type == callbackData->mEvent && "Callback data does not match event" );
 
   // remove callback data from the container first in case our callback tries to modify the container
-  callbackData->mRemoveFromContainerFunction(callbackData);
+  CallbackBase::Execute( *callbackData->mRemoveFromContainerFunction, callbackData );
 
   // run the call back
-  callbackData->mCallback();
+  CallbackBase::Execute( *callbackData->mCallback );
 
   Eina_Bool returnVal;
 
@@ -159,9 +166,9 @@ void AddStandardCallback(CallbackData *callbackData)
     // run the call back now, then delete it from the container
     if ( callbackData->mExecute )
     {
-      callbackData->mCallback();
+      CallbackBase::Execute( *callbackData->mCallback );
     }
-    callbackData->mRemoveFromContainerFunction(callbackData);
+    CallbackBase::Execute( *callbackData->mRemoveFromContainerFunction, callbackData );
     delete callbackData;
   }
 }
@@ -259,7 +266,7 @@ void EcoreCallbackManager::Stop()
   ecore_main_loop_thread_safe_call_sync(MainRemoveAllCallback, this);
 }
 
-bool EcoreCallbackManager::AddCallback(Callback callback, Priority priority)
+bool EcoreCallbackManager::AddCallback(CallbackBase* callback, Priority priority)
 {
   bool added(false);
 
@@ -269,7 +276,7 @@ bool EcoreCallbackManager::AddCallback(Callback callback, Priority priority)
 
     callbackData->mPriority = priority;
 
-    callbackData->mRemoveFromContainerFunction =  boost::bind(&EcoreCallbackManager::RemoveCallbackFromContainer, this,_1);
+    callbackData->mRemoveFromContainerFunction =  MakeCallback( this, &EcoreCallbackManager::RemoveCallbackFromContainer );
 
     { // acquire lock to access container
       boost::unique_lock< boost::mutex > lock( mMutex );
@@ -288,7 +295,7 @@ bool EcoreCallbackManager::AddCallback(Callback callback, Priority priority)
   return added;
 }
 
-bool EcoreCallbackManager::AddEventCallback(Callback callback, int type, EventControl control)
+bool EcoreCallbackManager::AddEventCallback(CallbackBase* callback, int type, EventControl control)
 {
   bool added(false);
 
@@ -298,7 +305,7 @@ bool EcoreCallbackManager::AddEventCallback(Callback callback, int type, EventCo
     callbackData->mEventControl = control;
     callbackData->mEvent = type;
 
-    callbackData->mRemoveFromContainerFunction =  boost::bind(&EcoreCallbackManager::RemoveCallbackFromContainer, this,_1);
+    callbackData->mRemoveFromContainerFunction =  MakeCallback( this, &EcoreCallbackManager::RemoveCallbackFromContainer );
 
     { // acquire lock to access container
       boost::unique_lock< boost::mutex > lock( mMutex );
index 4ec7c17..7e94941 100644 (file)
@@ -60,12 +60,12 @@ public:
     /**
      * @copydoc CallbackManager::AddCallback()
      */
-    virtual bool AddCallback(Callback callback, Priority priority);
+    virtual bool AddCallback(CallbackBase* callback, Priority priority);
 
     /**
      * @copydoc CallbackManager::AddEventCallback()
      */
-    virtual bool AddEventCallback(Callback callback, int type, EventControl control);
+    virtual bool AddEventCallback(CallbackBase* callback, int type, EventControl control);
 
     /**
      * @copydoc CallbackManager::Start()
index 8528523..8ecac2e 100644 (file)
@@ -19,8 +19,6 @@
 #include "gesture-manager.h"
 
 // EXTERNAL INCLUDES
-#include <boost/bind.hpp>
-
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
index e6fd7aa..edf139d 100644 (file)
@@ -36,16 +36,21 @@ namespace Adaptor
 struct FileDescriptorMonitor::Impl
 {
   // Construction
-  Impl(int fileDescriptor, boost::function<void()> functor)
-  : mFileDescriptor(fileDescriptor),
-    mFunctor(functor),
-    mHandler(NULL)
+  Impl( int fileDescriptor, CallbackBase* callback )
+  : mFileDescriptor( fileDescriptor ),
+    mCallback( callback ),
+    mHandler( NULL )
   {
   }
 
+  ~Impl()
+  {
+    delete mCallback;
+  }
+
   // Data
   int mFileDescriptor;
-  boost::function<void()> mFunctor;
+  CallbackBase* mCallback;
   Ecore_Fd_Handler* mHandler;
 
   // Static Methods
@@ -57,15 +62,15 @@ struct FileDescriptorMonitor::Impl
   {
     Impl* impl = reinterpret_cast<Impl*>(data);
 
-    impl->mFunctor();
+    CallbackBase::Execute( *impl->mCallback );
 
     return ECORE_CALLBACK_RENEW;
   }
 };
 
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, boost::function<void()> functor)
+FileDescriptorMonitor::FileDescriptorMonitor( int fileDescriptor, CallbackBase* callback )
 {
-  mImpl = new Impl(fileDescriptor, functor);
+  mImpl = new Impl(fileDescriptor, callback);
 
   if (fileDescriptor >= 0)
   {
index 1f6563c..08e7888 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
+#include <dali/public-api/signals/callback.h>
 
 namespace Dali
 {
@@ -36,8 +36,8 @@ namespace Adaptor
 {
 
 /**
- * Monitors the given file descriptor and whenever anything is written to it, it calls
- * the given boost function.
+ * @brief Monitors the given file descriptor and whenever anything is written to it, the provided
+ * callback is called
  */
 class FileDescriptorMonitor
 {
@@ -46,9 +46,10 @@ public:
   /**
    * Constructor
    * @param[in]  fileDescriptor  The file descriptor to monitor
-   * @param[in]  functor         The function to call when anything is written to the file descriptor
+   * @param[in]  callback        Called when anything is written to the file descriptor
+   * @note The ownership of callback is taken by this class.
    */
-  FileDescriptorMonitor(int fileDescriptor, boost::function<void()> functor);
+  FileDescriptorMonitor( int fileDescriptor, CallbackBase* callback );
 
   /**
    * Destructor
index fe714c7..19c5d25 100644 (file)
@@ -20,7 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <string>
-#include <boost/function.hpp>
+#include <dali/public-api/signals/callback.h>
 
 // INTERNAL INCLUDES
 #include "abort-handler.h"
@@ -118,8 +118,9 @@ public:
    * If the main loop aborts unexpectedly, then the connected callback function is called.
    * @param[in]  callBack  The function to call.
    * @note Only one callback can be registered.  The last callback to be set will be called on abort.
+   * @note The ownership of callback is passed onto this class.
    */
-  void AddAbortCallback(boost::function<void(void)> callBack);
+  void AddAbortCallback( CallbackBase* callback );
 
   /**
    * Gets bundle name which was passed in app_reset callback.
index 5aeb05a..0cfbe0f 100644 (file)
@@ -31,9 +31,9 @@ namespace Internal
 namespace Adaptor
 {
 
-TriggerEventInterface* TriggerEventFactory::CreateTriggerEvent(  boost::function<void()> functor,  TriggerEventInterface::Options options )
+TriggerEventInterface* TriggerEventFactory::CreateTriggerEvent(  CallbackBase* callback,  TriggerEventInterface::Options options )
 {
-  return new TriggerEvent( functor, options );
+  return new TriggerEvent( callback, options );
 }
 
 void TriggerEventFactory::DestroyTriggerEvent( TriggerEventInterface* triggerEventInterface )
index c73eb17..998de17 100644 (file)
@@ -56,7 +56,7 @@ public:
   /**
    * @copydoc TriggerEventFactoryInterface::CreateTriggerEvent
    */
-  virtual TriggerEventInterface* CreateTriggerEvent(  boost::function<void()> functor, TriggerEventInterface::Options options );
+  virtual TriggerEventInterface* CreateTriggerEvent(  CallbackBase* callback, TriggerEventInterface::Options options );
 
 
   /**
index 3de929d..c4bb760 100644 (file)
@@ -20,7 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <sys/eventfd.h>
-#include <boost/bind.hpp>
+#include <unistd.h>
 
 #include <dali/integration-api/debug.h>
 
@@ -37,10 +37,10 @@ namespace Internal
 namespace Adaptor
 {
 
-TriggerEvent::TriggerEvent( boost::function<void()> functor, TriggerEventInterface::Options options )
-: mFileDescriptorMonitor(NULL),
-  mFunctor(functor),
-  mFileDescriptor(-1),
+TriggerEvent::TriggerEvent( CallbackBase* callback, TriggerEventInterface::Options options )
+: mFileDescriptorMonitor( NULL ),
+  mCallback( callback ),
+  mFileDescriptor( -1 ),
   mOptions( options )
 {
   // Create accompanying file descriptor.
@@ -48,7 +48,7 @@ TriggerEvent::TriggerEvent( boost::function<void()> functor, TriggerEventInterfa
   if (mFileDescriptor >= 0)
   {
     // Now Monitor the created event file descriptor
-    mFileDescriptorMonitor = new FileDescriptorMonitor(mFileDescriptor, boost::bind(&TriggerEvent::Triggered, this));
+    mFileDescriptorMonitor = new FileDescriptorMonitor( mFileDescriptor, MakeCallback( this, &TriggerEvent::Triggered ) );
   }
   else
   {
@@ -58,11 +58,8 @@ TriggerEvent::TriggerEvent( boost::function<void()> functor, TriggerEventInterfa
 
 TriggerEvent::~TriggerEvent()
 {
-  if (mFileDescriptorMonitor)
-  {
-    delete mFileDescriptorMonitor;
-    mFileDescriptorMonitor = NULL;
-  }
+  delete mFileDescriptorMonitor;
+  delete mCallback;
 
   if (mFileDescriptor >= 0)
   {
@@ -104,8 +101,8 @@ void TriggerEvent::Triggered()
     DALI_LOG_WARNING("Unable to read to UpdateEvent File descriptor\n");
   }
 
-  // Call the connected boost function.
-  mFunctor();
+  // Call the connected callback
+  CallbackBase::Execute( *mCallback );
 
   //check if we should delete ourselves after the trigger
   if( mOptions == TriggerEventInterface::DELETE_AFTER_TRIGGER )
index e511b3f..c862748 100644 (file)
@@ -19,9 +19,8 @@
  */
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
-
 #include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/signals/callback.h>
 
 // INTERNAL INCLUDES
 #include <base/interfaces/trigger-event-interface.h>
@@ -56,10 +55,11 @@ public:
    * Creates an event file descriptor and starts a GSource which reads from the file
    * descriptor when there is data.
    *
-   * @param[in]  functor to call
-   * @param[in] options, trigger event options.
+   * @param[in] callback The callback to call
+   * @param[in] options Trigger event options.
+   * @note The ownership of callback is taken by this class.
    */
-  TriggerEvent( boost::function<void()> functor, TriggerEventInterface::Options options = TriggerEventInterface::NONE );
+  TriggerEvent( CallbackBase* callback, TriggerEventInterface::Options options = TriggerEventInterface::NONE );
 
   /**
    * Destructor
@@ -89,7 +89,7 @@ private:
 private:
 
   FileDescriptorMonitor* mFileDescriptorMonitor;
-  boost::function<void()> mFunctor; ///< Function object to call
+  CallbackBase* mCallback;
   int mFileDescriptor;
   TriggerEventInterface::Options mOptions;
 };
index 084462d..9976f72 100644 (file)
 
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
-
+#include <dali/public-api/events/touch-event.h>
 #include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/signals/dali-signal.h>
-#include <dali/public-api/events/touch-event.h>
 
 namespace Dali
 {
index d4a9056..fd3d4cb 100644 (file)
@@ -116,9 +116,9 @@ Orientation Application::GetOrientation()
   return Orientation();
 }
 
-bool Application::AddIdle(boost::function<void(void)> callBack)
+bool Application::AddIdle( CallbackBase* callback )
 {
-  return Internal::Adaptor::GetImplementation(*this).AddIdle(callBack);
+  return Internal::Adaptor::GetImplementation(*this).AddIdle( callback );
 }
 
 Window Application::GetWindow()
index 34e8292..9e135b8 100644 (file)
  */
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
 #include <string>
-#include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/common/view-mode.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/callback.h>
+
 
 // INTERNAL INCLUDES
 #include "application-configuration.h"
@@ -236,10 +237,12 @@ public:
    *   void MyFunction();
    * @endcode
    *
-   * @param[in]  callBack  The function to call.
+   * @param[in]  callback  The function to call.
    * @return true if added successfully, false otherwise
+   *
+   * @note Ownership of the callback is passed onto this class.
    */
-  bool AddIdle(boost::function<void(void)> callBack);
+  bool AddIdle( CallbackBase* callback );
 
   /**
    * Retrieves the window used by the Application class.
@@ -274,14 +277,16 @@ public: // Stereoscopy
   ViewMode GetViewMode() const;
 
   /**
-   * Set the stereo base (eye seperation) for stereoscopic 3D
-   * @param[in] stereoBase The stereo base (eye seperation) for stereoscopic 3D
+   * Set the stereo base (eye separation) for Stereoscopic 3D
+   *
+   * @param[in] stereoBase The stereo base (eye separation) for Stereoscopic 3D
    */
   void SetStereoBase( float stereoBase );
 
   /**
-   * Get the stereo base (eye seperation) for stereoscopic 3D
-   * @return The stereo base (eye seperation) for stereoscopic 3D
+   * Get the stereo base (eye separation) for Stereoscopic 3D
+   *
+   * @return The stereo base (eye separation) for Stereoscopic 3D
    */
   float GetStereoBase() const;
 
index d38344f..a7ba97a 100644 (file)
@@ -19,8 +19,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
-
 #include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/signals/dali-signal.h>
 
index b8f4472..d7b5c8e 100644 (file)
@@ -20,8 +20,6 @@
 
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
-
 #include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/signals/dali-signal.h>
 
index e1ee579..55bc705 100644 (file)
@@ -19,8 +19,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
-
 #include <dali/public-api/signals/dali-signal.h>
 #include <dali/public-api/object/base-handle.h>
 
index 5de1792..d7f7efd 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
 #include <string>
 
 #include <dali/public-api/object/base-handle.h>
index c8809cc..8b865ad 100644 (file)
@@ -19,8 +19,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
-
 #include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/signals/dali-signal.h>
 
index 8986853..5171324 100644 (file)
@@ -22,7 +22,6 @@
 #include <app.h>
 #include <bundle.h>
 #include <Ecore.h>
-#include <boost/bind.hpp>
 
 #include <dali/integration-api/debug.h>
 
@@ -62,6 +61,8 @@ struct Framework::Impl
   // Constructor
 
   Impl(void* data)
+  : mAbortCallBack( NULL ),
+    mCallbackManager( NULL )
   {
     mEventCallback.create = AppCreate;
     mEventCallback.terminate = AppTerminate;
@@ -83,6 +84,8 @@ struct Framework::Impl
 
   ~Impl()
   {
+    delete mAbortCallBack;
+
     // we're quiting the main loop so
     // mCallbackManager->RemoveAllCallBacks() does not need to be called
     // to delete our abort handler
@@ -91,7 +94,7 @@ struct Framework::Impl
 
   // Data
 
-  boost::function<void(void)> mAbortCallBack;
+  CallbackBase* mAbortCallBack;
   app_event_callback_s mEventCallback;
   CallbackManager *mCallbackManager;
   // Static methods
@@ -204,7 +207,7 @@ Framework::Framework(Framework::Observer& observer, int *argc, char ***argv, con
   mName(name),
   mBundleName(""),
   mBundleId(""),
-  mAbortHandler(boost::bind(&Framework::AbortCallback, this)),
+  mAbortHandler( MakeCallback( this, &Framework::AbortCallback ) ),
   mImpl(NULL)
 {
   InitThreads();
@@ -240,9 +243,9 @@ bool Framework::IsMainLoopRunning()
   return mRunning;
 }
 
-void Framework::AddAbortCallback(boost::function<void(void)> callBack)
+void Framework::AddAbortCallback( CallbackBase* callback )
 {
-  mImpl->mAbortCallBack = callBack;
+  mImpl->mAbortCallBack = callback;
 }
 
 std::string Framework::GetBundleName() const
@@ -270,7 +273,7 @@ void Framework::AbortCallback( )
   // if an abort call back has been installed run it.
   if (mImpl->mAbortCallBack)
   {
-    mImpl->mAbortCallBack();
+    CallbackBase::Execute( *mImpl->mAbortCallBack );
   }
   else
   {
index c799b39..49df4b5 100644 (file)
@@ -21,7 +21,6 @@
 // EXTERNAL INCLUDES
 #include <Ecore.h>
 #include <Elementary.h>
-#include <boost/bind.hpp>
 #include <X11/Xlib.h>
 
 #include <dali/integration-api/debug.h>
@@ -62,12 +61,15 @@ struct Framework::Impl
   // Constructor
 
   Impl(void* data)
+  : mAbortCallBack( NULL ),
+    mCallbackManager( CallbackManager::New() )
   {
-    mCallbackManager = CallbackManager::New();
   }
 
   ~Impl()
   {
+    delete mAbortCallBack;
+
     // we're quiting the main loop so
     // mCallbackManager->RemoveAllCallBacks() does not need to be called
     // to delete our abort handler
@@ -76,7 +78,7 @@ struct Framework::Impl
 
   // Data
 
-  boost::function<void(void)> mAbortCallBack;
+  CallbackBase* mAbortCallBack;
   CallbackManager *mCallbackManager;
   // Static methods
 
@@ -131,7 +133,7 @@ Framework::Framework(Framework::Observer& observer, int *argc, char ***argv, con
   mName(name),
   mBundleName(""),
   mBundleId(""),
-  mAbortHandler(boost::bind(&Framework::AbortCallback, this)),
+  mAbortHandler( MakeCallback( this, &Framework::AbortCallback ) ),
   mImpl(NULL)
 {
   InitThreads();
@@ -173,9 +175,9 @@ bool Framework::IsMainLoopRunning()
   return mRunning;
 }
 
-void Framework::AddAbortCallback(boost::function<void(void)> callBack)
+void Framework::AddAbortCallback( CallbackBase* callback )
 {
-  mImpl->mAbortCallBack = callBack;
+  mImpl->mAbortCallBack = callback;
 }
 
 std::string Framework::GetBundleName() const
@@ -203,7 +205,7 @@ void Framework::AbortCallback( )
   // if an abort call back has been installed run it.
   if (mImpl->mAbortCallBack)
   {
-    mImpl->mAbortCallBack();
+    CallbackBase::Execute( *mImpl->mAbortCallBack );
   }
   else
   {
index 8ca84dc..84bbdd2 100644 (file)
@@ -19,7 +19,6 @@
 #include <imf-manager-impl.h>
 
 // EXTERNAL INCLUDES
-#include <boost/bind.hpp>
 #include <dali/public-api/events/key-event.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/integration-api/debug.h>
index bb4eac5..0dc943a 100644 (file)
@@ -19,7 +19,6 @@
 #include <imf-manager-impl.h>
 
 // EXTERNAL INCLUDES
-#include <boost/bind.hpp>
 #include <dali/public-api/events/key-event.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/integration-api/debug.h>