From 858873b9404091f2ced59feea7279e3efda10207 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 21 Nov 2017 11:52:55 +0100 Subject: [PATCH] Replace boost::bind/boost::function with std::bind/std::function --- icinga-studio/mainform.cpp | 12 ++-- lib/base/application.cpp | 2 +- lib/base/array-script.cpp | 2 +- lib/base/configobject.cpp | 4 +- lib/base/configobject.hpp | 2 +- lib/base/filelogger.cpp | 2 +- lib/base/function.hpp | 3 +- lib/base/functionwrapper.cpp | 4 +- lib/base/functionwrapper.hpp | 82 +++++++++++----------- lib/base/i2-base.hpp | 5 ++ lib/base/loader.cpp | 2 +- lib/base/loader.hpp | 7 +- lib/base/object.cpp | 2 +- lib/base/process.cpp | 8 +-- lib/base/process.hpp | 5 +- lib/base/scriptutils.cpp | 4 +- lib/base/socketevents.cpp | 2 +- lib/base/statsfunction.hpp | 3 +- lib/base/stream.cpp | 4 +- lib/base/stream.hpp | 2 +- lib/base/streamlogger.cpp | 2 +- lib/base/threadpool.cpp | 2 +- lib/base/timer.cpp | 3 +- lib/base/tlsstream.cpp | 1 - lib/base/type.hpp | 3 +- lib/base/typetype-script.cpp | 2 +- lib/base/utility.cpp | 7 +- lib/base/utility.hpp | 5 +- lib/base/workqueue.cpp | 7 +- lib/base/workqueue.hpp | 9 ++- lib/checker/checkercomponent.cpp | 12 ++-- lib/cli/consolecommand.cpp | 4 +- lib/cli/daemonutility.cpp | 10 +-- lib/cli/featureutility.cpp | 6 +- lib/cli/troubleshootcommand.cpp | 2 +- lib/compat/checkresultreader.cpp | 4 +- lib/compat/compatlogger.cpp | 18 ++--- lib/compat/externalcommandlistener.cpp | 2 +- lib/compat/statusdatawriter.cpp | 6 +- lib/config/applyrule.hpp | 1 - lib/config/configcompiler.cpp | 8 +-- lib/config/configcompiler.hpp | 1 - lib/config/configitem.cpp | 4 +- lib/config/vmops.hpp | 2 +- lib/db_ido/dbconnection.cpp | 10 +-- lib/db_ido/dbevents.cpp | 70 +++++++++--------- lib/db_ido/dbobject.cpp | 6 +- lib/db_ido/dbtype.hpp | 2 +- lib/db_ido/endpointdbobject.cpp | 4 +- lib/db_ido_mysql/idomysqlconnection.cpp | 42 +++++------ lib/db_ido_mysql/idomysqlconnection.hpp | 2 +- lib/db_ido_pgsql/idopgsqlconnection.cpp | 34 ++++----- lib/demo/demo.cpp | 2 +- lib/icinga/checkable.cpp | 6 +- lib/icinga/comment.cpp | 2 +- lib/icinga/downtime.cpp | 4 +- lib/icinga/externalcommandprocessor.cpp | 2 +- lib/icinga/externalcommandprocessor.hpp | 1 - lib/icinga/icingaapplication.cpp | 4 +- lib/icinga/macroprocessor.cpp | 4 +- lib/icinga/macroprocessor.hpp | 3 +- lib/icinga/notification.cpp | 2 +- lib/icinga/pluginutility.cpp | 4 +- lib/icinga/pluginutility.hpp | 2 +- lib/icinga/scheduleddowntime.cpp | 4 +- lib/icinga/timeperiod.cpp | 2 +- lib/livestatus/column.cpp | 2 +- lib/livestatus/column.hpp | 5 +- lib/livestatus/commentstable.cpp | 4 +- lib/livestatus/downtimestable.cpp | 4 +- lib/livestatus/hoststable.cpp | 2 +- lib/livestatus/livestatuslistener.cpp | 6 +- lib/livestatus/livestatuslogutility.cpp | 4 +- lib/livestatus/logtable.cpp | 8 +-- lib/livestatus/servicestable.cpp | 6 +- lib/livestatus/statehisttable.cpp | 4 +- lib/livestatus/table.cpp | 3 +- lib/livestatus/table.hpp | 3 +- lib/methods/pluginchecktask.cpp | 2 +- lib/methods/plugineventtask.cpp | 2 +- lib/methods/pluginnotificationtask.cpp | 2 +- lib/notification/notificationcomponent.cpp | 4 +- lib/perfdata/elasticsearchwriter.cpp | 17 ++--- lib/perfdata/gelfwriter.cpp | 18 ++--- lib/perfdata/graphitewriter.cpp | 14 ++-- lib/perfdata/influxdbwriter.cpp | 8 +-- lib/perfdata/opentsdbwriter.cpp | 4 +- lib/perfdata/perfdatawriter.cpp | 4 +- lib/remote/apiaction.hpp | 3 +- lib/remote/apiclient.cpp | 8 +-- lib/remote/apiclient.hpp | 8 +-- lib/remote/apifunction.hpp | 3 +- lib/remote/apilistener-filesync.cpp | 2 +- lib/remote/apilistener.cpp | 26 +++---- lib/remote/configpackageutility.cpp | 8 +-- lib/remote/consolehandler.cpp | 2 +- lib/remote/filterutility.cpp | 4 +- lib/remote/filterutility.hpp | 4 +- lib/remote/httpclientconnection.cpp | 2 +- lib/remote/httpclientconnection.hpp | 2 +- lib/remote/httphandler.hpp | 1 - lib/remote/httpserverconnection.cpp | 6 +- lib/remote/jsonrpcconnection-heartbeat.cpp | 2 +- lib/remote/jsonrpcconnection.cpp | 6 +- lib/remote/pkiutility.cpp | 2 +- lib/remote/statushandler.cpp | 2 +- lib/remote/templatequeryhandler.cpp | 2 +- lib/remote/typequeryhandler.cpp | 2 +- lib/remote/variablequeryhandler.cpp | 2 +- plugins/check_disk.cpp | 2 +- plugins/check_nscp_api.cpp | 2 +- test/base-timer.cpp | 4 +- test/icinga-checkresult.cpp | 22 +++--- 113 files changed, 365 insertions(+), 378 deletions(-) diff --git a/icinga-studio/mainform.cpp b/icinga-studio/mainform.cpp index 9c4af4da1..5f226b4fc 100644 --- a/icinga-studio/mainform.cpp +++ b/icinga-studio/mainform.cpp @@ -39,7 +39,7 @@ MainForm::MainForm(wxWindow *parent, const Url::Ptr& url) port = "5665"; m_ApiClient = new ApiClient(url->GetHost(), port, url->GetUsername(), url->GetPassword()); - m_ApiClient->GetTypes(boost::bind(&MainForm::TypesCompletionHandler, this, _1, _2, true)); + m_ApiClient->GetTypes(std::bind(&MainForm::TypesCompletionHandler, this, _1, _2, true)); std::string title = url->Format() + " - Icinga Studio"; SetTitle(title); @@ -52,7 +52,7 @@ MainForm::MainForm(wxWindow *parent, const Url::Ptr& url) void MainForm::TypesCompletionHandler(boost::exception_ptr eptr, const std::vector& types, bool forward) { if (forward) { - CallAfter(boost::bind(&MainForm::TypesCompletionHandler, this, eptr, types, false)); + CallAfter(std::bind(&MainForm::TypesCompletionHandler, this, eptr, types, false)); return; } @@ -113,7 +113,7 @@ void MainForm::OnTypeSelected(wxTreeEvent& event) std::vector attrs; attrs.push_back("__name"); - m_ApiClient->GetObjects(type->PluralName, boost::bind(&MainForm::ObjectsCompletionHandler, this, _1, _2, true), + m_ApiClient->GetObjects(type->PluralName, std::bind(&MainForm::ObjectsCompletionHandler, this, _1, _2, true), std::vector(), attrs); } @@ -125,7 +125,7 @@ static bool ApiObjectLessComparer(const ApiObject::Ptr& o1, const ApiObject::Ptr void MainForm::ObjectsCompletionHandler(boost::exception_ptr eptr, const std::vector& objects, bool forward) { if (forward) { - CallAfter(boost::bind(&MainForm::ObjectsCompletionHandler, this, eptr, objects, false)); + CallAfter(std::bind(&MainForm::ObjectsCompletionHandler, this, eptr, objects, false)); return; } @@ -172,7 +172,7 @@ void MainForm::OnObjectSelected(wxListEvent& event) std::vector names; names.push_back(objectName); - m_ApiClient->GetObjects(type->PluralName, boost::bind(&MainForm::ObjectDetailsCompletionHandler, this, _1, _2, true), + m_ApiClient->GetObjects(type->PluralName, std::bind(&MainForm::ObjectDetailsCompletionHandler, this, _1, _2, true), names, std::vector(), std::vector(), true); } @@ -239,7 +239,7 @@ wxPGProperty *MainForm::ValueToProperty(const String& name, const Value& value) void MainForm::ObjectDetailsCompletionHandler(boost::exception_ptr eptr, const std::vector& objects, bool forward) { if (forward) { - CallAfter(boost::bind(&MainForm::ObjectDetailsCompletionHandler, this, eptr, objects, false)); + CallAfter(std::bind(&MainForm::ObjectDetailsCompletionHandler, this, eptr, objects, false)); return; } diff --git a/lib/base/application.cpp b/lib/base/application.cpp index ce4982e2a..43a69e893 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -394,7 +394,7 @@ static void ReloadProcessCallback(const ProcessResult& pr) { l_Restarting = false; - boost::thread t(boost::bind(&ReloadProcessCallbackInternal, pr)); + boost::thread t(std::bind(&ReloadProcessCallbackInternal, pr)); t.detach(); } diff --git a/lib/base/array-script.cpp b/lib/base/array-script.cpp index 568037d9e..1e9fd9965 100644 --- a/lib/base/array-script.cpp +++ b/lib/base/array-script.cpp @@ -100,7 +100,7 @@ static Array::Ptr ArraySort(const std::vector& args) BOOST_THROW_EXCEPTION(ScriptError("Sort function must be side-effect free.")); ObjectLock olock(arr); - std::sort(arr->Begin(), arr->End(), boost::bind(ArraySortCmp, args[0], _1, _2)); + std::sort(arr->Begin(), arr->End(), std::bind(ArraySortCmp, args[0], _1, _2)); } return arr; diff --git a/lib/base/configobject.cpp b/lib/base/configobject.cpp index 616aee8d5..55b780e13 100644 --- a/lib/base/configobject.cpp +++ b/lib/base/configobject.cpp @@ -594,7 +594,7 @@ void ConfigObject::RestoreObjects(const String& filename, int attributeTypes) if (srs != StatusNewItem) continue; - upq.Enqueue(boost::bind(&ConfigObject::RestoreObject, message, attributeTypes)); + upq.Enqueue(std::bind(&ConfigObject::RestoreObject, message, attributeTypes)); restored++; } @@ -638,7 +638,7 @@ void ConfigObject::StopObjects(void) } } -void ConfigObject::DumpModifiedAttributes(const boost::function& callback) +void ConfigObject::DumpModifiedAttributes(const std::function& callback) { for (const Type::Ptr& type : Type::GetAllTypes()) { ConfigType *dtype = dynamic_cast(type.get()); diff --git a/lib/base/configobject.hpp b/lib/base/configobject.hpp index 160594143..e47ba393e 100644 --- a/lib/base/configobject.hpp +++ b/lib/base/configobject.hpp @@ -92,7 +92,7 @@ public: static void RestoreObjects(const String& filename, int attributeTypes = FAState); static void StopObjects(void); - static void DumpModifiedAttributes(const boost::function& callback); + static void DumpModifiedAttributes(const std::function& callback); static Object::Ptr GetPrototype(void); diff --git a/lib/base/filelogger.cpp b/lib/base/filelogger.cpp index 233692a25..a54058097 100644 --- a/lib/base/filelogger.cpp +++ b/lib/base/filelogger.cpp @@ -50,7 +50,7 @@ void FileLogger::Start(bool runtimeCreated) ReopenLogFile(); - Application::OnReopenLogs.connect(boost::bind(&FileLogger::ReopenLogFile, this)); + Application::OnReopenLogs.connect(std::bind(&FileLogger::ReopenLogFile, this)); } void FileLogger::ReopenLogFile(void) diff --git a/lib/base/function.hpp b/lib/base/function.hpp index faf64ad92..ed88db18b 100644 --- a/lib/base/function.hpp +++ b/lib/base/function.hpp @@ -26,7 +26,6 @@ #include "base/functionwrapper.hpp" #include "base/scriptglobal.hpp" #include -#include namespace icinga { @@ -41,7 +40,7 @@ class I2_BASE_API Function : public ObjectImpl public: DECLARE_OBJECT(Function); - typedef boost::function& arguments)> Callback; + typedef std::function& arguments)> Callback; Function(const String& name, const Callback& function, const std::vector& args = std::vector(), bool side_effect_free = false, bool deprecated = false); diff --git a/lib/base/functionwrapper.cpp b/lib/base/functionwrapper.cpp index 007588b5d..f99a0f73a 100644 --- a/lib/base/functionwrapper.cpp +++ b/lib/base/functionwrapper.cpp @@ -35,7 +35,7 @@ Value icinga::FunctionWrapperVA(void (*function)(const std::vector&), con return Empty; } -boost::function& arguments)> icinga::WrapFunction(void (*function)(void)) +std::function& arguments)> icinga::WrapFunction(void (*function)(void)) { - return boost::bind(&FunctionWrapperVV, function, _1); + return std::bind(&FunctionWrapperVV, function, _1); } diff --git a/lib/base/functionwrapper.hpp b/lib/base/functionwrapper.hpp index af479cd40..835a79961 100644 --- a/lib/base/functionwrapper.hpp +++ b/lib/base/functionwrapper.hpp @@ -23,8 +23,8 @@ #include "base/i2-base.hpp" #include "base/value.hpp" #include -#include -#include + +using namespace std::placeholders; namespace icinga { @@ -32,7 +32,7 @@ namespace icinga Value FunctionWrapperVV(void (*function)(void), const std::vector& arguments); Value FunctionWrapperVA(void (*function)(const std::vector&), const std::vector& arguments); -boost::function& arguments)> I2_BASE_API WrapFunction(void (*function)(void)); +std::function& arguments)> I2_BASE_API WrapFunction(void (*function)(void)); template Value FunctionWrapperR(TR (*function)(void), const std::vector&) @@ -41,9 +41,9 @@ Value FunctionWrapperR(TR (*function)(void), const std::vector&) } template -boost::function& arguments)> WrapFunction(TR (*function)(void)) +std::function& arguments)> WrapFunction(TR (*function)(void)) { - return boost::bind(&FunctionWrapperR, function, _1); + return std::bind(&FunctionWrapperR, function, _1); } template @@ -60,9 +60,9 @@ Value FunctionWrapperV(void (*function)(T0), const std::vector& arguments } template -boost::function& arguments)> WrapFunction(void (*function)(T0)) +std::function& arguments)> WrapFunction(void (*function)(T0)) { - return boost::bind(&FunctionWrapperV, function, _1); + return std::bind(&FunctionWrapperV, function, _1); } template @@ -77,9 +77,9 @@ Value FunctionWrapperR(TR (*function)(T0), const std::vector& arguments) } template -boost::function& arguments)> WrapFunction(TR (*function)(T0)) +std::function& arguments)> WrapFunction(TR (*function)(T0)) { - return boost::bind(&FunctionWrapperR, function, _1); + return std::bind(&FunctionWrapperR, function, _1); } template @@ -97,9 +97,9 @@ Value FunctionWrapperV(void (*function)(T0, T1), const std::vector& argum } template -boost::function& arguments)> WrapFunction(void (*function)(T0, T1)) +std::function& arguments)> WrapFunction(void (*function)(T0, T1)) { - return boost::bind(&FunctionWrapperV, function, _1); + return std::bind(&FunctionWrapperV, function, _1); } template @@ -115,9 +115,9 @@ Value FunctionWrapperR(TR (*function)(T0, T1), const std::vector& argumen } template -boost::function& arguments)> WrapFunction(TR (*function)(T0, T1)) +std::function& arguments)> WrapFunction(TR (*function)(T0, T1)) { - return boost::bind(&FunctionWrapperR, function, _1); + return std::bind(&FunctionWrapperR, function, _1); } template @@ -136,9 +136,9 @@ Value FunctionWrapperV(void (*function)(T0, T1, T2), const std::vector& a } template -boost::function& arguments)> WrapFunction(void (*function)(T0, T1, T2)) +std::function& arguments)> WrapFunction(void (*function)(T0, T1, T2)) { - return boost::bind(&FunctionWrapperV, function, _1); + return std::bind(&FunctionWrapperV, function, _1); } template @@ -155,9 +155,9 @@ Value FunctionWrapperR(TR (*function)(T0, T1, T2), const std::vector& arg } template -boost::function& arguments)> WrapFunction(TR (*function)(T0, T1, T2)) +std::function& arguments)> WrapFunction(TR (*function)(T0, T1, T2)) { - return boost::bind(&FunctionWrapperR, function, _1); + return std::bind(&FunctionWrapperR, function, _1); } template @@ -177,9 +177,9 @@ Value FunctionWrapperV(void (*function)(T0, T1, T2, T3), const std::vector -boost::function& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3)) +std::function& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3)) { - return boost::bind(&FunctionWrapperV, function, _1); + return std::bind(&FunctionWrapperV, function, _1); } template @@ -197,9 +197,9 @@ Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3), const std::vector& } template -boost::function& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3)) +std::function& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3)) { - return boost::bind(&FunctionWrapperR, function, _1); + return std::bind(&FunctionWrapperR, function, _1); } template @@ -220,9 +220,9 @@ Value FunctionWrapperV(void (*function)(T0, T1, T2, T3, T4), const std::vector -boost::function& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4)) +std::function& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4)) { - return boost::bind(&FunctionWrapperV, function, _1); + return std::bind(&FunctionWrapperV, function, _1); } template @@ -241,9 +241,9 @@ Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4), const std::vector -boost::function& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4)) +std::function& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4)) { - return boost::bind(&FunctionWrapperR, function, _1); + return std::bind(&FunctionWrapperR, function, _1); } template @@ -265,9 +265,9 @@ Value FunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5), const std::vect } template -boost::function& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4, T5)) +std::function& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4, T5)) { - return boost::bind(&FunctionWrapperV, function, _1); + return std::bind(&FunctionWrapperV, function, _1); } template @@ -287,9 +287,9 @@ Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5), const std::vector } template -boost::function& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4, T5)) +std::function& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4, T5)) { - return boost::bind(&FunctionWrapperR, function, _1); + return std::bind(&FunctionWrapperR, function, _1); } template @@ -312,9 +312,9 @@ Value FunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5, T6), const std:: } template -boost::function& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4, T5, T6)) +std::function& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4, T5, T6)) { - return boost::bind(&FunctionWrapperV, function, _1); + return std::bind(&FunctionWrapperV, function, _1); } template @@ -335,9 +335,9 @@ Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5, T6), const std::ve } template -boost::function& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4, T5, T6)) +std::function& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4, T5, T6)) { - return boost::bind(&FunctionWrapperR, function, _1); + return std::bind(&FunctionWrapperR, function, _1); } template @@ -361,9 +361,9 @@ Value FunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5, T6, T7), const s } template -boost::function& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4, T5, T6, T7)) +std::function& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4, T5, T6, T7)) { - return boost::bind(&FunctionWrapperV, function, _1); + return std::bind(&FunctionWrapperV, function, _1); } template @@ -385,20 +385,20 @@ Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5, T6, T7), const std } template -boost::function& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4, T5, T6, T7)) +std::function& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4, T5, T6, T7)) { - return boost::bind(&FunctionWrapperR, function, _1); + return std::bind(&FunctionWrapperR, function, _1); } template -boost::function& arguments)> WrapFunction(TR (*function)(const std::vector&)) +std::function& arguments)> WrapFunction(TR (*function)(const std::vector&)) { - return boost::bind(function, _1); + return std::bind(function, _1); } -inline boost::function& arguments)> WrapFunction(void (*function)(const std::vector&)) +inline std::function& arguments)> WrapFunction(void (*function)(const std::vector&)) { - return boost::bind(&FunctionWrapperVA, function, _1); + return std::bind(&FunctionWrapperVA, function, _1); } } diff --git a/lib/base/i2-base.hpp b/lib/base/i2-base.hpp index c48aafbb0..0e71e2c23 100644 --- a/lib/base/i2-base.hpp +++ b/lib/base/i2-base.hpp @@ -105,5 +105,10 @@ # define unlikely(x) (x) #endif +#define BOOST_BIND_NO_PLACEHOLDERS + +#include + +using namespace std::placeholders; #endif /* I2BASE_H */ diff --git a/lib/base/loader.cpp b/lib/base/loader.cpp index 9e2e0074a..9988b609a 100644 --- a/lib/base/loader.cpp +++ b/lib/base/loader.cpp @@ -81,7 +81,7 @@ void Loader::ExecuteDeferredInitializers(void) } } -void Loader::AddDeferredInitializer(const boost::function& callback, int priority) +void Loader::AddDeferredInitializer(const std::function& callback, int priority) { if (!GetDeferredInitializers().get()) GetDeferredInitializers().reset(new std::priority_queue()); diff --git a/lib/base/loader.hpp b/lib/base/loader.hpp index 7421bb9e4..0a05f6214 100644 --- a/lib/base/loader.hpp +++ b/lib/base/loader.hpp @@ -23,7 +23,6 @@ #include "base/i2-base.hpp" #include "base/string.hpp" #include -#include #include namespace icinga @@ -32,7 +31,7 @@ namespace icinga struct DeferredInitializer { public: - DeferredInitializer(const boost::function& callback, int priority) + DeferredInitializer(const std::function& callback, int priority) : m_Callback(callback), m_Priority(priority) { } @@ -47,7 +46,7 @@ public: } private: - boost::function m_Callback; + std::function m_Callback; int m_Priority; }; @@ -61,7 +60,7 @@ class I2_BASE_API Loader public: static void LoadExtensionLibrary(const String& library); - static void AddDeferredInitializer(const boost::function& callback, int priority = 0); + static void AddDeferredInitializer(const std::function& callback, int priority = 0); static void ExecuteDeferredInitializers(void); private: diff --git a/lib/base/object.cpp b/lib/base/object.cpp index e9f3cd1bd..e07afd8aa 100644 --- a/lib/base/object.cpp +++ b/lib/base/object.cpp @@ -256,7 +256,7 @@ static void TypeInfoTimerHandler(void) INITIALIZE_ONCE([]() { l_ObjectCountTimer = new Timer(); l_ObjectCountTimer->SetInterval(10); - l_ObjectCountTimer->OnTimerExpired.connect(boost::bind(TypeInfoTimerHandler)); + l_ObjectCountTimer->OnTimerExpired.connect(std::bind(TypeInfoTimerHandler)); l_ObjectCountTimer->Start(); }); #endif /* I2_LEAK_DEBUG */ diff --git a/lib/base/process.cpp b/lib/base/process.cpp index 44af34a02..3d0cd5d3e 100644 --- a/lib/base/process.cpp +++ b/lib/base/process.cpp @@ -539,7 +539,7 @@ void Process::ThreadInitialize(void) { /* Note to self: Make sure this runs _after_ we've daemonized. */ for (int tid = 0; tid < IOTHREADS; tid++) { - boost::thread t(boost::bind(&Process::IOThreadProc, tid)); + boost::thread t(std::bind(&Process::IOThreadProc, tid)); t.detach(); } } @@ -788,7 +788,7 @@ static BOOL CreatePipeOverlapped(HANDLE *outReadPipe, HANDLE *outWritePipe, } #endif /* _WIN32 */ -void Process::Run(const boost::function& callback) +void Process::Run(const std::function& callback) { #ifndef _WIN32 boost::call_once(l_SpawnHelperOnceFlag, &Process::InitializeSpawnHelper); @@ -930,7 +930,7 @@ void Process::Run(const boost::function& callback) delete [] args; if (callback) - Utility::QueueAsyncCallback(boost::bind(callback, m_Result)); + Utility::QueueAsyncCallback(std::bind(callback, m_Result)); return; } @@ -1131,7 +1131,7 @@ bool Process::DoEvents(void) m_Result.Output = output; if (m_Callback) - Utility::QueueAsyncCallback(boost::bind(m_Callback, m_Result)); + Utility::QueueAsyncCallback(std::bind(m_Callback, m_Result)); return false; } diff --git a/lib/base/process.hpp b/lib/base/process.hpp index e20311f05..9414c68da 100644 --- a/lib/base/process.hpp +++ b/lib/base/process.hpp @@ -22,7 +22,6 @@ #include "base/i2-base.hpp" #include "base/dictionary.hpp" -#include #include #include #include @@ -76,7 +75,7 @@ public: void SetAdjustPriority(bool adjust); bool GetAdjustPriority(void) const; - void Run(const boost::function& callback = boost::function()); + void Run(const std::function& callback = std::function()); pid_t GetPID(void) const; @@ -109,7 +108,7 @@ private: #endif /* _WIN32 */ std::ostringstream m_OutputStream; - boost::function m_Callback; + std::function m_Callback; ProcessResult m_Result; static void IOThreadProc(int tid); diff --git a/lib/base/scriptutils.cpp b/lib/base/scriptutils.cpp index f71b1b869..a35db87c3 100644 --- a/lib/base/scriptutils.cpp +++ b/lib/base/scriptutils.cpp @@ -477,7 +477,7 @@ Value ScriptUtils::Glob(const std::vector& args) type = args[1]; std::vector paths; - Utility::Glob(pathSpec, boost::bind(&GlobCallbackHelper, boost::ref(paths), _1), type); + Utility::Glob(pathSpec, std::bind(&GlobCallbackHelper, boost::ref(paths), _1), type); return Array::FromVector(paths); } @@ -496,7 +496,7 @@ Value ScriptUtils::GlobRecursive(const std::vector& args) type = args[2]; std::vector paths; - Utility::GlobRecursive(path, pattern, boost::bind(&GlobCallbackHelper, boost::ref(paths), _1), type); + Utility::GlobRecursive(path, pattern, std::bind(&GlobCallbackHelper, boost::ref(paths), _1), type); return Array::FromVector(paths); } diff --git a/lib/base/socketevents.cpp b/lib/base/socketevents.cpp index 90b1d4798..00ca0c525 100644 --- a/lib/base/socketevents.cpp +++ b/lib/base/socketevents.cpp @@ -50,7 +50,7 @@ void SocketEventEngine::Start(void) InitializeThread(tid); - m_Threads[tid] = boost::thread(boost::bind(&SocketEventEngine::ThreadProc, this, tid)); + m_Threads[tid] = boost::thread(std::bind(&SocketEventEngine::ThreadProc, this, tid)); } } diff --git a/lib/base/statsfunction.hpp b/lib/base/statsfunction.hpp index 3a8c0240d..c8880d419 100644 --- a/lib/base/statsfunction.hpp +++ b/lib/base/statsfunction.hpp @@ -25,7 +25,6 @@ #include "base/value.hpp" #include "base/dictionary.hpp" #include "base/array.hpp" -#include namespace icinga { @@ -40,7 +39,7 @@ class I2_BASE_API StatsFunction : public Object public: DECLARE_PTR_TYPEDEFS(StatsFunction); - typedef boost::function Callback; + typedef std::function Callback; StatsFunction(const Callback& function); diff --git a/lib/base/stream.cpp b/lib/base/stream.cpp index 9390d97b9..3b1cd5426 100644 --- a/lib/base/stream.cpp +++ b/lib/base/stream.cpp @@ -22,7 +22,7 @@ using namespace icinga; -void Stream::RegisterDataHandler(const boost::function& handler) +void Stream::RegisterDataHandler(const std::function& handler) { if (SupportsWaiting()) OnDataAvailable.connect(handler); @@ -85,7 +85,7 @@ void Stream::Close(void) /* Force signals2 to remove the slots, see https://stackoverflow.com/questions/2049291/force-deletion-of-slot-in-boostsignals2 * for details. */ - OnDataAvailable.connect(boost::bind(&StreamDummyCallback)); + OnDataAvailable.connect(std::bind(&StreamDummyCallback)); } StreamReadStatus Stream::ReadLine(String *line, StreamReadContext& context, bool may_wait) diff --git a/lib/base/stream.hpp b/lib/base/stream.hpp index 6c39e79aa..bf79a7768 100644 --- a/lib/base/stream.hpp +++ b/lib/base/stream.hpp @@ -131,7 +131,7 @@ public: virtual bool IsDataAvailable(void) const; - void RegisterDataHandler(const boost::function& handler); + void RegisterDataHandler(const std::function& handler); StreamReadStatus ReadLine(String *line, StreamReadContext& context, bool may_wait = false); diff --git a/lib/base/streamlogger.cpp b/lib/base/streamlogger.cpp index b6a9bac31..cb36a3d40 100644 --- a/lib/base/streamlogger.cpp +++ b/lib/base/streamlogger.cpp @@ -81,7 +81,7 @@ void StreamLogger::BindStream(std::ostream *stream, bool ownsStream) m_FlushLogTimer = new Timer(); m_FlushLogTimer->SetInterval(1); - m_FlushLogTimer->OnTimerExpired.connect(boost::bind(&StreamLogger::FlushLogTimerHandler, this)); + m_FlushLogTimer->OnTimerExpired.connect(std::bind(&StreamLogger::FlushLogTimerHandler, this)); m_FlushLogTimer->Start(); } diff --git a/lib/base/threadpool.cpp b/lib/base/threadpool.cpp index e13f9b90b..0c2925f9b 100644 --- a/lib/base/threadpool.cpp +++ b/lib/base/threadpool.cpp @@ -54,7 +54,7 @@ void ThreadPool::Start(void) for (size_t i = 0; i < sizeof(m_Queues) / sizeof(m_Queues[0]); i++) m_Queues[i].SpawnWorker(m_ThreadGroup); - m_MgmtThread = boost::thread(boost::bind(&ThreadPool::ManagerThreadProc, this)); + m_MgmtThread = boost::thread(std::bind(&ThreadPool::ManagerThreadProc, this)); } void ThreadPool::Stop(void) diff --git a/lib/base/timer.cpp b/lib/base/timer.cpp index 293003852..9c1a2c4a1 100644 --- a/lib/base/timer.cpp +++ b/lib/base/timer.cpp @@ -20,7 +20,6 @@ #include "base/timer.hpp" #include "base/debug.hpp" #include "base/utility.hpp" -#include #include #include #include @@ -282,6 +281,6 @@ void Timer::TimerThreadProc(void) lock.unlock(); /* Asynchronously call the timer. */ - Utility::QueueAsyncCallback(boost::bind(&Timer::Call, ptimer)); + Utility::QueueAsyncCallback(std::bind(&Timer::Call, ptimer)); } } diff --git a/lib/base/tlsstream.cpp b/lib/base/tlsstream.cpp index 78b1851da..4bb98f5cd 100644 --- a/lib/base/tlsstream.cpp +++ b/lib/base/tlsstream.cpp @@ -21,7 +21,6 @@ #include "base/utility.hpp" #include "base/exception.hpp" #include "base/logger.hpp" -#include #include #ifndef _WIN32 diff --git a/lib/base/type.hpp b/lib/base/type.hpp index 52aa753a5..b6204b4be 100644 --- a/lib/base/type.hpp +++ b/lib/base/type.hpp @@ -24,7 +24,6 @@ #include "base/string.hpp" #include "base/object.hpp" #include "base/initialize.hpp" -#include #include namespace icinga @@ -105,7 +104,7 @@ public: virtual std::vector GetLoadDependencies(void) const; - typedef boost::function AttributeHandler; + typedef std::function AttributeHandler; virtual void RegisterAttributeHandler(int fieldId, const AttributeHandler& callback); protected: diff --git a/lib/base/typetype-script.cpp b/lib/base/typetype-script.cpp index 5189845b3..08d616b2e 100644 --- a/lib/base/typetype-script.cpp +++ b/lib/base/typetype-script.cpp @@ -39,7 +39,7 @@ static void TypeRegisterAttributeHandler(const String& fieldName, const Function Type::Ptr self = static_cast(vframe->Self); int fid = self->GetFieldId(fieldName); - self->RegisterAttributeHandler(fid, boost::bind(&InvokeAttributeHandlerHelper, callback, _1, _2)); + self->RegisterAttributeHandler(fid, std::bind(&InvokeAttributeHandlerHelper, callback, _1, _2)); } Object::Ptr TypeType::GetPrototype(void) diff --git a/lib/base/utility.cpp b/lib/base/utility.cpp index 791c6751c..d98aebbfb 100644 --- a/lib/base/utility.cpp +++ b/lib/base/utility.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #ifdef __FreeBSD__ # include @@ -502,7 +503,7 @@ static int GlobErrorHandler(const char *epath, int eerrno) * @param callback The callback which is invoked for each matching file. * @param type The file type (a combination of GlobFile and GlobDirectory) */ -bool Utility::Glob(const String& pathSpec, const boost::function& callback, int type) +bool Utility::Glob(const String& pathSpec, const std::function& callback, int type) { std::vector files, dirs; @@ -609,7 +610,7 @@ bool Utility::Glob(const String& pathSpec, const boost::function& callback, int type) +bool Utility::GlobRecursive(const String& path, const String& pattern, const std::function& callback, int type) { std::vector files, dirs, alldirs; @@ -768,7 +769,7 @@ void Utility::MkDirP(const String& path, int mode) void Utility::RemoveDirRecursive(const String& path) { std::vector paths; - Utility::GlobRecursive(path, "*", boost::bind(&Utility::CollectPaths, _1, boost::ref(paths)), GlobFile | GlobDirectory); + Utility::GlobRecursive(path, "*", std::bind(&Utility::CollectPaths, _1, boost::ref(paths)), GlobFile | GlobDirectory); /* This relies on the fact that GlobRecursive lists the parent directory first before recursing into subdirectories. */ diff --git a/lib/base/utility.hpp b/lib/base/utility.hpp index 3e19301f0..49d0a6a6d 100644 --- a/lib/base/utility.hpp +++ b/lib/base/utility.hpp @@ -24,7 +24,6 @@ #include "base/string.hpp" #include "base/array.hpp" #include "base/threadpool.hpp" -#include #include #include #include @@ -80,8 +79,8 @@ public: static String NewUniqueID(void); - static bool Glob(const String& pathSpec, const boost::function& callback, int type = GlobFile | GlobDirectory); - static bool GlobRecursive(const String& path, const String& pattern, const boost::function& callback, int type = GlobFile | GlobDirectory); + static bool Glob(const String& pathSpec, const std::function& callback, int type = GlobFile | GlobDirectory); + static bool GlobRecursive(const String& path, const String& pattern, const std::function& callback, int type = GlobFile | GlobDirectory); static void MkDir(const String& path, int mode); static void MkDirP(const String& path, int mode); static bool SetFileOwnership(const String& file, const String& user, const String& group); diff --git a/lib/base/workqueue.cpp b/lib/base/workqueue.cpp index f3d2a6c32..92641c70a 100644 --- a/lib/base/workqueue.cpp +++ b/lib/base/workqueue.cpp @@ -23,7 +23,6 @@ #include "base/convert.hpp" #include "base/application.hpp" #include "base/exception.hpp" -#include #include using namespace icinga; @@ -40,7 +39,7 @@ WorkQueue::WorkQueue(size_t maxItems, int threadCount) m_StatusTimer = new Timer(); m_StatusTimer->SetInterval(10); - m_StatusTimer->OnTimerExpired.connect(boost::bind(&WorkQueue::StatusTimerHandler, this)); + m_StatusTimer->OnTimerExpired.connect(std::bind(&WorkQueue::StatusTimerHandler, this)); m_StatusTimer->Start(); } @@ -67,7 +66,7 @@ String WorkQueue::GetName(void) const * allowInterleaved is true in which case the new task might be run * immediately if it's being enqueued from within the WorkQueue thread. */ -void WorkQueue::Enqueue(boost::function&& function, WorkQueuePriority priority, +void WorkQueue::Enqueue(std::function&& function, WorkQueuePriority priority, bool allowInterleaved) { bool wq_thread = IsWorkerThread(); @@ -85,7 +84,7 @@ void WorkQueue::Enqueue(boost::function&& function, WorkQueuePriori << "Spawning WorkQueue threads for '" << m_Name << "'"; for (int i = 0; i < m_ThreadCount; i++) { - m_Threads.create_thread(boost::bind(&WorkQueue::WorkerThreadProc, this)); + m_Threads.create_thread(std::bind(&WorkQueue::WorkerThreadProc, this)); } m_Spawned = true; diff --git a/lib/base/workqueue.hpp b/lib/base/workqueue.hpp index d9ec53bdd..760aa1353 100644 --- a/lib/base/workqueue.hpp +++ b/lib/base/workqueue.hpp @@ -23,7 +23,6 @@ #include "base/i2-base.hpp" #include "base/timer.hpp" #include "base/ringbuffer.hpp" -#include #include #include #include @@ -47,11 +46,11 @@ struct Task : Priority(PriorityNormal), ID(-1) { } - Task(boost::function&& function, WorkQueuePriority priority, int id) + Task(std::function&& function, WorkQueuePriority priority, int id) : Function(std::move(function)), Priority(priority), ID(id) { } - boost::function Function; + std::function Function; WorkQueuePriority Priority; int ID; }; @@ -79,7 +78,7 @@ inline bool operator<(const Task& a, const Task& b) class I2_BASE_API WorkQueue { public: - typedef boost::function ExceptionCallback; + typedef std::function ExceptionCallback; WorkQueue(size_t maxItems = 0, int threadCount = 1); ~WorkQueue(void); @@ -87,7 +86,7 @@ public: void SetName(const String& name); String GetName(void) const; - void Enqueue(boost::function&& function, WorkQueuePriority priority = PriorityNormal, + void Enqueue(std::function&& function, WorkQueuePriority priority = PriorityNormal, bool allowInterleaved = false); void Join(bool stop = false); diff --git a/lib/checker/checkercomponent.cpp b/lib/checker/checkercomponent.cpp index 65098d6c3..a943872b9 100644 --- a/lib/checker/checkercomponent.cpp +++ b/lib/checker/checkercomponent.cpp @@ -65,10 +65,10 @@ CheckerComponent::CheckerComponent(void) void CheckerComponent::OnConfigLoaded(void) { - ConfigObject::OnActiveChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1)); - ConfigObject::OnPausedChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1)); + ConfigObject::OnActiveChanged.connect(std::bind(&CheckerComponent::ObjectHandler, this, _1)); + ConfigObject::OnPausedChanged.connect(std::bind(&CheckerComponent::ObjectHandler, this, _1)); - Checkable::OnNextCheckChanged.connect(bind(&CheckerComponent::NextCheckChangedHandler, this, _1)); + Checkable::OnNextCheckChanged.connect(std::bind(&CheckerComponent::NextCheckChangedHandler, this, _1)); } void CheckerComponent::Start(bool runtimeCreated) @@ -79,11 +79,11 @@ void CheckerComponent::Start(bool runtimeCreated) << "'" << GetName() << "' started."; - m_Thread = boost::thread(boost::bind(&CheckerComponent::CheckThreadProc, this)); + m_Thread = boost::thread(std::bind(&CheckerComponent::CheckThreadProc, this)); m_ResultTimer = new Timer(); m_ResultTimer->SetInterval(5); - m_ResultTimer->OnTimerExpired.connect(boost::bind(&CheckerComponent::ResultTimerHandler, this)); + m_ResultTimer->OnTimerExpired.connect(std::bind(&CheckerComponent::ResultTimerHandler, this)); m_ResultTimer->Start(); } @@ -200,7 +200,7 @@ void CheckerComponent::CheckThreadProc(void) Checkable::IncreasePendingChecks(); - Utility::QueueAsyncCallback(boost::bind(&CheckerComponent::ExecuteCheckHelper, CheckerComponent::Ptr(this), checkable)); + Utility::QueueAsyncCallback(std::bind(&CheckerComponent::ExecuteCheckHelper, CheckerComponent::Ptr(this), checkable)); lock.lock(); } diff --git a/lib/cli/consolecommand.cpp b/lib/cli/consolecommand.cpp index 444588883..55b836eb3 100644 --- a/lib/cli/consolecommand.cpp +++ b/lib/cli/consolecommand.cpp @@ -195,7 +195,7 @@ char *ConsoleCommand::ConsoleCompleteHelper(const char *word, int state) Array::Ptr suggestions; l_ApiClient->AutocompleteScript(l_Session, word, l_ScriptFrame->Sandboxed, - boost::bind(&ConsoleCommand::AutocompleteScriptCompletionHandler, + std::bind(&ConsoleCommand::AutocompleteScriptCompletionHandler, boost::ref(mutex), boost::ref(cv), boost::ref(ready), _1, _2, boost::ref(suggestions))); @@ -425,7 +425,7 @@ incomplete: boost::exception_ptr eptr; l_ApiClient->ExecuteScript(l_Session, command, scriptFrame.Sandboxed, - boost::bind(&ConsoleCommand::ExecuteScriptCompletionHandler, + std::bind(&ConsoleCommand::ExecuteScriptCompletionHandler, boost::ref(mutex), boost::ref(cv), boost::ref(ready), _1, _2, boost::ref(result), boost::ref(eptr))); diff --git a/lib/cli/daemonutility.cpp b/lib/cli/daemonutility.cpp index c6748947e..903cca03f 100644 --- a/lib/cli/daemonutility.cpp +++ b/lib/cli/daemonutility.cpp @@ -52,7 +52,7 @@ static void IncludeZoneDirRecursive(const String& path, const String& package, b ConfigCompiler::RegisterZoneDir("_etc", path, zoneName); std::vector expressions; - Utility::GlobRecursive(path, "*.conf", boost::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile); + Utility::GlobRecursive(path, "*.conf", std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile); DictExpression expr(expressions); if (!ExecuteExpression(&expr)) success = false; @@ -75,7 +75,7 @@ static void IncludeNonLocalZone(const String& zonePath, const String& package, b } std::vector expressions; - Utility::GlobRecursive(zonePath, "*.conf", boost::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile); + Utility::GlobRecursive(zonePath, "*.conf", std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile); DictExpression expr(expressions); if (!ExecuteExpression(&expr)) success = false; @@ -126,7 +126,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector& configs, String zonesEtcDir = Application::GetZonesDir(); if (!zonesEtcDir.IsEmpty() && Utility::PathExists(zonesEtcDir)) - Utility::Glob(zonesEtcDir + "/*", boost::bind(&IncludeZoneDirRecursive, _1, "_etc", boost::ref(success)), GlobDirectory); + Utility::Glob(zonesEtcDir + "/*", std::bind(&IncludeZoneDirRecursive, _1, "_etc", boost::ref(success)), GlobDirectory); if (!success) return false; @@ -135,7 +135,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector& configs, * are authoritative on this node and are checked in HasZoneConfigAuthority(). */ String packagesVarDir = Application::GetLocalStateDir() + "/lib/icinga2/api/packages"; if (Utility::PathExists(packagesVarDir)) - Utility::Glob(packagesVarDir + "/*", boost::bind(&IncludePackage, _1, boost::ref(success)), GlobDirectory); + Utility::Glob(packagesVarDir + "/*", std::bind(&IncludePackage, _1, boost::ref(success)), GlobDirectory); if (!success) return false; @@ -143,7 +143,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector& configs, /* Load cluster synchronized configuration files */ String zonesVarDir = Application::GetLocalStateDir() + "/lib/icinga2/api/zones"; if (Utility::PathExists(zonesVarDir)) - Utility::Glob(zonesVarDir + "/*", boost::bind(&IncludeNonLocalZone, _1, "_cluster", boost::ref(success)), GlobDirectory); + Utility::Glob(zonesVarDir + "/*", std::bind(&IncludeNonLocalZone, _1, "_cluster", boost::ref(success)), GlobDirectory); if (!success) return false; diff --git a/lib/cli/featureutility.cpp b/lib/cli/featureutility.cpp index 9de11d000..4b4b9df8e 100644 --- a/lib/cli/featureutility.cpp +++ b/lib/cli/featureutility.cpp @@ -200,11 +200,11 @@ bool FeatureUtility::GetFeatures(std::vector& features, bool get_disable /* disable = available-enabled */ String available_pattern = GetFeaturesAvailablePath() + "/*.conf"; std::vector available; - Utility::Glob(available_pattern, boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(available)), GlobFile); + Utility::Glob(available_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(available)), GlobFile); String enabled_pattern = GetFeaturesEnabledPath() + "/*.conf"; std::vector enabled; - Utility::Glob(enabled_pattern, boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(enabled)), GlobFile); + Utility::Glob(enabled_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(enabled)), GlobFile); std::sort(available.begin(), available.end()); std::sort(enabled.begin(), enabled.end()); @@ -217,7 +217,7 @@ bool FeatureUtility::GetFeatures(std::vector& features, bool get_disable /* all enabled features */ String enabled_pattern = GetFeaturesEnabledPath() + "/*.conf"; - Utility::Glob(enabled_pattern, boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(features)), GlobFile); + Utility::Glob(enabled_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(features)), GlobFile); } return true; diff --git a/lib/cli/troubleshootcommand.cpp b/lib/cli/troubleshootcommand.cpp index 59b908941..01ae8644b 100644 --- a/lib/cli/troubleshootcommand.cpp +++ b/lib/cli/troubleshootcommand.cpp @@ -375,7 +375,7 @@ bool TroubleshootCommand::PrintCrashReports(InfoLog& log) String bestFilename; try { - Utility::Glob(spath, boost::bind(&GetLatestReport, _1, boost::ref(bestTimestamp), + Utility::Glob(spath, std::bind(&GetLatestReport, _1, boost::ref(bestTimestamp), boost::ref(bestFilename)), GlobFile); } #ifdef _WIN32 diff --git a/lib/compat/checkresultreader.cpp b/lib/compat/checkresultreader.cpp index 1ac8546e5..061c51470 100644 --- a/lib/compat/checkresultreader.cpp +++ b/lib/compat/checkresultreader.cpp @@ -63,7 +63,7 @@ void CheckResultReader::Start(bool runtimeCreated) #ifndef _WIN32 m_ReadTimer = new Timer(); - m_ReadTimer->OnTimerExpired.connect(boost::bind(&CheckResultReader::ReadTimerHandler, this)); + m_ReadTimer->OnTimerExpired.connect(std::bind(&CheckResultReader::ReadTimerHandler, this)); m_ReadTimer->SetInterval(5); m_ReadTimer->Start(); #endif /* _WIN32 */ @@ -87,7 +87,7 @@ void CheckResultReader::ReadTimerHandler(void) const { CONTEXT("Processing check result files in '" + GetSpoolDir() + "'"); - Utility::Glob(GetSpoolDir() + "/c??????.ok", boost::bind(&CheckResultReader::ProcessCheckResultFile, this, _1), GlobFile); + Utility::Glob(GetSpoolDir() + "/c??????.ok", std::bind(&CheckResultReader::ProcessCheckResultFile, this, _1), GlobFile); } void CheckResultReader::ProcessCheckResultFile(const String& path) const diff --git a/lib/compat/compatlogger.cpp b/lib/compat/compatlogger.cpp index dabefe785..67561327a 100644 --- a/lib/compat/compatlogger.cpp +++ b/lib/compat/compatlogger.cpp @@ -63,19 +63,19 @@ void CompatLogger::Start(bool runtimeCreated) Log(LogInformation, "CompatLogger") << "'" << GetName() << "' started."; - Checkable::OnNewCheckResult.connect(bind(&CompatLogger::CheckResultHandler, this, _1, _2)); - Checkable::OnNotificationSentToUser.connect(bind(&CompatLogger::NotificationSentHandler, this, _1, _2, _3, _4, _5, _6, _7, _8)); - Downtime::OnDowntimeTriggered.connect(boost::bind(&CompatLogger::TriggerDowntimeHandler, this, _1)); - Downtime::OnDowntimeRemoved.connect(boost::bind(&CompatLogger::RemoveDowntimeHandler, this, _1)); - Checkable::OnEventCommandExecuted.connect(bind(&CompatLogger::EventCommandHandler, this, _1)); + Checkable::OnNewCheckResult.connect(std::bind(&CompatLogger::CheckResultHandler, this, _1, _2)); + Checkable::OnNotificationSentToUser.connect(std::bind(&CompatLogger::NotificationSentHandler, this, _1, _2, _3, _4, _5, _6, _7, _8)); + Downtime::OnDowntimeTriggered.connect(std::bind(&CompatLogger::TriggerDowntimeHandler, this, _1)); + Downtime::OnDowntimeRemoved.connect(std::bind(&CompatLogger::RemoveDowntimeHandler, this, _1)); + Checkable::OnEventCommandExecuted.connect(std::bind(&CompatLogger::EventCommandHandler, this, _1)); - Checkable::OnFlappingChanged.connect(boost::bind(&CompatLogger::FlappingChangedHandler, this, _1)); - Checkable::OnEnableFlappingChanged.connect(boost::bind(&CompatLogger::EnableFlappingChangedHandler, this, _1)); + Checkable::OnFlappingChanged.connect(std::bind(&CompatLogger::FlappingChangedHandler, this, _1)); + Checkable::OnEnableFlappingChanged.connect(std::bind(&CompatLogger::EnableFlappingChangedHandler, this, _1)); - ExternalCommandProcessor::OnNewExternalCommand.connect(boost::bind(&CompatLogger::ExternalCommandHandler, this, _2, _3)); + ExternalCommandProcessor::OnNewExternalCommand.connect(std::bind(&CompatLogger::ExternalCommandHandler, this, _2, _3)); m_RotationTimer = new Timer(); - m_RotationTimer->OnTimerExpired.connect(boost::bind(&CompatLogger::RotationTimerHandler, this)); + m_RotationTimer->OnTimerExpired.connect(std::bind(&CompatLogger::RotationTimerHandler, this)); m_RotationTimer->Start(); ReopenFile(false); diff --git a/lib/compat/externalcommandlistener.cpp b/lib/compat/externalcommandlistener.cpp index 90669fafd..040255160 100644 --- a/lib/compat/externalcommandlistener.cpp +++ b/lib/compat/externalcommandlistener.cpp @@ -54,7 +54,7 @@ void ExternalCommandListener::Start(bool runtimeCreated) << "'" << GetName() << "' started."; #ifndef _WIN32 - m_CommandThread = boost::thread(boost::bind(&ExternalCommandListener::CommandPipeThread, this, GetCommandPath())); + m_CommandThread = boost::thread(std::bind(&ExternalCommandListener::CommandPipeThread, this, GetCommandPath())); m_CommandThread.detach(); #endif /* _WIN32 */ } diff --git a/lib/compat/statusdatawriter.cpp b/lib/compat/statusdatawriter.cpp index 22a22f7df..d67258035 100644 --- a/lib/compat/statusdatawriter.cpp +++ b/lib/compat/statusdatawriter.cpp @@ -80,12 +80,12 @@ void StatusDataWriter::Start(bool runtimeCreated) m_StatusTimer = new Timer(); m_StatusTimer->SetInterval(GetUpdateInterval()); - m_StatusTimer->OnTimerExpired.connect(boost::bind(&StatusDataWriter::StatusTimerHandler, this)); + m_StatusTimer->OnTimerExpired.connect(std::bind(&StatusDataWriter::StatusTimerHandler, this)); m_StatusTimer->Start(); m_StatusTimer->Reschedule(0); - ConfigObject::OnVersionChanged.connect(boost::bind(&StatusDataWriter::ObjectHandler, this)); - ConfigObject::OnActiveChanged.connect(boost::bind(&StatusDataWriter::ObjectHandler, this)); + ConfigObject::OnVersionChanged.connect(std::bind(&StatusDataWriter::ObjectHandler, this)); + ConfigObject::OnActiveChanged.connect(std::bind(&StatusDataWriter::ObjectHandler, this)); } /** diff --git a/lib/config/applyrule.hpp b/lib/config/applyrule.hpp index ef0ffd031..631d1e54f 100644 --- a/lib/config/applyrule.hpp +++ b/lib/config/applyrule.hpp @@ -23,7 +23,6 @@ #include "config/i2-config.hpp" #include "config/expression.hpp" #include "base/debuginfo.hpp" -#include namespace icinga { diff --git a/lib/config/configcompiler.cpp b/lib/config/configcompiler.cpp index 9fe90e8f8..f1bec5c91 100644 --- a/lib/config/configcompiler.cpp +++ b/lib/config/configcompiler.cpp @@ -155,7 +155,7 @@ Expression *ConfigCompiler::HandleInclude(const String& relativeBase, const Stri std::vector expressions; - if (!Utility::Glob(includePath, boost::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zone, package), GlobFile) && includePath.FindFirstOf("*?") == String::NPos) { + if (!Utility::Glob(includePath, std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zone, package), GlobFile) && includePath.FindFirstOf("*?") == String::NPos) { std::ostringstream msgbuf; msgbuf << "Include file '" + path + "' does not exist"; BOOST_THROW_EXCEPTION(ScriptError(msgbuf.str(), debuginfo)); @@ -185,7 +185,7 @@ Expression *ConfigCompiler::HandleIncludeRecursive(const String& relativeBase, c ppath = relativeBase + "/" + path; std::vector expressions; - Utility::GlobRecursive(ppath, pattern, boost::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zone, package), GlobFile); + Utility::GlobRecursive(ppath, pattern, std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zone, package), GlobFile); DictExpression *dict = new DictExpression(expressions); dict->MakeInline(); @@ -205,7 +205,7 @@ void ConfigCompiler::HandleIncludeZone(const String& relativeBase, const String& RegisterZoneDir(tag, ppath, zoneName); - Utility::GlobRecursive(ppath, pattern, boost::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile); + Utility::GlobRecursive(ppath, pattern, std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile); } /** @@ -231,7 +231,7 @@ Expression *ConfigCompiler::HandleIncludeZones(const String& relativeBase, const } std::vector expressions; - Utility::Glob(ppath + "/*", boost::bind(&ConfigCompiler::HandleIncludeZone, newRelativeBase, tag, _1, pattern, package, boost::ref(expressions)), GlobDirectory); + Utility::Glob(ppath + "/*", std::bind(&ConfigCompiler::HandleIncludeZone, newRelativeBase, tag, _1, pattern, package, boost::ref(expressions)), GlobDirectory); return new DictExpression(expressions); } diff --git a/lib/config/configcompiler.hpp b/lib/config/configcompiler.hpp index 94ae967bd..cd5395c8d 100644 --- a/lib/config/configcompiler.hpp +++ b/lib/config/configcompiler.hpp @@ -26,7 +26,6 @@ #include "base/registry.hpp" #include "base/initialize.hpp" #include "base/singleton.hpp" -#include #include #include diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index 8f630564f..f2bd6df57 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -608,7 +608,7 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vectorGetName() << "' of type '" << object->GetReflectionType()->GetName() << "'"; #endif /* I2_DEBUG */ - upq.Enqueue(boost::bind(&ConfigObject::PreActivate, object)); + upq.Enqueue(std::bind(&ConfigObject::PreActivate, object)); } upq.Join(); @@ -631,7 +631,7 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vectorGetName() << "' of type '" << object->GetReflectionType()->GetName() << "'"; #endif /* I2_DEBUG */ - upq.Enqueue(boost::bind(&ConfigObject::Activate, object, runtimeCreated)); + upq.Enqueue(std::bind(&ConfigObject::Activate, object, runtimeCreated)); } upq.Join(); diff --git a/lib/config/vmops.hpp b/lib/config/vmops.hpp index a8661faa3..c64ac1064 100644 --- a/lib/config/vmops.hpp +++ b/lib/config/vmops.hpp @@ -112,7 +112,7 @@ public: static inline Value NewFunction(ScriptFrame& frame, const String& name, const std::vector& args, std::map *closedVars, const boost::shared_ptr& expression) { - return new Function(name, boost::bind(&FunctionWrapper, _1, args, + return new Function(name, std::bind(&FunctionWrapper, _1, args, EvaluateClosedVars(frame, closedVars), expression), args); } diff --git a/lib/db_ido/dbconnection.cpp b/lib/db_ido/dbconnection.cpp index 95b14486d..96a744fdc 100644 --- a/lib/db_ido/dbconnection.cpp +++ b/lib/db_ido/dbconnection.cpp @@ -66,8 +66,8 @@ void DbConnection::Start(bool runtimeCreated) Log(LogInformation, "DbConnection") << "'" << GetName() << "' started."; - DbObject::OnQuery.connect(boost::bind(&DbConnection::ExecuteQuery, this, _1)); - DbObject::OnMultipleQueries.connect(boost::bind(&DbConnection::ExecuteMultipleQueries, this, _1)); + DbObject::OnQuery.connect(std::bind(&DbConnection::ExecuteQuery, this, _1)); + DbObject::OnMultipleQueries.connect(std::bind(&DbConnection::ExecuteMultipleQueries, this, _1)); } void DbConnection::Stop(bool runtimeRemoved) @@ -81,7 +81,7 @@ void DbConnection::Stop(bool runtimeRemoved) void DbConnection::EnableActiveChangedHandler(void) { if (!m_ActiveChangedHandler) { - ConfigObject::OnActiveChanged.connect(boost::bind(&DbConnection::UpdateObject, this, _1)); + ConfigObject::OnActiveChanged.connect(std::bind(&DbConnection::UpdateObject, this, _1)); m_ActiveChangedHandler = true; } } @@ -95,7 +95,7 @@ void DbConnection::Resume(void) m_CleanUpTimer = new Timer(); m_CleanUpTimer->SetInterval(60); - m_CleanUpTimer->OnTimerExpired.connect(boost::bind(&DbConnection::CleanUpHandler, this)); + m_CleanUpTimer->OnTimerExpired.connect(std::bind(&DbConnection::CleanUpHandler, this)); m_CleanUpTimer->Start(); } @@ -131,7 +131,7 @@ void DbConnection::InitializeDbTimer(void) { m_ProgramStatusTimer = new Timer(); m_ProgramStatusTimer->SetInterval(10); - m_ProgramStatusTimer->OnTimerExpired.connect(boost::bind(&DbConnection::UpdateProgramStatus)); + m_ProgramStatusTimer->OnTimerExpired.connect(std::bind(&DbConnection::UpdateProgramStatus)); m_ProgramStatusTimer->Start(); } diff --git a/lib/db_ido/dbevents.cpp b/lib/db_ido/dbevents.cpp index 2d6653579..b14b19ce6 100644 --- a/lib/db_ido/dbevents.cpp +++ b/lib/db_ido/dbevents.cpp @@ -42,49 +42,49 @@ INITIALIZE_ONCE(&DbEvents::StaticInitialize); void DbEvents::StaticInitialize(void) { /* Status */ - Comment::OnCommentAdded.connect(boost::bind(&DbEvents::AddComment, _1)); - Comment::OnCommentRemoved.connect(boost::bind(&DbEvents::RemoveComment, _1)); - Downtime::OnDowntimeAdded.connect(boost::bind(&DbEvents::AddDowntime, _1)); - Downtime::OnDowntimeRemoved.connect(boost::bind(&DbEvents::RemoveDowntime, _1)); - Downtime::OnDowntimeTriggered.connect(boost::bind(&DbEvents::TriggerDowntime, _1)); - Checkable::OnAcknowledgementSet.connect(boost::bind(&DbEvents::AddAcknowledgement, _1, _4)); - Checkable::OnAcknowledgementCleared.connect(boost::bind(&DbEvents::RemoveAcknowledgement, _1)); - - Checkable::OnNextCheckUpdated.connect(boost::bind(&DbEvents::NextCheckUpdatedHandler, _1)); - Checkable::OnFlappingChanged.connect(boost::bind(&DbEvents::FlappingChangedHandler, _1)); - Checkable::OnNotificationSentToAllUsers.connect(boost::bind(&DbEvents::LastNotificationChangedHandler, _1, _2)); - - Checkable::OnEnableActiveChecksChanged.connect(boost::bind(&DbEvents::EnableActiveChecksChangedHandler, _1)); - Checkable::OnEnablePassiveChecksChanged.connect(boost::bind(&DbEvents::EnablePassiveChecksChangedHandler, _1)); - Checkable::OnEnableNotificationsChanged.connect(boost::bind(&DbEvents::EnableNotificationsChangedHandler, _1)); - Checkable::OnEnablePerfdataChanged.connect(boost::bind(&DbEvents::EnablePerfdataChangedHandler, _1)); - Checkable::OnEnableFlappingChanged.connect(boost::bind(&DbEvents::EnableFlappingChangedHandler, _1)); - - Checkable::OnReachabilityChanged.connect(boost::bind(&DbEvents::ReachabilityChangedHandler, _1, _2, _3)); + Comment::OnCommentAdded.connect(std::bind(&DbEvents::AddComment, _1)); + Comment::OnCommentRemoved.connect(std::bind(&DbEvents::RemoveComment, _1)); + Downtime::OnDowntimeAdded.connect(std::bind(&DbEvents::AddDowntime, _1)); + Downtime::OnDowntimeRemoved.connect(std::bind(&DbEvents::RemoveDowntime, _1)); + Downtime::OnDowntimeTriggered.connect(std::bind(&DbEvents::TriggerDowntime, _1)); + Checkable::OnAcknowledgementSet.connect(std::bind(&DbEvents::AddAcknowledgement, _1, _4)); + Checkable::OnAcknowledgementCleared.connect(std::bind(&DbEvents::RemoveAcknowledgement, _1)); + + Checkable::OnNextCheckUpdated.connect(std::bind(&DbEvents::NextCheckUpdatedHandler, _1)); + Checkable::OnFlappingChanged.connect(std::bind(&DbEvents::FlappingChangedHandler, _1)); + Checkable::OnNotificationSentToAllUsers.connect(std::bind(&DbEvents::LastNotificationChangedHandler, _1, _2)); + + Checkable::OnEnableActiveChecksChanged.connect(std::bind(&DbEvents::EnableActiveChecksChangedHandler, _1)); + Checkable::OnEnablePassiveChecksChanged.connect(std::bind(&DbEvents::EnablePassiveChecksChangedHandler, _1)); + Checkable::OnEnableNotificationsChanged.connect(std::bind(&DbEvents::EnableNotificationsChangedHandler, _1)); + Checkable::OnEnablePerfdataChanged.connect(std::bind(&DbEvents::EnablePerfdataChangedHandler, _1)); + Checkable::OnEnableFlappingChanged.connect(std::bind(&DbEvents::EnableFlappingChangedHandler, _1)); + + Checkable::OnReachabilityChanged.connect(std::bind(&DbEvents::ReachabilityChangedHandler, _1, _2, _3)); /* History */ - Comment::OnCommentAdded.connect(boost::bind(&DbEvents::AddCommentHistory, _1)); - Downtime::OnDowntimeAdded.connect(boost::bind(&DbEvents::AddDowntimeHistory, _1)); - Checkable::OnAcknowledgementSet.connect(boost::bind(&DbEvents::AddAcknowledgementHistory, _1, _2, _3, _4, _5, _6)); + Comment::OnCommentAdded.connect(std::bind(&DbEvents::AddCommentHistory, _1)); + Downtime::OnDowntimeAdded.connect(std::bind(&DbEvents::AddDowntimeHistory, _1)); + Checkable::OnAcknowledgementSet.connect(std::bind(&DbEvents::AddAcknowledgementHistory, _1, _2, _3, _4, _5, _6)); - Checkable::OnNotificationSentToAllUsers.connect(boost::bind(&DbEvents::AddNotificationHistory, _1, _2, _3, _4, _5, _6, _7)); + Checkable::OnNotificationSentToAllUsers.connect(std::bind(&DbEvents::AddNotificationHistory, _1, _2, _3, _4, _5, _6, _7)); - Checkable::OnStateChange.connect(boost::bind(&DbEvents::AddStateChangeHistory, _1, _2, _3)); + Checkable::OnStateChange.connect(std::bind(&DbEvents::AddStateChangeHistory, _1, _2, _3)); - Checkable::OnNewCheckResult.connect(boost::bind(&DbEvents::AddCheckResultLogHistory, _1, _2)); - Checkable::OnNotificationSentToUser.connect(boost::bind(&DbEvents::AddNotificationSentLogHistory, _1, _2, _3, _4, _5, _6, _7)); - Checkable::OnFlappingChanged.connect(boost::bind(&DbEvents::AddFlappingChangedLogHistory, _1)); - Checkable::OnEnableFlappingChanged.connect(boost::bind(&DbEvents::AddEnableFlappingChangedLogHistory, _1)); - Downtime::OnDowntimeTriggered.connect(boost::bind(&DbEvents::AddTriggerDowntimeLogHistory, _1)); - Downtime::OnDowntimeRemoved.connect(boost::bind(&DbEvents::AddRemoveDowntimeLogHistory, _1)); + Checkable::OnNewCheckResult.connect(std::bind(&DbEvents::AddCheckResultLogHistory, _1, _2)); + Checkable::OnNotificationSentToUser.connect(std::bind(&DbEvents::AddNotificationSentLogHistory, _1, _2, _3, _4, _5, _6, _7)); + Checkable::OnFlappingChanged.connect(std::bind(&DbEvents::AddFlappingChangedLogHistory, _1)); + Checkable::OnEnableFlappingChanged.connect(std::bind(&DbEvents::AddEnableFlappingChangedLogHistory, _1)); + Downtime::OnDowntimeTriggered.connect(std::bind(&DbEvents::AddTriggerDowntimeLogHistory, _1)); + Downtime::OnDowntimeRemoved.connect(std::bind(&DbEvents::AddRemoveDowntimeLogHistory, _1)); - Checkable::OnFlappingChanged.connect(boost::bind(&DbEvents::AddFlappingChangedHistory, _1)); - Checkable::OnEnableFlappingChanged.connect(boost::bind(&DbEvents::AddEnableFlappingChangedHistory, _1)); - Checkable::OnNewCheckResult.connect(boost::bind(&DbEvents::AddCheckableCheckHistory, _1, _2)); + Checkable::OnFlappingChanged.connect(std::bind(&DbEvents::AddFlappingChangedHistory, _1)); + Checkable::OnEnableFlappingChanged.connect(std::bind(&DbEvents::AddEnableFlappingChangedHistory, _1)); + Checkable::OnNewCheckResult.connect(std::bind(&DbEvents::AddCheckableCheckHistory, _1, _2)); - Checkable::OnEventCommandExecuted.connect(boost::bind(&DbEvents::AddEventHandlerHistory, _1)); + Checkable::OnEventCommandExecuted.connect(std::bind(&DbEvents::AddEventHandlerHistory, _1)); - ExternalCommandProcessor::OnNewExternalCommand.connect(boost::bind(&DbEvents::AddExternalCommandHistory, _1, _2, _3)); + ExternalCommandProcessor::OnNewExternalCommand.connect(std::bind(&DbEvents::AddExternalCommandHistory, _1, _2, _3)); } /* check events */ diff --git a/lib/db_ido/dbobject.cpp b/lib/db_ido/dbobject.cpp index c4e4c0e9b..a40e7d775 100644 --- a/lib/db_ido/dbobject.cpp +++ b/lib/db_ido/dbobject.cpp @@ -52,11 +52,11 @@ DbObject::DbObject(const intrusive_ptr& type, const String& name1, const void DbObject::StaticInitialize(void) { /* triggered in ProcessCheckResult(), requires UpdateNextCheck() to be called before */ - ConfigObject::OnStateChanged.connect(boost::bind(&DbObject::StateChangedHandler, _1)); - CustomVarObject::OnVarsChanged.connect(boost::bind(&DbObject::VarsChangedHandler, _1)); + ConfigObject::OnStateChanged.connect(std::bind(&DbObject::StateChangedHandler, _1)); + CustomVarObject::OnVarsChanged.connect(std::bind(&DbObject::VarsChangedHandler, _1)); /* triggered on create, update and delete objects */ - ConfigObject::OnVersionChanged.connect(boost::bind(&DbObject::VersionChangedHandler, _1)); + ConfigObject::OnVersionChanged.connect(std::bind(&DbObject::VersionChangedHandler, _1)); } void DbObject::SetObject(const ConfigObject::Ptr& object) diff --git a/lib/db_ido/dbtype.hpp b/lib/db_ido/dbtype.hpp index 59ff8b3d9..72fdb9831 100644 --- a/lib/db_ido/dbtype.hpp +++ b/lib/db_ido/dbtype.hpp @@ -41,7 +41,7 @@ class I2_DB_IDO_API DbType : public Object public: DECLARE_PTR_TYPEDEFS(DbType); - typedef boost::function (const intrusive_ptr&, const String&, const String&)> ObjectFactory; + typedef std::function (const intrusive_ptr&, const String&, const String&)> ObjectFactory; typedef std::map TypeMap; typedef std::map, intrusive_ptr > ObjectMap; diff --git a/lib/db_ido/endpointdbobject.cpp b/lib/db_ido/endpointdbobject.cpp index a837e09c0..f6dbcc200 100644 --- a/lib/db_ido/endpointdbobject.cpp +++ b/lib/db_ido/endpointdbobject.cpp @@ -36,8 +36,8 @@ INITIALIZE_ONCE(&EndpointDbObject::StaticInitialize); void EndpointDbObject::StaticInitialize(void) { - Endpoint::OnConnected.connect(boost::bind(&EndpointDbObject::UpdateConnectedStatus, _1)); - Endpoint::OnDisconnected.connect(boost::bind(&EndpointDbObject::UpdateConnectedStatus, _1)); + Endpoint::OnConnected.connect(std::bind(&EndpointDbObject::UpdateConnectedStatus, _1)); + Endpoint::OnDisconnected.connect(std::bind(&EndpointDbObject::UpdateConnectedStatus, _1)); } EndpointDbObject::EndpointDbObject(const DbType::Ptr& type, const String& name1, const String& name2) diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp index 881c1d510..bc737b166 100644 --- a/lib/db_ido_mysql/idomysqlconnection.cpp +++ b/lib/db_ido_mysql/idomysqlconnection.cpp @@ -85,16 +85,16 @@ void IdoMysqlConnection::Resume(void) SetConnected(false); - m_QueryQueue.SetExceptionCallback(boost::bind(&IdoMysqlConnection::ExceptionHandler, this, _1)); + m_QueryQueue.SetExceptionCallback(std::bind(&IdoMysqlConnection::ExceptionHandler, this, _1)); m_TxTimer = new Timer(); m_TxTimer->SetInterval(1); - m_TxTimer->OnTimerExpired.connect(boost::bind(&IdoMysqlConnection::TxTimerHandler, this)); + m_TxTimer->OnTimerExpired.connect(std::bind(&IdoMysqlConnection::TxTimerHandler, this)); m_TxTimer->Start(); m_ReconnectTimer = new Timer(); m_ReconnectTimer->SetInterval(10); - m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&IdoMysqlConnection::ReconnectTimerHandler, this)); + m_ReconnectTimer->OnTimerExpired.connect(std::bind(&IdoMysqlConnection::ReconnectTimerHandler, this)); m_ReconnectTimer->Start(); m_ReconnectTimer->Reschedule(0); @@ -115,7 +115,7 @@ void IdoMysqlConnection::Pause(void) << "Rescheduling disconnect task."; #endif /* I2_DEBUG */ - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::Disconnect, this), PriorityHigh); + m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::Disconnect, this), PriorityHigh); m_QueryQueue.Join(); } @@ -163,8 +163,8 @@ void IdoMysqlConnection::NewTransaction(void) << "Scheduling new transaction and finishing async queries."; #endif /* I2_DEBUG */ - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::InternalNewTransaction, this), PriorityHigh); - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::FinishAsyncQueries, this), PriorityHigh); + m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalNewTransaction, this), PriorityHigh); + m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::FinishAsyncQueries, this), PriorityHigh); } void IdoMysqlConnection::InternalNewTransaction(void) @@ -185,7 +185,7 @@ void IdoMysqlConnection::ReconnectTimerHandler(void) << "Scheduling reconnect task."; #endif /* I2_DEBUG */ - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::Reconnect, this), PriorityLow); + m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::Reconnect, this), PriorityLow); } void IdoMysqlConnection::Reconnect(void) @@ -444,9 +444,9 @@ void IdoMysqlConnection::Reconnect(void) << "Scheduling session table clear and finish connect task."; #endif /* I2_DEBUG */ - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::ClearTablesBySession, this), PriorityLow); + m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::ClearTablesBySession, this), PriorityLow); - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::FinishConnect, this, startTime), PriorityLow); + m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::FinishConnect, this, startTime), PriorityLow); } void IdoMysqlConnection::FinishConnect(double startTime) @@ -479,7 +479,7 @@ void IdoMysqlConnection::ClearTableBySession(const String& table) Convert::ToString(GetSessionToken())); } -void IdoMysqlConnection::AsyncQuery(const String& query, const boost::function& callback) +void IdoMysqlConnection::AsyncQuery(const String& query, const std::function& callback) { AssertOnWorkQueue(); @@ -715,7 +715,7 @@ void IdoMysqlConnection::ActivateObject(const DbObject::Ptr& dbobj) << "Scheduling object activation task for '" << dbobj->GetName1() << "!" << dbobj->GetName2() << "'."; #endif /* I2_DEBUG */ - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::InternalActivateObject, this, dbobj), PriorityLow); + m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalActivateObject, this, dbobj), PriorityLow); } void IdoMysqlConnection::InternalActivateObject(const DbObject::Ptr& dbobj) @@ -754,7 +754,7 @@ void IdoMysqlConnection::DeactivateObject(const DbObject::Ptr& dbobj) << "Scheduling object deactivation task for '" << dbobj->GetName1() << "!" << dbobj->GetName2() << "'."; #endif /* I2_DEBUG */ - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::InternalDeactivateObject, this, dbobj), PriorityLow); + m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalDeactivateObject, this, dbobj), PriorityLow); } void IdoMysqlConnection::InternalDeactivateObject(const DbObject::Ptr& dbobj) @@ -859,7 +859,7 @@ void IdoMysqlConnection::ExecuteQuery(const DbQuery& query) << "Scheduling execute query task, type " << query.Type << ", table '" << query.Table << "'."; #endif /* I2_DEBUG */ - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, -1), query.Priority, true); + m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, -1), query.Priority, true); } void IdoMysqlConnection::ExecuteMultipleQueries(const std::vector& queries) @@ -872,7 +872,7 @@ void IdoMysqlConnection::ExecuteMultipleQueries(const std::vector& quer << "Scheduling multiple execute query task, type " << queries[0].Type << ", table '" << queries[0].Table << "'."; #endif /* I2_DEBUG */ - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::InternalExecuteMultipleQueries, this, queries), queries[0].Priority, true); + m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalExecuteMultipleQueries, this, queries), queries[0].Priority, true); } bool IdoMysqlConnection::CanExecuteQuery(const DbQuery& query) @@ -925,7 +925,7 @@ void IdoMysqlConnection::InternalExecuteMultipleQueries(const std::vector IdoMysqlResult; -typedef boost::function IdoAsyncCallback; +typedef std::function IdoAsyncCallback; struct IdoAsyncQuery { diff --git a/lib/db_ido_pgsql/idopgsqlconnection.cpp b/lib/db_ido_pgsql/idopgsqlconnection.cpp index 3d1a8662c..035a9c9d0 100644 --- a/lib/db_ido_pgsql/idopgsqlconnection.cpp +++ b/lib/db_ido_pgsql/idopgsqlconnection.cpp @@ -89,16 +89,16 @@ void IdoPgsqlConnection::Resume(void) SetConnected(false); - m_QueryQueue.SetExceptionCallback(boost::bind(&IdoPgsqlConnection::ExceptionHandler, this, _1)); + m_QueryQueue.SetExceptionCallback(std::bind(&IdoPgsqlConnection::ExceptionHandler, this, _1)); m_TxTimer = new Timer(); m_TxTimer->SetInterval(1); - m_TxTimer->OnTimerExpired.connect(boost::bind(&IdoPgsqlConnection::TxTimerHandler, this)); + m_TxTimer->OnTimerExpired.connect(std::bind(&IdoPgsqlConnection::TxTimerHandler, this)); m_TxTimer->Start(); m_ReconnectTimer = new Timer(); m_ReconnectTimer->SetInterval(10); - m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&IdoPgsqlConnection::ReconnectTimerHandler, this)); + m_ReconnectTimer->OnTimerExpired.connect(std::bind(&IdoPgsqlConnection::ReconnectTimerHandler, this)); m_ReconnectTimer->Start(); m_ReconnectTimer->Reschedule(0); @@ -114,7 +114,7 @@ void IdoPgsqlConnection::Pause(void) DbConnection::Pause(); - m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::Disconnect, this), PriorityHigh); + m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::Disconnect, this), PriorityHigh); m_QueryQueue.Join(); } @@ -156,7 +156,7 @@ void IdoPgsqlConnection::TxTimerHandler(void) void IdoPgsqlConnection::NewTransaction(void) { - m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::InternalNewTransaction, this), PriorityHigh, true); + m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalNewTransaction, this), PriorityHigh, true); } void IdoPgsqlConnection::InternalNewTransaction(void) @@ -172,7 +172,7 @@ void IdoPgsqlConnection::InternalNewTransaction(void) void IdoPgsqlConnection::ReconnectTimerHandler(void) { - m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::Reconnect, this), PriorityLow); + m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::Reconnect, this), PriorityLow); } void IdoPgsqlConnection::Reconnect(void) @@ -395,9 +395,9 @@ void IdoPgsqlConnection::Reconnect(void) UpdateAllObjects(); - m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::ClearTablesBySession, this), PriorityLow); + m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::ClearTablesBySession, this), PriorityLow); - m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::FinishConnect, this, startTime), PriorityLow); + m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::FinishConnect, this, startTime), PriorityLow); } void IdoPgsqlConnection::FinishConnect(double startTime) @@ -542,7 +542,7 @@ Dictionary::Ptr IdoPgsqlConnection::FetchRow(const IdoPgsqlResult& result, int r void IdoPgsqlConnection::ActivateObject(const DbObject::Ptr& dbobj) { - m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::InternalActivateObject, this, dbobj), PriorityLow); + m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalActivateObject, this, dbobj), PriorityLow); } void IdoPgsqlConnection::InternalActivateObject(const DbObject::Ptr& dbobj) @@ -576,7 +576,7 @@ void IdoPgsqlConnection::InternalActivateObject(const DbObject::Ptr& dbobj) void IdoPgsqlConnection::DeactivateObject(const DbObject::Ptr& dbobj) { - m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::InternalDeactivateObject, this, dbobj), PriorityLow); + m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalDeactivateObject, this, dbobj), PriorityLow); } void IdoPgsqlConnection::InternalDeactivateObject(const DbObject::Ptr& dbobj) @@ -676,7 +676,7 @@ void IdoPgsqlConnection::ExecuteQuery(const DbQuery& query) { ASSERT(query.Category != DbCatInvalid); - m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::InternalExecuteQuery, this, query, -1), query.Priority, true); + m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalExecuteQuery, this, query, -1), query.Priority, true); } void IdoPgsqlConnection::ExecuteMultipleQueries(const std::vector& queries) @@ -684,7 +684,7 @@ void IdoPgsqlConnection::ExecuteMultipleQueries(const std::vector& quer if (queries.empty()) return; - m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::InternalExecuteMultipleQueries, this, queries), queries[0].Priority, true); + m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalExecuteMultipleQueries, this, queries), queries[0].Priority, true); } bool IdoPgsqlConnection::CanExecuteQuery(const DbQuery& query) @@ -730,7 +730,7 @@ void IdoPgsqlConnection::InternalExecuteMultipleQueries(const std::vectorSetInterval(5); - m_DemoTimer->OnTimerExpired.connect(boost::bind(&Demo::DemoTimerHandler, this)); + m_DemoTimer->OnTimerExpired.connect(std::bind(&Demo::DemoTimerHandler, this)); m_DemoTimer->Start(); } diff --git a/lib/icinga/checkable.cpp b/lib/icinga/checkable.cpp index 100b8ed2b..1fbfa47ab 100644 --- a/lib/icinga/checkable.cpp +++ b/lib/icinga/checkable.cpp @@ -36,11 +36,11 @@ boost::signals2::signal void Checkable::StaticInitialize(void) { /* fixed downtime start */ - Downtime::OnDowntimeStarted.connect(boost::bind(&Checkable::NotifyFixedDowntimeStart, _1)); + Downtime::OnDowntimeStarted.connect(std::bind(&Checkable::NotifyFixedDowntimeStart, _1)); /* flexible downtime start */ - Downtime::OnDowntimeTriggered.connect(boost::bind(&Checkable::NotifyFlexibleDowntimeStart, _1)); + Downtime::OnDowntimeTriggered.connect(std::bind(&Checkable::NotifyFlexibleDowntimeStart, _1)); /* fixed/flexible downtime end */ - Downtime::OnDowntimeRemoved.connect(boost::bind(&Checkable::NotifyDowntimeEnd, _1)); + Downtime::OnDowntimeRemoved.connect(std::bind(&Checkable::NotifyDowntimeEnd, _1)); } Checkable::Checkable(void) diff --git a/lib/icinga/comment.cpp b/lib/icinga/comment.cpp index fc267039c..497c9a015 100644 --- a/lib/icinga/comment.cpp +++ b/lib/icinga/comment.cpp @@ -45,7 +45,7 @@ void Comment::StaticInitialize(void) { l_CommentsExpireTimer = new Timer(); l_CommentsExpireTimer->SetInterval(60); - l_CommentsExpireTimer->OnTimerExpired.connect(boost::bind(&Comment::CommentsExpireTimerHandler)); + l_CommentsExpireTimer->OnTimerExpired.connect(std::bind(&Comment::CommentsExpireTimerHandler)); l_CommentsExpireTimer->Start(); } diff --git a/lib/icinga/downtime.cpp b/lib/icinga/downtime.cpp index f2fbc8419..9c9903484 100644 --- a/lib/icinga/downtime.cpp +++ b/lib/icinga/downtime.cpp @@ -49,12 +49,12 @@ void Downtime::StaticInitialize(void) { l_DowntimesStartTimer = new Timer(); l_DowntimesStartTimer->SetInterval(5); - l_DowntimesStartTimer->OnTimerExpired.connect(boost::bind(&Downtime::DowntimesStartTimerHandler)); + l_DowntimesStartTimer->OnTimerExpired.connect(std::bind(&Downtime::DowntimesStartTimerHandler)); l_DowntimesStartTimer->Start(); l_DowntimesExpireTimer = new Timer(); l_DowntimesExpireTimer->SetInterval(60); - l_DowntimesExpireTimer->OnTimerExpired.connect(boost::bind(&Downtime::DowntimesExpireTimerHandler)); + l_DowntimesExpireTimer->OnTimerExpired.connect(std::bind(&Downtime::DowntimesExpireTimerHandler)); l_DowntimesExpireTimer->Start(); } diff --git a/lib/icinga/externalcommandprocessor.cpp b/lib/icinga/externalcommandprocessor.cpp index 6c3469f76..32db49ec3 100644 --- a/lib/icinga/externalcommandprocessor.cpp +++ b/lib/icinga/externalcommandprocessor.cpp @@ -44,7 +44,7 @@ using namespace icinga; INITIALIZE_ONCE(&ExternalCommandProcessor::StaticInitialize); -typedef boost::function& arguments)> ExternalCommandCallback; +typedef std::function& arguments)> ExternalCommandCallback; struct ExternalCommandInfo { diff --git a/lib/icinga/externalcommandprocessor.hpp b/lib/icinga/externalcommandprocessor.hpp index ab03a9f7b..07fbfa512 100644 --- a/lib/icinga/externalcommandprocessor.hpp +++ b/lib/icinga/externalcommandprocessor.hpp @@ -23,7 +23,6 @@ #include "icinga/i2-icinga.hpp" #include "icinga/command.hpp" #include "base/string.hpp" -#include #include #include diff --git a/lib/icinga/icingaapplication.cpp b/lib/icinga/icingaapplication.cpp index ef7354393..74a4a4c8d 100644 --- a/lib/icinga/icingaapplication.cpp +++ b/lib/icinga/icingaapplication.cpp @@ -100,7 +100,7 @@ int IcingaApplication::Main(void) /* periodically dump the program state */ l_RetentionTimer = new Timer(); l_RetentionTimer->SetInterval(300); - l_RetentionTimer->OnTimerExpired.connect(boost::bind(&IcingaApplication::DumpProgramState, this)); + l_RetentionTimer->OnTimerExpired.connect(std::bind(&IcingaApplication::DumpProgramState, this)); l_RetentionTimer->Start(); RunEventLoop(); @@ -166,7 +166,7 @@ void IcingaApplication::DumpModifiedAttributes(void) fp.exceptions(std::ofstream::failbit | std::ofstream::badbit); ConfigObject::Ptr previousObject; - ConfigObject::DumpModifiedAttributes(boost::bind(&PersistModAttrHelper, boost::ref(fp), boost::ref(previousObject), _1, _2, _3)); + ConfigObject::DumpModifiedAttributes(std::bind(&PersistModAttrHelper, boost::ref(fp), boost::ref(previousObject), _1, _2, _3)); if (previousObject) { ConfigWriter::EmitRaw(fp, "\tobj.version = "); diff --git a/lib/icinga/macroprocessor.cpp b/lib/icinga/macroprocessor.cpp index 2027ef82f..c7755df27 100644 --- a/lib/icinga/macroprocessor.cpp +++ b/lib/icinga/macroprocessor.cpp @@ -215,10 +215,10 @@ Value MacroProcessor::EvaluateFunction(const Function::Ptr& func, const Resolver resolvers_this->Set(resolver.first, resolver.second); } - resolvers_this->Set("macro", new Function("macro (temporary)", boost::bind(&MacroProcessor::InternalResolveMacrosShim, + resolvers_this->Set("macro", new Function("macro (temporary)", std::bind(&MacroProcessor::InternalResolveMacrosShim, _1, boost::cref(resolvers), cr, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros, recursionLevel + 1), { "str" })); - resolvers_this->Set("resolve_arguments", new Function("resolve_arguments (temporary)", boost::bind(&MacroProcessor::InternalResolveArgumentsShim, + resolvers_this->Set("resolve_arguments", new Function("resolve_arguments (temporary)", std::bind(&MacroProcessor::InternalResolveArgumentsShim, _1, boost::cref(resolvers), cr, resolvedMacros, useResolvedMacros, recursionLevel + 1))); diff --git a/lib/icinga/macroprocessor.hpp b/lib/icinga/macroprocessor.hpp index 8d3e80375..bd5e0dac8 100644 --- a/lib/icinga/macroprocessor.hpp +++ b/lib/icinga/macroprocessor.hpp @@ -23,7 +23,6 @@ #include "icinga/i2-icinga.hpp" #include "icinga/checkable.hpp" #include "base/value.hpp" -#include #include namespace icinga @@ -37,7 +36,7 @@ namespace icinga class I2_ICINGA_API MacroProcessor { public: - typedef boost::function EscapeCallback; + typedef std::function EscapeCallback; typedef std::pair ResolverSpec; typedef std::vector ResolverList; diff --git a/lib/icinga/notification.cpp b/lib/icinga/notification.cpp index 2dfb89541..1738bd359 100644 --- a/lib/icinga/notification.cpp +++ b/lib/icinga/notification.cpp @@ -416,7 +416,7 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe << "Sending " << (reminder ? "reminder " : "") << "'" << NotificationTypeToStringInternal(type) << "' notification '" << GetName() << "' for user '" << userName << "'"; - Utility::QueueAsyncCallback(boost::bind(&Notification::ExecuteNotificationHelper, this, type, user, cr, force, author, text)); + Utility::QueueAsyncCallback(std::bind(&Notification::ExecuteNotificationHelper, this, type, user, cr, force, author, text)); /* collect all notified users */ allNotifiedUsers.insert(user); diff --git a/lib/icinga/pluginutility.cpp b/lib/icinga/pluginutility.cpp index d59aac845..15b390a6d 100644 --- a/lib/icinga/pluginutility.cpp +++ b/lib/icinga/pluginutility.cpp @@ -35,7 +35,7 @@ using namespace icinga; void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const MacroProcessor::ResolverList& macroResolvers, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros, - const boost::function& callback) + const std::function& callback) { Value raw_command = commandObj->GetCommandLine(); Dictionary::Ptr raw_arguments = commandObj->GetArguments(); @@ -95,7 +95,7 @@ void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkab process->SetAdjustPriority(true); - process->Run(boost::bind(callback, command, _1)); + process->Run(std::bind(callback, command, _1)); } ServiceState PluginUtility::ExitStatusToState(int exitStatus) diff --git a/lib/icinga/pluginutility.hpp b/lib/icinga/pluginutility.hpp index 59d052ba9..b0b55b497 100644 --- a/lib/icinga/pluginutility.hpp +++ b/lib/icinga/pluginutility.hpp @@ -42,7 +42,7 @@ public: static void ExecuteCommand(const Command::Ptr& commandObj, const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const MacroProcessor::ResolverList& macroResolvers, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros, - const boost::function& callback = boost::function()); + const std::function& callback = std::function()); static ServiceState ExitStatusToState(int exitStatus); static std::pair ParseCheckOutput(const String& output); diff --git a/lib/icinga/scheduleddowntime.cpp b/lib/icinga/scheduleddowntime.cpp index c51c5c296..be980e68f 100644 --- a/lib/icinga/scheduleddowntime.cpp +++ b/lib/icinga/scheduleddowntime.cpp @@ -83,7 +83,7 @@ void ScheduledDowntime::StaticInitialize(void) { l_Timer = new Timer(); l_Timer->SetInterval(60); - l_Timer->OnTimerExpired.connect(boost::bind(&ScheduledDowntime::TimerProc)); + l_Timer->OnTimerExpired.connect(std::bind(&ScheduledDowntime::TimerProc)); l_Timer->Start(); } @@ -99,7 +99,7 @@ void ScheduledDowntime::Start(bool runtimeCreated) { ObjectImpl::Start(runtimeCreated); - Utility::QueueAsyncCallback(boost::bind(&ScheduledDowntime::CreateNextDowntime, this)); + Utility::QueueAsyncCallback(std::bind(&ScheduledDowntime::CreateNextDowntime, this)); } void ScheduledDowntime::TimerProc(void) diff --git a/lib/icinga/timeperiod.cpp b/lib/icinga/timeperiod.cpp index de844331d..004e67538 100644 --- a/lib/icinga/timeperiod.cpp +++ b/lib/icinga/timeperiod.cpp @@ -39,7 +39,7 @@ void TimePeriod::StaticInitialize(void) { l_UpdateTimer = new Timer(); l_UpdateTimer->SetInterval(300); - l_UpdateTimer->OnTimerExpired.connect(boost::bind(&TimePeriod::UpdateTimerHandler)); + l_UpdateTimer->OnTimerExpired.connect(std::bind(&TimePeriod::UpdateTimerHandler)); l_UpdateTimer->Start(); } diff --git a/lib/livestatus/column.cpp b/lib/livestatus/column.cpp index cb40ef278..4c315015b 100644 --- a/lib/livestatus/column.cpp +++ b/lib/livestatus/column.cpp @@ -29,7 +29,7 @@ Value Column::ExtractValue(const Value& urow, LivestatusGroupByType groupByType, { Value row; - if (!m_ObjectAccessor.empty()) + if (m_ObjectAccessor) row = m_ObjectAccessor(urow, groupByType, groupByObject); else row = urow; diff --git a/lib/livestatus/column.hpp b/lib/livestatus/column.hpp index cb83cbb06..92bf036a3 100644 --- a/lib/livestatus/column.hpp +++ b/lib/livestatus/column.hpp @@ -22,7 +22,6 @@ #include "livestatus/i2-livestatus.hpp" #include "base/value.hpp" -#include using namespace icinga; @@ -38,8 +37,8 @@ enum LivestatusGroupByType { class I2_LIVESTATUS_API Column { public: - typedef boost::function ValueAccessor; - typedef boost::function ObjectAccessor; + typedef std::function ValueAccessor; + typedef std::function ObjectAccessor; Column(const ValueAccessor& valueAccessor, const ObjectAccessor& objectAccessor); diff --git a/lib/livestatus/commentstable.cpp b/lib/livestatus/commentstable.cpp index c332ae140..3d69aa62b 100644 --- a/lib/livestatus/commentstable.cpp +++ b/lib/livestatus/commentstable.cpp @@ -48,8 +48,8 @@ void CommentsTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "expire_time", Column(&CommentsTable::ExpireTimeAccessor, objectAccessor)); /* order is important - host w/o services must not be empty */ - ServicesTable::AddColumns(table, "service_", boost::bind(&CommentsTable::ServiceAccessor, _1, objectAccessor)); - HostsTable::AddColumns(table, "host_", boost::bind(&CommentsTable::HostAccessor, _1, objectAccessor)); + ServicesTable::AddColumns(table, "service_", std::bind(&CommentsTable::ServiceAccessor, _1, objectAccessor)); + HostsTable::AddColumns(table, "host_", std::bind(&CommentsTable::HostAccessor, _1, objectAccessor)); } String CommentsTable::GetName(void) const diff --git a/lib/livestatus/downtimestable.cpp b/lib/livestatus/downtimestable.cpp index 0697394b0..dbb97cc52 100644 --- a/lib/livestatus/downtimestable.cpp +++ b/lib/livestatus/downtimestable.cpp @@ -48,8 +48,8 @@ void DowntimesTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "triggered_by", Column(&DowntimesTable::TriggeredByAccessor, objectAccessor)); /* order is important - host w/o services must not be empty */ - ServicesTable::AddColumns(table, "service_", boost::bind(&DowntimesTable::ServiceAccessor, _1, objectAccessor)); - HostsTable::AddColumns(table, "host_", boost::bind(&DowntimesTable::HostAccessor, _1, objectAccessor)); + ServicesTable::AddColumns(table, "service_", std::bind(&DowntimesTable::ServiceAccessor, _1, objectAccessor)); + HostsTable::AddColumns(table, "host_", std::bind(&DowntimesTable::HostAccessor, _1, objectAccessor)); } String DowntimesTable::GetName(void) const diff --git a/lib/livestatus/hoststable.cpp b/lib/livestatus/hoststable.cpp index 7e4a5bb30..ce4cb2a83 100644 --- a/lib/livestatus/hoststable.cpp +++ b/lib/livestatus/hoststable.cpp @@ -170,7 +170,7 @@ void HostsTable::AddColumns(Table *table, const String& prefix, /* _1 = row, _2 = groupByType, _3 = groupByObject */ Log(LogDebug, "Livestatus") << "Processing hosts group by hostgroup table."; - HostGroupsTable::AddColumns(table, "hostgroup_", boost::bind(&HostsTable::HostGroupAccessor, _1, _2, _3)); + HostGroupsTable::AddColumns(table, "hostgroup_", std::bind(&HostsTable::HostGroupAccessor, _1, _2, _3)); } } diff --git a/lib/livestatus/livestatuslistener.cpp b/lib/livestatus/livestatuslistener.cpp index d5e201409..ae0cbc1e6 100644 --- a/lib/livestatus/livestatuslistener.cpp +++ b/lib/livestatus/livestatuslistener.cpp @@ -82,7 +82,7 @@ void LivestatusListener::Start(bool runtimeCreated) m_Listener = socket; - m_Thread = boost::thread(boost::bind(&LivestatusListener::ServerThreadProc, this)); + m_Thread = boost::thread(std::bind(&LivestatusListener::ServerThreadProc, this)); Log(LogInformation, "LivestatusListener") << "Created TCP socket listening on host '" << GetBindHost() << "' port '" << GetBindPort() << "'."; @@ -110,7 +110,7 @@ void LivestatusListener::Start(bool runtimeCreated) m_Listener = socket; - m_Thread = boost::thread(boost::bind(&LivestatusListener::ServerThreadProc, this)); + m_Thread = boost::thread(std::bind(&LivestatusListener::ServerThreadProc, this)); Log(LogInformation, "LivestatusListener") << "Created UNIX socket in '" << GetSocketPath() << "'."; @@ -160,7 +160,7 @@ void LivestatusListener::ServerThreadProc(void) if (m_Listener->Poll(true, false, &tv)) { Socket::Ptr client = m_Listener->Accept(); Log(LogNotice, "LivestatusListener", "Client connected"); - Utility::QueueAsyncCallback(boost::bind(&LivestatusListener::ClientHandler, this, client), LowLatencyScheduler); + Utility::QueueAsyncCallback(std::bind(&LivestatusListener::ClientHandler, this, client), LowLatencyScheduler); } if (!IsActive()) diff --git a/lib/livestatus/livestatuslogutility.cpp b/lib/livestatus/livestatuslogutility.cpp index ec1fbd218..21570cf94 100644 --- a/lib/livestatus/livestatuslogutility.cpp +++ b/lib/livestatus/livestatuslogutility.cpp @@ -39,8 +39,8 @@ using namespace icinga; void LivestatusLogUtility::CreateLogIndex(const String& path, std::map& index) { - Utility::Glob(path + "/icinga.log", boost::bind(&LivestatusLogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile); - Utility::Glob(path + "/archives/*.log", boost::bind(&LivestatusLogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile); + Utility::Glob(path + "/icinga.log", std::bind(&LivestatusLogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile); + Utility::Glob(path + "/archives/*.log", std::bind(&LivestatusLogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile); } void LivestatusLogUtility::CreateLogIndexFileHandler(const String& path, std::map& index) diff --git a/lib/livestatus/logtable.cpp b/lib/livestatus/logtable.cpp index 3da5b0708..73cf8deaa 100644 --- a/lib/livestatus/logtable.cpp +++ b/lib/livestatus/logtable.cpp @@ -75,10 +75,10 @@ void LogTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "contact_name", Column(&LogTable::ContactNameAccessor, objectAccessor)); table->AddColumn(prefix + "command_name", Column(&LogTable::CommandNameAccessor, objectAccessor)); - HostsTable::AddColumns(table, "current_host_", boost::bind(&LogTable::HostAccessor, _1, objectAccessor)); - ServicesTable::AddColumns(table, "current_service_", boost::bind(&LogTable::ServiceAccessor, _1, objectAccessor)); - ContactsTable::AddColumns(table, "current_contact_", boost::bind(&LogTable::ContactAccessor, _1, objectAccessor)); - CommandsTable::AddColumns(table, "current_command_", boost::bind(&LogTable::CommandAccessor, _1, objectAccessor)); + HostsTable::AddColumns(table, "current_host_", std::bind(&LogTable::HostAccessor, _1, objectAccessor)); + ServicesTable::AddColumns(table, "current_service_", std::bind(&LogTable::ServiceAccessor, _1, objectAccessor)); + ContactsTable::AddColumns(table, "current_contact_", std::bind(&LogTable::ContactAccessor, _1, objectAccessor)); + CommandsTable::AddColumns(table, "current_command_", std::bind(&LogTable::CommandAccessor, _1, objectAccessor)); } String LogTable::GetName(void) const diff --git a/lib/livestatus/servicestable.cpp b/lib/livestatus/servicestable.cpp index e2edf8481..d7583da2c 100644 --- a/lib/livestatus/servicestable.cpp +++ b/lib/livestatus/servicestable.cpp @@ -138,19 +138,19 @@ void ServicesTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "cv_is_json", Column(&ServicesTable::CVIsJsonAccessor, objectAccessor)); table->AddColumn(prefix + "original_attributes", Column(&ServicesTable::OriginalAttributesAccessor, objectAccessor)); - HostsTable::AddColumns(table, "host_", boost::bind(&ServicesTable::HostAccessor, _1, objectAccessor)); + HostsTable::AddColumns(table, "host_", std::bind(&ServicesTable::HostAccessor, _1, objectAccessor)); /* add additional group by values received through the object accessor */ if (table->GetGroupByType() == LivestatusGroupByServiceGroup) { /* _1 = row, _2 = groupByType, _3 = groupByObject */ Log(LogDebug, "Livestatus") << "Processing services group by servicegroup table."; - ServiceGroupsTable::AddColumns(table, "servicegroup_", boost::bind(&ServicesTable::ServiceGroupAccessor, _1, _2, _3)); + ServiceGroupsTable::AddColumns(table, "servicegroup_", std::bind(&ServicesTable::ServiceGroupAccessor, _1, _2, _3)); } else if (table->GetGroupByType() == LivestatusGroupByHostGroup) { /* _1 = row, _2 = groupByType, _3 = groupByObject */ Log(LogDebug, "Livestatus") << "Processing services group by hostgroup table."; - HostGroupsTable::AddColumns(table, "hostgroup_", boost::bind(&ServicesTable::HostGroupAccessor, _1, _2, _3)); + HostGroupsTable::AddColumns(table, "hostgroup_", std::bind(&ServicesTable::HostGroupAccessor, _1, _2, _3)); } } diff --git a/lib/livestatus/statehisttable.cpp b/lib/livestatus/statehisttable.cpp index 311ee22ac..b8728472a 100644 --- a/lib/livestatus/statehisttable.cpp +++ b/lib/livestatus/statehisttable.cpp @@ -240,8 +240,8 @@ void StateHistTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "duration_unmonitored", Column(&StateHistTable::DurationUnmonitoredAccessor, objectAccessor)); table->AddColumn(prefix + "duration_part_unmonitored", Column(&StateHistTable::DurationPartUnmonitoredAccessor, objectAccessor)); - HostsTable::AddColumns(table, "current_host_", boost::bind(&StateHistTable::HostAccessor, _1, objectAccessor)); - ServicesTable::AddColumns(table, "current_service_", boost::bind(&StateHistTable::ServiceAccessor, _1, objectAccessor)); + HostsTable::AddColumns(table, "current_host_", std::bind(&StateHistTable::HostAccessor, _1, objectAccessor)); + ServicesTable::AddColumns(table, "current_service_", std::bind(&StateHistTable::ServiceAccessor, _1, objectAccessor)); } String StateHistTable::GetName(void) const diff --git a/lib/livestatus/table.cpp b/lib/livestatus/table.cpp index c71cf466a..7e04b21c0 100644 --- a/lib/livestatus/table.cpp +++ b/lib/livestatus/table.cpp @@ -38,7 +38,6 @@ #include "base/dictionary.hpp" #include #include -#include using namespace icinga; @@ -129,7 +128,7 @@ std::vector Table::FilterRows(const Filter::Ptr& filter, int { std::vector rs; - FetchRows(boost::bind(&Table::FilteredAddRow, this, boost::ref(rs), filter, limit, _1, _2, _3)); + FetchRows(std::bind(&Table::FilteredAddRow, this, boost::ref(rs), filter, limit, _1, _2, _3)); return rs; } diff --git a/lib/livestatus/table.hpp b/lib/livestatus/table.hpp index 56db6cf16..bae11b599 100644 --- a/lib/livestatus/table.hpp +++ b/lib/livestatus/table.hpp @@ -35,8 +35,7 @@ struct LivestatusRowValue { Value GroupByObject; }; - -typedef boost::function AddRowFunction; +typedef std::function AddRowFunction; class Filter; diff --git a/lib/methods/pluginchecktask.cpp b/lib/methods/pluginchecktask.cpp index abf2b0cd5..d2953b0dd 100644 --- a/lib/methods/pluginchecktask.cpp +++ b/lib/methods/pluginchecktask.cpp @@ -53,7 +53,7 @@ void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(), resolvers, resolvedMacros, useResolvedMacros, - boost::bind(&PluginCheckTask::ProcessFinishedHandler, checkable, cr, _1, _2)); + std::bind(&PluginCheckTask::ProcessFinishedHandler, checkable, cr, _1, _2)); if (!resolvedMacros || useResolvedMacros) Checkable::IncreasePendingChecks(); diff --git a/lib/methods/plugineventtask.cpp b/lib/methods/plugineventtask.cpp index 48a0b9ce0..51308f555 100644 --- a/lib/methods/plugineventtask.cpp +++ b/lib/methods/plugineventtask.cpp @@ -51,7 +51,7 @@ void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable, PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(), resolvers, resolvedMacros, useResolvedMacros, - boost::bind(&PluginEventTask::ProcessFinishedHandler, checkable, _1, _2)); + std::bind(&PluginEventTask::ProcessFinishedHandler, checkable, _1, _2)); } void PluginEventTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& commandLine, const ProcessResult& pr) diff --git a/lib/methods/pluginnotificationtask.cpp b/lib/methods/pluginnotificationtask.cpp index 42403e7bb..3485c5c0f 100644 --- a/lib/methods/pluginnotificationtask.cpp +++ b/lib/methods/pluginnotificationtask.cpp @@ -66,7 +66,7 @@ void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification, PluginUtility::ExecuteCommand(commandObj, checkable, cr, resolvers, resolvedMacros, useResolvedMacros, - boost::bind(&PluginNotificationTask::ProcessFinishedHandler, checkable, _1, _2)); + std::bind(&PluginNotificationTask::ProcessFinishedHandler, checkable, _1, _2)); } void PluginNotificationTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& commandLine, const ProcessResult& pr) diff --git a/lib/notification/notificationcomponent.cpp b/lib/notification/notificationcomponent.cpp index 3eebcf164..5ad1a43ea 100644 --- a/lib/notification/notificationcomponent.cpp +++ b/lib/notification/notificationcomponent.cpp @@ -55,12 +55,12 @@ void NotificationComponent::Start(bool runtimeCreated) Log(LogInformation, "NotificationComponent") << "'" << GetName() << "' started."; - Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationComponent::SendNotificationsHandler, this, _1, + Checkable::OnNotificationsRequested.connect(std::bind(&NotificationComponent::SendNotificationsHandler, this, _1, _2, _3, _4, _5)); m_NotificationTimer = new Timer(); m_NotificationTimer->SetInterval(5); - m_NotificationTimer->OnTimerExpired.connect(boost::bind(&NotificationComponent::NotificationTimerHandler, this)); + m_NotificationTimer->OnTimerExpired.connect(std::bind(&NotificationComponent::NotificationTimerHandler, this)); m_NotificationTimer->Start(); } diff --git a/lib/perfdata/elasticsearchwriter.cpp b/lib/perfdata/elasticsearchwriter.cpp index 69221fd88..f1880269d 100644 --- a/lib/perfdata/elasticsearchwriter.cpp +++ b/lib/perfdata/elasticsearchwriter.cpp @@ -35,6 +35,7 @@ #include "base/exception.hpp" #include "base/statsfunction.hpp" #include +#include using namespace icinga; @@ -83,19 +84,19 @@ void ElasticsearchWriter::Start(bool runtimeCreated) Log(LogInformation, "ElasticsearchWriter") << "'" << GetName() << "' started."; - m_WorkQueue.SetExceptionCallback(boost::bind(&ElasticsearchWriter::ExceptionHandler, this, _1)); + m_WorkQueue.SetExceptionCallback(std::bind(&ElasticsearchWriter::ExceptionHandler, this, _1)); /* Setup timer for periodically flushing m_DataBuffer */ m_FlushTimer = new Timer(); m_FlushTimer->SetInterval(GetFlushInterval()); - m_FlushTimer->OnTimerExpired.connect(boost::bind(&ElasticsearchWriter::FlushTimeout, this)); + m_FlushTimer->OnTimerExpired.connect(std::bind(&ElasticsearchWriter::FlushTimeout, this)); m_FlushTimer->Start(); m_FlushTimer->Reschedule(0); /* Register for new metrics. */ - Checkable::OnNewCheckResult.connect(boost::bind(&ElasticsearchWriter::CheckResultHandler, this, _1, _2)); - Checkable::OnStateChange.connect(boost::bind(&ElasticsearchWriter::StateChangeHandler, this, _1, _2, _3)); - Checkable::OnNotificationSentToAllUsers.connect(boost::bind(&ElasticsearchWriter::NotificationSentToAllUsersHandler, this, _1, _2, _3, _4, _5, _6, _7)); + Checkable::OnNewCheckResult.connect(std::bind(&ElasticsearchWriter::CheckResultHandler, this, _1, _2)); + Checkable::OnStateChange.connect(std::bind(&ElasticsearchWriter::StateChangeHandler, this, _1, _2, _3)); + Checkable::OnNotificationSentToAllUsers.connect(std::bind(&ElasticsearchWriter::NotificationSentToAllUsersHandler, this, _1, _2, _3, _4, _5, _6, _7)); } void ElasticsearchWriter::Stop(bool runtimeRemoved) @@ -175,7 +176,7 @@ void ElasticsearchWriter::AddCheckResult(const Dictionary::Ptr& fields, const Ch void ElasticsearchWriter::CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) { - m_WorkQueue.Enqueue(boost::bind(&ElasticsearchWriter::InternalCheckResultHandler, this, checkable, cr)); + m_WorkQueue.Enqueue(std::bind(&ElasticsearchWriter::InternalCheckResultHandler, this, checkable, cr)); } void ElasticsearchWriter::InternalCheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) @@ -229,7 +230,7 @@ void ElasticsearchWriter::InternalCheckResultHandler(const Checkable::Ptr& check void ElasticsearchWriter::StateChangeHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type) { - m_WorkQueue.Enqueue(boost::bind(&ElasticsearchWriter::StateChangeHandlerInternal, this, checkable, cr, type)); + m_WorkQueue.Enqueue(std::bind(&ElasticsearchWriter::StateChangeHandlerInternal, this, checkable, cr, type)); } void ElasticsearchWriter::StateChangeHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type) @@ -278,7 +279,7 @@ void ElasticsearchWriter::NotificationSentToAllUsersHandler(const Notification:: const Checkable::Ptr& checkable, const std::set& users, NotificationType type, const CheckResult::Ptr& cr, const String& author, const String& text) { - m_WorkQueue.Enqueue(boost::bind(&ElasticsearchWriter::NotificationSentToAllUsersHandlerInternal, this, + m_WorkQueue.Enqueue(std::bind(&ElasticsearchWriter::NotificationSentToAllUsersHandlerInternal, this, notification, checkable, users, type, cr, author, text)); } diff --git a/lib/perfdata/gelfwriter.cpp b/lib/perfdata/gelfwriter.cpp index f8798d4f6..b459da7ae 100644 --- a/lib/perfdata/gelfwriter.cpp +++ b/lib/perfdata/gelfwriter.cpp @@ -87,19 +87,19 @@ void GelfWriter::Start(bool runtimeCreated) << "'" << GetName() << "' started."; /* Register exception handler for WQ tasks. */ - m_WorkQueue.SetExceptionCallback(boost::bind(&GelfWriter::ExceptionHandler, this, _1)); + m_WorkQueue.SetExceptionCallback(std::bind(&GelfWriter::ExceptionHandler, this, _1)); /* Timer for reconnecting */ m_ReconnectTimer = new Timer(); m_ReconnectTimer->SetInterval(10); - m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&GelfWriter::ReconnectTimerHandler, this)); + m_ReconnectTimer->OnTimerExpired.connect(std::bind(&GelfWriter::ReconnectTimerHandler, this)); m_ReconnectTimer->Start(); m_ReconnectTimer->Reschedule(0); /* Register event handlers. */ - Checkable::OnNewCheckResult.connect(boost::bind(&GelfWriter::CheckResultHandler, this, _1, _2)); - Checkable::OnNotificationSentToUser.connect(boost::bind(&GelfWriter::NotificationToUserHandler, this, _1, _2, _3, _4, _5, _6, _7, _8)); - Checkable::OnStateChange.connect(boost::bind(&GelfWriter::StateChangeHandler, this, _1, _2, _3)); + Checkable::OnNewCheckResult.connect(std::bind(&GelfWriter::CheckResultHandler, this, _1, _2)); + Checkable::OnNotificationSentToUser.connect(std::bind(&GelfWriter::NotificationToUserHandler, this, _1, _2, _3, _4, _5, _6, _7, _8)); + Checkable::OnStateChange.connect(std::bind(&GelfWriter::StateChangeHandler, this, _1, _2, _3)); } void GelfWriter::Stop(bool runtimeRemoved) @@ -167,7 +167,7 @@ void GelfWriter::Reconnect(void) void GelfWriter::ReconnectTimerHandler(void) { - m_WorkQueue.Enqueue(boost::bind(&GelfWriter::Reconnect, this), PriorityNormal); + m_WorkQueue.Enqueue(std::bind(&GelfWriter::Reconnect, this), PriorityNormal); } void GelfWriter::Disconnect(void) @@ -184,7 +184,7 @@ void GelfWriter::Disconnect(void) void GelfWriter::CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) { - m_WorkQueue.Enqueue(boost::bind(&GelfWriter::CheckResultHandlerInternal, this, checkable, cr)); + m_WorkQueue.Enqueue(std::bind(&GelfWriter::CheckResultHandlerInternal, this, checkable, cr)); } void GelfWriter::CheckResultHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) @@ -284,7 +284,7 @@ void GelfWriter::NotificationToUserHandler(const Notification::Ptr& notification const User::Ptr& user, NotificationType notificationType, CheckResult::Ptr const& cr, const String& author, const String& commentText, const String& commandName) { - m_WorkQueue.Enqueue(boost::bind(&GelfWriter::NotificationToUserHandlerInternal, this, + m_WorkQueue.Enqueue(std::bind(&GelfWriter::NotificationToUserHandlerInternal, this, notification, checkable, user, notificationType, cr, author, commentText, commandName)); } @@ -349,7 +349,7 @@ void GelfWriter::NotificationToUserHandlerInternal(const Notification::Ptr& noti void GelfWriter::StateChangeHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type) { - m_WorkQueue.Enqueue(boost::bind(&GelfWriter::StateChangeHandlerInternal, this, checkable, cr, type)); + m_WorkQueue.Enqueue(std::bind(&GelfWriter::StateChangeHandlerInternal, this, checkable, cr, type)); } void GelfWriter::StateChangeHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type) diff --git a/lib/perfdata/graphitewriter.cpp b/lib/perfdata/graphitewriter.cpp index eb6db28b2..04aad230a 100644 --- a/lib/perfdata/graphitewriter.cpp +++ b/lib/perfdata/graphitewriter.cpp @@ -86,17 +86,17 @@ void GraphiteWriter::Start(bool runtimeCreated) << "'" << GetName() << "' started."; /* Register exception handler for WQ tasks. */ - m_WorkQueue.SetExceptionCallback(boost::bind(&GraphiteWriter::ExceptionHandler, this, _1)); + m_WorkQueue.SetExceptionCallback(std::bind(&GraphiteWriter::ExceptionHandler, this, _1)); /* Timer for reconnecting */ m_ReconnectTimer = new Timer(); m_ReconnectTimer->SetInterval(10); - m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&GraphiteWriter::ReconnectTimerHandler, this)); + m_ReconnectTimer->OnTimerExpired.connect(std::bind(&GraphiteWriter::ReconnectTimerHandler, this)); m_ReconnectTimer->Start(); m_ReconnectTimer->Reschedule(0); /* Register event handlers. */ - Checkable::OnNewCheckResult.connect(boost::bind(&GraphiteWriter::CheckResultHandler, this, _1, _2)); + Checkable::OnNewCheckResult.connect(std::bind(&GraphiteWriter::CheckResultHandler, this, _1, _2)); } void GraphiteWriter::Stop(bool runtimeRemoved) @@ -164,7 +164,7 @@ void GraphiteWriter::Reconnect(void) void GraphiteWriter::ReconnectTimerHandler(void) { - m_WorkQueue.Enqueue(boost::bind(&GraphiteWriter::Reconnect, this), PriorityNormal); + m_WorkQueue.Enqueue(std::bind(&GraphiteWriter::Reconnect, this), PriorityNormal); } void GraphiteWriter::Disconnect(void) @@ -181,7 +181,7 @@ void GraphiteWriter::Disconnect(void) void GraphiteWriter::CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) { - m_WorkQueue.Enqueue(boost::bind(&GraphiteWriter::CheckResultHandlerInternal, this, checkable, cr)); + m_WorkQueue.Enqueue(std::bind(&GraphiteWriter::CheckResultHandlerInternal, this, checkable, cr)); } void GraphiteWriter::CheckResultHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) @@ -206,9 +206,9 @@ void GraphiteWriter::CheckResultHandlerInternal(const Checkable::Ptr& checkable, String prefix; if (service) { - prefix = MacroProcessor::ResolveMacros(GetServiceNameTemplate(), resolvers, cr, NULL, boost::bind(&GraphiteWriter::EscapeMacroMetric, _1)); + prefix = MacroProcessor::ResolveMacros(GetServiceNameTemplate(), resolvers, cr, NULL, std::bind(&GraphiteWriter::EscapeMacroMetric, _1)); } else { - prefix = MacroProcessor::ResolveMacros(GetHostNameTemplate(), resolvers, cr, NULL, boost::bind(&GraphiteWriter::EscapeMacroMetric, _1)); + prefix = MacroProcessor::ResolveMacros(GetHostNameTemplate(), resolvers, cr, NULL, std::bind(&GraphiteWriter::EscapeMacroMetric, _1)); } String prefixPerfdata = prefix + ".perfdata"; diff --git a/lib/perfdata/influxdbwriter.cpp b/lib/perfdata/influxdbwriter.cpp index 9b9bd7410..fa08a69f3 100644 --- a/lib/perfdata/influxdbwriter.cpp +++ b/lib/perfdata/influxdbwriter.cpp @@ -96,17 +96,17 @@ void InfluxdbWriter::Start(bool runtimeCreated) << "'" << GetName() << "' started."; /* Register exception handler for WQ tasks. */ - m_WorkQueue.SetExceptionCallback(boost::bind(&InfluxdbWriter::ExceptionHandler, this, _1)); + m_WorkQueue.SetExceptionCallback(std::bind(&InfluxdbWriter::ExceptionHandler, this, _1)); /* Setup timer for periodically flushing m_DataBuffer */ m_FlushTimer = new Timer(); m_FlushTimer->SetInterval(GetFlushInterval()); - m_FlushTimer->OnTimerExpired.connect(boost::bind(&InfluxdbWriter::FlushTimeout, this)); + m_FlushTimer->OnTimerExpired.connect(std::bind(&InfluxdbWriter::FlushTimeout, this)); m_FlushTimer->Start(); m_FlushTimer->Reschedule(0); /* Register for new metrics. */ - Service::OnNewCheckResult.connect(boost::bind(&InfluxdbWriter::CheckResultHandler, this, _1, _2)); + Service::OnNewCheckResult.connect(std::bind(&InfluxdbWriter::CheckResultHandler, this, _1, _2)); } void InfluxdbWriter::Stop(bool runtimeRemoved) @@ -176,7 +176,7 @@ Stream::Ptr InfluxdbWriter::Connect() void InfluxdbWriter::CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) { - m_WorkQueue.Enqueue(boost::bind(&InfluxdbWriter::InternalCheckResultHandler, this, checkable, cr)); + m_WorkQueue.Enqueue(std::bind(&InfluxdbWriter::InternalCheckResultHandler, this, checkable, cr)); } void InfluxdbWriter::InternalCheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) diff --git a/lib/perfdata/opentsdbwriter.cpp b/lib/perfdata/opentsdbwriter.cpp index 328c5be7f..f225eff9b 100644 --- a/lib/perfdata/opentsdbwriter.cpp +++ b/lib/perfdata/opentsdbwriter.cpp @@ -66,11 +66,11 @@ void OpenTsdbWriter::Start(bool runtimeCreated) m_ReconnectTimer = new Timer(); m_ReconnectTimer->SetInterval(10); - m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&OpenTsdbWriter::ReconnectTimerHandler, this)); + m_ReconnectTimer->OnTimerExpired.connect(std::bind(&OpenTsdbWriter::ReconnectTimerHandler, this)); m_ReconnectTimer->Start(); m_ReconnectTimer->Reschedule(0); - Service::OnNewCheckResult.connect(boost::bind(&OpenTsdbWriter::CheckResultHandler, this, _1, _2)); + Service::OnNewCheckResult.connect(std::bind(&OpenTsdbWriter::CheckResultHandler, this, _1, _2)); } void OpenTsdbWriter::Stop(bool runtimeRemoved) diff --git a/lib/perfdata/perfdatawriter.cpp b/lib/perfdata/perfdatawriter.cpp index 0ba3e8940..3200252ff 100644 --- a/lib/perfdata/perfdatawriter.cpp +++ b/lib/perfdata/perfdatawriter.cpp @@ -56,10 +56,10 @@ void PerfdataWriter::Start(bool runtimeCreated) Log(LogInformation, "PerfdataWriter") << "'" << GetName() << "' started."; - Checkable::OnNewCheckResult.connect(boost::bind(&PerfdataWriter::CheckResultHandler, this, _1, _2)); + Checkable::OnNewCheckResult.connect(std::bind(&PerfdataWriter::CheckResultHandler, this, _1, _2)); m_RotationTimer = new Timer(); - m_RotationTimer->OnTimerExpired.connect(boost::bind(&PerfdataWriter::RotationTimerHandler, this)); + m_RotationTimer->OnTimerExpired.connect(std::bind(&PerfdataWriter::RotationTimerHandler, this)); m_RotationTimer->SetInterval(GetRotationInterval()); m_RotationTimer->Start(); diff --git a/lib/remote/apiaction.hpp b/lib/remote/apiaction.hpp index b4b4f957f..6d515be4b 100644 --- a/lib/remote/apiaction.hpp +++ b/lib/remote/apiaction.hpp @@ -26,7 +26,6 @@ #include "base/dictionary.hpp" #include "base/configobject.hpp" #include -#include #include #include #include @@ -44,7 +43,7 @@ class I2_REMOTE_API ApiAction : public Object public: DECLARE_PTR_TYPEDEFS(ApiAction); - typedef boost::function Callback; + typedef std::function Callback; ApiAction(const std::vector& registerTypes, const Callback& function); diff --git a/lib/remote/apiclient.cpp b/lib/remote/apiclient.cpp index 8aa676a47..45cf06f6a 100644 --- a/lib/remote/apiclient.cpp +++ b/lib/remote/apiclient.cpp @@ -51,7 +51,7 @@ void ApiClient::GetTypes(const TypesCompletionCallback& callback) const req->RequestUrl = url; req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password)); req->AddHeader("Accept", "application/json"); - m_Connection->SubmitRequest(req, boost::bind(TypesHttpCompletionCallback, _1, _2, callback)); + m_Connection->SubmitRequest(req, std::bind(TypesHttpCompletionCallback, _1, _2, callback)); } catch (const std::exception& ex) { callback(boost::current_exception(), std::vector()); } @@ -141,7 +141,7 @@ void ApiClient::GetObjects(const String& pluralType, const ObjectsCompletionCall req->RequestUrl = url; req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password)); req->AddHeader("Accept", "application/json"); - m_Connection->SubmitRequest(req, boost::bind(ObjectsHttpCompletionCallback, _1, _2, callback)); + m_Connection->SubmitRequest(req, std::bind(ObjectsHttpCompletionCallback, _1, _2, callback)); } catch (const std::exception& ex) { callback(boost::current_exception(), std::vector()); } @@ -255,7 +255,7 @@ void ApiClient::ExecuteScript(const String& session, const String& command, bool req->RequestUrl = url; req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password)); req->AddHeader("Accept", "application/json"); - m_Connection->SubmitRequest(req, boost::bind(ExecuteScriptHttpCompletionCallback, _1, _2, callback)); + m_Connection->SubmitRequest(req, std::bind(ExecuteScriptHttpCompletionCallback, _1, _2, callback)); } catch (const std::exception& ex) { callback(boost::current_exception(), Empty); } @@ -339,7 +339,7 @@ void ApiClient::AutocompleteScript(const String& session, const String& command, req->RequestUrl = url; req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password)); req->AddHeader("Accept", "application/json"); - m_Connection->SubmitRequest(req, boost::bind(AutocompleteScriptHttpCompletionCallback, _1, _2, callback)); + m_Connection->SubmitRequest(req, std::bind(AutocompleteScriptHttpCompletionCallback, _1, _2, callback)); } catch (const std::exception& ex) { callback(boost::current_exception(), Array::Ptr()); } diff --git a/lib/remote/apiclient.hpp b/lib/remote/apiclient.hpp index 4c2122df5..554682694 100644 --- a/lib/remote/apiclient.hpp +++ b/lib/remote/apiclient.hpp @@ -92,20 +92,20 @@ public: ApiClient(const String& host, const String& port, const String& user, const String& password); - typedef boost::function&)> TypesCompletionCallback; + typedef std::function&)> TypesCompletionCallback; void GetTypes(const TypesCompletionCallback& callback) const; - typedef boost::function&)> ObjectsCompletionCallback; + typedef std::function&)> ObjectsCompletionCallback; void GetObjects(const String& pluralType, const ObjectsCompletionCallback& callback, const std::vector& names = std::vector(), const std::vector& attrs = std::vector(), const std::vector& joins = std::vector(), bool all_joins = false) const; - typedef boost::function ExecuteScriptCompletionCallback; + typedef std::function ExecuteScriptCompletionCallback; void ExecuteScript(const String& session, const String& command, bool sandboxed, const ExecuteScriptCompletionCallback& callback) const; - typedef boost::function AutocompleteScriptCompletionCallback; + typedef std::function AutocompleteScriptCompletionCallback; void AutocompleteScript(const String& session, const String& command, bool sandboxed, const AutocompleteScriptCompletionCallback& callback) const; diff --git a/lib/remote/apifunction.hpp b/lib/remote/apifunction.hpp index b71ed6475..264ff95f6 100644 --- a/lib/remote/apifunction.hpp +++ b/lib/remote/apifunction.hpp @@ -26,7 +26,6 @@ #include "base/value.hpp" #include "base/dictionary.hpp" #include -#include namespace icinga { @@ -41,7 +40,7 @@ class I2_REMOTE_API ApiFunction : public Object public: DECLARE_PTR_TYPEDEFS(ApiFunction); - typedef boost::function Callback; + typedef std::function Callback; ApiFunction(const Callback& function); diff --git a/lib/remote/apilistener-filesync.cpp b/lib/remote/apilistener-filesync.cpp index 0743d25bc..7dd5e4502 100644 --- a/lib/remote/apilistener-filesync.cpp +++ b/lib/remote/apilistener-filesync.cpp @@ -72,7 +72,7 @@ ConfigDirInformation ApiListener::LoadConfigDir(const String& dir) ConfigDirInformation config; config.UpdateV1 = new Dictionary(); config.UpdateV2 = new Dictionary(); - Utility::GlobRecursive(dir, "*", boost::bind(&ApiListener::ConfigGlobHandler, boost::ref(config), dir, _1), GlobFile); + Utility::GlobRecursive(dir, "*", std::bind(&ApiListener::ConfigGlobHandler, boost::ref(config), dir, _1), GlobFile); return config; } diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 86cc79759..2e93c2af4 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -233,24 +233,24 @@ void ApiListener::Start(bool runtimeCreated) } m_Timer = new Timer(); - m_Timer->OnTimerExpired.connect(boost::bind(&ApiListener::ApiTimerHandler, this)); + m_Timer->OnTimerExpired.connect(std::bind(&ApiListener::ApiTimerHandler, this)); m_Timer->SetInterval(5); m_Timer->Start(); m_Timer->Reschedule(0); m_ReconnectTimer = new Timer(); - m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&ApiListener::ApiReconnectTimerHandler, this)); + m_ReconnectTimer->OnTimerExpired.connect(std::bind(&ApiListener::ApiReconnectTimerHandler, this)); m_ReconnectTimer->SetInterval(60); m_ReconnectTimer->Start(); m_ReconnectTimer->Reschedule(0); m_AuthorityTimer = new Timer(); - m_AuthorityTimer->OnTimerExpired.connect(boost::bind(&ApiListener::UpdateObjectAuthority)); + m_AuthorityTimer->OnTimerExpired.connect(std::bind(&ApiListener::UpdateObjectAuthority)); m_AuthorityTimer->SetInterval(30); m_AuthorityTimer->Start(); m_CleanupCertificateRequestsTimer = new Timer(); - m_CleanupCertificateRequestsTimer->OnTimerExpired.connect(boost::bind(&ApiListener::CleanupCertificateRequestsTimerHandler, this)); + m_CleanupCertificateRequestsTimer->OnTimerExpired.connect(std::bind(&ApiListener::CleanupCertificateRequestsTimerHandler, this)); m_CleanupCertificateRequestsTimer->SetInterval(3600); m_CleanupCertificateRequestsTimer->Start(); m_CleanupCertificateRequestsTimer->Reschedule(0); @@ -332,7 +332,7 @@ bool ApiListener::AddListener(const String& node, const String& service) return false; } - boost::thread thread(boost::bind(&ApiListener::ListenerThreadProc, this, server)); + boost::thread thread(std::bind(&ApiListener::ListenerThreadProc, this, server)); thread.detach(); m_Servers.insert(server); @@ -349,7 +349,7 @@ void ApiListener::ListenerThreadProc(const Socket::Ptr& server) for (;;) { try { Socket::Ptr client = server->Accept(); - boost::thread thread(boost::bind(&ApiListener::NewClientHandler, this, client, String(), RoleServer)); + boost::thread thread(std::bind(&ApiListener::NewClientHandler, this, client, String(), RoleServer)); thread.detach(); } catch (const std::exception&) { Log(LogCritical, "ApiListener", "Cannot accept new connection."); @@ -539,7 +539,7 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri endpoint->AddClient(aclient); - m_SyncQueue.Enqueue(boost::bind(&ApiListener::SyncClient, this, aclient, endpoint, needSync)); + m_SyncQueue.Enqueue(std::bind(&ApiListener::SyncClient, this, aclient, endpoint, needSync)); } else AddAnonymousClient(aclient); } else { @@ -571,7 +571,7 @@ void ApiListener::SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoi JsonRpcConnection::SendCertificateRequest(aclient, MessageOrigin::Ptr(), String()); if (Utility::PathExists(ApiListener::GetCertificateRequestsDir())) - Utility::Glob(ApiListener::GetCertificateRequestsDir() + "/*.json", boost::bind(&JsonRpcConnection::SendCertificateRequest, aclient, MessageOrigin::Ptr(), _1), GlobFile); + Utility::Glob(ApiListener::GetCertificateRequestsDir() + "/*.json", std::bind(&JsonRpcConnection::SendCertificateRequest, aclient, MessageOrigin::Ptr(), _1), GlobFile); } /* Make sure that the config updates are synced @@ -631,7 +631,7 @@ void ApiListener::ApiTimerHandler(void) double now = Utility::GetTime(); std::vector files; - Utility::Glob(GetApiDir() + "log/*", boost::bind(&ApiListener::LogGlobHandler, boost::ref(files), _1), GlobFile); + Utility::Glob(GetApiDir() + "log/*", std::bind(&ApiListener::LogGlobHandler, boost::ref(files), _1), GlobFile); std::sort(files.begin(), files.end()); for (int ts : files) { @@ -744,7 +744,7 @@ void ApiListener::ApiReconnectTimerHandler(void) continue; } - boost::thread thread(boost::bind(&ApiListener::AddConnection, this, endpoint)); + boost::thread thread(std::bind(&ApiListener::AddConnection, this, endpoint)); thread.detach(); } } @@ -787,7 +787,7 @@ void ApiListener::CleanupCertificateRequestsTimerHandler(void) if (Utility::PathExists(requestsDir)) { /* remove certificate requests that are older than a week */ double expiryTime = Utility::GetTime() - 7 * 24 * 60 * 60; - Utility::Glob(requestsDir + "/*.json", boost::bind(&CleanupCertificateRequest, _1, expiryTime), GlobFile); + Utility::Glob(requestsDir + "/*.json", std::bind(&CleanupCertificateRequest, _1, expiryTime), GlobFile); } } @@ -797,7 +797,7 @@ void ApiListener::RelayMessage(const MessageOrigin::Ptr& origin, if (!IsActive()) return; - m_RelayQueue.Enqueue(boost::bind(&ApiListener::SyncRelayMessage, this, origin, secobj, message, log), PriorityNormal, true); + m_RelayQueue.Enqueue(std::bind(&ApiListener::SyncRelayMessage, this, origin, secobj, message, log), PriorityNormal, true); } void ApiListener::PersistMessage(const Dictionary::Ptr& message, const ConfigObject::Ptr& secobj) @@ -1090,7 +1090,7 @@ void ApiListener::ReplayLog(const JsonRpcConnection::Ptr& client) count = 0; std::vector files; - Utility::Glob(GetApiDir() + "log/*", boost::bind(&ApiListener::LogGlobHandler, boost::ref(files), _1), GlobFile); + Utility::Glob(GetApiDir() + "log/*", std::bind(&ApiListener::LogGlobHandler, boost::ref(files), _1), GlobFile); std::sort(files.begin(), files.end()); for (int ts : files) { diff --git a/lib/remote/configpackageutility.cpp b/lib/remote/configpackageutility.cpp index b7f04a18f..c7a6670fa 100644 --- a/lib/remote/configpackageutility.cpp +++ b/lib/remote/configpackageutility.cpp @@ -59,7 +59,7 @@ void ConfigPackageUtility::DeletePackage(const String& name) std::vector ConfigPackageUtility::GetPackages(void) { std::vector packages; - Utility::Glob(GetPackageDir() + "/*", boost::bind(&ConfigPackageUtility::CollectDirNames, + Utility::Glob(GetPackageDir() + "/*", std::bind(&ConfigPackageUtility::CollectDirNames, _1, boost::ref(packages)), GlobDirectory); return packages; } @@ -218,7 +218,7 @@ void ConfigPackageUtility::AsyncTryActivateStage(const String& packageName, cons Process::Ptr process = new Process(Process::PrepareCommand(args)); process->SetTimeout(300); - process->Run(boost::bind(&TryActivateStageCallback, _1, packageName, stageName, reload)); + process->Run(std::bind(&TryActivateStageCallback, _1, packageName, stageName, reload)); } void ConfigPackageUtility::DeleteStage(const String& packageName, const String& stageName) @@ -237,7 +237,7 @@ void ConfigPackageUtility::DeleteStage(const String& packageName, const String& std::vector ConfigPackageUtility::GetStages(const String& packageName) { std::vector stages; - Utility::Glob(GetPackageDir() + "/" + packageName + "/*", boost::bind(&ConfigPackageUtility::CollectDirNames, _1, boost::ref(stages)), GlobDirectory); + Utility::Glob(GetPackageDir() + "/" + packageName + "/*", std::bind(&ConfigPackageUtility::CollectDirNames, _1, boost::ref(stages)), GlobDirectory); return stages; } @@ -263,7 +263,7 @@ String ConfigPackageUtility::GetActiveStage(const String& packageName) std::vector > ConfigPackageUtility::GetFiles(const String& packageName, const String& stageName) { std::vector > paths; - Utility::GlobRecursive(GetPackageDir() + "/" + packageName + "/" + stageName, "*", boost::bind(&ConfigPackageUtility::CollectPaths, _1, boost::ref(paths)), GlobDirectory | GlobFile); + Utility::GlobRecursive(GetPackageDir() + "/" + packageName + "/" + stageName, "*", std::bind(&ConfigPackageUtility::CollectPaths, _1, boost::ref(paths)), GlobDirectory | GlobFile); return paths; } diff --git a/lib/remote/consolehandler.cpp b/lib/remote/consolehandler.cpp index 0cfc1b971..953bb23b5 100644 --- a/lib/remote/consolehandler.cpp +++ b/lib/remote/consolehandler.cpp @@ -59,7 +59,7 @@ static void ScriptFrameCleanupHandler(void) INITIALIZE_ONCE([]() { l_FrameCleanupTimer = new Timer(); - l_FrameCleanupTimer->OnTimerExpired.connect(boost::bind(ScriptFrameCleanupHandler)); + l_FrameCleanupTimer->OnTimerExpired.connect(std::bind(ScriptFrameCleanupHandler)); l_FrameCleanupTimer->SetInterval(30); l_FrameCleanupTimer->Start(); }); diff --git a/lib/remote/filterutility.cpp b/lib/remote/filterutility.cpp index aa1743698..7d897745f 100644 --- a/lib/remote/filterutility.cpp +++ b/lib/remote/filterutility.cpp @@ -44,7 +44,7 @@ Type::Ptr FilterUtility::TypeFromPluralName(const String& pluralName) return Type::Ptr(); } -void ConfigObjectTargetProvider::FindTargets(const String& type, const boost::function& addTarget) const +void ConfigObjectTargetProvider::FindTargets(const String& type, const std::function& addTarget) const { Type::Ptr ptype = Type::GetByName(type); ConfigType *ctype = dynamic_cast(ptype.get()); @@ -268,7 +268,7 @@ std::vector FilterUtility::GetFilterTargets(const QueryDescription& qd, c frame.Self = uvars; try { - provider->FindTargets(type, boost::bind(&FilteredAddTarget, + provider->FindTargets(type, std::bind(&FilteredAddTarget, boost::ref(permissionFrame), permissionFilter, boost::ref(frame), ufilter, boost::ref(result), variableName, _1)); } catch (const std::exception& ex) { diff --git a/lib/remote/filterutility.hpp b/lib/remote/filterutility.hpp index 0f742b58c..461cfd638 100644 --- a/lib/remote/filterutility.hpp +++ b/lib/remote/filterutility.hpp @@ -35,7 +35,7 @@ class TargetProvider : public Object public: DECLARE_PTR_TYPEDEFS(TargetProvider); - virtual void FindTargets(const String& type, const boost::function& addTarget) const = 0; + virtual void FindTargets(const String& type, const std::function& addTarget) const = 0; virtual Value GetTargetByName(const String& type, const String& name) const = 0; virtual bool IsValidType(const String& type) const = 0; virtual String GetPluralName(const String& type) const = 0; @@ -46,7 +46,7 @@ class ConfigObjectTargetProvider : public TargetProvider public: DECLARE_PTR_TYPEDEFS(ConfigObjectTargetProvider); - virtual void FindTargets(const String& type, const boost::function& addTarget) const override; + virtual void FindTargets(const String& type, const std::function& addTarget) const override; virtual Value GetTargetByName(const String& type, const String& name) const override; virtual bool IsValidType(const String& type) const override; virtual String GetPluralName(const String& type) const override; diff --git a/lib/remote/httpclientconnection.cpp b/lib/remote/httpclientconnection.cpp index ffd241caa..3caeb3057 100644 --- a/lib/remote/httpclientconnection.cpp +++ b/lib/remote/httpclientconnection.cpp @@ -63,7 +63,7 @@ void HttpClientConnection::Reconnect(void) -- does not currently work because the NetworkStream class doesn't support async I/O */ /* the stream holds an owning reference to this object through the callback we're registering here */ - m_Stream->RegisterDataHandler(boost::bind(&HttpClientConnection::DataAvailableHandler, HttpClientConnection::Ptr(this), _1)); + m_Stream->RegisterDataHandler(std::bind(&HttpClientConnection::DataAvailableHandler, HttpClientConnection::Ptr(this), _1)); if (m_Stream->IsDataAvailable()) DataAvailableHandler(m_Stream); } diff --git a/lib/remote/httpclientconnection.hpp b/lib/remote/httpclientconnection.hpp index 41a4ba136..d8b820831 100644 --- a/lib/remote/httpclientconnection.hpp +++ b/lib/remote/httpclientconnection.hpp @@ -52,7 +52,7 @@ public: boost::shared_ptr NewRequest(void); - typedef boost::function HttpCompletionCallback; + typedef std::function HttpCompletionCallback; void SubmitRequest(const boost::shared_ptr& request, const HttpCompletionCallback& callback); private: diff --git a/lib/remote/httphandler.hpp b/lib/remote/httphandler.hpp index 444c6694a..7c440f962 100644 --- a/lib/remote/httphandler.hpp +++ b/lib/remote/httphandler.hpp @@ -25,7 +25,6 @@ #include "remote/apiuser.hpp" #include "base/registry.hpp" #include -#include namespace icinga { diff --git a/lib/remote/httpserverconnection.cpp b/lib/remote/httpserverconnection.cpp index c2538b6eb..53e6f7af7 100644 --- a/lib/remote/httpserverconnection.cpp +++ b/lib/remote/httpserverconnection.cpp @@ -51,7 +51,7 @@ HttpServerConnection::HttpServerConnection(const String& identity, bool authenti void HttpServerConnection::StaticInitialize(void) { l_HttpServerConnectionTimeoutTimer = new Timer(); - l_HttpServerConnectionTimeoutTimer->OnTimerExpired.connect(boost::bind(&HttpServerConnection::TimeoutTimerHandler)); + l_HttpServerConnectionTimeoutTimer->OnTimerExpired.connect(std::bind(&HttpServerConnection::TimeoutTimerHandler)); l_HttpServerConnectionTimeoutTimer->SetInterval(15); l_HttpServerConnectionTimeoutTimer->Start(); } @@ -59,7 +59,7 @@ void HttpServerConnection::StaticInitialize(void) void HttpServerConnection::Start(void) { /* the stream holds an owning reference to this object through the callback we're registering here */ - m_Stream->RegisterDataHandler(boost::bind(&HttpServerConnection::DataAvailableHandler, HttpServerConnection::Ptr(this))); + m_Stream->RegisterDataHandler(std::bind(&HttpServerConnection::DataAvailableHandler, HttpServerConnection::Ptr(this))); if (m_Stream->IsDataAvailable()) DataAvailableHandler(); } @@ -114,7 +114,7 @@ bool HttpServerConnection::ProcessMessage(void) } if (m_CurrentRequest.Complete) { - m_RequestQueue.Enqueue(boost::bind(&HttpServerConnection::ProcessMessageAsync, + m_RequestQueue.Enqueue(std::bind(&HttpServerConnection::ProcessMessageAsync, HttpServerConnection::Ptr(this), m_CurrentRequest)); m_Seen = Utility::GetTime(); diff --git a/lib/remote/jsonrpcconnection-heartbeat.cpp b/lib/remote/jsonrpcconnection-heartbeat.cpp index 4ae677b35..5485ca8d9 100644 --- a/lib/remote/jsonrpcconnection-heartbeat.cpp +++ b/lib/remote/jsonrpcconnection-heartbeat.cpp @@ -33,7 +33,7 @@ static Timer::Ptr l_HeartbeatTimer; INITIALIZE_ONCE([]() { l_HeartbeatTimer = new Timer(); - l_HeartbeatTimer->OnTimerExpired.connect(boost::bind(&JsonRpcConnection::HeartbeatTimerHandler)); + l_HeartbeatTimer->OnTimerExpired.connect(std::bind(&JsonRpcConnection::HeartbeatTimerHandler)); l_HeartbeatTimer->SetInterval(10); l_HeartbeatTimer->Start(); }); diff --git a/lib/remote/jsonrpcconnection.cpp b/lib/remote/jsonrpcconnection.cpp index 3d9cacaf0..0107871db 100644 --- a/lib/remote/jsonrpcconnection.cpp +++ b/lib/remote/jsonrpcconnection.cpp @@ -55,7 +55,7 @@ JsonRpcConnection::JsonRpcConnection(const String& identity, bool authenticated, void JsonRpcConnection::StaticInitialize(void) { l_JsonRpcConnectionTimeoutTimer = new Timer(); - l_JsonRpcConnectionTimeoutTimer->OnTimerExpired.connect(boost::bind(&JsonRpcConnection::TimeoutTimerHandler)); + l_JsonRpcConnectionTimeoutTimer->OnTimerExpired.connect(std::bind(&JsonRpcConnection::TimeoutTimerHandler)); l_JsonRpcConnectionTimeoutTimer->SetInterval(15); l_JsonRpcConnectionTimeoutTimer->Start(); @@ -70,7 +70,7 @@ void JsonRpcConnection::StaticInitialize(void) void JsonRpcConnection::Start(void) { /* the stream holds an owning reference to this object through the callback we're registering here */ - m_Stream->RegisterDataHandler(boost::bind(&JsonRpcConnection::DataAvailableHandler, JsonRpcConnection::Ptr(this))); + m_Stream->RegisterDataHandler(std::bind(&JsonRpcConnection::DataAvailableHandler, JsonRpcConnection::Ptr(this))); if (m_Stream->IsDataAvailable()) DataAvailableHandler(); } @@ -237,7 +237,7 @@ bool JsonRpcConnection::ProcessMessage(void) if (srs != StatusNewItem) return false; - l_JsonRpcConnectionWorkQueues[m_ID % l_JsonRpcConnectionWorkQueueCount].Enqueue(boost::bind(&JsonRpcConnection::MessageHandlerWrapper, JsonRpcConnection::Ptr(this), message)); + l_JsonRpcConnectionWorkQueues[m_ID % l_JsonRpcConnectionWorkQueueCount].Enqueue(std::bind(&JsonRpcConnection::MessageHandlerWrapper, JsonRpcConnection::Ptr(this), message)); return true; } diff --git a/lib/remote/pkiutility.cpp b/lib/remote/pkiutility.cpp index 6e8443bd5..ab3685588 100644 --- a/lib/remote/pkiutility.cpp +++ b/lib/remote/pkiutility.cpp @@ -431,7 +431,7 @@ Dictionary::Ptr PkiUtility::GetCertificateRequests(void) String requestDir = ApiListener::GetCertificateRequestsDir(); if (Utility::PathExists(requestDir)) - Utility::Glob(requestDir + "/*.json", boost::bind(&CollectRequestHandler, requests, _1), GlobFile); + Utility::Glob(requestDir + "/*.json", std::bind(&CollectRequestHandler, requests, _1), GlobFile); return requests; } diff --git a/lib/remote/statushandler.cpp b/lib/remote/statushandler.cpp index 8578d4352..518a9513f 100644 --- a/lib/remote/statushandler.cpp +++ b/lib/remote/statushandler.cpp @@ -33,7 +33,7 @@ public: DECLARE_PTR_TYPEDEFS(StatusTargetProvider); virtual void FindTargets(const String& type, - const boost::function& addTarget) const override + const std::function& addTarget) const override { typedef std::pair kv_pair; for (const kv_pair& kv : StatsFunctionRegistry::GetInstance()->GetItems()) { diff --git a/lib/remote/templatequeryhandler.cpp b/lib/remote/templatequeryhandler.cpp index 4d8124286..d6445f42a 100644 --- a/lib/remote/templatequeryhandler.cpp +++ b/lib/remote/templatequeryhandler.cpp @@ -55,7 +55,7 @@ public: } virtual void FindTargets(const String& type, - const boost::function& addTarget) const override + const std::function& addTarget) const override { Type::Ptr ptype = Type::GetByName(type); diff --git a/lib/remote/typequeryhandler.cpp b/lib/remote/typequeryhandler.cpp index 73dde3678..c0b56b0d4 100644 --- a/lib/remote/typequeryhandler.cpp +++ b/lib/remote/typequeryhandler.cpp @@ -36,7 +36,7 @@ public: DECLARE_PTR_TYPEDEFS(TypeTargetProvider); virtual void FindTargets(const String& type, - const boost::function& addTarget) const override + const std::function& addTarget) const override { for (const Type::Ptr& target : Type::GetAllTypes()) { addTarget(target); diff --git a/lib/remote/variablequeryhandler.cpp b/lib/remote/variablequeryhandler.cpp index 65afdde61..0f3dbd953 100644 --- a/lib/remote/variablequeryhandler.cpp +++ b/lib/remote/variablequeryhandler.cpp @@ -46,7 +46,7 @@ public: } virtual void FindTargets(const String& type, - const boost::function& addTarget) const override + const std::function& addTarget) const override { { Dictionary::Ptr globals = ScriptGlobal::GetGlobals(); diff --git a/plugins/check_disk.cpp b/plugins/check_disk.cpp index 7e4fa35d0..75835c8fd 100644 --- a/plugins/check_disk.cpp +++ b/plugins/check_disk.cpp @@ -362,7 +362,7 @@ static INT check_drives(std::vector& vDrives, std::vector& BOOST_FOREACH(const std::wstring wsDriveName, vExclude_Drives) { vDrives.erase(std::remove_if(vDrives.begin(), vDrives.end(), - boost::bind(checkName, _1, wsDriveName + L'\\')), vDrives.end()); + std::bind(checkName, _1, wsDriveName + L'\\')), vDrives.end()); } } return -1; diff --git a/plugins/check_nscp_api.cpp b/plugins/check_nscp_api.cpp index 8a632ef85..71ae8623c 100644 --- a/plugins/check_nscp_api.cpp +++ b/plugins/check_nscp_api.cpp @@ -94,7 +94,7 @@ static Dictionary::Ptr QueryEndpoint(const String& host, const String& port, con // Submits the request. The 'ResultHttpCompletionCallback' is called once the HttpRequest receives an answer, // which then sets 'ready' to true - m_Connection->SubmitRequest(req, boost::bind(ResultHttpCompletionCallback, _1, _2, + m_Connection->SubmitRequest(req, std::bind(ResultHttpCompletionCallback, _1, _2, boost::ref(ready), boost::ref(cv), boost::ref(mtx), boost::ref(result))); // We need to spinlock here because our 'HttpRequest' works asynchronous diff --git a/test/base-timer.cpp b/test/base-timer.cpp index 1a4735370..e82e30a85 100644 --- a/test/base-timer.cpp +++ b/test/base-timer.cpp @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE(invoke) { int counter; Timer::Ptr timer = new Timer(); - timer->OnTimerExpired.connect(boost::bind(&Callback, &counter)); + timer->OnTimerExpired.connect(std::bind(&Callback, &counter)); timer->SetInterval(1); counter = 0; @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(scope) { int counter; Timer::Ptr timer = new Timer(); - timer->OnTimerExpired.connect(boost::bind(&Callback, &counter)); + timer->OnTimerExpired.connect(std::bind(&Callback, &counter)); timer->SetInterval(1); counter = 0; diff --git a/test/icinga-checkresult.cpp b/test/icinga-checkresult.cpp index 6adbcc065..1dae65862 100644 --- a/test/icinga-checkresult.cpp +++ b/test/icinga-checkresult.cpp @@ -60,7 +60,7 @@ static void CheckNotification(const Checkable::Ptr& checkable, bool expected, No BOOST_AUTO_TEST_CASE(host_1attempt) { - boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationHandler, _1, _2)); + boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(std::bind(&NotificationHandler, _1, _2)); Host::Ptr host = new Host(); host->SetMaxCheckAttempts(1); @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(host_1attempt) BOOST_AUTO_TEST_CASE(host_2attempts) { - boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationHandler, _1, _2)); + boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(std::bind(&NotificationHandler, _1, _2)); Host::Ptr host = new Host(); host->SetMaxCheckAttempts(2); @@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(host_2attempts) BOOST_AUTO_TEST_CASE(host_3attempts) { - boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationHandler, _1, _2)); + boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(std::bind(&NotificationHandler, _1, _2)); Host::Ptr host = new Host(); host->SetMaxCheckAttempts(3); @@ -225,7 +225,7 @@ BOOST_AUTO_TEST_CASE(host_3attempts) BOOST_AUTO_TEST_CASE(service_1attempt) { - boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationHandler, _1, _2)); + boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(std::bind(&NotificationHandler, _1, _2)); Service::Ptr service = new Service(); service->SetMaxCheckAttempts(1); @@ -273,7 +273,7 @@ BOOST_AUTO_TEST_CASE(service_1attempt) BOOST_AUTO_TEST_CASE(service_2attempts) { - boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationHandler, _1, _2)); + boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(std::bind(&NotificationHandler, _1, _2)); Service::Ptr service = new Service(); service->SetMaxCheckAttempts(2); @@ -328,7 +328,7 @@ BOOST_AUTO_TEST_CASE(service_2attempts) BOOST_AUTO_TEST_CASE(service_3attempts) { - boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationHandler, _1, _2)); + boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(std::bind(&NotificationHandler, _1, _2)); Service::Ptr service = new Service(); service->SetMaxCheckAttempts(3); @@ -393,7 +393,7 @@ BOOST_AUTO_TEST_CASE(host_flapping_notification) #ifndef I2_DEBUG BOOST_WARN_MESSAGE(false, "This test can only be run in a debug build!"); #else /* I2_DEBUG */ - boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationHandler, _1, _2)); + boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(std::bind(&NotificationHandler, _1, _2)); int timeStepInterval = 60; @@ -446,7 +446,7 @@ BOOST_AUTO_TEST_CASE(service_flapping_notification) #ifndef I2_DEBUG BOOST_WARN_MESSAGE(false, "This test can only be run in a debug build!"); #else /* I2_DEBUG */ - boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationHandler, _1, _2)); + boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(std::bind(&NotificationHandler, _1, _2)); int timeStepInterval = 60; @@ -500,7 +500,7 @@ BOOST_AUTO_TEST_CASE(service_flapping_problem_notifications) #ifndef I2_DEBUG BOOST_WARN_MESSAGE(false, "This test can only be run in a debug build!"); #else /* I2_DEBUG */ - boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationHandler, _1, _2)); + boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(std::bind(&NotificationHandler, _1, _2)); int timeStepInterval = 60; @@ -598,7 +598,7 @@ BOOST_AUTO_TEST_CASE(service_flapping_ok_into_bad) #ifndef I2_DEBUG BOOST_WARN_MESSAGE(false, "This test can only be run in a debug build!"); #else /* I2_DEBUG */ - boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationHandler, _1, _2)); + boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(std::bind(&NotificationHandler, _1, _2)); int timeStepInterval = 60; @@ -676,7 +676,7 @@ BOOST_AUTO_TEST_CASE(service_flapping_ok_over_bad_into_ok) #ifndef I2_DEBUG BOOST_WARN_MESSAGE(false, "This test can only be run in a debug build!"); #else /* I2_DEBUG */ - boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationHandler, _1, _2)); + boost::signals2::connection c = Checkable::OnNotificationsRequested.connect(std::bind(&NotificationHandler, _1, _2)); int timeStepInterval = 60; -- 2.40.0