Cleaned up #includes (Part 1).

This commit is contained in:
Gunnar Beutner 2013-03-15 18:21:29 +01:00
parent 4e765c58de
commit 3073200b53
77 changed files with 210 additions and 156 deletions

View File

@ -40,7 +40,7 @@ void CheckerComponent::Start(void)
m_Stopped = false;
m_Thread = thread(boost::bind(&CheckerComponent::CheckThreadProc, this));
m_Thread = boost::thread(boost::bind(&CheckerComponent::CheckThreadProc, this));
m_ResultTimer = boost::make_shared<Timer>();
m_ResultTimer->SetInterval(5);

View File

@ -74,7 +74,7 @@ private:
boost::mutex m_Mutex;
boost::condition_variable m_CV;
bool m_Stopped;
thread m_Thread;
boost::thread m_Thread;
ServiceSet m_IdleServices;
ServiceSet m_PendingServices;

View File

@ -41,7 +41,7 @@ void CompatComponent::Start(void)
m_StatusTimer->Reschedule(0);
#ifndef _WIN32
m_CommandThread = thread(boost::bind(&CompatComponent::CommandPipeThread, this, GetCommandPath()));
m_CommandThread = boost::thread(boost::bind(&CompatComponent::CommandPipeThread, this, GetCommandPath()));
m_CommandThread.detach();
#endif /* _WIN32 */
}

View File

@ -46,7 +46,7 @@ private:
Attribute<String> m_CommandPath;
#ifndef _WIN32
thread m_CommandThread;
boost::thread m_CommandThread;
void CommandPipeThread(const String& commandPath);
#endif /* _WIN32 */

View File

@ -26,8 +26,8 @@ namespace livestatus
class Column
{
public:
typedef function<Value (const Object::Ptr&)> ValueAccessor;
typedef function<Object::Ptr (const Object::Ptr&)> ObjectAccessor;
typedef boost::function<Value (const Object::Ptr&)> ValueAccessor;
typedef boost::function<Object::Ptr (const Object::Ptr&)> ObjectAccessor;
Column(const ValueAccessor& valueAccessor, const ObjectAccessor& objectAccessor);

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-livestatus.h"
#include <boost/tuple/tuple.hpp>
using namespace icinga;
using namespace livestatus;
@ -50,7 +51,7 @@ String CommentsTable::GetName(void) const
return "comments";
}
void CommentsTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
void CommentsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
Service::Ptr service = static_pointer_cast<Service>(object);
@ -62,7 +63,7 @@ void CommentsTable::FetchRows(const function<void (const Object::Ptr&)>& addRowF
ObjectLock olock(comments);
Value comment;
BOOST_FOREACH(tie(tuples::ignore, comment), comments) {
BOOST_FOREACH(boost::tie(boost::tuples::ignore, comment), comments) {
addRowFn(comment);
}
}

View File

@ -40,7 +40,7 @@ public:
virtual String GetName(void) const;
protected:
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
virtual void FetchRows(const AddRowFunction& addRowFn);
};
}

View File

@ -40,7 +40,7 @@ String ContactGroupsTable::GetName(void) const
return "contactgroups";
}
void ContactGroupsTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
void ContactGroupsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("UserGroup")) {
addRowFn(object);
@ -61,4 +61,4 @@ Value ContactGroupsTable::MembersAccessor(const Object::Ptr& object)
}
return members;
}
}

View File

@ -40,7 +40,7 @@ public:
virtual String GetName(void) const;
protected:
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
virtual void FetchRows(const AddRowFunction& addRowFn);
static Value NameAccessor(const Object::Ptr& object);
static Value MembersAccessor(const Object::Ptr& object);

View File

@ -53,7 +53,7 @@ String ContactsTable::GetName(void) const
return "contacts";
}
void ContactsTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
void ContactsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("User")) {
addRowFn(object);

View File

@ -40,7 +40,7 @@ public:
virtual String GetName(void) const;
protected:
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
virtual void FetchRows(const AddRowFunction& addRowFn);
static Value NameAccessor(const Object::Ptr& object);
static Value MembersAccessor(const Object::Ptr& object);

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-livestatus.h"
#include <boost/tuple/tuple.hpp>
using namespace icinga;
using namespace livestatus;
@ -50,7 +51,7 @@ String DowntimesTable::GetName(void) const
return "downtimes";
}
void DowntimesTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
void DowntimesTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
Service::Ptr service = static_pointer_cast<Service>(object);
@ -62,7 +63,7 @@ void DowntimesTable::FetchRows(const function<void (const Object::Ptr&)>& addRow
ObjectLock olock(downtimes);
Value downtime;
BOOST_FOREACH(tie(tuples::ignore, downtime), downtimes) {
BOOST_FOREACH(boost::tie(boost::tuples::ignore, downtime), downtimes) {
addRowFn(downtime);
}
}

View File

@ -40,7 +40,7 @@ public:
virtual String GetName(void) const;
protected:
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
virtual void FetchRows(const AddRowFunction& addRowFn);
};
}

View File

@ -145,7 +145,7 @@ String HostsTable::GetName(void) const
return "hosts";
}
void HostsTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
void HostsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Host")) {
addRowFn(object);

View File

@ -40,7 +40,7 @@ public:
virtual String GetName(void) const;
protected:
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
virtual void FetchRows(const AddRowFunction& addRowFn);
static Value NameAccessor(const Object::Ptr& object);
static Value DisplayNameAccessor(const Object::Ptr& object);

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-livestatus.h"
#include <boost/algorithm/string/classification.hpp>
using namespace icinga;
using namespace livestatus;
@ -62,11 +63,11 @@ Query::Query(const vector<String>& lines)
else if (header == "OutputFormat")
m_OutputFormat = params;
else if (header == "Columns")
m_Columns = params.Split(is_any_of(" "));
m_Columns = params.Split(boost::is_any_of(" "));
else if (header == "ColumnHeaders")
m_ColumnHeaders = (params == "on");
else if (header == "Filter" || header == "Stats") {
vector<String> tokens = params.Split(is_any_of(" "));
vector<String> tokens = params.Split(boost::is_any_of(" "));
if (tokens.size() == 2)
tokens.push_back("");

View File

@ -121,7 +121,7 @@ String ServicesTable::GetName(void) const
return "services";
}
void ServicesTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
void ServicesTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
addRowFn(object);

View File

@ -40,7 +40,7 @@ public:
virtual String GetName(void) const;
protected:
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
virtual void FetchRows(const AddRowFunction& addRowFn);
static Object::Ptr HostAccessor(const Object::Ptr& object);

View File

@ -96,7 +96,7 @@ String StatusTable::GetName(void) const
return "status";
}
void StatusTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
void StatusTable::FetchRows(const AddRowFunction& addRowFn)
{
Object::Ptr obj = boost::make_shared<Object>();

View File

@ -40,7 +40,7 @@ public:
virtual String GetName(void) const;
protected:
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
virtual void FetchRows(const AddRowFunction& addRowFn);
};
}

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-livestatus.h"
#include <boost/tuple/tuple.hpp>
using namespace icinga;
using namespace livestatus;
@ -70,7 +71,7 @@ vector<String> Table::GetColumnNames(void) const
vector<String> names;
String name;
BOOST_FOREACH(tie(name, tuples::ignore), m_Columns) {
BOOST_FOREACH(boost::tie(name, boost::tuples::ignore), m_Columns) {
names.push_back(name);
}

View File

@ -34,6 +34,8 @@ public:
typedef shared_ptr<Table> Ptr;
typedef weak_ptr<Table> WeakPtr;
typedef boost::function<void (const Object::Ptr&)> AddRowFunction;
static Table::Ptr GetByName(const String& name);
@ -48,7 +50,7 @@ public:
protected:
Table(void);
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn) = 0;
virtual void FetchRows(const AddRowFunction& addRowFn) = 0;
static Value ZeroAccessor(const Object::Ptr&);
static Value OneAccessor(const Object::Ptr&);

View File

@ -18,7 +18,8 @@
******************************************************************************/
#include <i2-icinga.h>
#include <boost/program_options.hpp>
#include <boost/tuple/tuple.hpp>
#ifndef _WIN32
# include "icinga-version.h"
@ -49,7 +50,7 @@ static bool LoadConfigFiles(bool validateOnly)
}
String name, fragment;
BOOST_FOREACH(tie(name, fragment), ConfigFragmentRegistry::GetInstance()->GetItems()) {
BOOST_FOREACH(boost::tie(name, fragment), ConfigFragmentRegistry::GetInstance()->GetItems()) {
ConfigCompiler::CompileText(name, fragment);
}

View File

@ -18,6 +18,9 @@
******************************************************************************/
#include "i2-base.h"
#include <boost/algorithm/string/classification.hpp>
#include <boost/thread/thread.hpp>
#include <boost/bind.hpp>
using namespace icinga;
@ -126,7 +129,7 @@ void Application::ShutdownTimerHandler(void)
void Application::RunEventLoop(void) const
{
/* Start the system time watch thread. */
thread t(&Application::TimeWatchThreadProc);
boost::thread t(&Application::TimeWatchThreadProc);
t.detach();
/* Set up a timer that watches the m_Shutdown flag. */

View File

@ -20,6 +20,11 @@
#ifndef ASYNCTASK_H
#define ASYNCTASK_H
#include <boost/function.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/bind.hpp>
namespace icinga
{
@ -38,7 +43,7 @@ public:
/**
* A completion callback for an AsyncTask.
*/
typedef function<void (const shared_ptr<TClass>&)> CompletionCallback;
typedef boost::function<void (const shared_ptr<TClass>&)> CompletionCallback;
/**
* Constructor for the AsyncTask class.

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-base.h"
#include <boost/bind.hpp>
using namespace icinga;

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-base.h"
#include <boost/lexical_cast.hpp>
using namespace icinga;

View File

@ -19,6 +19,7 @@
#include "i2-base.h"
#include <cJSON.h>
#include <boost/tuple/tuple.hpp>
using namespace icinga;
@ -248,7 +249,7 @@ Dictionary::Ptr Dictionary::ShallowClone(void) const
String key;
Value value;
BOOST_FOREACH(tie(key, value), m_Data) {
BOOST_FOREACH(boost::tie(key, value), m_Data) {
clone->Set(key, value);
}
@ -294,7 +295,7 @@ cJSON *Dictionary::ToJson(void) const
String key;
Value value;
BOOST_FOREACH(tie(key, value), m_Data) {
BOOST_FOREACH(boost::tie(key, value), m_Data) {
cJSON_AddItemToObject(json, key.CStr(), value.ToJson());
}
} catch (...) {

View File

@ -20,6 +20,8 @@
#ifndef DYNAMICOBJECT_H
#define DYNAMICOBJECT_H
#include <boost/thread/once.hpp>
namespace icinga
{

View File

@ -20,6 +20,8 @@
#ifndef DYNAMICTYPE_H
#define DYNAMICTYPE_H
#include <boost/function.hpp>
namespace icinga
{
@ -29,7 +31,7 @@ public:
typedef shared_ptr<DynamicType> Ptr;
typedef weak_ptr<DynamicType> WeakPtr;
typedef function<DynamicObject::Ptr (const Dictionary::Ptr&)> ObjectFactory;
typedef boost::function<DynamicObject::Ptr (const Dictionary::Ptr&)> ObjectFactory;
DynamicType(const String& name, const ObjectFactory& factory);
@ -73,7 +75,7 @@ private:
*
* @ingroup base
*/
class I2_BASE_API DynamicTypeRegistry : public Registry<DynamicType::Ptr>
class DynamicTypeRegistry : public Registry<DynamicType::Ptr>
{ };
/**

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-base.h"
#include <boost/bind.hpp>
using namespace icinga;
@ -27,7 +28,7 @@ using namespace icinga;
EventQueue::EventQueue(void)
: m_Stopped(false)
{
unsigned int threads = thread::hardware_concurrency();
unsigned int threads = boost::thread::hardware_concurrency();
if (threads == 0)
threads = 1;
@ -37,7 +38,7 @@ EventQueue::EventQueue(void)
for (unsigned int i = 0; i < threads; i++)
m_Threads.create_thread(boost::bind(&EventQueue::QueueThreadProc, this));
thread reportThread(boost::bind(&EventQueue::ReportThreadProc, this));
boost::thread reportThread(boost::bind(&EventQueue::ReportThreadProc, this));
reportThread.detach();
}

View File

@ -20,6 +20,11 @@
#ifndef EVENTQUEUE_H
#define EVENTQUEUE_H
#include <boost/function.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
namespace icinga
{
@ -33,7 +38,7 @@ class Timer;
class I2_BASE_API EventQueue
{
public:
typedef function<void ()> Callback;
typedef boost::function<void ()> Callback;
EventQueue(void);
~EventQueue(void);
@ -44,10 +49,10 @@ public:
void Post(const Callback& callback);
private:
thread_group m_Threads;
boost::thread_group m_Threads;
boost::mutex m_Mutex;
condition_variable m_CV;
boost::condition_variable m_CV;
bool m_Stopped;
stack<Callback> m_Events;

View File

@ -20,6 +20,8 @@
#ifndef EXCEPTION_H
#define EXCEPTION_H
#include <boost/thread/tss.hpp>
namespace icinga
{

View File

@ -126,21 +126,8 @@ using std::type_info;
#include <boost/smart_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/signals2.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/compare.hpp>
#include <boost/thread.hpp>
#include <boost/variant.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/program_options.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/error_info.hpp>
#include <boost/exception/errinfo_api_function.hpp>
@ -149,23 +136,11 @@ using std::type_info;
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/key_extractors.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
using boost::shared_ptr;
using boost::weak_ptr;
using boost::enable_shared_from_this;
using boost::dynamic_pointer_cast;
using boost::static_pointer_cast;
using boost::function;
using boost::thread;
using boost::thread_group;
using boost::recursive_mutex;
using boost::condition_variable;
using boost::system_time;
using boost::posix_time::millisec;
using boost::tie;
using boost::rethrow_exception;
using boost::current_exception;
using boost::diagnostic_information;
using boost::errinfo_api_function;
using boost::errinfo_errno;
@ -177,7 +152,6 @@ using boost::multi_index::ordered_unique;
using boost::multi_index::ordered_non_unique;
using boost::multi_index::nth_index;
namespace tuples = boost::tuples;
namespace signals2 = boost::signals2;
#if defined(__APPLE__) && defined(__MACH__)

View File

@ -20,6 +20,8 @@
#ifndef OBJECT_H
#define OBJECT_H
#include <boost/thread/mutex.hpp>
namespace icinga
{
@ -31,7 +33,7 @@ class SharedPtrHolder;
*
* @ingroup base
*/
class I2_BASE_API Object : public enable_shared_from_this<Object>
class I2_BASE_API Object : public boost::enable_shared_from_this<Object>
{
public:
typedef shared_ptr<Object> Ptr;

View File

@ -18,13 +18,15 @@
******************************************************************************/
#include "i2-base.h"
#include <boost/bind.hpp>
#include <boost/tuple/tuple.hpp>
#ifndef _WIN32
#include <execvpe.h>
using namespace icinga;
condition_variable Process::m_CV;
boost::condition_variable Process::m_CV;
int Process::m_TaskFd;
Timer::Ptr Process::m_StatusTimer;
@ -60,7 +62,7 @@ void Process::Initialize(void)
m_TaskFd = fds[1];
unsigned int threads = thread::hardware_concurrency();
unsigned int threads = boost::thread::hardware_concurrency();
if (threads == 0)
threads = 2;
@ -77,7 +79,7 @@ void Process::Initialize(void)
Utility::SetNonBlocking(childTaskFd);
Utility::SetCloExec(childTaskFd);
thread t(&Process::WorkerThreadProc, childTaskFd);
boost::thread t(&Process::WorkerThreadProc, childTaskFd);
t.detach();
}
@ -108,7 +110,7 @@ void Process::WorkerThreadProc(int taskFd)
int idx = 0;
int fd;
BOOST_FOREACH(tie(fd, tuples::ignore), tasks) {
BOOST_FOREACH(boost::tie(fd, boost::tuples::ignore), tasks) {
pfds[idx].fd = fd;
pfds[idx].events = POLLIN | POLLHUP;
idx++;
@ -284,7 +286,7 @@ void Process::InitTask(void)
String key;
Value value;
int index = envc;
BOOST_FOREACH(tie(key, value), m_ExtraEnvironment) {
BOOST_FOREACH(boost::tie(key, value), m_ExtraEnvironment) {
String kv = key + "=" + Convert::ToString(value);
envp[index] = strdup(kv.CStr());
index++;

View File

@ -20,6 +20,10 @@
#ifndef PROCESS_H
#define PROCESS_H
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/once.hpp>
namespace icinga
{
@ -71,7 +75,7 @@ private:
static boost::mutex m_Mutex;
static deque<Process::Ptr> m_Tasks;
#ifndef _WIN32
static condition_variable m_CV;
static boost::condition_variable m_CV;
static int m_TaskFd;
static Timer::Ptr m_StatusTimer;

View File

@ -18,6 +18,9 @@
******************************************************************************/
#include "i2-base.h"
#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/compare.hpp>
using namespace icinga;

View File

@ -20,6 +20,8 @@
#ifndef STRING_H
#define STRING_H
#include <boost/algorithm/string/split.hpp>
namespace icinga {
/**

View File

@ -29,7 +29,7 @@ namespace icinga
* @ingroup base
*/
template<typename T>
class Registry
class I2_BASE_API Registry
{
public:
typedef map<String, T, string_iless> ItemMap;

View File

@ -26,10 +26,10 @@ REGISTER_TYPE(Script);
/**
* Constructor for the Script class.
*
* @param properties A serialized dictionary containing attributes.
* @param serializedUpdate A serialized dictionary containing attributes.
*/
Script::Script(const Dictionary::Ptr& properties)
: DynamicObject(properties)
Script::Script(const Dictionary::Ptr& serializedUpdate)
: DynamicObject(serializedUpdate)
{
RegisterAttribute("language", Attribute_Config, &m_Language);
RegisterAttribute("code", Attribute_Config, &m_Code);

View File

@ -36,7 +36,7 @@ public:
typedef shared_ptr<Script> Ptr;
typedef weak_ptr<Script> WeakPtr;
Script(const Dictionary::Ptr& properties);
Script(const Dictionary::Ptr& serializedUpdate);
virtual void Start(void);

View File

@ -20,6 +20,8 @@
#ifndef SCRIPTFUNCTION_H
#define SCRIPTFUNCTION_H
#include <boost/function.hpp>
namespace icinga
{
@ -36,7 +38,7 @@ public:
typedef shared_ptr<ScriptFunction> Ptr;
typedef weak_ptr<ScriptFunction> WeakPtr;
typedef function<void (const shared_ptr<ScriptTask>&, const vector<Value>& arguments)> Callback;
typedef boost::function<void (const shared_ptr<ScriptTask>&, const vector<Value>& arguments)> Callback;
explicit ScriptFunction(const Callback& function);

View File

@ -29,7 +29,7 @@ namespace icinga
* @ingroup base
*/
template<typename T>
class Singleton
class I2_BASE_API Singleton
{
public:
static T *GetInstance(void)
@ -38,17 +38,20 @@ public:
static boost::mutex mutex;
boost::mutex::scoped_lock lock(mutex);
static T *instance = NULL;
if (!m_Instance)
m_Instance = new T();
if (!instance)
instance = new T();
return instance;
return m_Instance;
}
private:
friend T *T::GetInstance(void);
static T *m_Instance;
};
template<typename T>
T *Singleton<T>::m_Instance = NULL;
}
#endif /* SINGLETON_H */

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-base.h"
#include <boost/bind.hpp>
using namespace icinga;
@ -51,11 +52,11 @@ void Socket::Start(void)
ASSERT(!m_ReadThread.joinable() && !m_WriteThread.joinable());
ASSERT(GetFD() != INVALID_SOCKET);
// TODO: figure out why we're not using "this" here
m_ReadThread = thread(boost::bind(&Socket::ReadThreadProc, static_cast<Socket::Ptr>(GetSelf())));
// TODO: figure out why we're not using "this" here (hint: to keep the object alive until the threads are done)
m_ReadThread = boost::thread(boost::bind(&Socket::ReadThreadProc, static_cast<Socket::Ptr>(GetSelf())));
m_ReadThread.detach();
m_WriteThread = thread(boost::bind(&Socket::WriteThreadProc, static_cast<Socket::Ptr>(GetSelf())));
m_WriteThread = boost::thread(boost::bind(&Socket::WriteThreadProc, static_cast<Socket::Ptr>(GetSelf())));
m_WriteThread.detach();
Stream::Start();

View File

@ -20,6 +20,10 @@
#ifndef SOCKET_H
#define SOCKET_H
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
namespace icinga {
/**
@ -69,10 +73,10 @@ private:
bool m_Connected;
bool m_Listening;
thread m_ReadThread;
thread m_WriteThread;
boost::thread m_ReadThread;
boost::thread m_WriteThread;
condition_variable m_WriteCV;
boost::condition_variable m_WriteCV;
void ReadThreadProc(void);
void WriteThreadProc(void);

View File

@ -20,6 +20,8 @@
#ifndef STACKTRACE_H
#define STACKTRACE_H
#include <boost/thread/once.hpp>
namespace icinga
{

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-base.h"
#include <boost/algorithm/string/trim.hpp>
using namespace icinga;

View File

@ -20,6 +20,8 @@
#ifndef STREAM_H
#define STREAM_H
#include <boost/exception_ptr.hpp>
namespace icinga
{

View File

@ -18,11 +18,12 @@
******************************************************************************/
#include "i2-base.h"
#include <boost/bind.hpp>
using namespace icinga;
Timer::TimerSet Timer::m_Timers;
thread Timer::m_Thread;
boost::thread Timer::m_Thread;
boost::mutex Timer::m_Mutex;
boost::condition_variable Timer::m_CV;
bool Timer::m_StopThread;
@ -62,7 +63,7 @@ void Timer::Initialize(void)
{
boost::mutex::scoped_lock lock(m_Mutex);
m_StopThread = false;
m_Thread = thread(boost::bind(&Timer::TimerThreadProc));
m_Thread = boost::thread(boost::bind(&Timer::TimerThreadProc));
}
/**

View File

@ -20,7 +20,9 @@
#ifndef TIMER_H
#define TIMER_H
#include <time.h>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
namespace icinga {
@ -82,7 +84,7 @@ private:
static boost::mutex m_Mutex;
static boost::condition_variable m_CV;
static thread m_Thread;
static boost::thread m_Thread;
static bool m_StopThread;
static TimerSet m_Timers;

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-base.h"
#include <boost/bind.hpp>
using namespace icinga;

View File

@ -19,6 +19,11 @@
#include "i2-base.h"
#include <mmatch.h>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/function.hpp>
using namespace icinga;
@ -402,7 +407,7 @@ String Utility::NewUUID(void)
*
* @param pathSpec The path specification.
*/
bool Utility::Glob(const String& pathSpec, const function<void (const String&)>& callback)
bool Utility::Glob(const String& pathSpec, const boost::function<void (const String&)>& callback)
{
#ifdef _WIN32
HANDLE handle;

View File

@ -20,6 +20,8 @@
#ifndef UTILITY_H
#define UTILITY_H
#include <boost/function.hpp>
namespace icinga
{
@ -53,7 +55,7 @@ public:
static String NewUUID(void);
static bool Glob(const String& pathSpec, const function<void (const String&)>& callback);
static bool Glob(const String& pathSpec, const boost::function<void (const String&)>& callback);
static void QueueAsyncCallback(const boost::function<void (void)>& callback);

View File

@ -19,6 +19,7 @@
#include "i2-base.h"
#include <cJSON.h>
#include <boost/lexical_cast.hpp>
using namespace icinga;

View File

@ -20,6 +20,8 @@
#ifndef VALUE_H
#define VALUE_H
#include <boost/variant.hpp>
struct cJSON;
namespace icinga

View File

@ -32,7 +32,7 @@ namespace icinga
class I2_CONFIG_API ConfigCompiler
{
public:
typedef function<void (const String&, bool, const DebugInfo&)> HandleIncludeFunc;
typedef boost::function<void (const String&, bool, const DebugInfo&)> HandleIncludeFunc;
explicit ConfigCompiler(const String& path, istream *input = &cin,
HandleIncludeFunc includeHandler = &ConfigCompiler::HandleFileInclude);
@ -72,7 +72,7 @@ private:
void DestroyScanner(void);
};
class I2_CONFIG_API ConfigFragmentRegistry : public Registry<String>
class ConfigFragmentRegistry : public Registry<String>
{ };
/**

View File

@ -18,10 +18,11 @@
******************************************************************************/
#include "i2-config.h"
#include <boost/tuple/tuple.hpp>
using namespace icinga;
recursive_mutex ConfigItem::m_Mutex;
boost::mutex ConfigItem::m_Mutex;
ConfigItem::ItemMap ConfigItem::m_Items;
signals2::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnCommitted;
signals2::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnRemoved;
@ -184,7 +185,7 @@ DynamicObject::Ptr ConfigItem::Commit(void)
ConfigItem::Ptr oldItem;
{
recursive_mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
ItemMap::iterator it = m_Items.find(ikey);
@ -212,7 +213,7 @@ DynamicObject::Ptr ConfigItem::Commit(void)
ConfigItem::Ptr self = GetSelf();
{
recursive_mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
/* Register this item. */
m_Items[ikey] = self;
@ -242,7 +243,7 @@ DynamicObject::Ptr ConfigItem::Commit(void)
String key;
Value data;
BOOST_FOREACH(tie(key, data), properties) {
BOOST_FOREACH(boost::tie(key, data), properties) {
Dictionary::Ptr attr = boost::make_shared<Dictionary>();
attr->Set("data", data);
attr->Set("type", Attribute_Config);
@ -377,7 +378,7 @@ DynamicObject::Ptr ConfigItem::GetDynamicObject(void) const
*/
ConfigItem::Ptr ConfigItem::GetObject(const String& type, const String& name)
{
recursive_mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
ConfigItem::ItemMap::iterator it;
@ -425,20 +426,22 @@ void ConfigItem::Dump(ostream& fp) const
*/
void ConfigItem::UnloadUnit(const String& unit)
{
recursive_mutex::scoped_lock lock(m_Mutex);
Logger::Write(LogInformation, "config", "Unloading config items from compilation unit '" + unit + "'");
vector<ConfigItem::Ptr> obsoleteItems;
ConfigItem::Ptr item;
BOOST_FOREACH(tie(tuples::ignore, item), m_Items) {
ObjectLock olock(item);
{
boost::mutex::scoped_lock lock(m_Mutex);
if (item->m_Unit != unit)
continue;
Logger::Write(LogInformation, "config", "Unloading config items from compilation unit '" + unit + "'");
obsoleteItems.push_back(item);
ConfigItem::Ptr item;
BOOST_FOREACH(boost::tie(boost::tuples::ignore, item), m_Items) {
ObjectLock olock(item);
if (item->m_Unit != unit)
continue;
obsoleteItems.push_back(item);
}
}
BOOST_FOREACH(const ConfigItem::Ptr& item, obsoleteItems) {

View File

@ -89,7 +89,7 @@ private:
set<ConfigItem::WeakPtr> m_ChildObjects; /**< Instantiated items
* that inherit from this item */
static recursive_mutex m_Mutex;
static boost::mutex m_Mutex;
typedef map<pair<String, String>, ConfigItem::Ptr> ItemMap;
static ItemMap m_Items; /**< All registered configuration items. */

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-config.h"
#include <boost/tuple/tuple.hpp>
using namespace icinga;
@ -141,7 +142,7 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary,
String key;
Value value;
BOOST_FOREACH(tie(key, value), dictionary) {
BOOST_FOREACH(boost::tie(key, value), dictionary) {
TypeValidationResult overallResult = ValidationUnknownField;
vector<TypeRuleList::Ptr> subRuleLists;

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-config.h"
#include <boost/tuple/tuple.hpp>
using namespace icinga;
@ -89,7 +90,7 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
String key;
Value value;
BOOST_FOREACH(tie(key, value), valueDict) {
BOOST_FOREACH(boost::tie(key, value), valueDict) {
dict->Set(key, value);
}
} else {
@ -134,7 +135,7 @@ void Expression::DumpValue(ostream& fp, int indent, const Value& value, bool inl
String k;
Value v;
BOOST_FOREACH(tie(k, v), static_cast<Dictionary::Ptr>(value)) {
BOOST_FOREACH(boost::tie(k, v), static_cast<Dictionary::Ptr>(value)) {
for (int i = 0; i < indent; i++)
fp << "\t";

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-icinga.h"
#include <boost/algorithm/string/classification.hpp>
using namespace icinga;
@ -49,7 +50,7 @@ void ExternalCommandProcessor::Execute(const String& line)
if (ts == 0)
BOOST_THROW_EXCEPTION(invalid_argument("Invalid timestamp in command: " + line));
vector<String> argv = args.Split(is_any_of(";"));
vector<String> argv = args.Split(boost::is_any_of(";"));
if (argv.empty())
BOOST_THROW_EXCEPTION(invalid_argument("Missing arguments in command: " + line));

View File

@ -29,7 +29,7 @@ public:
static void Execute(double time, const String& command, const vector<String>& arguments);
private:
typedef function<void (double time, const vector<String>& arguments)> Callback;
typedef boost::function<void (double time, const vector<String>& arguments)> Callback;
static boost::once_flag m_InitializeOnce;
static boost::mutex m_Mutex;

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-icinga.h"
#include <boost/tuple/tuple.hpp>
using namespace icinga;
@ -48,7 +49,7 @@ Host::~Host(void)
if (m_SlaveServices) {
ConfigItem::Ptr service;
BOOST_FOREACH(tie(tuples::ignore, service), m_SlaveServices) {
BOOST_FOREACH(boost::tie(boost::tuples::ignore, service), m_SlaveServices) {
service->Unregister();
}
}
@ -225,7 +226,7 @@ void Host::UpdateSlaveServices(void)
ObjectLock olock(serviceDescs);
String svcname;
Value svcdesc;
BOOST_FOREACH(tie(svcname, svcdesc), serviceDescs) {
BOOST_FOREACH(boost::tie(svcname, svcdesc), serviceDescs) {
if (svcdesc.IsScalar())
svcname = svcdesc;
@ -270,7 +271,7 @@ void Host::UpdateSlaveServices(void)
ObjectLock olock(oldServices);
ConfigItem::Ptr service;
BOOST_FOREACH(tie(tuples::ignore, service), oldServices) {
BOOST_FOREACH(boost::tie(boost::tuples::ignore, service), oldServices) {
if (!service)
continue;
@ -306,7 +307,7 @@ set<Service::Ptr> Host::GetServices(void) const
boost::mutex::scoped_lock lock(m_ServiceMutex);
Service::WeakPtr wservice;
BOOST_FOREACH(tie(tuples::ignore, wservice), m_ServicesCache[GetName()]) {
BOOST_FOREACH(boost::tie(boost::tuples::ignore, wservice), m_ServicesCache[GetName()]) {
Service::Ptr service = wservice.lock();
if (!service)
@ -383,7 +384,7 @@ void Host::ValidateServiceDictionary(const ScriptTask::Ptr& task, const vector<V
String key;
Value value;
BOOST_FOREACH(tie(key, value), attrs) {
BOOST_FOREACH(boost::tie(key, value), attrs) {
vector<String> templates;
if (!value.IsObjectType<Dictionary>())

View File

@ -31,9 +31,6 @@
#include <i2-config.h>
#include <i2-remoting.h>
using boost::iterator_range;
using boost::algorithm::is_any_of;
#ifdef I2_ICINGA_BUILD
# define I2_ICINGA_API I2_EXPORT
#else /* I2_ICINGA_BUILD */

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-icinga.h"
#include <boost/tuple/tuple.hpp>
using namespace icinga;
@ -93,7 +94,7 @@ Dictionary::Ptr MacroProcessor::MergeMacroDicts(const vector<Dictionary::Ptr>& d
String key;
Value value;
BOOST_FOREACH(tie(key, value), dict) {
BOOST_FOREACH(boost::tie(key, value), dict) {
if (!value.IsScalar())
continue;

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-icinga.h"
#include <boost/tuple/tuple.hpp>
using namespace icinga;
@ -88,13 +89,12 @@ set<User::Ptr> Notification::GetUsers(void) const
{
set<User::Ptr> result;
Dictionary::Ptr users = m_Users;
Array::Ptr users = m_Users;
if (users) {
ObjectLock olock(users);
String name;
BOOST_FOREACH(tie(tuples::ignore, name), users) {
BOOST_FOREACH(const String& name, users) {
User::Ptr user = User::GetByName(name);
if (!user)
@ -114,13 +114,12 @@ set<UserGroup::Ptr> Notification::GetGroups(void) const
{
set<UserGroup::Ptr> result;
Dictionary::Ptr groups = m_Groups;
Array::Ptr groups = m_Groups;
if (groups) {
ObjectLock olock(groups);
String name;
BOOST_FOREACH(tie(tuples::ignore, name), groups) {
BOOST_FOREACH(const String& name, groups) {
UserGroup::Ptr ug = UserGroup::GetByName(name);
if (!ug)

View File

@ -73,8 +73,8 @@ protected:
private:
Attribute<Value> m_NotificationCommand;
Attribute<Dictionary::Ptr> m_Macros;
Attribute<Dictionary::Ptr> m_Users;
Attribute<Dictionary::Ptr> m_Groups;
Attribute<Array::Ptr> m_Users;
Attribute<Array::Ptr> m_Groups;
Attribute<String> m_HostName;
Attribute<String> m_Service;

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-icinga.h"
#include <boost/algorithm/string/classification.hpp>
using namespace icinga;
@ -104,7 +105,7 @@ Dictionary::Ptr PluginCheckTask::ParseCheckOutput(const String& output)
String text;
String perfdata;
vector<String> lines = output.Split(is_any_of("\r\n"));
vector<String> lines = output.Split(boost::is_any_of("\r\n"));
BOOST_FOREACH (const String& line, lines) {
size_t delim = line.FindFirstOf("|");

View File

@ -578,7 +578,7 @@ bool Service::IsAllowedChecker(const String& checker) const
/**
* @threadsafety Always.
*/
void Service::BeginExecuteCheck(const function<void (void)>& callback)
void Service::BeginExecuteCheck(const boost::function<void (void)>& callback)
{
ASSERT(!OwnsLock());
@ -629,7 +629,7 @@ void Service::BeginExecuteCheck(const function<void (void)>& callback)
* @threadsafety Always.
*/
void Service::CheckCompletedHandler(const Dictionary::Ptr& checkInfo,
const ScriptTask::Ptr& task, const function<void (void)>& callback)
const ScriptTask::Ptr& task, const boost::function<void (void)>& callback)
{
ASSERT(!OwnsLock());

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-icinga.h"
#include <boost/tuple/tuple.hpp>
using namespace icinga;
@ -137,7 +138,7 @@ void Service::TriggerDowntimes(void)
ObjectLock olock(downtimes);
String id;
BOOST_FOREACH(tie(id, tuples::ignore), downtimes) {
BOOST_FOREACH(boost::tie(id, boost::tuples::ignore), downtimes) {
TriggerDowntime(id);
}
}
@ -165,7 +166,7 @@ void Service::TriggerDowntime(const String& id)
Dictionary::Ptr triggers = downtime->Get("triggers");
ObjectLock olock(triggers);
String tid;
BOOST_FOREACH(tie(tid, tuples::ignore), triggers) {
BOOST_FOREACH(boost::tie(tid, boost::tuples::ignore), triggers) {
TriggerDowntime(tid);
}
@ -295,7 +296,7 @@ void Service::RefreshDowntimesCache(void)
String id;
Dictionary::Ptr downtime;
BOOST_FOREACH(tie(id, downtime), downtimes) {
BOOST_FOREACH(boost::tie(id, downtime), downtimes) {
int legacy_id = downtime->Get("legacy_id");
if (legacy_id >= m_NextDowntimeID)
@ -344,7 +345,7 @@ void Service::RemoveExpiredDowntimes(void)
String id;
Dictionary::Ptr downtime;
BOOST_FOREACH(tie(id, downtime), downtimes) {
BOOST_FOREACH(boost::tie(id, downtime), downtimes) {
if (IsDowntimeExpired(downtime))
expiredDowntimes.push_back(id);
}
@ -383,7 +384,7 @@ bool Service::IsInDowntime(void) const
ObjectLock olock(downtimes);
Dictionary::Ptr downtime;
BOOST_FOREACH(tie(tuples::ignore, downtime), downtimes) {
BOOST_FOREACH(boost::tie(boost::tuples::ignore, downtime), downtimes) {
if (Service::IsDowntimeActive(downtime))
return true;
}

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-icinga.h"
#include <boost/tuple/tuple.hpp>
using namespace icinga;
@ -220,7 +221,7 @@ void Service::UpdateSlaveNotifications(void)
String nfcname;
Value nfcdesc;
BOOST_FOREACH(tie(nfcname, nfcdesc), notificationDescs) {
BOOST_FOREACH(boost::tie(nfcname, nfcdesc), notificationDescs) {
stringstream namebuf;
namebuf << GetName() << "-" << nfcname;
String name = namebuf.str();
@ -261,7 +262,7 @@ void Service::UpdateSlaveNotifications(void)
ObjectLock olock(oldNotifications);
ConfigItem::Ptr notification;
BOOST_FOREACH(tie(tuples::ignore, notification), oldNotifications) {
BOOST_FOREACH(boost::tie(boost::tuples::ignore, notification), oldNotifications) {
if (!notification)
continue;

View File

@ -167,7 +167,7 @@ public:
void AcknowledgeProblem(AcknowledgementType type, double expiry = 0);
void ClearAcknowledgement(void);
void BeginExecuteCheck(const function<void (void)>& callback);
void BeginExecuteCheck(const boost::function<void (void)>& callback);
void ProcessCheckResult(const Dictionary::Ptr& cr);
static double CalculateExecutionTime(const Dictionary::Ptr& cr);
@ -288,7 +288,7 @@ private:
long m_SchedulingOffset;
void CheckCompletedHandler(const Dictionary::Ptr& checkInfo,
const ScriptTask::Ptr& task, const function<void (void)>& callback);
const ScriptTask::Ptr& task, const boost::function<void (void)>& callback);
/* Downtimes */
Attribute<Dictionary::Ptr> m_Downtimes;

View File

@ -199,7 +199,7 @@ void Endpoint::SetSubscriptions(const Dictionary::Ptr& subscriptions)
Touch("subscriptions");
}
void Endpoint::RegisterTopicHandler(const String& topic, const function<Endpoint::Callback>& callback)
void Endpoint::RegisterTopicHandler(const String& topic, const boost::function<Endpoint::Callback>& callback)
{
ObjectLock olock(this);
@ -222,7 +222,7 @@ void Endpoint::RegisterTopicHandler(const String& topic, const function<Endpoint
RegisterSubscription(topic);
}
void Endpoint::UnregisterTopicHandler(const String&, const function<Endpoint::Callback>&)
void Endpoint::UnregisterTopicHandler(const String&, const boost::function<Endpoint::Callback>&)
{
// TODO: implement
//m_TopicHandlers[method] -= callback;

View File

@ -61,8 +61,8 @@ public:
void ClearSubscriptions(void);
void RegisterTopicHandler(const String& topic, const function<Callback>& callback);
void UnregisterTopicHandler(const String& topic, const function<Callback>& callback);
void RegisterTopicHandler(const String& topic, const boost::function<Callback>& callback);
void UnregisterTopicHandler(const String& topic, const boost::function<Callback>& callback);
String GetNode(void) const;
String GetService(void) const;

View File

@ -18,6 +18,7 @@
******************************************************************************/
#include "i2-remoting.h"
#include <boost/tuple/tuple.hpp>
using namespace icinga;
@ -357,7 +358,7 @@ void EndpointManager::SubscriptionTimerHandler(void)
ObjectLock olock(endpointSubscriptions);
String topic;
BOOST_FOREACH(tie(tuples::ignore, topic), endpointSubscriptions) {
BOOST_FOREACH(boost::tie(boost::tuples::ignore, topic), endpointSubscriptions) {
subscriptions->Set(topic, topic);
}
}

View File

@ -53,7 +53,7 @@ public:
void SendMulticastMessage(const RequestMessage& message);
void SendMulticastMessage(const Endpoint::Ptr& sender, const RequestMessage& message);
typedef function<void(const Endpoint::Ptr, const RequestMessage&, const ResponseMessage&, bool TimedOut)> APICallback;
typedef boost::function<void(const Endpoint::Ptr, const RequestMessage&, const ResponseMessage&, bool TimedOut)> APICallback;
void SendAPIMessage(const Endpoint::Ptr& sender, const Endpoint::Ptr& recipient, RequestMessage& message,
const APICallback& callback, double timeout = 30);
@ -84,7 +84,7 @@ private:
{
double Timeout;
RequestMessage Request;
function<void(const Endpoint::Ptr, const RequestMessage&, const ResponseMessage&, bool TimedOut)> Callback;
boost::function<void(const Endpoint::Ptr, const RequestMessage&, const ResponseMessage&, bool TimedOut)> Callback;
bool HasTimedOut(void) const
{