Apply clang-tidy fix 'modernize-use-default-member-init'

This commit is contained in:
Gunnar Beutner 2018-01-04 09:43:49 +01:00
parent e0174b8f3f
commit 91c256261a
89 changed files with 120 additions and 393 deletions

View File

@ -32,16 +32,10 @@ template class std::vector<Value>;
REGISTER_PRIMITIVE_TYPE(Array, Object, Array::GetPrototype()); REGISTER_PRIMITIVE_TYPE(Array, Object, Array::GetPrototype());
Array::Array()
{ }
Array::Array(std::initializer_list<Value> init) Array::Array(std::initializer_list<Value> init)
: m_Data(init) : m_Data(init)
{ } { }
Array::~Array()
{ }
/** /**
* Restrieves a value from an array. * Restrieves a value from an array.
* *

View File

@ -47,11 +47,9 @@ public:
typedef std::vector<Value>::size_type SizeType; typedef std::vector<Value>::size_type SizeType;
Array(); Array() = default;
Array(std::initializer_list<Value> init); Array(std::initializer_list<Value> init);
~Array() override;
Value Get(SizeType index) const; Value Get(SizeType index) const;
void Set(SizeType index, const Value& value); void Set(SizeType index, const Value& value);
void Set(SizeType index, Value&& value); void Set(SizeType index, Value&& value);

View File

@ -46,9 +46,6 @@ REGISTER_TYPE_WITH_PROTOTYPE(ConfigObject, ConfigObject::GetPrototype());
boost::signals2::signal<void (const ConfigObject::Ptr&)> ConfigObject::OnStateChanged; boost::signals2::signal<void (const ConfigObject::Ptr&)> ConfigObject::OnStateChanged;
ConfigObject::ConfigObject()
{ }
bool ConfigObject::IsActive() const bool ConfigObject::IsActive() const
{ {
return GetActive(); return GetActive();

View File

@ -96,9 +96,6 @@ public:
static Object::Ptr GetPrototype(); static Object::Ptr GetPrototype();
protected:
explicit ConfigObject();
private: private:
ConfigObject::Ptr m_Zone; ConfigObject::Ptr m_Zone;

View File

@ -23,10 +23,6 @@
using namespace icinga; using namespace icinga;
DebugInfo::DebugInfo()
: FirstLine(0), FirstColumn(0), LastLine(0), LastColumn(0)
{ }
/** /**
* Outputs a DebugInfo struct to a stream. * Outputs a DebugInfo struct to a stream.
* *

View File

@ -35,13 +35,11 @@ struct DebugInfo
{ {
String Path; String Path;
int FirstLine; int FirstLine{0};
int FirstColumn; int FirstColumn{0};
int LastLine; int LastLine{0};
int LastColumn; int LastColumn{0};
DebugInfo();
}; };
std::ostream& operator<<(std::ostream& out, const DebugInfo& val); std::ostream& operator<<(std::ostream& out, const DebugInfo& val);

View File

@ -29,12 +29,6 @@ template class std::map<String, Value>;
REGISTER_PRIMITIVE_TYPE(Dictionary, Object, Dictionary::GetPrototype()); REGISTER_PRIMITIVE_TYPE(Dictionary, Object, Dictionary::GetPrototype());
Dictionary::Dictionary()
{ }
Dictionary::~Dictionary()
{ }
/** /**
* Retrieves a value from a dictionary. * Retrieves a value from a dictionary.
* *

View File

@ -49,10 +49,6 @@ public:
typedef std::map<String, Value>::value_type Pair; typedef std::map<String, Value>::value_type Pair;
Dictionary();
~Dictionary() override;
Value Get(const String& key) const; Value Get(const String& key) const;
bool Get(const String& key, Value *result) const; bool Get(const String& key, Value *result) const;
void Set(const String& key, Value value); void Set(const String& key, Value value);

View File

@ -291,9 +291,6 @@ ScriptError::ScriptError(String message, DebugInfo di, bool incompleteExpr)
: m_Message(std::move(message)), m_DebugInfo(std::move(di)), m_IncompleteExpr(incompleteExpr), m_HandledByDebugger(false) : m_Message(std::move(message)), m_DebugInfo(std::move(di)), m_IncompleteExpr(incompleteExpr), m_HandledByDebugger(false)
{ } { }
ScriptError::~ScriptError() throw()
{ }
const char *ScriptError::what() const throw() const char *ScriptError::what() const throw()
{ {
return m_Message.CStr(); return m_Message.CStr();
@ -319,10 +316,6 @@ void ScriptError::SetHandledByDebugger(bool handled)
m_HandledByDebugger = handled; m_HandledByDebugger = handled;
} }
posix_error::posix_error()
: m_Message(nullptr)
{ }
posix_error::~posix_error() throw() posix_error::~posix_error() throw()
{ {
free(m_Message); free(m_Message);

View File

@ -53,7 +53,7 @@ class ScriptError : virtual public user_error
public: public:
ScriptError(String message); ScriptError(String message);
ScriptError(String message, DebugInfo di, bool incompleteExpr = false); ScriptError(String message, DebugInfo di, bool incompleteExpr = false);
~ScriptError() throw() override; ~ScriptError() throw() = default;
const char *what(void) const throw() final; const char *what(void) const throw() final;
@ -125,13 +125,12 @@ String DiagnosticInformation(const boost::exception_ptr& eptr, bool verbose = tr
class posix_error : virtual public std::exception, virtual public boost::exception { class posix_error : virtual public std::exception, virtual public boost::exception {
public: public:
posix_error();
~posix_error() throw() override; ~posix_error() throw() override;
const char *what(void) const throw() final; const char *what(void) const throw() final;
private: private:
mutable char *m_Message; mutable char *m_Message{nullptr};
}; };
#ifdef _WIN32 #ifdef _WIN32

View File

@ -21,13 +21,6 @@
using namespace icinga; using namespace icinga;
/**
* Constructor for the FIFO class.
*/
FIFO::FIFO()
: m_Buffer(nullptr), m_DataSize(0), m_AllocSize(0), m_Offset(0)
{ }
/** /**
* Destructor for the FIFO class. * Destructor for the FIFO class.
*/ */

View File

@ -38,7 +38,6 @@ public:
static const size_t BlockSize = 512; static const size_t BlockSize = 512;
FIFO();
~FIFO() override; ~FIFO() override;
size_t Peek(void *buffer, size_t count, bool allow_partial = false) override; size_t Peek(void *buffer, size_t count, bool allow_partial = false) override;
@ -52,10 +51,10 @@ public:
size_t GetAvailableBytes() const; size_t GetAvailableBytes() const;
private: private:
char *m_Buffer; char *m_Buffer{nullptr};
size_t m_DataSize; size_t m_DataSize{0};
size_t m_AllocSize; size_t m_AllocSize{0};
size_t m_Offset; size_t m_Offset{0};
void ResizeBuffer(size_t newSize, bool decrease); void ResizeBuffer(size_t newSize, bool decrease);
void Optimize(); void Optimize();

View File

@ -126,12 +126,8 @@ String icinga::JsonEncode(const Value& value, bool pretty_print)
struct JsonElement struct JsonElement
{ {
String Key; String Key;
bool KeySet; bool KeySet{false};
Value EValue; Value EValue;
JsonElement()
: KeySet(false)
{ }
}; };
struct JsonContext struct JsonContext

View File

@ -38,13 +38,6 @@ static std::map<String, int> l_ObjectCounts;
static Timer::Ptr l_ObjectCountTimer; static Timer::Ptr l_ObjectCountTimer;
#endif /* I2_LEAK_DEBUG */ #endif /* I2_LEAK_DEBUG */
/**
* Default constructor for the Object class.
*/
Object::Object()
: m_References(0), m_Mutex(0)
{ }
/** /**
* Destructor for the Object class. * Destructor for the Object class.
*/ */

View File

@ -109,7 +109,7 @@ class Object
public: public:
DECLARE_PTR_TYPEDEFS(Object); DECLARE_PTR_TYPEDEFS(Object);
Object(); Object() = default;
virtual ~Object(); virtual ~Object();
virtual String ToString() const; virtual String ToString() const;
@ -139,11 +139,11 @@ public:
static intrusive_ptr<Type> TypeInstance; static intrusive_ptr<Type> TypeInstance;
private: private:
Object(const Object& other); Object(const Object& other) = delete;
Object& operator=(const Object& rhs); Object& operator=(const Object& rhs) = delete;
uintptr_t m_References; uintptr_t m_References{0};
mutable uintptr_t m_Mutex; mutable uintptr_t m_Mutex{0};
#ifdef I2_DEBUG #ifdef I2_DEBUG
# ifndef _WIN32 # ifndef _WIN32

View File

@ -25,10 +25,6 @@ using namespace icinga;
#define I2MUTEX_UNLOCKED 0 #define I2MUTEX_UNLOCKED 0
#define I2MUTEX_LOCKED 1 #define I2MUTEX_LOCKED 1
ObjectLock::ObjectLock()
: m_Object(nullptr), m_Locked(false)
{ }
ObjectLock::~ObjectLock() ObjectLock::~ObjectLock()
{ {
Unlock(); Unlock();

View File

@ -31,7 +31,6 @@ namespace icinga
struct ObjectLock struct ObjectLock
{ {
public: public:
ObjectLock();
ObjectLock(const Object::Ptr& object); ObjectLock(const Object::Ptr& object);
ObjectLock(const Object *object); ObjectLock(const Object *object);
@ -46,8 +45,8 @@ public:
void Unlock(); void Unlock();
private: private:
const Object *m_Object; const Object *m_Object{nullptr};
bool m_Locked; bool m_Locked{false};
}; };
} }

View File

@ -29,9 +29,6 @@ INITIALIZE_ONCE_WITH_PRIORITY([]() {
Object::TypeInstance = type; Object::TypeInstance = type;
}, 20); }, 20);
ObjectType::ObjectType()
{ }
String ObjectType::GetName() const String ObjectType::GetName() const
{ {
return "Object"; return "Object";

View File

@ -30,8 +30,6 @@ namespace icinga
class ObjectType final : public Type class ObjectType final : public Type
{ {
public: public:
ObjectType();
String GetName() const override; String GetName() const override;
Type::Ptr GetBaseType() const override; Type::Ptr GetBaseType() const override;
int GetAttributes() const override; int GetAttributes() const override;

View File

@ -36,7 +36,7 @@ class PerfdataValue final : public ObjectImpl<PerfdataValue>
public: public:
DECLARE_OBJECT(PerfdataValue); DECLARE_OBJECT(PerfdataValue);
PerfdataValue(); PerfdataValue() = default;
PerfdataValue(const String& label, double value, bool counter = false, const String& unit = "", PerfdataValue(const String& label, double value, bool counter = false, const String& unit = "",
const Value& warn = Empty, const Value& crit = Empty, const Value& warn = Empty, const Value& crit = Empty,

View File

@ -34,18 +34,10 @@
using namespace icinga; using namespace icinga;
/**
* Constructor for the Socket class.
*/
Socket::Socket()
: m_FD(INVALID_SOCKET)
{ }
/** /**
* Constructor for the Socket class. * Constructor for the Socket class.
*/ */
Socket::Socket(SOCKET fd) Socket::Socket(SOCKET fd)
: m_FD(INVALID_SOCKET)
{ {
SetFD(fd); SetFD(fd);
} }

View File

@ -36,7 +36,7 @@ class Socket : public Object
public: public:
DECLARE_PTR_TYPEDEFS(Socket); DECLARE_PTR_TYPEDEFS(Socket);
Socket(); Socket() = default;
Socket(SOCKET fd); Socket(SOCKET fd);
~Socket() override; ~Socket() override;
@ -67,7 +67,7 @@ protected:
mutable boost::mutex m_SocketMutex; mutable boost::mutex m_SocketMutex;
private: private:
SOCKET m_FD; /**< The socket descriptor. */ SOCKET m_FD{INVALID_SOCKET}; /**< The socket descriptor. */
static String GetAddressFromSockaddr(sockaddr *address, socklen_t len); static String GetAddressFromSockaddr(sockaddr *address, socklen_t len);
}; };

View File

@ -77,13 +77,9 @@ private:
struct SocketEventDescriptor struct SocketEventDescriptor
{ {
int Events; int Events{POLLIN};
SocketEvents *EventInterface; SocketEvents *EventInterface{nullptr};
Object *LifesupportObject; Object *LifesupportObject{nullptr};
SocketEventDescriptor()
: Events(POLLIN), EventInterface(nullptr), LifesupportObject(nullptr)
{ }
}; };
struct EventDescription struct EventDescription

View File

@ -38,10 +38,6 @@ enum ConnectionRole
struct StreamReadContext struct StreamReadContext
{ {
StreamReadContext()
: Buffer(nullptr), Size(0), MustRead(true), Eof(false)
{ }
~StreamReadContext() ~StreamReadContext()
{ {
free(Buffer); free(Buffer);
@ -50,10 +46,10 @@ struct StreamReadContext
bool FillFromStream(const intrusive_ptr<Stream>& stream, bool may_wait); bool FillFromStream(const intrusive_ptr<Stream>& stream, bool may_wait);
void DropData(size_t count); void DropData(size_t count);
char *Buffer; char *Buffer{nullptr};
size_t Size; size_t Size{0};
bool MustRead; bool MustRead{true};
bool Eof; bool Eof{false};
}; };
enum StreamReadStatus enum StreamReadStatus

View File

@ -30,13 +30,6 @@ REGISTER_TYPE(StreamLogger);
boost::mutex StreamLogger::m_Mutex; boost::mutex StreamLogger::m_Mutex;
/**
* Constructor for the StreamLogger class.
*/
StreamLogger::StreamLogger()
: m_Stream(nullptr), m_OwnsStream(false)
{ }
void StreamLogger::Stop(bool runtimeRemoved) void StreamLogger::Stop(bool runtimeRemoved)
{ {
ObjectImpl<StreamLogger>::Stop(runtimeRemoved); ObjectImpl<StreamLogger>::Stop(runtimeRemoved);

View File

@ -38,8 +38,6 @@ class StreamLogger : public ObjectImpl<StreamLogger>
public: public:
DECLARE_OBJECT(StreamLogger); DECLARE_OBJECT(StreamLogger);
StreamLogger();
void Stop(bool runtimeRemoved) override; void Stop(bool runtimeRemoved) override;
~StreamLogger() override; ~StreamLogger() override;
@ -53,8 +51,8 @@ protected:
private: private:
static boost::mutex m_Mutex; static boost::mutex m_Mutex;
std::ostream *m_Stream; std::ostream *m_Stream{nullptr};
bool m_OwnsStream; bool m_OwnsStream{false};
Timer::Ptr m_FlushLogTimer; Timer::Ptr m_FlushLogTimer;

View File

@ -31,10 +31,6 @@ REGISTER_BUILTIN_TYPE(String, String::GetPrototype());
const String::SizeType String::NPos = std::string::npos; const String::SizeType String::NPos = std::string::npos;
String::String()
: m_Data()
{ }
String::String(const char *data) String::String(const char *data)
: m_Data(data) : m_Data(data)
{ } { }
@ -62,9 +58,6 @@ String::String(Value&& other)
} }
#endif /* _MSC_VER */ #endif /* _MSC_VER */
String::~String()
{ }
String& String::operator=(Value&& other) String& String::operator=(Value&& other)
{ {
if (other.IsString()) if (other.IsString())

View File

@ -58,7 +58,7 @@ public:
typedef std::string::size_type SizeType; typedef std::string::size_type SizeType;
String(); String() = default;
String(const char *data); String(const char *data);
String(std::string data); String(std::string data);
String(String::SizeType n, char c); String(String::SizeType n, char c);
@ -69,8 +69,6 @@ public:
String(Value&& other); String(Value&& other);
#endif /* _MSC_VER */ #endif /* _MSC_VER */
~String();
template<typename InputIterator> template<typename InputIterator>
String(InputIterator begin, InputIterator end) String(InputIterator begin, InputIterator end)
: m_Data(begin, end) : m_Data(begin, end)

View File

@ -30,7 +30,7 @@ using namespace icinga;
int ThreadPool::m_NextID = 1; int ThreadPool::m_NextID = 1;
ThreadPool::ThreadPool(size_t max_threads) ThreadPool::ThreadPool(size_t max_threads)
: m_ID(m_NextID++), m_MaxThreads(max_threads), m_Stopped(true) : m_ID(m_NextID++), m_MaxThreads(max_threads)
{ {
if (m_MaxThreads != UINT_MAX && m_MaxThreads < sizeof(m_Queues) / sizeof(m_Queues[0])) if (m_MaxThreads != UINT_MAX && m_MaxThreads < sizeof(m_Queues) / sizeof(m_Queues[0]))
m_MaxThreads = sizeof(m_Queues) / sizeof(m_Queues[0]); m_MaxThreads = sizeof(m_Queues) / sizeof(m_Queues[0]);

View File

@ -75,14 +75,14 @@ private:
struct WorkerThread struct WorkerThread
{ {
ThreadState State; ThreadState State{ThreadDead};
bool Zombie; bool Zombie{false};
double Utilization; double Utilization{0};
double LastUpdate; double LastUpdate{0};
boost::thread *Thread; boost::thread *Thread{nullptr};
WorkerThread(ThreadState state = ThreadDead) WorkerThread(ThreadState state = ThreadDead)
: State(state), Zombie(false), Utilization(0), LastUpdate(0), Thread(nullptr) : State(state)
{ } { }
void UpdateUtilization(ThreadState state = ThreadUnspecified); void UpdateUtilization(ThreadState state = ThreadUnspecified);
@ -98,18 +98,14 @@ private:
std::deque<WorkItem> Items; std::deque<WorkItem> Items;
double WaitTime; double WaitTime{0};
double ServiceTime; double ServiceTime{0};
int TaskCount; int TaskCount{0};
bool Stopped; bool Stopped{false};
WorkerThread Threads[16]; WorkerThread Threads[16];
Queue()
: WaitTime(0), ServiceTime(0), TaskCount(0), Stopped(false)
{ }
void SpawnWorker(boost::thread_group& group); void SpawnWorker(boost::thread_group& group);
void KillWorker(boost::thread_group& group); void KillWorker(boost::thread_group& group);
}; };
@ -124,7 +120,7 @@ private:
std::thread m_MgmtThread; std::thread m_MgmtThread;
boost::mutex m_MgmtMutex; boost::mutex m_MgmtMutex;
boost::condition_variable m_MgmtCV; boost::condition_variable m_MgmtCV;
bool m_Stopped; bool m_Stopped{true};
Queue m_Queues[QUEUECOUNT]; Queue m_Queues[QUEUECOUNT];

View File

@ -73,13 +73,6 @@ static bool l_StopTimerThread;
static TimerSet l_Timers; static TimerSet l_Timers;
static int l_AliveTimers; static int l_AliveTimers;
/**
* Constructor for the Timer class.
*/
Timer::Timer()
: m_Interval(0), m_Next(0), m_Started(false), m_Running(false)
{ }
/** /**
* Destructor for the Timer class. * Destructor for the Timer class.
*/ */

View File

@ -38,7 +38,6 @@ class Timer final : public Object
public: public:
DECLARE_PTR_TYPEDEFS(Timer); DECLARE_PTR_TYPEDEFS(Timer);
Timer();
~Timer() override; ~Timer() override;
static void Uninitialize(); static void Uninitialize();
@ -57,10 +56,10 @@ public:
boost::signals2::signal<void(const Timer::Ptr&)> OnTimerExpired; boost::signals2::signal<void(const Timer::Ptr&)> OnTimerExpired;
private: private:
double m_Interval; /**< The interval of the timer. */ double m_Interval{0}; /**< The interval of the timer. */
double m_Next; /**< When the next event should happen. */ double m_Next{0}; /**< When the next event should happen. */
bool m_Started; /**< Whether the timer is enabled. */ bool m_Started{false}; /**< Whether the timer is enabled. */
bool m_Running; /**< Whether the timer proc is currently running. */ bool m_Running{false}; /**< Whether the timer proc is currently running. */
void Call(); void Call();
void InternalReschedule(bool completed, double next = -1); void InternalReschedule(bool completed, double next = -1);

View File

@ -32,12 +32,6 @@ INITIALIZE_ONCE_WITH_PRIORITY([]() {
Type::Register(type); Type::Register(type);
}, 20); }, 20);
Type::Type()
{ }
Type::~Type()
{ }
String Type::ToString() const String Type::ToString() const
{ {
return "type '" + GetName() + "'"; return "type '" + GetName() + "'";

View File

@ -75,9 +75,6 @@ class Type : public Object
public: public:
DECLARE_OBJECT(Type); DECLARE_OBJECT(Type);
Type();
~Type() override;
String ToString() const override; String ToString() const override;
virtual String GetName() const = 0; virtual String GetName() const = 0;

View File

@ -32,9 +32,6 @@ template const Object::Ptr& Value::Get<Object::Ptr>() const;
Value icinga::Empty; Value icinga::Empty;
Value::Value()
{ }
Value::Value(std::nullptr_t) Value::Value(std::nullptr_t)
{ } { }
@ -105,9 +102,6 @@ Value::Value(const intrusive_ptr<Object>& value)
m_Value = value; m_Value = value;
} }
Value::~Value()
{ }
Value& Value::operator=(const Value& other) Value& Value::operator=(const Value& other)
{ {
m_Value = other.m_Value; m_Value = other.m_Value;

View File

@ -52,7 +52,7 @@ enum ValueType
class Value class Value
{ {
public: public:
Value(); Value() = default;
Value(std::nullptr_t); Value(std::nullptr_t);
Value(int value); Value(int value);
Value(unsigned int value); Value(unsigned int value);
@ -77,8 +77,6 @@ public:
static_assert(!std::is_same<T, Object>::value, "T must not be Object"); static_assert(!std::is_same<T, Object>::value, "T must not be Object");
} }
~Value();
bool ToBool() const; bool ToBool() const;
operator double() const; operator double() const;

View File

@ -31,8 +31,8 @@ std::atomic<int> WorkQueue::m_NextID(1);
boost::thread_specific_ptr<WorkQueue *> l_ThreadWorkQueue; boost::thread_specific_ptr<WorkQueue *> l_ThreadWorkQueue;
WorkQueue::WorkQueue(size_t maxItems, int threadCount) WorkQueue::WorkQueue(size_t maxItems, int threadCount)
: m_ID(m_NextID++), m_ThreadCount(threadCount), m_Spawned(false), m_MaxItems(maxItems), m_Stopped(false), : m_ID(m_NextID++), m_ThreadCount(threadCount), m_MaxItems(maxItems),
m_Processing(0), m_NextTaskID(0), m_TaskStats(15 * 60), m_PendingTasks(0), m_PendingTasksTimestamp(0) m_TaskStats(15 * 60)
{ {
/* Initialize logger. */ /* Initialize logger. */
m_StatusTimerTimeout = Utility::GetTime(); m_StatusTimerTimeout = Utility::GetTime();

View File

@ -43,17 +43,15 @@ enum WorkQueuePriority
struct Task struct Task
{ {
Task() Task() = default;
: Priority(PriorityNormal), ID(-1)
{ }
Task(std::function<void (void)>&& function, WorkQueuePriority priority, int id) Task(std::function<void (void)> function, WorkQueuePriority priority, int id)
: Function(std::move(function)), Priority(priority), ID(id) : Function(std::move(function)), Priority(priority), ID(id)
{ } { }
std::function<void (void)> Function; std::function<void (void)> Function;
WorkQueuePriority Priority; WorkQueuePriority Priority{PriorityNormal};
int ID; int ID{-1};
}; };
inline bool operator<(const Task& a, const Task& b) inline bool operator<(const Task& a, const Task& b)
@ -110,7 +108,7 @@ private:
String m_Name; String m_Name;
static std::atomic<int> m_NextID; static std::atomic<int> m_NextID;
int m_ThreadCount; int m_ThreadCount;
bool m_Spawned; bool m_Spawned{false};
mutable boost::mutex m_Mutex; mutable boost::mutex m_Mutex;
boost::condition_variable m_CVEmpty; boost::condition_variable m_CVEmpty;
@ -118,10 +116,10 @@ private:
boost::condition_variable m_CVStarved; boost::condition_variable m_CVStarved;
boost::thread_group m_Threads; boost::thread_group m_Threads;
size_t m_MaxItems; size_t m_MaxItems;
bool m_Stopped; bool m_Stopped{false};
int m_Processing; int m_Processing{0};
std::priority_queue<Task, std::deque<Task> > m_Tasks; std::priority_queue<Task, std::deque<Task> > m_Tasks;
int m_NextTaskID; int m_NextTaskID{0};
ExceptionCallback m_ExceptionCallback; ExceptionCallback m_ExceptionCallback;
std::vector<boost::exception_ptr> m_Exceptions; std::vector<boost::exception_ptr> m_Exceptions;
Timer::Ptr m_StatusTimer; Timer::Ptr m_StatusTimer;
@ -129,8 +127,8 @@ private:
mutable boost::mutex m_StatsMutex; mutable boost::mutex m_StatsMutex;
RingBuffer m_TaskStats; RingBuffer m_TaskStats;
size_t m_PendingTasks; size_t m_PendingTasks{0};
double m_PendingTasksTimestamp; double m_PendingTasksTimestamp{0};
void WorkerThreadProc(); void WorkerThreadProc();
void StatusTimerHandler(); void StatusTimerHandler();

View File

@ -59,10 +59,6 @@ void CheckerComponent::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr
status->Set("checkercomponent", nodes); status->Set("checkercomponent", nodes);
} }
CheckerComponent::CheckerComponent()
: m_Stopped(false)
{ }
void CheckerComponent::OnConfigLoaded() void CheckerComponent::OnConfigLoaded()
{ {
ConfigObject::OnActiveChanged.connect(std::bind(&CheckerComponent::ObjectHandler, this, _1)); ConfigObject::OnActiveChanged.connect(std::bind(&CheckerComponent::ObjectHandler, this, _1));

View File

@ -77,8 +77,6 @@ public:
> >
> CheckableSet; > CheckableSet;
CheckerComponent();
void OnConfigLoaded() override; void OnConfigLoaded() override;
void Start(bool runtimeCreated) override; void Start(bool runtimeCreated) override;
void Stop(bool runtimeRemoved) override; void Stop(bool runtimeRemoved) override;
@ -90,7 +88,7 @@ public:
private: private:
boost::mutex m_Mutex; boost::mutex m_Mutex;
boost::condition_variable m_CV; boost::condition_variable m_CV;
bool m_Stopped; bool m_Stopped{false};
std::thread m_Thread; std::thread m_Thread;
CheckableSet m_IdleCheckables; CheckableSet m_IdleCheckables;

View File

@ -31,10 +31,6 @@ ConfigCompilerContext *ConfigCompilerContext::GetInstance()
return Singleton<ConfigCompilerContext>::GetInstance(); return Singleton<ConfigCompilerContext>::GetInstance();
} }
ConfigCompilerContext::ConfigCompilerContext()
: m_ObjectsFP(nullptr)
{ }
void ConfigCompilerContext::OpenObjectsFile(const String& filename) void ConfigCompilerContext::OpenObjectsFile(const String& filename)
{ {
m_ObjectsPath = filename; m_ObjectsPath = filename;

View File

@ -34,8 +34,6 @@ namespace icinga
class ConfigCompilerContext class ConfigCompilerContext
{ {
public: public:
ConfigCompilerContext();
void OpenObjectsFile(const String& filename); void OpenObjectsFile(const String& filename);
void WriteObject(const Dictionary::Ptr& object); void WriteObject(const Dictionary::Ptr& object);
void CancelObjectsFile(); void CancelObjectsFile();
@ -46,7 +44,7 @@ public:
private: private:
String m_ObjectsPath; String m_ObjectsPath;
String m_ObjectsTempFile; String m_ObjectsTempFile;
std::fstream *m_ObjectsFP; std::fstream *m_ObjectsFP{nullptr};
mutable boost::mutex m_Mutex; mutable boost::mutex m_Mutex;
}; };

View File

@ -23,15 +23,6 @@
using namespace icinga; using namespace icinga;
ConfigItemBuilder::ConfigItemBuilder()
: m_Abstract(false), m_DefaultTmpl(false), m_IgnoreOnError(false)
{
m_DebugInfo.FirstLine = 0;
m_DebugInfo.FirstColumn = 0;
m_DebugInfo.LastLine = 0;
m_DebugInfo.LastColumn = 0;
}
ConfigItemBuilder::ConfigItemBuilder(const DebugInfo& debugInfo) ConfigItemBuilder::ConfigItemBuilder(const DebugInfo& debugInfo)
: m_Abstract(false), m_DefaultTmpl(false), m_IgnoreOnError(false) : m_Abstract(false), m_DefaultTmpl(false), m_IgnoreOnError(false)
{ {

View File

@ -39,7 +39,7 @@ class ConfigItemBuilder final : public Object
public: public:
DECLARE_PTR_TYPEDEFS(ConfigItemBuilder); DECLARE_PTR_TYPEDEFS(ConfigItemBuilder);
ConfigItemBuilder(); ConfigItemBuilder() = default;
explicit ConfigItemBuilder(const DebugInfo& debugInfo); explicit ConfigItemBuilder(const DebugInfo& debugInfo);
void SetType(const Type::Ptr& type); void SetType(const Type::Ptr& type);
@ -59,15 +59,15 @@ public:
private: private:
Type::Ptr m_Type; /**< The object type. */ Type::Ptr m_Type; /**< The object type. */
String m_Name; /**< The name. */ String m_Name; /**< The name. */
bool m_Abstract; /**< Whether the item is abstract. */ bool m_Abstract{false}; /**< Whether the item is abstract. */
std::vector<std::unique_ptr<Expression> > m_Expressions; /**< Expressions for this item. */ std::vector<std::unique_ptr<Expression> > m_Expressions; /**< Expressions for this item. */
std::shared_ptr<Expression> m_Filter; /**< Filter expression. */ std::shared_ptr<Expression> m_Filter; /**< Filter expression. */
DebugInfo m_DebugInfo; /**< Debug information. */ DebugInfo m_DebugInfo; /**< Debug information. */
Dictionary::Ptr m_Scope; /**< variable scope. */ Dictionary::Ptr m_Scope; /**< variable scope. */
String m_Zone; /**< The zone. */ String m_Zone; /**< The zone. */
String m_Package; /**< The package name. */ String m_Package; /**< The package name. */
bool m_DefaultTmpl; bool m_DefaultTmpl{false};
bool m_IgnoreOnError; /**< Whether the object should be ignored when an error occurs in one of the expressions. */ bool m_IgnoreOnError{false}; /**< Whether the object should be ignored when an error occurs in one of the expressions. */
}; };
} }

View File

@ -599,7 +599,7 @@ class DictExpression final : public DebuggableExpression
{ {
public: public:
DictExpression(std::vector<std::unique_ptr<Expression> >&& expressions = {}, const DebugInfo& debugInfo = DebugInfo()) DictExpression(std::vector<std::unique_ptr<Expression> >&& expressions = {}, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Expressions(std::move(expressions)), m_Inline(false) : DebuggableExpression(debugInfo), m_Expressions(std::move(expressions))
{ } { }
void MakeInline(); void MakeInline();
@ -609,7 +609,7 @@ protected:
private: private:
std::vector<std::unique_ptr<Expression> > m_Expressions; std::vector<std::unique_ptr<Expression> > m_Expressions;
bool m_Inline; bool m_Inline{false};
friend void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec); friend void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec);
}; };

View File

@ -37,10 +37,6 @@ REGISTER_TYPE(DbConnection);
Timer::Ptr DbConnection::m_ProgramStatusTimer; Timer::Ptr DbConnection::m_ProgramStatusTimer;
boost::once_flag DbConnection::m_OnceFlag = BOOST_ONCE_INIT; boost::once_flag DbConnection::m_OnceFlag = BOOST_ONCE_INIT;
DbConnection::DbConnection()
: m_IDCacheValid(false), m_QueryStats(15 * 60), m_ActiveChangedHandler(false)
{ }
void DbConnection::OnConfigLoaded() void DbConnection::OnConfigLoaded()
{ {
ConfigObject::OnConfigLoaded(); ConfigObject::OnConfigLoaded();

View File

@ -45,8 +45,6 @@ class DbConnection : public ObjectImpl<DbConnection>
public: public:
DECLARE_OBJECT(DbConnection); DECLARE_OBJECT(DbConnection);
DbConnection();
static void InitializeDbTimer(); static void InitializeDbTimer();
void SetConfigHash(const DbObject::Ptr& dbobj, const String& hash); void SetConfigHash(const DbObject::Ptr& dbobj, const String& hash);
@ -112,7 +110,7 @@ protected:
static int GetSessionToken(); static int GetSessionToken();
private: private:
bool m_IDCacheValid; bool m_IDCacheValid{false};
std::map<std::pair<DbType::Ptr, DbReference>, String> m_ConfigHashes; std::map<std::pair<DbType::Ptr, DbReference>, String> m_ConfigHashes;
std::map<DbObject::Ptr, DbReference> m_ObjectIDs; std::map<DbObject::Ptr, DbReference> m_ObjectIDs;
std::map<std::pair<DbType::Ptr, DbReference>, DbReference> m_InsertIDs; std::map<std::pair<DbType::Ptr, DbReference>, DbReference> m_InsertIDs;
@ -129,8 +127,8 @@ private:
static void InsertRuntimeVariable(const String& key, const Value& value); static void InsertRuntimeVariable(const String& key, const Value& value);
mutable boost::mutex m_StatsMutex; mutable boost::mutex m_StatsMutex;
RingBuffer m_QueryStats; RingBuffer m_QueryStats{15 * 60};
bool m_ActiveChangedHandler; bool m_ActiveChangedHandler{false};
}; };
struct database_error : virtual std::exception, virtual boost::exception { }; struct database_error : virtual std::exception, virtual boost::exception { };

View File

@ -62,24 +62,20 @@ class DbObject;
struct DbQuery struct DbQuery
{ {
int Type; int Type{0};
DbQueryCategory Category; DbQueryCategory Category{DbCatInvalid};
String Table; String Table;
String IdColumn; String IdColumn;
Dictionary::Ptr Fields; Dictionary::Ptr Fields;
Dictionary::Ptr WhereCriteria; Dictionary::Ptr WhereCriteria;
intrusive_ptr<DbObject> Object; intrusive_ptr<DbObject> Object;
DbValue::Ptr NotificationInsertID; DbValue::Ptr NotificationInsertID;
bool ConfigUpdate; bool ConfigUpdate{false};
bool StatusUpdate; bool StatusUpdate{false};
WorkQueuePriority Priority; WorkQueuePriority Priority{PriorityNormal};
static void StaticInitialize(); static void StaticInitialize();
DbQuery()
: Type(0), Category(DbCatInvalid), ConfigUpdate(false), StatusUpdate(false), Priority(PriorityNormal)
{ }
static const std::map<String, int>& GetCategoryFilterMap(); static const std::map<String, int>& GetCategoryFilterMap();
private: private:

View File

@ -21,10 +21,6 @@
using namespace icinga; using namespace icinga;
DbReference::DbReference()
: m_Id(-1)
{ }
DbReference::DbReference(long id) DbReference::DbReference(long id)
: m_Id(id) : m_Id(id)
{ } { }

View File

@ -33,13 +33,13 @@ namespace icinga
struct DbReference struct DbReference
{ {
public: public:
DbReference(); DbReference() = default;
DbReference(long id); DbReference(long id);
bool IsValid() const; bool IsValid() const;
operator long() const; operator long() const;
private: private:
long m_Id; long m_Id{-1};
}; };
} }

View File

@ -38,10 +38,6 @@ using namespace icinga;
REGISTER_TYPE(IdoMysqlConnection); REGISTER_TYPE(IdoMysqlConnection);
REGISTER_STATSFUNCTION(IdoMysqlConnection, &IdoMysqlConnection::StatsFunc); REGISTER_STATSFUNCTION(IdoMysqlConnection, &IdoMysqlConnection::StatsFunc);
IdoMysqlConnection::IdoMysqlConnection()
: m_QueryQueue(10000000)
{ }
void IdoMysqlConnection::OnConfigLoaded() void IdoMysqlConnection::OnConfigLoaded()
{ {
ObjectImpl<IdoMysqlConnection>::OnConfigLoaded(); ObjectImpl<IdoMysqlConnection>::OnConfigLoaded();
@ -654,7 +650,7 @@ DbReference IdoMysqlConnection::GetLastInsertID()
{ {
AssertOnWorkQueue(); AssertOnWorkQueue();
return {m_Mysql->insert_id(&m_Connection)}; return {static_cast<long>(m_Mysql->insert_id(&m_Connection))};
} }
int IdoMysqlConnection::GetAffectedRows() int IdoMysqlConnection::GetAffectedRows()

View File

@ -51,8 +51,6 @@ public:
DECLARE_OBJECT(IdoMysqlConnection); DECLARE_OBJECT(IdoMysqlConnection);
DECLARE_OBJECTNAME(IdoMysqlConnection); DECLARE_OBJECTNAME(IdoMysqlConnection);
IdoMysqlConnection();
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
int GetPendingQueryCount() const override; int GetPendingQueryCount() const override;
@ -73,7 +71,7 @@ protected:
private: private:
DbReference m_InstanceID; DbReference m_InstanceID;
WorkQueue m_QueryQueue; WorkQueue m_QueryQueue{10000000};
Library m_Library; Library m_Library;
std::unique_ptr<MysqlInterface, MysqlInterfaceDeleter> m_Mysql; std::unique_ptr<MysqlInterface, MysqlInterfaceDeleter> m_Mysql;

View File

@ -41,7 +41,6 @@ REGISTER_TYPE(IdoPgsqlConnection);
REGISTER_STATSFUNCTION(IdoPgsqlConnection, &IdoPgsqlConnection::StatsFunc); REGISTER_STATSFUNCTION(IdoPgsqlConnection, &IdoPgsqlConnection::StatsFunc);
IdoPgsqlConnection::IdoPgsqlConnection() IdoPgsqlConnection::IdoPgsqlConnection()
: m_QueryQueue(1000000)
{ {
m_QueryQueue.SetName("IdoPgsqlConnection, " + GetName()); m_QueryQueue.SetName("IdoPgsqlConnection, " + GetName());
} }

View File

@ -65,7 +65,7 @@ protected:
private: private:
DbReference m_InstanceID; DbReference m_InstanceID;
WorkQueue m_QueryQueue; WorkQueue m_QueryQueue{1000000};
Library m_Library; Library m_Library;
std::unique_ptr<PgsqlInterface, PgsqlInterfaceDeleter> m_Pgsql; std::unique_ptr<PgsqlInterface, PgsqlInterfaceDeleter> m_Pgsql;

View File

@ -44,7 +44,6 @@ void Checkable::StaticInitialize()
} }
Checkable::Checkable() Checkable::Checkable()
: m_CheckRunning(false)
{ {
SetSchedulingOffset(Utility::Random()); SetSchedulingOffset(Utility::Random());
} }

View File

@ -206,7 +206,7 @@ protected:
private: private:
mutable boost::mutex m_CheckableMutex; mutable boost::mutex m_CheckableMutex;
bool m_CheckRunning; bool m_CheckRunning{false};
long m_SchedulingOffset; long m_SchedulingOffset;
static boost::mutex m_StatsMutex; static boost::mutex m_StatsMutex;

View File

@ -422,17 +422,13 @@ Value MacroProcessor::EscapeMacroShellArg(const Value& value)
struct CommandArgument struct CommandArgument
{ {
int Order; int Order{0};
bool SkipKey; bool SkipKey{false};
bool RepeatKey; bool RepeatKey{true};
bool SkipValue; bool SkipValue{false};
String Key; String Key;
Value AValue; Value AValue;
CommandArgument()
: Order(0), SkipKey(false), RepeatKey(true), SkipValue(false)
{ }
bool operator<(const CommandArgument& rhs) const bool operator<(const CommandArgument& rhs) const
{ {
return Order < rhs.Order; return Order < rhs.Order;

View File

@ -21,9 +21,6 @@
using namespace icinga; using namespace icinga;
Aggregator::Aggregator()
{ }
void Aggregator::SetFilter(const Filter::Ptr& filter) void Aggregator::SetFilter(const Filter::Ptr& filter)
{ {
m_Filter = filter; m_Filter = filter;

View File

@ -48,7 +48,7 @@ public:
void SetFilter(const Filter::Ptr& filter); void SetFilter(const Filter::Ptr& filter);
protected: protected:
Aggregator(); Aggregator() = default;
Filter::Ptr GetFilter() const; Filter::Ptr GetFilter() const;

View File

@ -21,9 +21,6 @@
using namespace icinga; using namespace icinga;
AndFilter::AndFilter()
{ }
bool AndFilter::Apply(const Table::Ptr& table, const Value& row) bool AndFilter::Apply(const Table::Ptr& table, const Value& row)
{ {
for (const Filter::Ptr& filter : m_Filters) { for (const Filter::Ptr& filter : m_Filters) {

View File

@ -35,8 +35,6 @@ class AndFilter final : public CombinerFilter
public: public:
DECLARE_PTR_TYPEDEFS(AndFilter); DECLARE_PTR_TYPEDEFS(AndFilter);
AndFilter();
bool Apply(const Table::Ptr& table, const Value& row) override; bool Apply(const Table::Ptr& table, const Value& row) override;
}; };

View File

@ -31,12 +31,8 @@ namespace icinga
*/ */
struct AvgAggregatorState final : public AggregatorState struct AvgAggregatorState final : public AggregatorState
{ {
AvgAggregatorState() double Avg{0};
: Avg(0), AvgCount(0) double AvgCount{0};
{ }
double Avg;
double AvgCount;
}; };
/** /**

View File

@ -21,9 +21,6 @@
using namespace icinga; using namespace icinga;
CombinerFilter::CombinerFilter()
{ }
void CombinerFilter::AddSubFilter(const Filter::Ptr& filter) void CombinerFilter::AddSubFilter(const Filter::Ptr& filter)
{ {
m_Filters.push_back(filter); m_Filters.push_back(filter);

View File

@ -40,7 +40,7 @@ public:
protected: protected:
std::vector<Filter::Ptr> m_Filters; std::vector<Filter::Ptr> m_Filters;
CombinerFilter(); CombinerFilter() = default;
}; };
} }

View File

@ -31,11 +31,7 @@ namespace icinga
*/ */
struct CountAggregatorState final : public AggregatorState struct CountAggregatorState final : public AggregatorState
{ {
CountAggregatorState() int Count{0};
: Count(0)
{ }
int Count;
}; };
/** /**

View File

@ -31,12 +31,8 @@ namespace icinga
*/ */
struct InvAvgAggregatorState final : public AggregatorState struct InvAvgAggregatorState final : public AggregatorState
{ {
InvAvgAggregatorState() double InvAvg{0};
: InvAvg(0), InvAvgCount(0) double InvAvgCount{0};
{ }
double InvAvg;
double InvAvgCount;
}; };
/** /**

View File

@ -31,11 +31,7 @@ namespace icinga
*/ */
struct InvSumAggregatorState final : public AggregatorState struct InvSumAggregatorState final : public AggregatorState
{ {
InvSumAggregatorState() double InvSum{0};
: InvSum(0)
{ }
double InvSum;
}; };
/** /**

View File

@ -31,11 +31,7 @@ namespace icinga
*/ */
struct MaxAggregatorState final : public AggregatorState struct MaxAggregatorState final : public AggregatorState
{ {
MaxAggregatorState() double Max{0};
: Max(0)
{ }
double Max;
}; };
/** /**

View File

@ -32,11 +32,7 @@ namespace icinga
*/ */
struct MinAggregatorState final : public AggregatorState struct MinAggregatorState final : public AggregatorState
{ {
MinAggregatorState() double Min{DBL_MAX};
: Min(DBL_MAX)
{ }
double Min;
}; };
/** /**

View File

@ -21,9 +21,6 @@
using namespace icinga; using namespace icinga;
OrFilter::OrFilter()
{ }
bool OrFilter::Apply(const Table::Ptr& table, const Value& row) bool OrFilter::Apply(const Table::Ptr& table, const Value& row)
{ {
if (m_Filters.empty()) if (m_Filters.empty())

View File

@ -35,8 +35,6 @@ class OrFilter final : public CombinerFilter
public: public:
DECLARE_PTR_TYPEDEFS(OrFilter); DECLARE_PTR_TYPEDEFS(OrFilter);
OrFilter();
bool Apply(const Table::Ptr& table, const Value& row) override; bool Apply(const Table::Ptr& table, const Value& row) override;
}; };

View File

@ -31,13 +31,9 @@ namespace icinga
*/ */
struct StdAggregatorState final : public AggregatorState struct StdAggregatorState final : public AggregatorState
{ {
StdAggregatorState() double StdSum{0};
: StdSum(0), StdQSum(0), StdCount(0) double StdQSum{0};
{ } double StdCount{0};
double StdSum;
double StdQSum;
double StdCount;
}; };
/** /**

View File

@ -31,11 +31,7 @@ namespace icinga
*/ */
struct SumAggregatorState final : public AggregatorState struct SumAggregatorState final : public AggregatorState
{ {
SumAggregatorState() double Sum{0};
: Sum(0)
{ }
double Sum;
}; };
/** /**

View File

@ -44,10 +44,6 @@ REGISTER_TYPE(ElasticsearchWriter);
REGISTER_STATSFUNCTION(ElasticsearchWriter, &ElasticsearchWriter::StatsFunc); REGISTER_STATSFUNCTION(ElasticsearchWriter, &ElasticsearchWriter::StatsFunc);
ElasticsearchWriter::ElasticsearchWriter()
: m_WorkQueue(10000000, 1)
{ }
void ElasticsearchWriter::OnConfigLoaded() void ElasticsearchWriter::OnConfigLoaded()
{ {
ObjectImpl<ElasticsearchWriter>::OnConfigLoaded(); ObjectImpl<ElasticsearchWriter>::OnConfigLoaded();

View File

@ -35,8 +35,6 @@ public:
DECLARE_OBJECT(ElasticsearchWriter); DECLARE_OBJECT(ElasticsearchWriter);
DECLARE_OBJECTNAME(ElasticsearchWriter); DECLARE_OBJECTNAME(ElasticsearchWriter);
ElasticsearchWriter();
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
static String FormatTimestamp(double ts); static String FormatTimestamp(double ts);
@ -48,7 +46,7 @@ protected:
private: private:
String m_EventPrefix; String m_EventPrefix;
WorkQueue m_WorkQueue; WorkQueue m_WorkQueue{10000000, 1};
Timer::Ptr m_FlushTimer; Timer::Ptr m_FlushTimer;
std::vector<String> m_DataBuffer; std::vector<String> m_DataBuffer;
boost::mutex m_DataBufferMutex; boost::mutex m_DataBufferMutex;

View File

@ -46,10 +46,6 @@ REGISTER_TYPE(GelfWriter);
REGISTER_STATSFUNCTION(GelfWriter, &GelfWriter::StatsFunc); REGISTER_STATSFUNCTION(GelfWriter, &GelfWriter::StatsFunc);
GelfWriter::GelfWriter()
: m_WorkQueue(10000000, 1)
{ }
void GelfWriter::OnConfigLoaded() void GelfWriter::OnConfigLoaded()
{ {
ObjectImpl<GelfWriter>::OnConfigLoaded(); ObjectImpl<GelfWriter>::OnConfigLoaded();

View File

@ -42,8 +42,6 @@ public:
DECLARE_OBJECT(GelfWriter); DECLARE_OBJECT(GelfWriter);
DECLARE_OBJECTNAME(GelfWriter); DECLARE_OBJECTNAME(GelfWriter);
GelfWriter();
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
protected: protected:
@ -53,7 +51,7 @@ protected:
private: private:
Stream::Ptr m_Stream; Stream::Ptr m_Stream;
WorkQueue m_WorkQueue; WorkQueue m_WorkQueue{10000000, 1};
Timer::Ptr m_ReconnectTimer; Timer::Ptr m_ReconnectTimer;

View File

@ -46,10 +46,6 @@ REGISTER_TYPE(GraphiteWriter);
REGISTER_STATSFUNCTION(GraphiteWriter, &GraphiteWriter::StatsFunc); REGISTER_STATSFUNCTION(GraphiteWriter, &GraphiteWriter::StatsFunc);
GraphiteWriter::GraphiteWriter()
: m_WorkQueue(10000000, 1)
{ }
void GraphiteWriter::OnConfigLoaded() void GraphiteWriter::OnConfigLoaded()
{ {
ObjectImpl<GraphiteWriter>::OnConfigLoaded(); ObjectImpl<GraphiteWriter>::OnConfigLoaded();

View File

@ -42,8 +42,6 @@ public:
DECLARE_OBJECT(GraphiteWriter); DECLARE_OBJECT(GraphiteWriter);
DECLARE_OBJECTNAME(GraphiteWriter); DECLARE_OBJECTNAME(GraphiteWriter);
GraphiteWriter();
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
void ValidateHostNameTemplate(const String& value, const ValidationUtils& utils) override; void ValidateHostNameTemplate(const String& value, const ValidationUtils& utils) override;
@ -56,7 +54,7 @@ protected:
private: private:
Stream::Ptr m_Stream; Stream::Ptr m_Stream;
WorkQueue m_WorkQueue; WorkQueue m_WorkQueue{10000000, 1};
Timer::Ptr m_ReconnectTimer; Timer::Ptr m_ReconnectTimer;

View File

@ -72,10 +72,6 @@ REGISTER_TYPE(InfluxdbWriter);
REGISTER_STATSFUNCTION(InfluxdbWriter, &InfluxdbWriter::StatsFunc); REGISTER_STATSFUNCTION(InfluxdbWriter, &InfluxdbWriter::StatsFunc);
InfluxdbWriter::InfluxdbWriter()
: m_WorkQueue(10000000, 1)
{ }
void InfluxdbWriter::OnConfigLoaded() void InfluxdbWriter::OnConfigLoaded()
{ {
ObjectImpl<InfluxdbWriter>::OnConfigLoaded(); ObjectImpl<InfluxdbWriter>::OnConfigLoaded();

View File

@ -42,8 +42,6 @@ public:
DECLARE_OBJECT(InfluxdbWriter); DECLARE_OBJECT(InfluxdbWriter);
DECLARE_OBJECTNAME(InfluxdbWriter); DECLARE_OBJECTNAME(InfluxdbWriter);
InfluxdbWriter();
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
void ValidateHostTemplate(const Dictionary::Ptr& value, const ValidationUtils& utils) override; void ValidateHostTemplate(const Dictionary::Ptr& value, const ValidationUtils& utils) override;
@ -55,7 +53,7 @@ protected:
void Stop(bool runtimeRemoved) override; void Stop(bool runtimeRemoved) override;
private: private:
WorkQueue m_WorkQueue; WorkQueue m_WorkQueue{10000000, 1};
Timer::Ptr m_FlushTimer; Timer::Ptr m_FlushTimer;
std::vector<String> m_DataBuffer; std::vector<String> m_DataBuffer;

View File

@ -49,7 +49,6 @@ REGISTER_STATSFUNCTION(ApiListener, &ApiListener::StatsFunc);
REGISTER_APIFUNCTION(Hello, icinga, &ApiListener::HelloAPIHandler); REGISTER_APIFUNCTION(Hello, icinga, &ApiListener::HelloAPIHandler);
ApiListener::ApiListener() ApiListener::ApiListener()
: m_SyncQueue(0, 4), m_LogMessageCount(0)
{ {
m_RelayQueue.SetName("ApiListener, RelayQueue"); m_RelayQueue.SetName("ApiListener, RelayQueue");
m_SyncQueue.SetName("ApiListener, SyncQueue"); m_SyncQueue.SetName("ApiListener, SyncQueue");

View File

@ -145,11 +145,11 @@ private:
void ListenerThreadProc(const Socket::Ptr& server); void ListenerThreadProc(const Socket::Ptr& server);
WorkQueue m_RelayQueue; WorkQueue m_RelayQueue;
WorkQueue m_SyncQueue; WorkQueue m_SyncQueue{0, 4};
boost::mutex m_LogLock; boost::mutex m_LogLock;
Stream::Ptr m_LogFile; Stream::Ptr m_LogFile;
size_t m_LogMessageCount; size_t m_LogMessageCount{0};
bool RelayMessageOne(const Zone::Ptr& zone, const MessageOrigin::Ptr& origin, const Dictionary::Ptr& message, const Endpoint::Ptr& currentMaster); bool RelayMessageOne(const Zone::Ptr& zone, const MessageOrigin::Ptr& origin, const Dictionary::Ptr& message, const Endpoint::Ptr& currentMaster);
void SyncRelayMessage(const MessageOrigin::Ptr& origin, const ConfigObject::Ptr& secobj, const Dictionary::Ptr& message, bool log); void SyncRelayMessage(const MessageOrigin::Ptr& origin, const ConfigObject::Ptr& secobj, const Dictionary::Ptr& message, bool log);

View File

@ -28,14 +28,10 @@ namespace icinga
struct ApiScriptFrame struct ApiScriptFrame
{ {
double Seen; double Seen{0};
int NextLine; int NextLine{1};
std::map<String, String> Lines; std::map<String, String> Lines;
Dictionary::Ptr Locals; Dictionary::Ptr Locals;
ApiScriptFrame()
: Seen(0), NextLine(1)
{ }
}; };
class ConsoleHandler final : public HttpHandler class ConsoleHandler final : public HttpHandler

View File

@ -34,10 +34,6 @@ REGISTER_TYPE(Endpoint);
boost::signals2::signal<void(const Endpoint::Ptr&, const JsonRpcConnection::Ptr&)> Endpoint::OnConnected; boost::signals2::signal<void(const Endpoint::Ptr&, const JsonRpcConnection::Ptr&)> Endpoint::OnConnected;
boost::signals2::signal<void(const Endpoint::Ptr&, const JsonRpcConnection::Ptr&)> Endpoint::OnDisconnected; boost::signals2::signal<void(const Endpoint::Ptr&, const JsonRpcConnection::Ptr&)> Endpoint::OnDisconnected;
Endpoint::Endpoint()
: m_MessagesSent(60), m_MessagesReceived(60), m_BytesSent(60), m_BytesReceived(60)
{ }
void Endpoint::OnAllConfigLoaded() void Endpoint::OnAllConfigLoaded()
{ {
ObjectImpl<Endpoint>::OnAllConfigLoaded(); ObjectImpl<Endpoint>::OnAllConfigLoaded();

View File

@ -42,8 +42,6 @@ public:
DECLARE_OBJECT(Endpoint); DECLARE_OBJECT(Endpoint);
DECLARE_OBJECTNAME(Endpoint); DECLARE_OBJECTNAME(Endpoint);
Endpoint();
static boost::signals2::signal<void(const Endpoint::Ptr&, const intrusive_ptr<JsonRpcConnection>&)> OnConnected; static boost::signals2::signal<void(const Endpoint::Ptr&, const intrusive_ptr<JsonRpcConnection>&)> OnConnected;
static boost::signals2::signal<void(const Endpoint::Ptr&, const intrusive_ptr<JsonRpcConnection>&)> OnDisconnected; static boost::signals2::signal<void(const Endpoint::Ptr&, const intrusive_ptr<JsonRpcConnection>&)> OnDisconnected;
@ -76,10 +74,10 @@ private:
std::set<intrusive_ptr<JsonRpcConnection> > m_Clients; std::set<intrusive_ptr<JsonRpcConnection> > m_Clients;
intrusive_ptr<Zone> m_Zone; intrusive_ptr<Zone> m_Zone;
mutable RingBuffer m_MessagesSent; mutable RingBuffer m_MessagesSent{60};
mutable RingBuffer m_MessagesReceived; mutable RingBuffer m_MessagesReceived{60};
mutable RingBuffer m_BytesSent; mutable RingBuffer m_BytesSent{60};
mutable RingBuffer m_BytesReceived; mutable RingBuffer m_BytesReceived{60};
}; };
} }

View File

@ -26,9 +26,6 @@
using namespace icinga; using namespace icinga;
Url::Url()
{ }
Url::Url(const String& base_url) Url::Url(const String& base_url)
{ {
String url = base_url; String url = base_url;

View File

@ -41,7 +41,7 @@ class Url final : public Object
public: public:
DECLARE_PTR_TYPEDEFS(Url); DECLARE_PTR_TYPEDEFS(Url);
Url(); Url() = default;
Url(const String& url); Url(const String& url);
String Format(bool onlyPathAndQuery = false, bool printCredentials = false) const; String Format(bool onlyPathAndQuery = false, bool printCredentials = false) const;

View File

@ -81,13 +81,9 @@ enum FieldAttribute
struct FieldType struct FieldType
{ {
bool IsName; bool IsName{false};
std::string TypeName; std::string TypeName;
int ArrayRank; int ArrayRank{0};
FieldType()
: IsName(false), ArrayRank(0)
{ }
inline std::string GetRealType() const inline std::string GetRealType() const
{ {
@ -113,23 +109,19 @@ struct FieldType
struct Field struct Field
{ {
int Attributes; int Attributes{0};
FieldType Type; FieldType Type;
std::string Name; std::string Name;
std::string AlternativeName; std::string AlternativeName;
std::string GetAccessor; std::string GetAccessor;
bool PureGetAccessor; bool PureGetAccessor{false};
std::string SetAccessor; std::string SetAccessor;
bool PureSetAccessor; bool PureSetAccessor{false};
std::string DefaultAccessor; std::string DefaultAccessor;
std::string TrackAccessor; std::string TrackAccessor;
std::string NavigationName; std::string NavigationName;
std::string NavigateAccessor; std::string NavigateAccessor;
bool PureNavigateAccessor; bool PureNavigateAccessor{false};
Field()
: Attributes(0), PureGetAccessor(false), PureSetAccessor(false), PureNavigateAccessor(false)
{ }
inline std::string GetFriendlyName() const inline std::string GetFriendlyName() const
{ {