[DEV] continue removing STL

This commit is contained in:
Edouard DUPIN 2017-09-14 00:59:21 +02:00
parent ab070be3f8
commit 37a1dce0b4
14 changed files with 16 additions and 43 deletions

View File

@ -13,7 +13,7 @@ Declaring a signal is really simple, just include the esignal file:
You can now declare your signals. We have basicly declare some basic signal type: You can now declare your signals. We have basicly declare some basic signal type:
- void - void
- bool - bool
- std::string / std::u32string - etk::String / etk::UString
- int8_t / int16_t / int32_t / int64_t - int8_t / int16_t / int32_t / int64_t
- uint8_t / uint16_t / uint32_t / uint64_t - uint8_t / uint16_t / uint32_t / uint64_t
- float / double - float / double

View File

@ -1,8 +1,6 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved * @copyright 2016, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */

View File

@ -1,19 +1,16 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved * @copyright 2016, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#pragma once #pragma once
#include <functional> #include <etk/Function.hpp>
#include <ememory/memory.hpp> #include <ememory/memory.hpp>
#include <esignal/debug.hpp> #include <esignal/debug.hpp>
#include <esignal/Base.hpp> #include <esignal/Base.hpp>
#include <functional> #include <etk/Function.hpp>
#include <type_traits> #include <etk/typeTrait.hpp>
#include <utility>
#include <ethread/Mutex.hpp> #include <ethread/Mutex.hpp>
/** /**

View File

@ -1,8 +1,6 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved * @copyright 2016, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#include <esignal/debug.hpp> #include <esignal/debug.hpp>

View File

@ -1,13 +1,11 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved * @copyright 2016, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#pragma once #pragma once
#include <functional> #include <etk/Function.hpp>
#include <ememory/memory.hpp> #include <ememory/memory.hpp>
#include <esignal/debug.hpp> #include <esignal/debug.hpp>
#include <esignal/Base.hpp> #include <esignal/Base.hpp>

View File

@ -1,8 +1,6 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved * @copyright 2016, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#pragma once #pragma once

View File

@ -1,8 +1,6 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved * @copyright 2016, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */

View File

@ -1,8 +1,6 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved * @copyright 2016, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#pragma once #pragma once

View File

@ -1,19 +1,16 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved * @copyright 2016, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#pragma once #pragma once
#include <functional> #include <etk/Function.hpp>
#include <memory>
#include <ememory/memory.hpp> #include <ememory/memory.hpp>
#include <ememory/UniquePtr.hpp>
#include <esignal/debug.hpp> #include <esignal/debug.hpp>
#include <esignal/Base.hpp> #include <esignal/Base.hpp>
#include <esignal/Connection.hpp> #include <esignal/Connection.hpp>
#include <utility>
#include <esignal/Interface.hpp> #include <esignal/Interface.hpp>
namespace esignal { namespace esignal {
@ -67,7 +64,7 @@ namespace esignal {
virtual bool isSharedPtr(const ememory::SharedPtr<void>& _obj); virtual bool isSharedPtr(const ememory::SharedPtr<void>& _obj);
}; };
protected: protected:
etk::Vector<std::unique_ptr<Executor>> m_executors; //!< List of all executors. etk::Vector<ememory::UniquePtr<Executor>> m_executors; //!< List of all executors.
private: private:
/** /**
* @brief Executor specific to the Shared_ptr caller that does not want to worry about the removing of the signal. * @brief Executor specific to the Shared_ptr caller that does not want to worry about the removing of the signal.
@ -223,7 +220,7 @@ namespace esignal {
return esignal::Connection(); return esignal::Connection();
} }
ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data); ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data);
return pointer->connect(std::forward<OBSERVER_TYPE>(_observer)); return pointer->connect(etk::forward<OBSERVER_TYPE>(_observer));
} }
/** /**
* @brief Connect an function member on the signal. * @brief Connect an function member on the signal.
@ -240,7 +237,7 @@ namespace esignal {
return esignal::Connection(); return esignal::Connection();
} }
ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data); ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data);
return pointer->connect(_class, _func, std::forward<FUNC_ARGS_TYPE>(_args)...); return pointer->connect(_class, _func, etk::forward<FUNC_ARGS_TYPE>(_args)...);
} }
/** /**
* @brief Connect an function member on the signal with the shared_ptr object. * @brief Connect an function member on the signal with the shared_ptr object.
@ -256,7 +253,7 @@ namespace esignal {
return; return;
} }
ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data); ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data);
return pointer->connect(_class, _func, std::forward<FUNC_ARGS_TYPE>(_args)...); return pointer->connect(_class, _func, etk::forward<FUNC_ARGS_TYPE>(_args)...);
} }
public: public:
/** /**
@ -268,7 +265,7 @@ namespace esignal {
return; return;
} }
ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data); ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data);
return pointer->emit(std::forward<const T_ARGS&>(_args)...); return pointer->emit(etk::forward<const T_ARGS&>(_args)...);
} }
public: public:
/** /**
@ -319,7 +316,7 @@ template<class... T_ARGS>
template<class OBSERVER_TYPE > template<class OBSERVER_TYPE >
esignal::Connection esignal::SignalInternal<T_ARGS...>::connect(OBSERVER_TYPE&& _observer ) { esignal::Connection esignal::SignalInternal<T_ARGS...>::connect(OBSERVER_TYPE&& _observer ) {
ESIGNAL_DEBUG("esignal: '" << getName() << "' try connect: '" << getName() << "' (observer)"); ESIGNAL_DEBUG("esignal: '" << getName() << "' try connect: '" << getName() << "' (observer)");
std::unique_ptr<Executor> executer(new Executor(std::forward<OBSERVER_TYPE>(_observer))); ememory::UniquePtr<Executor> executer(new Executor(etk::forward<OBSERVER_TYPE>(_observer)));
size_t uid = executer->m_uid; size_t uid = executer->m_uid;
m_executors.pushBack(etk::move(executer)); m_executors.pushBack(etk::move(executer));
if (m_connectionObserver!=nullptr) { if (m_connectionObserver!=nullptr) {
@ -339,7 +336,7 @@ esignal::Connection esignal::SignalInternal<T_ARGS...>::connect(CLASS_TYPE* _cla
ESIGNAL_ERROR(" '" << getName() << "' Class pointer in nullptr"); ESIGNAL_ERROR(" '" << getName() << "' Class pointer in nullptr");
return esignal::Connection(); return esignal::Connection();
} }
std::unique_ptr<Executor> executer(new Executor([=](const T_ARGS& ... _argBase){ ememory::UniquePtr<Executor> executer(new Executor([=](const T_ARGS& ... _argBase){
(*_class.*_func)(_argBase..., _arg... ); (*_class.*_func)(_argBase..., _arg... );
})); }));
size_t uid = executer->m_uid; size_t uid = executer->m_uid;
@ -367,7 +364,7 @@ void esignal::SignalInternal<T_ARGS...>::connect(const ememory::SharedPtr<PARENT
return; return;
} }
CLASS_TYPE* directPointer = obj2.get(); CLASS_TYPE* directPointer = obj2.get();
std::unique_ptr<ExecutorShared> executer(new ExecutorShared(_class, [=]( const T_ARGS& ... _argBase){ ememory::UniquePtr<ExecutorShared> executer(new ExecutorShared(_class, [=]( const T_ARGS& ... _argBase){
// TODO : Check if compilator does not use the shared ptr ... // TODO : Check if compilator does not use the shared ptr ...
(*directPointer.*_func)(_argBase..., _args... ); (*directPointer.*_func)(_argBase..., _args... );
})); }));

View File

@ -1,8 +1,6 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved * @copyright 2016, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */

View File

@ -1,8 +1,6 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved * @copyright 2016, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#pragma once #pragma once

View File

@ -1,8 +1,6 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved * @copyright 2016, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#include <esignal/details/Signal.hxx> #include <esignal/details/Signal.hxx>

View File

@ -1,8 +1,6 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved * @copyright 2016, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#pragma once #pragma once

View File

@ -13,8 +13,7 @@
#include <etest/etest.hpp> #include <etest/etest.hpp>
int main(int _argc, const char *_argv[]) { int main(int _argc, const char *_argv[]) {
::testing::InitGoogleTest(&_argc, const_cast<char **>(_argv)); etest::init(_argc, _argv);
etk::init(_argc, _argv);
for (int32_t iii=0; iii<_argc ; ++iii) { for (int32_t iii=0; iii<_argc ; ++iii) {
etk::String data = _argv[iii]; etk::String data = _argv[iii];
if ( data == "-h" if ( data == "-h"