win32.h
libbase_la_LIBADD=$(LIBLTDL)
-libbase_la_LDFLAGS=-pthread
AM_CFLAGS=$(LTDLINCL)
AM_CXXFLAGS=$(LTDLINCL)
list<DelegateType> m_Delegates;
public:
- void bind(const DelegateType& delegate)
+ void hook(const DelegateType& delegate)
{
m_Delegates.push_front(delegate);
}
- void unbind(const DelegateType& delegate)
+ void unhook(const DelegateType& delegate)
{
m_Delegates.remove(delegate);
}
+ event<TArgs>& operator +=(const DelegateType& rhs)
+ {
+ hook(rhs);
+ return *this;
+ }
+
+ event<TArgs>& operator -=(const DelegateType& rhs)
+ {
+ unhook(rhs);
+ return *this;
+ }
+
void operator()(const TArgs& args)
{
typename list<DelegateType>::iterator prev, i;
{
TCPSocket::Start();
- function<int (EventArgs::Ptr)> rd = bind_weak(&TCPClient::ReadableEventHandler, shared_from_this());
- OnReadable.bind(rd);
-
- function<int (EventArgs::Ptr)> wd = bind_weak(&TCPClient::WritableEventHandler, shared_from_this());
- OnWritable.bind(wd);
+ OnReadable += bind_weak(&TCPClient::ReadableEventHandler, shared_from_this());
+ OnWritable += bind_weak(&TCPClient::WritableEventHandler, shared_from_this());
}
FIFO::Ptr TCPClient::GetSendQueue(void)
{
TCPSocket::Start();
- function<int (EventArgs::Ptr)> dr = bind_weak(&TCPServer::ReadableEventHandler, shared_from_this());
- OnReadable.bind(dr);
+ OnReadable += bind_weak(&TCPServer::ReadableEventHandler, shared_from_this());
}
void TCPServer::Listen(void)
libconfigrpccomponent_la_CXXFLAGS = -I${top_srcdir}/base -I${top_srcdir}/jsonrpc -I${top_srcdir}/icinga
-libconfigrpccomponent_la_LDFLAGS = -module -version-info 0:0:0 -no-undefined
+libconfigrpccomponent_la_LDFLAGS = -module -version-info 0:0:0 -no-undefined -pthread
libconfigrpccomponent_la_LIBADD = ${top_builddir}/base/libbase.la ${top_builddir}/jsonrpc/libjsonrpc.la
if (GetConfig()->GetPropertyInteger("configSource", &configSource) && configSource != 0) {
connectionManager->RegisterMethod("config::FetchObjects", bind_weak(&ConfigRpcComponent::FetchObjectsHandler, shared_from_this()));
- configHive->OnObjectCreated.bind(bind_weak(&ConfigRpcComponent::LocalObjectCreatedHandler, shared_from_this()));
- configHive->OnObjectRemoved.bind(bind_weak(&ConfigRpcComponent::LocalObjectRemovedHandler, shared_from_this()));
- configHive->OnPropertyChanged.bind(bind_weak(&ConfigRpcComponent::LocalPropertyChangedHandler, shared_from_this()));
+ configHive->OnObjectCreated += bind_weak(&ConfigRpcComponent::LocalObjectCreatedHandler, shared_from_this());
+ configHive->OnObjectRemoved += bind_weak(&ConfigRpcComponent::LocalObjectRemovedHandler, shared_from_this());
+ configHive->OnPropertyChanged += bind_weak(&ConfigRpcComponent::LocalPropertyChangedHandler, shared_from_this());
}
connectionManager->RegisterMethod("config::ObjectCreated", bind_weak(&ConfigRpcComponent::RemoteObjectCreatedHandler, shared_from_this()));
string componentDirectory = GetExeDirectory() + "/../lib/icinga";
AddComponentSearchDir(componentDirectory);
- GetConfigHive()->OnObjectCreated.bind(bind_weak(&IcingaApplication::ConfigObjectCreatedHandler, shared_from_this()));
- GetConfigHive()->OnObjectRemoved.bind(bind_weak(&IcingaApplication::ConfigObjectRemovedHandler, shared_from_this()));
+ GetConfigHive()->OnObjectCreated += bind_weak(&IcingaApplication::ConfigObjectCreatedHandler, shared_from_this());
+ GetConfigHive()->OnObjectRemoved += bind_weak(&IcingaApplication::ConfigObjectRemovedHandler, shared_from_this());
ConfigObject::Ptr fileComponentConfig = new_object<ConfigObject>();
fileComponentConfig->SetName("configfilecomponent");
void ConnectionManager::RegisterServer(JsonRpcServer::Ptr server)
{
m_Servers.push_front(server);
- server->OnNewClient.bind(bind_weak(&ConnectionManager::NewClientHandler, shared_from_this()));
+ server->OnNewClient += bind_weak(&ConnectionManager::NewClientHandler, shared_from_this());
}
void ConnectionManager::UnregisterServer(JsonRpcServer::Ptr server)
void ConnectionManager::RegisterClient(JsonRpcClient::Ptr client)
{
m_Clients.push_front(client);
- client->OnNewMessage.bind(bind_weak(&ConnectionManager::NewMessageHandler, shared_from_this()));
+ client->OnNewMessage += bind_weak(&ConnectionManager::NewMessageHandler, shared_from_this());
}
void ConnectionManager::UnregisterClient(JsonRpcClient::Ptr client)
i = m_Methods.find(method);
}
- i->second.bind(callback);
+ i->second += callback;
}
void ConnectionManager::UnregisterMethod(string method, function<int (NewMessageEventArgs::Ptr)> function)
{
TCPClient::Start();
- OnDataAvailable.bind(bind_weak(&JsonRpcClient::DataAvailableHandler, shared_from_this()));
+ OnDataAvailable += bind_weak(&JsonRpcClient::DataAvailableHandler, shared_from_this());
}
void JsonRpcClient::SendMessage(JsonRpcMessage::Ptr message)