#include <dpl/event/thread_event_dispatcher.h>
#include <dpl/event/main_event_dispatcher.h>
#include <dpl/fast_delegate.h>
-#include <dpl/shared_ptr.h>
-#include <dpl/enable_shared_from_this.h>
#include <dpl/generic_event.h>
#include <dpl/foreach.h>
#include <dpl/recursive_mutex.h>
#include <dpl/apply.h>
#include <tuple>
#include <list>
+#include <memory>
/*
* - Created ICDelegate can be passed freely to other threads.
class ICDSharedDataBase
{
public:
- typedef DPL::SharedPtr<ICDSharedDataBase> ICDSharedDataBasePtr;
+ typedef std::shared_ptr<ICDSharedDataBase> ICDSharedDataBasePtr;
typedef std::list<ICDSharedDataBasePtr> ICDSharedDataBaseList;
class ScopedLock : DPL::Noncopyable
}
virtual void Call()
{
- m_helperBase.Reset();
+ m_helperBase.reset();
}
private:
ICD::Reuse reuse)
{
ICDSharedData* hlp = new ICDSharedData(base, outerDelegate, reuse);
- m_helper.Reset(hlp);
+ m_helper.reset(hlp);
}
// Calling operator will pass all args passed to it to correct context and
{
Assert(m_helper);
ICDPrivate::ICDSharedDataBase::ScopedLock lock(
- DPL::StaticPointerCast<ICDPrivate::ICDSharedDataBase>(m_helper));
+ std::static_pointer_cast<ICDPrivate::ICDSharedDataBase>(m_helper));
m_helper->CallDelegate(args ...);
}
{
Assert(m_helper);
ICDPrivate::ICDSharedDataBase::ScopedLock lock(
- DPL::StaticPointerCast<ICDPrivate::ICDSharedDataBase>(m_helper));
+ std::static_pointer_cast<ICDPrivate::ICDSharedDataBase>(m_helper));
m_helper->disable();
}
ICDPrivate::ICDSharedDataBase::ICDSharedDataBasePtr
getRelatedICDSharedData() const
{
- return DPL::StaticPointerCast<ICDPrivate::ICDSharedDataBase>(m_helper);
+ return std::static_pointer_cast<ICDPrivate::ICDSharedDataBase>(m_helper);
}
private:
template<typename ThisType>
friend class ICDelegateSupport;
class ICDSharedData;
- typedef DPL::SharedPtr<ICDSharedData> ICDSharedDataPtr;
+ typedef std::shared_ptr<ICDSharedData> ICDSharedDataPtr;
struct PrivateEvent
{
typedef DPL::FastDelegate<void (const PrivateEvent&)>
ICDSharedDataDelegateType;
class ICDSharedData : private DPL::Event::EventSupport<PrivateEvent>,
- private DPL::EnableSharedFromThis<ICDSharedData>,
+ public std::enable_shared_from_this<ICDSharedData>,
public ICDPrivate::ICDSharedDataBase
{
public:
void CallDelegate(ArgTypesList ... args)
{
ICDPrivate::ICDSharedDataBase::ScopedLock lock(
- DPL::StaticPointerCast<ICDPrivate::ICDSharedDataBase>(
- this->SharedFromThis()));
+ std::static_pointer_cast<ICDPrivate::ICDSharedDataBase>(
+ this->shared_from_this()));
if (!isDisabled()) {
- EmitEvent(PrivateEvent(this->SharedFromThis(),
+ EmitEvent(PrivateEvent(this->shared_from_this(),
args ...));
}
}
virtual void disable()
{
ICDPrivate::ICDSharedDataBase::ICDSharedDataBasePtr ptr(
- DPL::StaticPointerCast<ICDSharedDataBase>(
- this->SharedFromThis()));
+ std::static_pointer_cast<ICDSharedDataBase>(
+ this->shared_from_this()));
ICDPrivate::ICDSharedDataBase::ScopedLock lock(ptr);
if (!isDisabled()) {
ICDPrivate::ICDSharedDataBase::disable();
}
private:
- friend class DPL::SharedPtr<ICDSharedData>;
+ friend class std::shared_ptr<ICDSharedData>;
ICDSharedDataDelegateType m_subDelegate;
ICDPrivate::ICDelegateSupportInterface* m_base;
DPL::FastDelegate<void (ArgTypesList ...)> m_outerDelegate;
void delegateForwarder(const PrivateEvent& event)
{
ICDPrivate::ICDSharedDataBase::ICDSharedDataBasePtr ptr(
- DPL::StaticPointerCast<ICDSharedDataBase>(event.helper));
+ std::static_pointer_cast<ICDSharedDataBase>(event.helper));
ICDPrivate::ICDSharedDataBase::ScopedLock lock(ptr);
Assert(!m_outerDelegate.empty());
m_ICDSharedDatas;
FOREACH(helper, list) {
ICDPrivate::ICDSharedDataBase::ScopedLock lock(
- DPL::StaticPointerCast<ICDPrivate::ICDSharedDataBase>(*helper));
+ std::static_pointer_cast<ICDPrivate::ICDSharedDataBase>(*helper));
(*helper)->disable();
}
m_ICDSharedDatas.clear();