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());
Array::Array()
{ }
Array::Array(std::initializer_list<Value> init)
: m_Data(init)
{ }
Array::~Array()
{ }
/**
* Restrieves a value from an array.
*

View File

@ -47,11 +47,9 @@ public:
typedef std::vector<Value>::size_type SizeType;
Array();
Array() = default;
Array(std::initializer_list<Value> init);
~Array() override;
Value Get(SizeType index) const;
void Set(SizeType index, const 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;
ConfigObject::ConfigObject()
{ }
bool ConfigObject::IsActive() const
{
return GetActive();

View File

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

View File

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

View File

@ -35,13 +35,11 @@ struct DebugInfo
{
String Path;
int FirstLine;
int FirstColumn;
int FirstLine{0};
int FirstColumn{0};
int LastLine;
int LastColumn;
DebugInfo();
int LastLine{0};
int LastColumn{0};
};
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());
Dictionary::Dictionary()
{ }
Dictionary::~Dictionary()
{ }
/**
* Retrieves a value from a dictionary.
*

View File

@ -49,10 +49,6 @@ public:
typedef std::map<String, Value>::value_type Pair;
Dictionary();
~Dictionary() override;
Value Get(const String& key) const;
bool Get(const String& key, Value *result) const;
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)
{ }
ScriptError::~ScriptError() throw()
{ }
const char *ScriptError::what() const throw()
{
return m_Message.CStr();
@ -319,10 +316,6 @@ void ScriptError::SetHandledByDebugger(bool handled)
m_HandledByDebugger = handled;
}
posix_error::posix_error()
: m_Message(nullptr)
{ }
posix_error::~posix_error() throw()
{
free(m_Message);

View File

@ -53,7 +53,7 @@ class ScriptError : virtual public user_error
public:
ScriptError(String message);
ScriptError(String message, DebugInfo di, bool incompleteExpr = false);
~ScriptError() throw() override;
~ScriptError() throw() = default;
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 {
public:
posix_error();
~posix_error() throw() override;
const char *what(void) const throw() final;
private:
mutable char *m_Message;
mutable char *m_Message{nullptr};
};
#ifdef _WIN32

View File

@ -21,13 +21,6 @@
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.
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@ using namespace icinga;
int ThreadPool::m_NextID = 1;
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]))
m_MaxThreads = sizeof(m_Queues) / sizeof(m_Queues[0]);

View File

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

View File

@ -73,13 +73,6 @@ static bool l_StopTimerThread;
static TimerSet l_Timers;
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.
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,15 +23,6 @@
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)
: m_Abstract(false), m_DefaultTmpl(false), m_IgnoreOnError(false)
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -145,11 +145,11 @@ private:
void ListenerThreadProc(const Socket::Ptr& server);
WorkQueue m_RelayQueue;
WorkQueue m_SyncQueue;
WorkQueue m_SyncQueue{0, 4};
boost::mutex m_LogLock;
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);
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
{
double Seen;
int NextLine;
double Seen{0};
int NextLine{1};
std::map<String, String> Lines;
Dictionary::Ptr Locals;
ApiScriptFrame()
: Seen(0), NextLine(1)
{ }
};
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::OnDisconnected;
Endpoint::Endpoint()
: m_MessagesSent(60), m_MessagesReceived(60), m_BytesSent(60), m_BytesReceived(60)
{ }
void Endpoint::OnAllConfigLoaded()
{
ObjectImpl<Endpoint>::OnAllConfigLoaded();

View File

@ -42,8 +42,6 @@ public:
DECLARE_OBJECT(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>&)> OnDisconnected;
@ -76,10 +74,10 @@ private:
std::set<intrusive_ptr<JsonRpcConnection> > m_Clients;
intrusive_ptr<Zone> m_Zone;
mutable RingBuffer m_MessagesSent;
mutable RingBuffer m_MessagesReceived;
mutable RingBuffer m_BytesSent;
mutable RingBuffer m_BytesReceived;
mutable RingBuffer m_MessagesSent{60};
mutable RingBuffer m_MessagesReceived{60};
mutable RingBuffer m_BytesSent{60};
mutable RingBuffer m_BytesReceived{60};
};
}

View File

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

View File

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

View File

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