[DEV] update etk null
This commit is contained in:
parent
85423b4823
commit
7da790e3e4
@ -33,7 +33,7 @@ void esignal::BaseInternal::setDescription(const etk::String& _desc) {
|
||||
}
|
||||
|
||||
esignal::Base::Base() :
|
||||
m_data(nullptr) {
|
||||
m_data(null) {
|
||||
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ esignal::Base::~Base() {
|
||||
}
|
||||
|
||||
const etk::String& esignal::Base::getName() const {
|
||||
if (m_data != nullptr) {
|
||||
if (m_data != null) {
|
||||
return m_data->getName();
|
||||
}
|
||||
static etk::String noValue;
|
||||
@ -50,7 +50,7 @@ const etk::String& esignal::Base::getName() const {
|
||||
}
|
||||
|
||||
const etk::String& esignal::Base::getDescription() const {
|
||||
if (m_data != nullptr) {
|
||||
if (m_data != null) {
|
||||
return m_data->getDescription();
|
||||
}
|
||||
static etk::String noValue;
|
||||
@ -58,7 +58,7 @@ const etk::String& esignal::Base::getDescription() const {
|
||||
}
|
||||
|
||||
void esignal::Base::setPeriodic(bool _state) {
|
||||
if (m_data != nullptr) {
|
||||
if (m_data != null) {
|
||||
m_data->setPeriodic(_state);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <esignal/Connection.hpp>
|
||||
|
||||
esignal::Connection::Connection():
|
||||
m_data(nullptr),
|
||||
m_data(null),
|
||||
m_uid(0) {
|
||||
|
||||
}
|
||||
@ -36,7 +36,7 @@ esignal::Connection& esignal::Connection::operator=(esignal::Connection&& _obj)
|
||||
|
||||
esignal::Connection::~Connection() {
|
||||
ememory::SharedPtr<esignal::BaseInternal> ref = m_data.lock();
|
||||
if (ref == nullptr) {
|
||||
if (ref == null) {
|
||||
return;
|
||||
}
|
||||
ref->disconnect(m_uid);
|
||||
@ -46,7 +46,7 @@ esignal::Connection::~Connection() {
|
||||
|
||||
void esignal::Connection::disconnect() {
|
||||
ememory::SharedPtr<esignal::BaseInternal> ref = m_data.lock();
|
||||
if (ref == nullptr) {
|
||||
if (ref == null) {
|
||||
return;
|
||||
}
|
||||
ref->disconnect(m_uid);
|
||||
|
@ -19,8 +19,8 @@ esignal::InterfaceData::~InterfaceData() {
|
||||
|
||||
// note this pointer is not allocated and not free at the end of the class
|
||||
void esignal::InterfaceData::add(esignal::Base* _pointerOnSignal) {
|
||||
if (_pointerOnSignal == nullptr) {
|
||||
ESIGNAL_ERROR("Try to link a nullptr parameters");
|
||||
if (_pointerOnSignal == null) {
|
||||
ESIGNAL_ERROR("Try to link a null parameters");
|
||||
return;
|
||||
}
|
||||
m_list.pushBack(_pointerOnSignal);
|
||||
@ -29,7 +29,7 @@ void esignal::InterfaceData::add(esignal::Base* _pointerOnSignal) {
|
||||
void esignal::InterfaceData::remove(esignal::Base* _pointerOnSignal) {
|
||||
auto it = m_list.begin();
|
||||
while (it != m_list.end()) {
|
||||
if ( *it == nullptr
|
||||
if ( *it == null
|
||||
|| *it == _pointerOnSignal) {
|
||||
it = m_list.erase(it);
|
||||
} else {
|
||||
@ -41,7 +41,7 @@ void esignal::InterfaceData::remove(esignal::Base* _pointerOnSignal) {
|
||||
etk::Vector<etk::String> esignal::InterfaceData::getAll() const {
|
||||
etk::Vector<etk::String> out;
|
||||
for (auto &it : m_list) {
|
||||
if(it != nullptr) {
|
||||
if(it != null) {
|
||||
out.pushBack(it->getName());
|
||||
}
|
||||
}
|
||||
@ -49,12 +49,12 @@ etk::Vector<etk::String> esignal::InterfaceData::getAll() const {
|
||||
}
|
||||
|
||||
void esignal::InterfaceData::disconnect(const ememory::SharedPtr<void>& _object) {
|
||||
if (_object == nullptr) {
|
||||
ESIGNAL_ERROR("Input ERROR nullptr pointer Object ...");
|
||||
if (_object == null) {
|
||||
ESIGNAL_ERROR("Input ERROR null pointer Object ...");
|
||||
return;
|
||||
}
|
||||
for(auto &it : m_list) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
it->disconnectShared(_object);
|
||||
|
@ -150,7 +150,7 @@ namespace esignal {
|
||||
* @param[in] _name Static name of the signal.
|
||||
* @param[in] _description Description of the signal.
|
||||
*/
|
||||
Signal(esignal::BaseInternal::ObserverConnection _countObs=nullptr,
|
||||
Signal(esignal::BaseInternal::ObserverConnection _countObs=null,
|
||||
const etk::String& _name="",
|
||||
const etk::String& _description="");
|
||||
/**
|
||||
@ -216,7 +216,7 @@ namespace esignal {
|
||||
*/
|
||||
template< class OBSERVER_TYPE >
|
||||
esignal::Connection connect(OBSERVER_TYPE&& _observer) {
|
||||
if (m_data == nullptr) {
|
||||
if (m_data == null) {
|
||||
return esignal::Connection();
|
||||
}
|
||||
ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data);
|
||||
@ -233,7 +233,7 @@ namespace esignal {
|
||||
esignal::Connection connect(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
FUNC_ARGS_TYPE... _args) {
|
||||
if (m_data == nullptr) {
|
||||
if (m_data == null) {
|
||||
return esignal::Connection();
|
||||
}
|
||||
ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data);
|
||||
@ -249,7 +249,7 @@ namespace esignal {
|
||||
void connect(const ememory::SharedPtr<PARENT_CLASS_TYPE>& _class,
|
||||
void (CLASS_TYPE::*_func)(const T_ARGS&..., FUNC_ARGS_TYPE...),
|
||||
FUNC_ARGS_TYPE... _args) {
|
||||
if (m_data == nullptr) {
|
||||
if (m_data == null) {
|
||||
return;
|
||||
}
|
||||
ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data);
|
||||
@ -261,7 +261,7 @@ namespace esignal {
|
||||
* @param[in] _args Argument data to emit.
|
||||
*/
|
||||
void emit(const T_ARGS&... _args) {
|
||||
if (m_data == nullptr) {
|
||||
if (m_data == null) {
|
||||
return;
|
||||
}
|
||||
ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data);
|
||||
@ -273,7 +273,7 @@ namespace esignal {
|
||||
* @param[in] _obj Link with the object to check
|
||||
*/
|
||||
void disconnectShared(const ememory::SharedPtr<void>& _obj) override {
|
||||
if (m_data == nullptr) {
|
||||
if (m_data == null) {
|
||||
return;;
|
||||
}
|
||||
m_data->disconnectShared(_obj);
|
||||
@ -283,7 +283,7 @@ namespace esignal {
|
||||
* @return The count of observer.
|
||||
*/
|
||||
size_t size() const {
|
||||
if (m_data == nullptr) {
|
||||
if (m_data == null) {
|
||||
return 0;
|
||||
}
|
||||
return m_data->size();
|
||||
@ -294,7 +294,7 @@ namespace esignal {
|
||||
* @return false No observers.
|
||||
*/
|
||||
bool empty() const {
|
||||
if (m_data == nullptr) {
|
||||
if (m_data == null) {
|
||||
return true;
|
||||
}
|
||||
return m_data->empty();
|
||||
@ -303,7 +303,7 @@ namespace esignal {
|
||||
* @brief Clear all connectd observers.
|
||||
*/
|
||||
void clear() {
|
||||
if (m_data == nullptr) {
|
||||
if (m_data == null) {
|
||||
return;
|
||||
}
|
||||
m_data->clear();
|
||||
@ -319,7 +319,7 @@ esignal::Connection esignal::SignalInternal<T_ARGS...>::connect(OBSERVER_TYPE&&
|
||||
ememory::UniquePtr<Executor> executer(ETK_NEW(Executor, etk::forward<OBSERVER_TYPE>(_observer)));
|
||||
size_t uid = executer->m_uid;
|
||||
m_executors.pushBack(etk::move(executer));
|
||||
if (m_connectionObserver!=nullptr) {
|
||||
if (m_connectionObserver!=null) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
ESIGNAL_DEBUG(" '" << getName() << "' new count: " << m_executors.size());
|
||||
@ -332,8 +332,8 @@ esignal::Connection esignal::SignalInternal<T_ARGS...>::connect(CLASS_TYPE* _cla
|
||||
FUNC_TYPE _func,
|
||||
FUNC_ARGS_TYPE... _arg) {
|
||||
ESIGNAL_DEBUG("esignal: '" << getName() << "' try connect: '" << getName() << "' (reference)");
|
||||
if (_class == nullptr) {
|
||||
ESIGNAL_ERROR(" '" << getName() << "' Class pointer in nullptr");
|
||||
if (_class == null) {
|
||||
ESIGNAL_ERROR(" '" << getName() << "' Class pointer in null");
|
||||
return esignal::Connection();
|
||||
}
|
||||
ememory::UniquePtr<Executor> executer(ETK_NEW(Executor, [=](const T_ARGS& ... _argBase){
|
||||
@ -341,7 +341,7 @@ esignal::Connection esignal::SignalInternal<T_ARGS...>::connect(CLASS_TYPE* _cla
|
||||
}));
|
||||
size_t uid = executer->m_uid;
|
||||
m_executors.pushBack(etk::move(executer));
|
||||
if (m_connectionObserver != nullptr) {
|
||||
if (m_connectionObserver != null) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
ESIGNAL_DEBUG(" '" << getName() << "' new count: " << m_executors.size());
|
||||
@ -354,12 +354,12 @@ void esignal::SignalInternal<T_ARGS...>::connect(const ememory::SharedPtr<PARENT
|
||||
void (CLASS_TYPE::*_func)(const T_ARGS&..., FUNC_ARGS_TYPE...),
|
||||
FUNC_ARGS_TYPE... _args) {
|
||||
ESIGNAL_DEBUG("esignal: '" << getName() << "' try connect: '" << getName() << "' (weak pointer)");
|
||||
if (_class == nullptr) {
|
||||
ESIGNAL_ERROR(" '" << getName() << "' Class pointer in nullptr");
|
||||
if (_class == null) {
|
||||
ESIGNAL_ERROR(" '" << getName() << "' Class pointer in null");
|
||||
return;
|
||||
}
|
||||
ememory::SharedPtr<CLASS_TYPE> obj2 = ememory::dynamicPointerCast<CLASS_TYPE>(_class);
|
||||
if (obj2 == nullptr) {
|
||||
if (obj2 == null) {
|
||||
ESIGNAL_ERROR("Can not connect signal ...");
|
||||
return;
|
||||
}
|
||||
@ -369,7 +369,7 @@ void esignal::SignalInternal<T_ARGS...>::connect(const ememory::SharedPtr<PARENT
|
||||
(*directPointer.*_func)(_argBase..., _args... );
|
||||
}));
|
||||
m_executors.pushBack(etk::move(executer));
|
||||
if (m_connectionObserver!=nullptr) {
|
||||
if (m_connectionObserver!=null) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
ESIGNAL_DEBUG(" '" << getName() << "' new count: " << m_executors.size());
|
||||
@ -384,20 +384,20 @@ esignal::Signal<T_ARGS...>::Signal(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
const etk::String& _name,
|
||||
const etk::String& _description):
|
||||
m_signalInterfaceLink(nullptr) {
|
||||
m_signalInterfaceLink(null) {
|
||||
// nothing to do
|
||||
if (_func != nullptr) {
|
||||
if (_func != null) {
|
||||
esignal::Base::m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>([=](size_t _val){(*_class.*_func)(_val);});
|
||||
} else {
|
||||
esignal::Base::m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(nullptr);
|
||||
esignal::Base::m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(null);
|
||||
}
|
||||
if (esignal::Base::m_data != nullptr) {
|
||||
if (esignal::Base::m_data != null) {
|
||||
esignal::Base::m_data->setName(_name);
|
||||
esignal::Base::m_data->setDescription(_description);
|
||||
}
|
||||
m_signalInterfaceLink = _class;
|
||||
// add a reference on the current signal ...
|
||||
if (m_signalInterfaceLink != nullptr) {
|
||||
if (m_signalInterfaceLink != null) {
|
||||
m_signalInterfaceLink->signals.add(this);
|
||||
}
|
||||
}
|
||||
@ -410,14 +410,14 @@ esignal::Signal<T_ARGS...>::Signal(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
const etk::String& _name,
|
||||
const etk::String& _description):
|
||||
m_signalInterfaceLink(nullptr) {
|
||||
m_signalInterfaceLink(null) {
|
||||
// nothing to do
|
||||
if (_func != nullptr) {
|
||||
if (_func != null) {
|
||||
esignal::Base::m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>([=](size_t _val){(*_class.*_func)(_val);});
|
||||
} else {
|
||||
esignal::Base::m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(nullptr);
|
||||
esignal::Base::m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(null);
|
||||
}
|
||||
if (esignal::Base::m_data != nullptr) {
|
||||
if (esignal::Base::m_data != null) {
|
||||
esignal::Base::m_data->setName(_name);
|
||||
esignal::Base::m_data->setDescription(_description);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
template<class... T_ARGS>
|
||||
esignal::Signal<T_ARGS...>::~Signal() {
|
||||
if (m_signalInterfaceLink != nullptr) {
|
||||
if (m_signalInterfaceLink != null) {
|
||||
m_signalInterfaceLink->signals.remove(this);
|
||||
}
|
||||
}
|
||||
@ -19,10 +19,10 @@ esignal::Signal<T_ARGS...>::Signal(esignal::BaseInternal::ObserverConnection _co
|
||||
const etk::String& _name,
|
||||
const etk::String& _description):
|
||||
esignal::Base(),
|
||||
m_signalInterfaceLink(nullptr) {
|
||||
m_signalInterfaceLink(null) {
|
||||
// create internal data assiciated:
|
||||
m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(etk::move(_countObs));
|
||||
if (esignal::Base::m_data != nullptr) {
|
||||
if (esignal::Base::m_data != null) {
|
||||
esignal::Base::m_data->setName(_name);
|
||||
esignal::Base::m_data->setDescription(_description);
|
||||
}
|
||||
@ -34,13 +34,13 @@ esignal::Signal<T_ARGS...>::Signal(esignal::Interface* _signalInterfaceLink,
|
||||
const etk::String& _description):
|
||||
m_signalInterfaceLink(_signalInterfaceLink) {
|
||||
// create internal data assiciated:
|
||||
m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(nullptr);
|
||||
if (esignal::Base::m_data != nullptr) {
|
||||
m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(null);
|
||||
if (esignal::Base::m_data != null) {
|
||||
esignal::Base::m_data->setName(_name);
|
||||
esignal::Base::m_data->setDescription(_description);
|
||||
}
|
||||
// add a reference on the current signal ...
|
||||
if (m_signalInterfaceLink != nullptr) {
|
||||
if (m_signalInterfaceLink != null) {
|
||||
m_signalInterfaceLink->signals.add(this);
|
||||
}
|
||||
}
|
||||
@ -67,7 +67,7 @@ void esignal::SignalInternal<T_ARGS...>::emit(const T_ARGS&... _args) {
|
||||
bool haveRemove = false;
|
||||
auto it = m_executors.begin();
|
||||
while (it != m_executors.end()) {
|
||||
if ( *it == nullptr
|
||||
if ( *it == null
|
||||
|| (*it)->m_removed == true) {
|
||||
it = m_executors.erase(it);
|
||||
haveRemove = true;
|
||||
@ -76,7 +76,7 @@ void esignal::SignalInternal<T_ARGS...>::emit(const T_ARGS&... _args) {
|
||||
++it;
|
||||
}
|
||||
if (haveRemove == true) {
|
||||
if (m_connectionObserver!=nullptr) {
|
||||
if (m_connectionObserver!=null) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
}
|
||||
@ -92,7 +92,7 @@ void esignal::SignalInternal<T_ARGS...>::removeIfPossible() {
|
||||
bool haveRemove = false;
|
||||
auto it = m_executors.begin();
|
||||
while (it != m_executors.end()) {
|
||||
if ( *it == nullptr
|
||||
if ( *it == null
|
||||
|| (*it)->m_removed == true) {
|
||||
it = m_executors.erase(it);
|
||||
haveRemove = true;
|
||||
@ -101,7 +101,7 @@ void esignal::SignalInternal<T_ARGS...>::removeIfPossible() {
|
||||
++it;
|
||||
}
|
||||
if (haveRemove == true) {
|
||||
if (m_connectionObserver!=nullptr) {
|
||||
if (m_connectionObserver!=null) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
}
|
||||
@ -186,7 +186,7 @@ template<typename... T_ARGS>
|
||||
void esignal::SignalInternal<T_ARGS...>::ExecutorShared::emit(const T_ARGS&... _values) {
|
||||
// TODO: maybe an error if the object is not manage by the same thread.
|
||||
ememory::SharedPtr<void> destObject = m_object.lock();
|
||||
if (destObject == nullptr) {
|
||||
if (destObject == null) {
|
||||
Executor::m_removed = true;
|
||||
return;
|
||||
}
|
||||
@ -203,7 +203,7 @@ void esignal::SignalInternal<T_ARGS...>::ExecutorShared::emit(const T_ARGS&... _
|
||||
template<typename... T_ARGS>
|
||||
bool esignal::SignalInternal<T_ARGS...>::ExecutorShared::isSharedPtr(const ememory::SharedPtr<void>& _obj) {
|
||||
ememory::SharedPtr<void> destObject = m_object.lock();
|
||||
if (destObject == nullptr) {
|
||||
if (destObject == null) {
|
||||
return true;
|
||||
}
|
||||
if (destObject == _obj) {
|
||||
|
@ -105,7 +105,7 @@ TEST(test_isignal_counter, localbasicInterfaceGetListSignal) {
|
||||
|
||||
TEST(test_isignal_counter, localbasicInterfaceDisconnectNullPtr) {
|
||||
testISignal localClass;
|
||||
localClass.signals.disconnect(nullptr);
|
||||
localClass.signals.disconnect(null);
|
||||
}
|
||||
|
||||
TEST(test_isignal_counter, localbasicInterfaceDisconnectSharedPtr) {
|
||||
|
@ -19,7 +19,7 @@ class testCallback {
|
||||
etk::String m_string;
|
||||
bool m_void;
|
||||
testCallback() {
|
||||
m_emptyFunctor = nullptr;
|
||||
m_emptyFunctor = null;
|
||||
m_void = false;
|
||||
m_int32 = 0;
|
||||
m_string = "";
|
||||
@ -105,7 +105,7 @@ TEST(test_signal_class_func, localbasicNameDesc) {
|
||||
}
|
||||
|
||||
TEST(test_signal_class_func, localNullClass) {
|
||||
testCallback* localClass = nullptr;
|
||||
testCallback* localClass = null;
|
||||
esignal::Signal<> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
|
@ -19,7 +19,7 @@ class testCallbackShared : public ememory::EnableSharedFromThis<testCallbackShar
|
||||
etk::String m_string;
|
||||
bool m_void;
|
||||
testCallbackShared() {
|
||||
m_emptyFunctor = nullptr;
|
||||
m_emptyFunctor = null;
|
||||
m_void = false;
|
||||
m_int32 = 0;
|
||||
m_string = "";
|
||||
|
Loading…
Reference in New Issue
Block a user