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 c1b78562a6aa02a6c4ba751c60e381b35f40e2f0..1c249d9ac35d3061bc5a47cbf800733c2ccc5b0c 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 eea7ec68e35de4ea1c740a6168847a6ce6d25e68..ed4d09e462a559589104459dc750fded3cfef18f 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 af53864fbdda1ee91e9e3b34d1816b36bfcbf98d..df2b619f5618a2f3357e79bb033afa6f3d079ab1 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 d12bb01d7c3c70a34283b73c6a520f9a281c5317..f614faa858060aa7ae5067853fa8dd128ea87783 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 a3ce04c97aee0d5292cbe2b1474b543a9dcae1d7..ad7d1005a85a151e5870d80854d94cf047cc2d53 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 7eecd5bb342fcaf1ac0e3ba90f0d359b59fdbf41..b71b210f687a6a06dbac033c9c43f4b6c8e365f6 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 41da5402aa5b0f3cbeb4a0abac945b870866de31..ab5997a6742f3b8287c84992554ecdceccab7dbd 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 6b288b5cc74349f1a55a01335f78b76cbc68e6e3..eac238e903a45307304cad1737dcc67cf09a30c0 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 7dc75f6d8bfa9e5fae128159a1ea6b23e36003f3..919a7e38e0721264345729b5998ba517afd8dd2c 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 b666366dca02daa91708960c89b62f6f590f938a..f6f4cec026f6885a7d43759e8f40f0131488b0a2 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 d8cb4f8939e671ef90e6124fb123cd14483e9387..e5dc5d32be29bb47c0345ec41119e8b68c6bad64 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 4ec7c1729cf1e1e79da067ce6011d98beae93a00..7e9494129e8dc87fac6c071ebe76fa1294460f64 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 85285236f2c736e960fc1da78824401fcf376313..8ecac2e67a4045c79ea5d935f7506ea0fb3385d2 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 e6fd7aaf90388727c8658b7e6d6963829b70efba..edf139d977442e653cadbee51e84abc54149aece 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 1f6563cf98d4e72c053dd721c437723f3dd13c72..08e78883701afebbc1ae879e307364608ac9bb77 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 fe714c7e3aaaff58d440861a81dca083164c9f6c..19c5d25f5bb85fd2efff7f010d52a4be35c51928 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 5aeb05ab91ac160706e4cfef3b844864d43f876d..0cfbe0f42d9bac4c5487166cd29f0ac87ea9ca5f 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 c73eb173f84cd5ea8e840f7b0cea7c030b5490c3..998de1734b8a069c0564141b200845be75102767 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 3de929d486937720a6c5e575e2cedc26a993d3c3..c4bb760cd6f2a7de931ac7106e24d852ca6f0762 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 e511b3fa75d4333aa77475103931764682945ea0..c862748cc3428ba97761abf35a11b934fcd8f2c5 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 084462d5d6856dc62ed5cb66d93f67c5e5df44bd..9976f72ab9a06558ecdb1cefcbd79f47b7038543 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 d4a905651497896b71d556c07cb009a0810fc7b9..fd3d4cbc5c63f8e8c8cfcf2198b67b620ee505a8 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 34e82928ff560d8cff6e90e7bb98a471fa4f0f8a..9e135b864a982fda48a6da4327e86e7ea5036d22 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 d38344f27761cf8867b7959881517e5bb81a8207..a7ba97a7d7b42dc9f012e92c2fa7966ca7844914 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 b8f4472b9e6dc65569c67198f9ef1b3b722432b3..d7b5c8e91daa336da918bb1072b4b1b48af76762 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 e1ee579cc0007fa15df6ed80414d83d721567e75..55bc7054618fc38460c9116627f71b11cb8b461e 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 5de179273f532e3830d5a6fa3c16e6575c6522d6..d7f7efd07243adc2823950c0feec32d31441e266 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <boost/function.hpp>
 #include <string>
 
 #include <dali/public-api/object/base-handle.h>
index c8809cc69c4074564c2c0c601b85e12e5a646d91..8b865adf608569f8b00bace97983813ceeae8533 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 898685352d326e155f9c86cfa34eaad3ab83978e..517132484dd088ed30bcad2a9b13f53cf75ec1e1 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 c799b39ec8673c969a73370ebc81d67a79449e4d..49df4b514462a3f12e5c4771859288516793af10 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 8ca84dc5aed694e90968db88f10b5eb6371454f0..84bbdd2bc90e3fec74714d6380706b9ec3287215 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 bb4eac59913c0fe9a73e3bcd2a504dc6bb17fc4a..0dc943a77839734149d404713389e7088d88b2c8 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>