data: lambda handling

* implemented handling lambdas as functions
* functions can have child nodes now
* NameElements in NameHierarchy can have signatures now.
* fixed crash that occurred when message listener was used while being half way through its destruction process.
This commit is contained in:
malte_langkabel
2015-12-10 18:00:54 +01:00
parent 2b03215ea4
commit 01bcf7266b
22 changed files with 238 additions and 568 deletions
+3 -3
View File
@@ -15,17 +15,17 @@ public:
{
}
virtual std::string getType() const
private:
virtual std::string doGetType() const
{
return MessageType::getStaticType();
}
virtual void handleMessageBase(MessageBase* message)
virtual void doHandleMessageBase(MessageBase* message)
{
handleMessage(dynamic_cast<MessageType*>(message));
}
private:
virtual void handleMessage(MessageType* message) = 0;
};
@@ -12,12 +12,14 @@ class MessageListenerBase
public:
MessageListenerBase()
: m_id(s_nextId++)
, m_alive(true)
{
MessageQueue::getInstance()->registerListener(this);
}
virtual ~MessageListenerBase()
{
m_alive = false;
MessageQueue::getInstance()->unregisterListener(this);
}
@@ -26,14 +28,31 @@ public:
return m_id;
}
virtual std::string getType() const = 0;
std::string getType() const
{
if (m_alive)
{
return doGetType();
}
return "";
}
virtual void handleMessageBase(MessageBase*) = 0;
void handleMessageBase(MessageBase* message)
{
if (m_alive)
{
doHandleMessageBase(message);
}
}
private:
virtual std::string doGetType() const = 0;
virtual void doHandleMessageBase(MessageBase*) = 0;
static uint s_nextId;
uint m_id;
bool m_alive;
};
#endif // MESSAGE_LISTENER_BASE_H