icinga2/icinga/endpoint.cpp

64 lines
1.4 KiB
C++
Raw Normal View History

#include "i2-icinga.h"
using namespace icinga;
2012-04-18 15:22:25 +02:00
EndpointManager::Ptr Endpoint::GetEndpointManager(void) const
{
return m_EndpointManager;
}
void Endpoint::SetEndpointManager(EndpointManager::Ptr manager)
{
m_EndpointManager = manager;
}
2012-04-16 16:27:41 +02:00
void Endpoint::RegisterMethodSink(string method)
{
2012-04-16 16:27:41 +02:00
m_MethodSinks.insert(method);
}
2012-04-16 16:27:41 +02:00
void Endpoint::UnregisterMethodSink(string method)
{
2012-04-16 16:27:41 +02:00
m_MethodSinks.erase(method);
}
2012-04-18 15:22:25 +02:00
bool Endpoint::IsMethodSink(string method) const
{
2012-04-16 16:27:41 +02:00
return (m_MethodSinks.find(method) != m_MethodSinks.end());
}
2012-04-18 15:22:25 +02:00
void Endpoint::ForeachMethodSink(function<int (const NewMethodEventArgs&)> callback)
{
for (set<string>::iterator i = m_MethodSinks.begin(); i != m_MethodSinks.end(); i++) {
NewMethodEventArgs nmea;
nmea.Source = shared_from_this();
nmea.Method = *i;
callback(nmea);
}
}
2012-04-16 16:27:41 +02:00
void Endpoint::RegisterMethodSource(string method)
{
m_MethodSources.insert(method);
}
void Endpoint::UnregisterMethodSource(string method)
{
m_MethodSources.erase(method);
}
2012-04-18 15:22:25 +02:00
bool Endpoint::IsMethodSource(string method) const
2012-04-16 16:27:41 +02:00
{
return (m_MethodSources.find(method) != m_MethodSinks.end());
}
2012-04-18 15:22:25 +02:00
void Endpoint::ForeachMethodSource(function<int (const NewMethodEventArgs&)> callback)
{
for (set<string>::iterator i = m_MethodSources.begin(); i != m_MethodSources.end(); i++) {
NewMethodEventArgs nmea;
nmea.Source = shared_from_this();
nmea.Method = *i;
callback(nmea);
}
}