Merge pull request #5824 from Icinga/feature/cxx11-features

Replace a few Boost features with equivalent C++11 features
This commit is contained in:
Michael Friedrich 2017-11-30 20:39:21 +01:00 committed by GitHub
commit 7f28a1a78a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
179 changed files with 755 additions and 880 deletions

View File

@ -34,7 +34,7 @@
#include "base/process.hpp"
#include "config.h"
#include <boost/program_options.hpp>
#include <boost/tuple/tuple.hpp>
#include <thread>
#ifndef _WIN32
# include <sys/types.h>
@ -93,7 +93,7 @@ static std::vector<String> GlobalArgumentCompletion(const String& argument, cons
return std::vector<String>();
}
int Main(void)
static int Main(void)
{
int argc = Application::GetArgC();
char **argv = Application::GetArgV();
@ -159,7 +159,7 @@ int Main(void)
Application::DeclareRLimitProcesses(Application::GetDefaultRLimitProcesses());
Application::DeclareRLimitStack(Application::GetDefaultRLimitStack());
#endif /* __linux__ */
Application::DeclareConcurrency(boost::thread::hardware_concurrency());
Application::DeclareConcurrency(std::thread::hardware_concurrency());
ScriptGlobal::Set("AttachDebugger", false);
@ -700,7 +700,7 @@ static int SetupService(bool install, int argc, char **argv)
return 0;
}
VOID ReportSvcStatus(DWORD dwCurrentState,
static VOID ReportSvcStatus(DWORD dwCurrentState,
DWORD dwWin32ExitCode,
DWORD dwWaitHint)
{
@ -724,7 +724,7 @@ VOID ReportSvcStatus(DWORD dwCurrentState,
SetServiceStatus(l_SvcStatusHandle, &l_SvcStatus);
}
VOID WINAPI ServiceControlHandler(DWORD dwCtrl)
static VOID WINAPI ServiceControlHandler(DWORD dwCtrl)
{
if (dwCtrl == SERVICE_CONTROL_STOP) {
ReportSvcStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
@ -732,7 +732,7 @@ VOID WINAPI ServiceControlHandler(DWORD dwCtrl)
}
}
VOID WINAPI ServiceMain(DWORD argc, LPSTR *argv)
static VOID WINAPI ServiceMain(DWORD argc, LPSTR *argv)
{
l_SvcStatusHandle = RegisterServiceCtrlHandler(
"icinga2",

View File

@ -40,6 +40,7 @@
#include <sstream>
#include <iostream>
#include <fstream>
#include <thread>
#ifdef __linux__
#include <sys/prctl.h>
#endif /* __linux__ */
@ -157,8 +158,6 @@ void Application::InitializeBase(void)
/* make sure the thread pool gets initialized */
GetTP().Start();
Timer::Initialize();
}
void Application::UninitializeBase(void)
@ -316,8 +315,6 @@ void Application::SetArgV(char **argv)
*/
void Application::RunEventLoop(void)
{
Timer::Initialize();
double lastLoop = Utility::GetTime();
mainloop:
@ -394,7 +391,7 @@ static void ReloadProcessCallback(const ProcessResult& pr)
{
l_Restarting = false;
boost::thread t(std::bind(&ReloadProcessCallbackInternal, pr));
std::thread t(std::bind(&ReloadProcessCallbackInternal, pr));
t.detach();
}
@ -1508,7 +1505,7 @@ void Application::DeclareConcurrency(int ncpus)
*/
int Application::GetConcurrency(void)
{
Value defaultConcurrency = boost::thread::hardware_concurrency();
Value defaultConcurrency = std::thread::hardware_concurrency();
return ScriptGlobal::Get("Concurrency", &defaultConcurrency);
}

View File

@ -77,10 +77,7 @@ static void ArrayClear(void)
static bool ArraySortCmp(const Function::Ptr& cmp, const Value& a, const Value& b)
{
std::vector<Value> args;
args.push_back(a);
args.push_back(b);
return cmp->Invoke(args);
return cmp->Invoke({ a, b });
}
static Array::Ptr ArraySort(const std::vector<Value>& args)
@ -154,9 +151,7 @@ static Array::Ptr ArrayMap(const Function::Ptr& function)
ObjectLock olock(self);
for (const Value& item : self) {
std::vector<Value> args;
args.push_back(item);
result->Add(function->Invoke(args));
result->Add(function->Invoke({ item }));
}
return result;
@ -177,10 +172,7 @@ static Value ArrayReduce(const Function::Ptr& function)
ObjectLock olock(self);
for (size_t i = 1; i < self->GetLength(); i++) {
std::vector<Value> args;
args.push_back(result);
args.push_back(self->Get(i));
result = function->Invoke(args);
result = function->Invoke({ result, self->Get(i) });
}
return result;
@ -198,9 +190,7 @@ static Array::Ptr ArrayFilter(const Function::Ptr& function)
ObjectLock olock(self);
for (const Value& item : self) {
std::vector<Value> args;
args.push_back(item);
if (function->Invoke(args))
if (function->Invoke({ item }))
result->Add(item);
}
@ -217,9 +207,7 @@ static bool ArrayAny(const Function::Ptr& function)
ObjectLock olock(self);
for (const Value& item : self) {
std::vector<Value> args;
args.push_back(item);
if (function->Invoke(args))
if (function->Invoke({ item }))
return true;
}
@ -236,9 +224,7 @@ static bool ArrayAll(const Function::Ptr& function)
ObjectLock olock(self);
for (const Value& item : self) {
std::vector<Value> args;
args.push_back(item);
if (!function->Invoke(args))
if (!function->Invoke({ item }))
return false;
}

View File

@ -90,7 +90,7 @@ void Array::Add(Value&& value)
{
ObjectLock olock(this);
m_Data.push_back(std::move(value));
m_Data.emplace_back(std::move(value));
}
/**

View File

@ -706,7 +706,7 @@ ConfigObject::Ptr ConfigObject::GetObject(const String& type, const String& name
ConfigType *ctype = dynamic_cast<ConfigType *>(ptype.get());
if (!ctype)
return ConfigObject::Ptr();
return nullptr;
return ctype->GetObject(name);
}

View File

@ -33,7 +33,7 @@ ConfigObject::Ptr ConfigType::GetObject(const String& name) const
auto nt = m_ObjectMap.find(name);
if (nt == m_ObjectMap.end())
return ConfigObject::Ptr();
return nullptr;
return nt->second;
}

View File

@ -61,7 +61,7 @@ public:
static void EmitArray(std::ostream& fp, int indentLevel, const Array::Ptr& val);
static void EmitArrayItems(std::ostream& fp, int indentLevel, const Array::Ptr& val);
static void EmitScope(std::ostream& fp, int indentLevel, const Dictionary::Ptr& val,
const Array::Ptr& imports = Array::Ptr(), bool splitDot = false);
const Array::Ptr& imports = nullptr, bool splitDot = false);
static void EmitValue(std::ostream& fp, int indentLevel, const Value& val);
static void EmitRaw(std::ostream& fp, const String& val);
static void EmitIndent(std::ostream& fp, int indentLevel);

View File

@ -25,8 +25,7 @@ using namespace icinga;
static ConsoleType l_ConsoleType = Console_Dumb;
static void InitializeConsole(void)
{
INITIALIZE_ONCE([]() {
l_ConsoleType = Console_Dumb;
#ifndef _WIN32
@ -35,9 +34,7 @@ static void InitializeConsole(void)
#else /* _WIN32 */
l_ConsoleType = Console_Windows;
#endif /* _WIN32 */
}
INITIALIZE_ONCE(InitializeConsole);
})
ConsoleColorTag::ConsoleColorTag(int color, ConsoleType consoleType)
: m_Color(color), m_ConsoleType(consoleType)

View File

@ -34,7 +34,7 @@ static Value FunctionCall(const std::vector<Value>& args)
Function::Ptr self = static_cast<Function::Ptr>(vframe->Self);
std::vector<Value> uargs(args.begin() + 1, args.end());
return self->Invoke(args[0], uargs);
return self->InvokeThis(args[0], uargs);
}
static Value FunctionCallV(const Value& thisArg, const Array::Ptr& args)
@ -49,7 +49,7 @@ static Value FunctionCallV(const Value& thisArg, const Array::Ptr& args)
uargs = std::vector<Value>(args->Begin(), args->End());
}
return self->Invoke(thisArg, uargs);
return self->InvokeThis(thisArg, uargs);
}

View File

@ -42,7 +42,7 @@ Value Function::Invoke(const std::vector<Value>& arguments)
return m_Callback(arguments);
}
Value Function::Invoke(const Value& otherThis, const std::vector<Value>& arguments)
Value Function::InvokeThis(const Value& otherThis, const std::vector<Value>& arguments)
{
ScriptFrame frame;
frame.Self = otherThis;

View File

@ -49,7 +49,7 @@ public:
{ }
Value Invoke(const std::vector<Value>& arguments = std::vector<Value>());
Value Invoke(const Value& otherThis, const std::vector<Value>& arguments = std::vector<Value>());
Value InvokeThis(const Value& otherThis, const std::vector<Value>& arguments = std::vector<Value>());
inline bool IsSideEffectFree(void) const
{

View File

@ -31,9 +31,6 @@ using boost::intrusive_ptr;
using boost::dynamic_pointer_cast;
using boost::static_pointer_cast;
#include <boost/tuple/tuple.hpp>
using boost::tie;
namespace icinga
{

View File

@ -39,7 +39,7 @@ String ObjectType::GetName(void) const
Type::Ptr ObjectType::GetBaseType(void) const
{
return Type::Ptr();
return nullptr;
}
int ObjectType::GetAttributes(void) const

View File

@ -34,7 +34,7 @@ String PrimitiveType::GetName(void) const
Type::Ptr PrimitiveType::GetBaseType(void) const
{
if (m_Base == "None")
return Type::Ptr();
return nullptr;
else
return Type::GetByName(m_Base);
}

View File

@ -30,6 +30,7 @@
#include "base/json.hpp"
#include <boost/algorithm/string/join.hpp>
#include <boost/thread/once.hpp>
#include <thread>
#include <iostream>
#ifndef _WIN32
@ -539,7 +540,7 @@ void Process::ThreadInitialize(void)
{
/* Note to self: Make sure this runs _after_ we've daemonized. */
for (int tid = 0; tid < IOTHREADS; tid++) {
boost::thread t(std::bind(&Process::IOThreadProc, tid));
std::thread t(std::bind(&Process::IOThreadProc, tid));
t.detach();
}
}
@ -573,10 +574,7 @@ Process::Arguments Process::PrepareCommand(const Value& command)
#ifdef _WIN32
return command;
#else /* _WIN32 */
args.push_back("sh");
args.push_back("-c");
args.push_back(command);
return args;
return { "sh", "-c", command };
#endif
}

View File

@ -66,7 +66,7 @@ public:
static const std::deque<Process::Ptr>::size_type MaxTasksPerThread = 512;
Process(const Arguments& arguments, const Dictionary::Ptr& extraEnvironment = Dictionary::Ptr());
Process(const Arguments& arguments, const Dictionary::Ptr& extraEnvironment = nullptr);
~Process(void);
void SetTimeout(double timeout);

View File

@ -405,7 +405,7 @@ ConfigObject::Ptr ScriptUtils::GetObject(const Value& vtype, const String& name)
ConfigType *ctype = dynamic_cast<ConfigType *>(ptype.get());
if (!ctype)
return ConfigObject::Ptr();
return nullptr;
return ctype->GetObject(name);
}
@ -477,7 +477,7 @@ Value ScriptUtils::Glob(const std::vector<Value>& args)
type = args[1];
std::vector<String> paths;
Utility::Glob(pathSpec, std::bind(&GlobCallbackHelper, boost::ref(paths), _1), type);
Utility::Glob(pathSpec, std::bind(&GlobCallbackHelper, std::ref(paths), _1), type);
return Array::FromVector(paths);
}
@ -496,7 +496,7 @@ Value ScriptUtils::GlobRecursive(const std::vector<Value>& args)
type = args[2];
std::vector<String> paths;
Utility::GlobRecursive(path, pattern, std::bind(&GlobCallbackHelper, boost::ref(paths), _1), type);
Utility::GlobRecursive(path, pattern, std::bind(&GlobCallbackHelper, std::ref(paths), _1), type);
return Array::FromVector(paths);
}

View File

@ -55,7 +55,7 @@ static Object::Ptr SerializeObject(const Object::Ptr& input, int attributeTypes)
Type::Ptr type = input->GetReflectionType();
if (!type)
return Object::Ptr();
return nullptr;
Dictionary::Ptr fields = new Dictionary();
@ -168,7 +168,7 @@ Value icinga::Serialize(const Value& value, int attributeTypes)
Value icinga::Deserialize(const Value& value, bool safe_mode, int attributeTypes)
{
return Deserialize(Object::Ptr(), value, safe_mode, attributeTypes);
return Deserialize(nullptr, value, safe_mode, attributeTypes);
}
Value icinga::Deserialize(const Object::Ptr& object, const Value& value, bool safe_mode, int attributeTypes)

View File

@ -116,7 +116,7 @@ void SocketEventEngineEpoll::ThreadProc(int tid)
event.LifesupportReference = event.Descriptor.LifesupportObject;
VERIFY(event.LifesupportReference);
events.push_back(event);
events.emplace_back(std::move(event));
}
}

View File

@ -108,7 +108,7 @@ void SocketEventEnginePoll::ThreadProc(int tid)
event.LifesupportReference = event.Descriptor.LifesupportObject;
VERIFY(event.LifesupportReference);
events.push_back(event);
events.emplace_back(std::move(event));
}
}
@ -192,7 +192,7 @@ void SocketEventEnginePoll::ChangeEvents(SocketEvents *se, int events)
it->second.Events = events;
if (se->m_EnginePrivate && boost::this_thread::get_id() == m_Threads[tid].get_id())
if (se->m_EnginePrivate && std::this_thread::get_id() == m_Threads[tid].get_id())
((pollfd *)se->m_EnginePrivate)->events = events;
else
m_FDChanged[tid] = true;

View File

@ -50,7 +50,7 @@ void SocketEventEngine::Start(void)
InitializeThread(tid);
m_Threads[tid] = boost::thread(std::bind(&SocketEventEngine::ThreadProc, this, tid));
m_Threads[tid] = std::thread(std::bind(&SocketEventEngine::ThreadProc, this, tid));
}
}
@ -58,7 +58,7 @@ void SocketEventEngine::WakeUpThread(int sid, bool wait)
{
int tid = sid % SOCKET_IOTHREADS;
if (boost::this_thread::get_id() == m_Threads[tid].get_id())
if (std::this_thread::get_id() == m_Threads[tid].get_id())
return;
if (wait) {

View File

@ -22,7 +22,7 @@
#include "base/i2-base.hpp"
#include "base/socket.hpp"
#include <boost/thread.hpp>
#include <thread>
#ifndef _WIN32
# include <poll.h>
@ -109,7 +109,7 @@ protected:
virtual void Unregister(SocketEvents *se) = 0;
virtual void ChangeEvents(SocketEvents *se, int events) = 0;
boost::thread m_Threads[SOCKET_IOTHREADS];
std::thread m_Threads[SOCKET_IOTHREADS];
SOCKET m_EventFDs[SOCKET_IOTHREADS][2];
bool m_FDChanged[SOCKET_IOTHREADS];
boost::mutex m_EventMutex[SOCKET_IOTHREADS];

View File

@ -23,7 +23,6 @@
#include "base/utility.hpp"
#include "base/exception.hpp"
#include "base/application.hpp"
#include <boost/bind.hpp>
#include <iostream>
using namespace icinga;
@ -54,7 +53,7 @@ void ThreadPool::Start(void)
for (size_t i = 0; i < sizeof(m_Queues) / sizeof(m_Queues[0]); i++)
m_Queues[i].SpawnWorker(m_ThreadGroup);
m_MgmtThread = boost::thread(std::bind(&ThreadPool::ManagerThreadProc, this));
m_MgmtThread = std::thread(std::bind(&ThreadPool::ManagerThreadProc, this));
}
void ThreadPool::Stop(void)
@ -213,7 +212,7 @@ bool ThreadPool::Post(const ThreadPool::WorkFunction& callback, SchedulerPolicy
if (policy == LowLatencyScheduler)
queue.SpawnWorker(m_ThreadGroup);
queue.Items.push_back(wi);
queue.Items.emplace_back(std::move(wi));
queue.CV.notify_one();
}
@ -337,7 +336,7 @@ void ThreadPool::Queue::SpawnWorker(boost::thread_group& group)
Log(LogDebug, "ThreadPool", "Spawning worker thread.");
Threads[i] = WorkerThread(ThreadIdle);
Threads[i].Thread = group.create_thread(boost::bind(&ThreadPool::WorkerThread::ThreadProc, boost::ref(Threads[i]), boost::ref(*this)));
Threads[i].Thread = group.create_thread(std::bind(&ThreadPool::WorkerThread::ThreadProc, std::ref(Threads[i]), std::ref(*this)));
break;
}

View File

@ -26,6 +26,7 @@
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <deque>
#include <thread>
namespace icinga
{
@ -121,7 +122,7 @@ private:
boost::thread_group m_ThreadGroup;
boost::thread m_MgmtThread;
std::thread m_MgmtThread;
boost::mutex m_MgmtMutex;
boost::condition_variable m_MgmtCV;
bool m_Stopped;

View File

@ -20,28 +20,58 @@
#include "base/timer.hpp"
#include "base/debug.hpp"
#include "base/utility.hpp"
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/key_extractors.hpp>
#include <thread>
using namespace icinga;
namespace icinga {
class TimerHolder {
public:
TimerHolder(Timer *timer)
: m_Timer(timer)
{ }
inline Timer *GetObject(void) const
{
return m_Timer;
}
inline double GetNextUnlocked(void) const
{
return m_Timer->m_Next;
}
operator Timer *(void) const
{
return m_Timer;
}
private:
Timer *m_Timer;
};
}
typedef boost::multi_index_container<
Timer::Holder,
TimerHolder,
boost::multi_index::indexed_by<
boost::multi_index::ordered_unique<boost::multi_index::const_mem_fun<Timer::Holder, Timer *, &Timer::Holder::GetObject> >,
boost::multi_index::ordered_non_unique<boost::multi_index::const_mem_fun<Timer::Holder, double, &Timer::Holder::GetNextUnlocked> >
boost::multi_index::ordered_unique<boost::multi_index::const_mem_fun<TimerHolder, Timer *, &TimerHolder::GetObject> >,
boost::multi_index::ordered_non_unique<boost::multi_index::const_mem_fun<TimerHolder, double, &TimerHolder::GetNextUnlocked> >
>
> TimerSet;
static boost::mutex l_TimerMutex;
static boost::condition_variable l_TimerCV;
static boost::thread l_TimerThread;
static std::thread l_TimerThread;
static bool l_StopTimerThread;
static TimerSet l_Timers;
static int l_AliveTimers;
/**
* Constructor for the Timer class.
@ -58,29 +88,16 @@ Timer::~Timer(void)
Stop(true);
}
/**
* Initializes the timer sub-system.
*/
void Timer::Initialize(void)
{
boost::mutex::scoped_lock lock(l_TimerMutex);
l_StopTimerThread = false;
l_TimerThread = boost::thread(&Timer::TimerThreadProc);
}
/**
* Disables the timer sub-system.
*/
void Timer::Uninitialize(void)
{
{
boost::mutex::scoped_lock lock(l_TimerMutex);
l_StopTimerThread = true;
l_TimerCV.notify_all();
}
{
boost::mutex::scoped_lock lock(l_TimerMutex);
l_StopTimerThread = true;
l_TimerCV.notify_all();
}
if (l_TimerThread.joinable())
l_TimerThread.join();
if (l_TimerThread.joinable())
l_TimerThread.join();
}
/**
@ -129,6 +146,11 @@ void Timer::Start(void)
{
boost::mutex::scoped_lock lock(l_TimerMutex);
m_Started = true;
if (l_AliveTimers++ == 0) {
l_StopTimerThread = false;
l_TimerThread = std::thread(&Timer::TimerThreadProc);
}
}
InternalReschedule(false);
@ -144,6 +166,18 @@ void Timer::Stop(bool wait)
boost::mutex::scoped_lock lock(l_TimerMutex);
if (m_Started && --l_AliveTimers == 0) {
l_StopTimerThread = true;
l_TimerCV.notify_all();
lock.unlock();
if (l_TimerThread.joinable() && l_TimerThread.get_id() != std::this_thread::get_id())
l_TimerThread.join();
lock.lock();
}
m_Started = false;
l_Timers.erase(this);

View File

@ -26,6 +26,8 @@
namespace icinga {
class TimerHolder;
/**
* A timer that periodically triggers an event.
*
@ -39,6 +41,8 @@ public:
Timer(void);
~Timer(void);
static void Uninitialize(void);
void SetInterval(double interval);
double GetInterval(void) const;
@ -52,31 +56,6 @@ public:
boost::signals2::signal<void(const Timer::Ptr&)> OnTimerExpired;
class Holder {
public:
Holder(Timer *timer)
: m_Timer(timer)
{ }
inline Timer *GetObject(void) const
{
return m_Timer;
}
inline double GetNextUnlocked(void) const
{
return m_Timer->m_Next;
}
operator Timer *(void) const
{
return m_Timer;
}
private:
Timer *m_Timer;
};
private:
double m_Interval; /**< The interval of the timer. */
double m_Next; /**< When the next event should happen. */
@ -88,10 +67,7 @@ private:
static void TimerThreadProc(void);
static void Initialize(void);
static void Uninitialize(void);
friend class Application;
friend class TimerHolder;
};
}

View File

@ -38,7 +38,7 @@ bool I2_EXPORT TlsStream::m_SSLIndexInitialized = false;
* @param role The role of the client.
* @param sslContext The SSL context for the client.
*/
TlsStream::TlsStream(const Socket::Ptr& socket, const String& hostname, ConnectionRole role, const boost::shared_ptr<SSL_CTX>& sslContext)
TlsStream::TlsStream(const Socket::Ptr& socket, const String& hostname, ConnectionRole role, const std::shared_ptr<SSL_CTX>& sslContext)
: SocketEvents(socket, this), m_Eof(false), m_HandshakeOK(false), m_VerifyOK(true), m_ErrorCode(0),
m_ErrorOccurred(false), m_Socket(socket), m_Role(role), m_SendQ(new FIFO()), m_RecvQ(new FIFO()),
m_CurrentAction(TlsActionNone), m_Retry(false), m_Shutdown(false)
@ -46,7 +46,7 @@ TlsStream::TlsStream(const Socket::Ptr& socket, const String& hostname, Connecti
std::ostringstream msgbuf;
char errbuf[120];
m_SSL = boost::shared_ptr<SSL>(SSL_new(sslContext.get()), SSL_free);
m_SSL = std::shared_ptr<SSL>(SSL_new(sslContext.get()), SSL_free);
if (!m_SSL) {
msgbuf << "SSL_new() failed with code " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\"";
@ -119,10 +119,10 @@ String TlsStream::GetVerifyError(void) const
*
* @returns The X509 certificate.
*/
boost::shared_ptr<X509> TlsStream::GetClientCertificate(void) const
std::shared_ptr<X509> TlsStream::GetClientCertificate(void) const
{
boost::mutex::scoped_lock lock(m_Mutex);
return boost::shared_ptr<X509>(SSL_get_certificate(m_SSL.get()), &Utility::NullDeleter);
return std::shared_ptr<X509>(SSL_get_certificate(m_SSL.get()), &Utility::NullDeleter);
}
/**
@ -130,10 +130,10 @@ boost::shared_ptr<X509> TlsStream::GetClientCertificate(void) const
*
* @returns The X509 certificate.
*/
boost::shared_ptr<X509> TlsStream::GetPeerCertificate(void) const
std::shared_ptr<X509> TlsStream::GetPeerCertificate(void) const
{
boost::mutex::scoped_lock lock(m_Mutex);
return boost::shared_ptr<X509>(SSL_get_peer_certificate(m_SSL.get()), X509_free);
return std::shared_ptr<X509>(SSL_get_peer_certificate(m_SSL.get()), X509_free);
}
void TlsStream::OnEvent(int revents)

View File

@ -48,13 +48,13 @@ class I2_BASE_API TlsStream : public Stream, private SocketEvents
public:
DECLARE_PTR_TYPEDEFS(TlsStream);
TlsStream(const Socket::Ptr& socket, const String& hostname, ConnectionRole role, const boost::shared_ptr<SSL_CTX>& sslContext = MakeSSLContext());
TlsStream(const Socket::Ptr& socket, const String& hostname, ConnectionRole role, const std::shared_ptr<SSL_CTX>& sslContext = MakeSSLContext());
~TlsStream(void);
Socket::Ptr GetSocket(void) const;
boost::shared_ptr<X509> GetClientCertificate(void) const;
boost::shared_ptr<X509> GetPeerCertificate(void) const;
std::shared_ptr<X509> GetClientCertificate(void) const;
std::shared_ptr<X509> GetPeerCertificate(void) const;
void Handshake(void);
@ -74,7 +74,7 @@ public:
String GetVerifyError(void) const;
private:
boost::shared_ptr<SSL> m_SSL;
std::shared_ptr<SSL> m_SSL;
bool m_Eof;
mutable boost::mutex m_Mutex;
mutable boost::condition_variable m_CV;

View File

@ -81,13 +81,13 @@ void InitializeOpenSSL(void)
* @param cakey CA certificate chain file.
* @returns An SSL context.
*/
boost::shared_ptr<SSL_CTX> MakeSSLContext(const String& pubkey, const String& privkey, const String& cakey)
std::shared_ptr<SSL_CTX> MakeSSLContext(const String& pubkey, const String& privkey, const String& cakey)
{
char errbuf[120];
InitializeOpenSSL();
boost::shared_ptr<SSL_CTX> sslContext = boost::shared_ptr<SSL_CTX>(SSL_CTX_new(SSLv23_method()), SSL_CTX_free);
std::shared_ptr<SSL_CTX> sslContext = std::shared_ptr<SSL_CTX>(SSL_CTX_new(SSLv23_method()), SSL_CTX_free);
EC_KEY *ecdh = EC_KEY_new_by_curve_name(NID_secp384r1);
@ -174,7 +174,7 @@ boost::shared_ptr<SSL_CTX> MakeSSLContext(const String& pubkey, const String& pr
* @param context The ssl context.
* @param cipherList The ciper list.
**/
void SetCipherListToSSLContext(const boost::shared_ptr<SSL_CTX>& context, const String& cipherList)
void SetCipherListToSSLContext(const std::shared_ptr<SSL_CTX>& context, const String& cipherList)
{
char errbuf[256];
@ -198,7 +198,7 @@ void SetCipherListToSSLContext(const boost::shared_ptr<SSL_CTX>& context, const
* @param context The ssl context.
* @param tlsProtocolmin The minimum TLS protocol version.
*/
void SetTlsProtocolminToSSLContext(const boost::shared_ptr<SSL_CTX>& context, const String& tlsProtocolmin)
void SetTlsProtocolminToSSLContext(const std::shared_ptr<SSL_CTX>& context, const String& tlsProtocolmin)
{
long flags = SSL_CTX_get_options(context.get());
@ -226,7 +226,7 @@ void SetTlsProtocolminToSSLContext(const boost::shared_ptr<SSL_CTX>& context, co
* @param context The SSL context.
* @param crlPath The path to the CRL file.
*/
void AddCRLToSSLContext(const boost::shared_ptr<SSL_CTX>& context, const String& crlPath)
void AddCRLToSSLContext(const std::shared_ptr<SSL_CTX>& context, const String& crlPath)
{
char errbuf[120];
X509_STORE *x509_store = SSL_CTX_get_cert_store(context.get());
@ -281,7 +281,7 @@ static String GetX509NameCN(X509_NAME *name)
* @param certificate The X509 certificate.
* @returns The common name.
*/
String GetCertificateCN(const boost::shared_ptr<X509>& certificate)
String GetCertificateCN(const std::shared_ptr<X509>& certificate)
{
return GetX509NameCN(X509_get_subject_name(certificate.get()));
}
@ -292,7 +292,7 @@ String GetCertificateCN(const boost::shared_ptr<X509>& certificate)
* @param pemfile The filename.
* @returns An X509 certificate.
*/
boost::shared_ptr<X509> GetX509Certificate(const String& pemfile)
std::shared_ptr<X509> GetX509Certificate(const String& pemfile)
{
char errbuf[120];
X509 *cert;
@ -327,7 +327,7 @@ boost::shared_ptr<X509> GetX509Certificate(const String& pemfile)
BIO_free(fpcert);
return boost::shared_ptr<X509>(cert, X509_free);
return std::shared_ptr<X509>(cert, X509_free);
}
int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile, const String& certfile, bool ca)
@ -402,7 +402,7 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile,
X509_NAME *subject = X509_NAME_new();
X509_NAME_add_entry_by_txt(subject, "CN", MBSTRING_ASC, (unsigned char *)cn.CStr(), -1, -1, 0);
boost::shared_ptr<X509> cert = CreateCert(key, subject, subject, key, ca);
std::shared_ptr<X509> cert = CreateCert(key, subject, subject, key, ca);
X509_NAME_free(subject);
@ -491,7 +491,7 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile,
return 1;
}
boost::shared_ptr<X509> CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca)
std::shared_ptr<X509> CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca)
{
X509 *cert = X509_new();
X509_set_version(cert, 2);
@ -568,7 +568,7 @@ boost::shared_ptr<X509> CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NA
X509_sign(cert, cakey, EVP_sha256());
return boost::shared_ptr<X509>(cert, X509_free);
return std::shared_ptr<X509>(cert, X509_free);
}
String GetIcingaCADir(void)
@ -576,7 +576,7 @@ String GetIcingaCADir(void)
return Application::GetLocalStateDir() + "/lib/icinga2/ca";
}
boost::shared_ptr<X509> CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject)
std::shared_ptr<X509> CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject)
{
char errbuf[120];
@ -589,7 +589,7 @@ boost::shared_ptr<X509> CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject)
if (!cakeybio) {
Log(LogCritical, "SSL")
<< "Could not open CA key file '" << cakeyfile << "': " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\"";
return boost::shared_ptr<X509>();
return std::shared_ptr<X509>();
}
EVP_PKEY *privkey = PEM_read_bio_PrivateKey(cakeybio, NULL, NULL, NULL);
@ -597,25 +597,25 @@ boost::shared_ptr<X509> CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject)
if (!privkey) {
Log(LogCritical, "SSL")
<< "Could not read private key from CA key file '" << cakeyfile << "': " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\"";
return boost::shared_ptr<X509>();
return std::shared_ptr<X509>();
}
BIO_free(cakeybio);
String cacertfile = cadir + "/ca.crt";
boost::shared_ptr<X509> cacert = GetX509Certificate(cacertfile);
std::shared_ptr<X509> cacert = GetX509Certificate(cacertfile);
return CreateCert(pubkey, subject, X509_get_subject_name(cacert.get()), privkey, false);
}
boost::shared_ptr<X509> CreateCertIcingaCA(const boost::shared_ptr<X509>& cert)
std::shared_ptr<X509> CreateCertIcingaCA(const std::shared_ptr<X509>& cert)
{
boost::shared_ptr<EVP_PKEY> pkey = boost::shared_ptr<EVP_PKEY>(X509_get_pubkey(cert.get()), EVP_PKEY_free);
std::shared_ptr<EVP_PKEY> pkey = std::shared_ptr<EVP_PKEY>(X509_get_pubkey(cert.get()), EVP_PKEY_free);
return CreateCertIcingaCA(pkey.get(), X509_get_subject_name(cert.get()));
}
String CertificateToString(const boost::shared_ptr<X509>& cert)
String CertificateToString(const std::shared_ptr<X509>& cert)
{
BIO *mem = BIO_new(BIO_s_mem());
PEM_write_bio_X509(mem, cert.get());
@ -630,7 +630,7 @@ String CertificateToString(const boost::shared_ptr<X509>& cert)
return result;
}
boost::shared_ptr<X509> StringToCertificate(const String& cert)
std::shared_ptr<X509> StringToCertificate(const String& cert)
{
BIO *bio = BIO_new(BIO_s_mem());
BIO_write(bio, (const void *)cert.CStr(), cert.GetLength());
@ -642,7 +642,7 @@ boost::shared_ptr<X509> StringToCertificate(const String& cert)
if (!rawCert)
BOOST_THROW_EXCEPTION(std::invalid_argument("The specified X509 certificate is invalid."));
return boost::shared_ptr<X509>(rawCert, X509_free);
return std::shared_ptr<X509>(rawCert, X509_free);
}
String PBKDF2_SHA1(const String& password, const String& salt, int iterations)
@ -762,7 +762,7 @@ String RandomString(int length)
return result;
}
bool VerifyCertificate(const boost::shared_ptr<X509>& caCertificate, const boost::shared_ptr<X509>& certificate)
bool VerifyCertificate(const std::shared_ptr<X509>& caCertificate, const std::shared_ptr<X509>& certificate)
{
X509_STORE *store = X509_STORE_new();

View File

@ -31,31 +31,30 @@
#include <openssl/x509v3.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/exception/info.hpp>
namespace icinga
{
void I2_BASE_API InitializeOpenSSL(void);
boost::shared_ptr<SSL_CTX> I2_BASE_API MakeSSLContext(const String& pubkey = String(), const String& privkey = String(), const String& cakey = String());
void I2_BASE_API AddCRLToSSLContext(const boost::shared_ptr<SSL_CTX>& context, const String& crlPath);
void I2_BASE_API SetCipherListToSSLContext(const boost::shared_ptr<SSL_CTX>& context, const String& cipherList);
void I2_BASE_API SetTlsProtocolminToSSLContext(const boost::shared_ptr<SSL_CTX>& context, const String& tlsProtocolmin);
String I2_BASE_API GetCertificateCN(const boost::shared_ptr<X509>& certificate);
boost::shared_ptr<X509> I2_BASE_API GetX509Certificate(const String& pemfile);
std::shared_ptr<SSL_CTX> I2_BASE_API MakeSSLContext(const String& pubkey = String(), const String& privkey = String(), const String& cakey = String());
void I2_BASE_API AddCRLToSSLContext(const std::shared_ptr<SSL_CTX>& context, const String& crlPath);
void I2_BASE_API SetCipherListToSSLContext(const std::shared_ptr<SSL_CTX>& context, const String& cipherList);
void I2_BASE_API SetTlsProtocolminToSSLContext(const std::shared_ptr<SSL_CTX>& context, const String& tlsProtocolmin);
String I2_BASE_API GetCertificateCN(const std::shared_ptr<X509>& certificate);
std::shared_ptr<X509> I2_BASE_API GetX509Certificate(const String& pemfile);
int I2_BASE_API MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile = String(), const String& certfile = String(), bool ca = false);
boost::shared_ptr<X509> I2_BASE_API CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca);
std::shared_ptr<X509> I2_BASE_API CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca);
String I2_BASE_API GetIcingaCADir(void);
String I2_BASE_API CertificateToString(const boost::shared_ptr<X509>& cert);
boost::shared_ptr<X509> I2_BASE_API StringToCertificate(const String& cert);
boost::shared_ptr<X509> I2_BASE_API CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject);
boost::shared_ptr<X509> I2_BASE_API CreateCertIcingaCA(const boost::shared_ptr<X509>& cert);
String I2_BASE_API CertificateToString(const std::shared_ptr<X509>& cert);
std::shared_ptr<X509> I2_BASE_API StringToCertificate(const String& cert);
std::shared_ptr<X509> I2_BASE_API CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject);
std::shared_ptr<X509> I2_BASE_API CreateCertIcingaCA(const std::shared_ptr<X509>& cert);
String I2_BASE_API PBKDF2_SHA1(const String& password, const String& salt, int iterations);
String I2_BASE_API SHA1(const String& s, bool binary = false);
String I2_BASE_API SHA256(const String& s);
String I2_BASE_API RandomString(int length);
bool I2_BASE_API VerifyCertificate(const boost::shared_ptr<X509>& caCertificate, const boost::shared_ptr<X509>& certificate);
bool I2_BASE_API VerifyCertificate(const std::shared_ptr<X509>& caCertificate, const std::shared_ptr<X509>& certificate);
class I2_BASE_API openssl_error : virtual public std::exception, virtual public boost::exception { };

View File

@ -49,12 +49,12 @@ Type::Ptr Type::GetByName(const String& name)
Dictionary::Ptr typesNS = ScriptGlobal::Get("Types", &Empty);
if (!typesNS)
return Type::Ptr();
return nullptr;
Value ptype = typesNS->Get(name);
if (!ptype.IsObjectType<Type>())
return Type::Ptr();
return nullptr;
return ptype;
}

View File

@ -28,9 +28,7 @@ using namespace icinga;
static void InvokeAttributeHandlerHelper(const Function::Ptr& callback,
const Object::Ptr& object, const Value& cookie)
{
std::vector<Value> arguments;
arguments.push_back(object);
callback->Invoke(arguments);
callback->Invoke({ object });
}
static void TypeRegisterAttributeHandler(const String& fieldName, const Function::Ptr& callback)

View File

@ -28,6 +28,7 @@
#include "base/objectlock.hpp"
#include <mmatch.h>
#include <boost/lexical_cast.hpp>
#include <boost/thread/tss.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/trim.hpp>
@ -769,7 +770,7 @@ void Utility::MkDirP(const String& path, int mode)
void Utility::RemoveDirRecursive(const String& path)
{
std::vector<String> paths;
Utility::GlobRecursive(path, "*", std::bind(&Utility::CollectPaths, _1, boost::ref(paths)), GlobFile | GlobDirectory);
Utility::GlobRecursive(path, "*", std::bind(&Utility::CollectPaths, _1, std::ref(paths)), GlobFile | GlobDirectory);
/* This relies on the fact that GlobRecursive lists the parent directory
first before recursing into subdirectories. */
@ -975,31 +976,31 @@ String Utility::FormatDuration(double duration)
if (duration >= 86400) {
int days = duration / 86400;
tokens.push_back(Convert::ToString(days) + (days != 1 ? " days" : " day"));
tokens.emplace_back(Convert::ToString(days) + (days != 1 ? " days" : " day"));
duration = static_cast<int>(duration) % 86400;
}
if (duration >= 3600) {
int hours = duration / 3600;
tokens.push_back(Convert::ToString(hours) + (hours != 1 ? " hours" : " hour"));
tokens.emplace_back(Convert::ToString(hours) + (hours != 1 ? " hours" : " hour"));
duration = static_cast<int>(duration) % 3600;
}
if (duration >= 60) {
int minutes = duration / 60;
tokens.push_back(Convert::ToString(minutes) + (minutes != 1 ? " minutes" : " minute"));
tokens.emplace_back(Convert::ToString(minutes) + (minutes != 1 ? " minutes" : " minute"));
duration = static_cast<int>(duration) % 60;
}
if (duration >= 1) {
int seconds = duration;
tokens.push_back(Convert::ToString(seconds) + (seconds != 1 ? " seconds" : " second"));
tokens.emplace_back(Convert::ToString(seconds) + (seconds != 1 ? " seconds" : " second"));
}
if (tokens.size() == 0) {
int milliseconds = std::floor(duration * 1000);
if (milliseconds >= 1)
tokens.push_back(Convert::ToString(milliseconds) + (milliseconds != 1 ? " milliseconds" : " millisecond"));
tokens.emplace_back(Convert::ToString(milliseconds) + (milliseconds != 1 ? " milliseconds" : " millisecond"));
else
tokens.push_back("less than 1 millisecond");
}
@ -1221,7 +1222,7 @@ String Utility::GetThreadName(void)
if (!name) {
std::ostringstream idbuf;
idbuf << boost::this_thread::get_id();
idbuf << std::this_thread::get_id();
return idbuf.str();
}

View File

@ -100,7 +100,7 @@ Type::Ptr Value::GetReflectionType(void) const
case ValueObject:
return boost::get<Object::Ptr>(m_Value)->GetReflectionType();
default:
return Type::Ptr();
return nullptr;
}
}

View File

@ -55,6 +55,9 @@ public:
inline Value(void)
{ }
inline Value(std::nullptr_t)
{ }
inline Value(int value)
: m_Value(double(value))
{ }

View File

@ -79,7 +79,7 @@ void CheckerComponent::Start(bool runtimeCreated)
<< "'" << GetName() << "' started.";
m_Thread = boost::thread(std::bind(&CheckerComponent::CheckThreadProc, this));
m_Thread = std::thread(std::bind(&CheckerComponent::CheckThreadProc, this));
m_ResultTimer = new Timer();
m_ResultTimer->SetInterval(5);

View File

@ -25,12 +25,12 @@
#include "base/configobject.hpp"
#include "base/timer.hpp"
#include "base/utility.hpp"
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/key_extractors.hpp>
#include <thread>
namespace icinga
{
@ -91,7 +91,7 @@ private:
boost::mutex m_Mutex;
boost::condition_variable m_CV;
bool m_Stopped;
boost::thread m_Thread;
std::thread m_Thread;
CheckableSet m_IdleCheckables;
CheckableSet m_PendingCheckables;

View File

@ -132,16 +132,7 @@ bool ApiSetupUtility::SetupMasterCertificates(const String& cn)
Utility::CopyFile(ca, target_ca);
/* fix permissions: root -> icinga daemon user */
std::vector<String> files;
files.push_back(ca_path);
files.push_back(ca);
files.push_back(ca_key);
files.push_back(target_ca);
files.push_back(key);
files.push_back(csr);
files.push_back(cert);
for (const String& file : files) {
for (const String& file : { ca_path, ca, ca_key, target_ca, key, csr, cert }) {
if (!Utility::SetFileOwnership(file, user, group)) {
Log(LogWarning, "cli")
<< "Cannot set ownership for user '" << user << "' group '" << group << "' on file '" << file << "'.";
@ -201,9 +192,7 @@ bool ApiSetupUtility::SetupMasterEnableApi(void)
{
Log(LogInformation, "cli", "Enabling the 'api' feature.");
std::vector<std::string> features;
features.push_back("api");
FeatureUtility::EnableFeatures(features);
FeatureUtility::EnableFeatures({ "api" });
return true;
}

View File

@ -69,14 +69,14 @@ int CASignCommand::Run(const boost::program_options::variables_map& vm, const st
String certRequestText = request->Get("cert_request");
boost::shared_ptr<X509> certRequest = StringToCertificate(certRequestText);
std::shared_ptr<X509> certRequest = StringToCertificate(certRequestText);
if (!certRequest) {
Log(LogCritical, "cli", "Certificate request is invalid. Could not parse X.509 certificate for the 'cert_request' attribute.");
return 1;
}
boost::shared_ptr<X509> certResponse = CreateCertIcingaCA(certRequest);
std::shared_ptr<X509> certResponse = CreateCertIcingaCA(certRequest);
BIO *out = BIO_new(BIO_s_mem());
X509_NAME_print_ex(out, X509_get_subject_name(certRequest.get()), 0, XN_FLAG_ONELINE & ~ASN1_STRFLGS_ESC_MSB);

View File

@ -130,7 +130,7 @@ CLICommand::Ptr CLICommand::GetByName(const std::vector<String>& name)
auto it = GetRegistry().find(name);
if (it == GetRegistry().end())
return CLICommand::Ptr();
return nullptr;
return it->second;
}

View File

@ -196,9 +196,9 @@ char *ConsoleCommand::ConsoleCompleteHelper(const char *word, int state)
l_ApiClient->AutocompleteScript(l_Session, word, l_ScriptFrame->Sandboxed,
std::bind(&ConsoleCommand::AutocompleteScriptCompletionHandler,
boost::ref(mutex), boost::ref(cv), boost::ref(ready),
std::ref(mutex), std::ref(cv), std::ref(ready),
_1, _2,
boost::ref(suggestions)));
std::ref(suggestions)));
{
boost::mutex::scoped_lock lock(mutex);
@ -426,9 +426,9 @@ incomplete:
l_ApiClient->ExecuteScript(l_Session, command, scriptFrame.Sandboxed,
std::bind(&ConsoleCommand::ExecuteScriptCompletionHandler,
boost::ref(mutex), boost::ref(cv), boost::ref(ready),
std::ref(mutex), std::ref(cv), std::ref(ready),
_1, _2,
boost::ref(result), boost::ref(eptr)));
std::ref(result), std::ref(eptr)));
{
boost::mutex::scoped_lock lock(mutex);

View File

@ -234,7 +234,7 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector<std::strin
std::vector<std::string> configs;
if (vm.count("config") > 0)
configs = vm["config"].as < std::vector<std::string> >() ;
configs = vm["config"].as<std::vector<std::string> >();
else if (!vm.count("no-config"))
configs.push_back(Application::GetSysconfDir() + "/icinga2/icinga2.conf");

View File

@ -52,7 +52,7 @@ static void IncludeZoneDirRecursive(const String& path, const String& package, b
ConfigCompiler::RegisterZoneDir("_etc", path, zoneName);
std::vector<Expression *> expressions;
Utility::GlobRecursive(path, "*.conf", std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile);
Utility::GlobRecursive(path, "*.conf", std::bind(&ConfigCompiler::CollectIncludes, std::ref(expressions), _1, zoneName, package), GlobFile);
DictExpression expr(expressions);
if (!ExecuteExpression(&expr))
success = false;
@ -75,7 +75,7 @@ static void IncludeNonLocalZone(const String& zonePath, const String& package, b
}
std::vector<Expression *> expressions;
Utility::GlobRecursive(zonePath, "*.conf", std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile);
Utility::GlobRecursive(zonePath, "*.conf", std::bind(&ConfigCompiler::CollectIncludes, std::ref(expressions), _1, zoneName, package), GlobFile);
DictExpression expr(expressions);
if (!ExecuteExpression(&expr))
success = false;
@ -126,7 +126,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
String zonesEtcDir = Application::GetZonesDir();
if (!zonesEtcDir.IsEmpty() && Utility::PathExists(zonesEtcDir))
Utility::Glob(zonesEtcDir + "/*", std::bind(&IncludeZoneDirRecursive, _1, "_etc", boost::ref(success)), GlobDirectory);
Utility::Glob(zonesEtcDir + "/*", std::bind(&IncludeZoneDirRecursive, _1, "_etc", std::ref(success)), GlobDirectory);
if (!success)
return false;
@ -135,7 +135,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
* are authoritative on this node and are checked in HasZoneConfigAuthority(). */
String packagesVarDir = Application::GetLocalStateDir() + "/lib/icinga2/api/packages";
if (Utility::PathExists(packagesVarDir))
Utility::Glob(packagesVarDir + "/*", std::bind(&IncludePackage, _1, boost::ref(success)), GlobDirectory);
Utility::Glob(packagesVarDir + "/*", std::bind(&IncludePackage, _1, std::ref(success)), GlobDirectory);
if (!success)
return false;
@ -143,7 +143,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
/* Load cluster synchronized configuration files */
String zonesVarDir = Application::GetLocalStateDir() + "/lib/icinga2/api/zones";
if (Utility::PathExists(zonesVarDir))
Utility::Glob(zonesVarDir + "/*", std::bind(&IncludeNonLocalZone, _1, "_cluster", boost::ref(success)), GlobDirectory);
Utility::Glob(zonesVarDir + "/*", std::bind(&IncludeNonLocalZone, _1, "_cluster", std::ref(success)), GlobDirectory);
if (!success)
return false;

View File

@ -200,11 +200,11 @@ bool FeatureUtility::GetFeatures(std::vector<String>& features, bool get_disable
/* disable = available-enabled */
String available_pattern = GetFeaturesAvailablePath() + "/*.conf";
std::vector<String> available;
Utility::Glob(available_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(available)), GlobFile);
Utility::Glob(available_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, std::ref(available)), GlobFile);
String enabled_pattern = GetFeaturesEnabledPath() + "/*.conf";
std::vector<String> enabled;
Utility::Glob(enabled_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(enabled)), GlobFile);
Utility::Glob(enabled_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, std::ref(enabled)), GlobFile);
std::sort(available.begin(), available.end());
std::sort(enabled.begin(), enabled.end());
@ -217,7 +217,7 @@ bool FeatureUtility::GetFeatures(std::vector<String>& features, bool get_disable
/* all enabled features */
String enabled_pattern = GetFeaturesEnabledPath() + "/*.conf";
Utility::Glob(enabled_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(features)), GlobFile);
Utility::Glob(enabled_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, std::ref(features)), GlobFile);
}
return true;

View File

@ -159,12 +159,7 @@ int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& v
/* write zones.conf and update with zone + endpoint information */
Log(LogInformation, "cli", "Generating zone and object configuration.");
std::vector<String> globalZones;
globalZones.push_back("global-templates");
globalZones.push_back("director-global");
NodeUtility::GenerateNodeMasterIcingaConfig(globalZones);
NodeUtility::GenerateNodeMasterIcingaConfig({ "global-templates", "director-global" });
/* update the ApiListener config - SetupMaster() will always enable it */
Log(LogInformation, "cli", "Updating the APIListener feature.");
@ -291,7 +286,7 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
return 1;
}
boost::shared_ptr<X509> trustedcert = GetX509Certificate(vm["trustedcert"].as<std::string>());
std::shared_ptr<X509> trustedcert = GetX509Certificate(vm["trustedcert"].as<std::string>());
Log(LogInformation, "cli")
<< "Verifying trusted certificate file '" << vm["trustedcert"].as<std::string>() << "'.";
@ -362,17 +357,13 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
/* disable the notifications feature */
Log(LogInformation, "cli", "Disabling the Notification feature.");
std::vector<std::string> disable;
disable.push_back("notification");
FeatureUtility::DisableFeatures(disable);
FeatureUtility::DisableFeatures({ "notification" });
/* enable the ApiListener config */
Log(LogInformation, "cli", "Updating the ApiListener feature.");
std::vector<std::string> enable;
enable.push_back("api");
FeatureUtility::EnableFeatures(enable);
FeatureUtility::EnableFeatures({ "api" });
String apipath = FeatureUtility::GetFeaturesAvailablePath() + "/api.conf";
NodeUtility::CreateBackupFile(apipath);
@ -427,12 +418,7 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
Log(LogInformation, "cli", "Generating zone and object configuration.");
std::vector<String> globalZones;
globalZones.push_back("global-templates");
globalZones.push_back("director-global");
NodeUtility::GenerateNodeIcingaConfig(vm["endpoint"].as<std::vector<std::string> >(), globalZones);
NodeUtility::GenerateNodeIcingaConfig(vm["endpoint"].as<std::vector<std::string> >(), { "global-templates", "director-global" });
/* update constants.conf with NodeName = CN */
if (cn != Utility::GetFQDN()) {

View File

@ -303,7 +303,7 @@ wizard_endpoint_loop_start:
<< "' on file '" << nodeKey << "'. Verify it yourself!";
}
boost::shared_ptr<X509> trustedParentCert;
std::shared_ptr<X509> trustedParentCert;
/* Check whether we should connect to the parent node and present its trusted certificate. */
if (connectToParent) {
@ -457,15 +457,11 @@ wizard_ticket:
/* disable the notifications feature on client nodes */
Log(LogInformation, "cli", "Disabling the Notification feature.");
std::vector<std::string> disable;
disable.push_back("notification");
FeatureUtility::DisableFeatures(disable);
FeatureUtility::DisableFeatures({ "notification" });
Log(LogInformation, "cli", "Enabling the ApiListener feature.");
std::vector<std::string> enable;
enable.push_back("api");
FeatureUtility::EnableFeatures(enable);
FeatureUtility::EnableFeatures({ "api" });
String apiConfPath = FeatureUtility::GetFeaturesAvailablePath() + "/api.conf";
NodeUtility::CreateBackupFile(apiConfPath);
@ -503,12 +499,7 @@ wizard_ticket:
/* apilistener config */
Log(LogInformation, "cli", "Generating local zones.conf.");
std::vector<String> globalZones;
globalZones.push_back("global-templates");
globalZones.push_back("director-global");
NodeUtility::GenerateNodeIcingaConfig(endpoints, globalZones);
NodeUtility::GenerateNodeIcingaConfig(endpoints, { "global-templates", "director-global" });
if (cn != Utility::GetFQDN()) {
Log(LogWarning, "cli")
@ -604,12 +595,7 @@ int NodeWizardCommand::MasterSetup(void) const
else
std::cout << "'api' feature already enabled.\n";
std::vector<String> globalZones;
globalZones.push_back("global-templates");
globalZones.push_back("director-global");
NodeUtility::GenerateNodeMasterIcingaConfig(globalZones);
NodeUtility::GenerateNodeMasterIcingaConfig({ "global-templates", "director-global" });
/* apilistener config */
std::cout << ConsoleColorTag(Console_Bold)

View File

@ -85,7 +85,7 @@ int PKISaveCertCommand::Run(const boost::program_options::variables_map& vm, con
Log(LogInformation, "cli")
<< "Retrieving X.509 certificate for '" << host << ":" << port << "'.";
boost::shared_ptr<X509> cert = PkiUtility::FetchCert(host, port);
std::shared_ptr<X509> cert = PkiUtility::FetchCert(host, port);
if (!cert) {
Log(LogCritical, "cli", "Failed to fetch certificate from host.");

View File

@ -375,8 +375,8 @@ bool TroubleshootCommand::PrintCrashReports(InfoLog& log)
String bestFilename;
try {
Utility::Glob(spath, std::bind(&GetLatestReport, _1, boost::ref(bestTimestamp),
boost::ref(bestFilename)), GlobFile);
Utility::Glob(spath, std::bind(&GetLatestReport, _1, std::ref(bestTimestamp),
std::ref(bestFilename)), GlobFile);
}
#ifdef _WIN32
catch (win32_error &ex) {
@ -444,10 +444,7 @@ bool TroubleshootCommand::PrintFile(InfoLog& log, const String& path)
bool TroubleshootCommand::CheckConfig(void)
{
std::vector<std::string> configs;
configs.push_back(Application::GetSysconfDir() + "/icinga2/icinga2.conf");
return DaemonUtility::ValidateConfigFiles(configs, Application::GetObjectsPath());
return DaemonUtility::ValidateConfigFiles({ Application::GetSysconfDir() + "/icinga2/icinga2.conf" }, Application::GetObjectsPath());
}
//print is supposed allow the user to print the object file

View File

@ -54,7 +54,7 @@ void ExternalCommandListener::Start(bool runtimeCreated)
<< "'" << GetName() << "' started.";
#ifndef _WIN32
m_CommandThread = boost::thread(std::bind(&ExternalCommandListener::CommandPipeThread, this, GetCommandPath()));
m_CommandThread = std::thread(std::bind(&ExternalCommandListener::CommandPipeThread, this, GetCommandPath()));
m_CommandThread.detach();
#endif /* _WIN32 */
}

View File

@ -24,7 +24,7 @@
#include "base/objectlock.hpp"
#include "base/timer.hpp"
#include "base/utility.hpp"
#include <boost/thread/thread.hpp>
#include <thread>
#include <iostream>
namespace icinga
@ -47,7 +47,7 @@ protected:
private:
#ifndef _WIN32
boost::thread m_CommandThread;
std::thread m_CommandThread;
void CommandPipeThread(const String& commandPath);
#endif /* _WIN32 */

View File

@ -634,8 +634,8 @@ void StatusDataWriter::UpdateObjectsCache(void)
for (const Service::Ptr& service : sg->GetMembers()) {
Host::Ptr host = service->GetHost();
sglist.push_back(host->GetName());
sglist.push_back(service->GetShortName());
sglist.emplace_back(host->GetName());
sglist.emplace_back(service->GetShortName());
}
DumpStringList(tempobjectfp, sglist);
@ -734,15 +734,15 @@ void StatusDataWriter::UpdateObjectsCache(void)
int state_filter = dep->GetStateFilter();
std::vector<String> failure_criteria;
if (state_filter & StateFilterOK || state_filter & StateFilterUp)
failure_criteria.push_back("o");
failure_criteria.emplace_back("o");
if (state_filter & StateFilterWarning)
failure_criteria.push_back("w");
failure_criteria.emplace_back("w");
if (state_filter & StateFilterCritical)
failure_criteria.push_back("c");
failure_criteria.emplace_back("c");
if (state_filter & StateFilterUnknown)
failure_criteria.push_back("u");
failure_criteria.emplace_back("u");
if (state_filter & StateFilterDown)
failure_criteria.push_back("d");
failure_criteria.emplace_back("d");
String criteria = boost::algorithm::join(failure_criteria, ",");

View File

@ -28,7 +28,6 @@
#include "icinga/compatutility.hpp"
#include "base/timer.hpp"
#include "base/utility.hpp"
#include <boost/thread/thread.hpp>
#include <iostream>
namespace icinga

View File

@ -49,7 +49,7 @@ private:
class I2_CONFIG_API ActivationScope
{
public:
ActivationScope(const ActivationContext::Ptr& context = ActivationContext::Ptr());
ActivationScope(const ActivationContext::Ptr& context = nullptr);
~ActivationScope(void);
ActivationContext::Ptr GetContext(void) const;

View File

@ -26,8 +26,8 @@ using namespace icinga;
ApplyRule::RuleMap ApplyRule::m_Rules;
ApplyRule::TypeMap ApplyRule::m_Types;
ApplyRule::ApplyRule(const String& targetType, const String& name, const boost::shared_ptr<Expression>& expression,
const boost::shared_ptr<Expression>& filter, const String& package, const String& fkvar, const String& fvvar, const boost::shared_ptr<Expression>& fterm,
ApplyRule::ApplyRule(const String& targetType, const String& name, const std::shared_ptr<Expression>& expression,
const std::shared_ptr<Expression>& filter, const String& package, const String& fkvar, const String& fvvar, const std::shared_ptr<Expression>& fterm,
bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope)
: m_TargetType(targetType), m_Name(name), m_Expression(expression), m_Filter(filter), m_Package(package), m_FKVar(fkvar),
m_FVVar(fvvar), m_FTerm(fterm), m_IgnoreOnError(ignoreOnError), m_DebugInfo(di), m_Scope(scope), m_HasMatches(false)
@ -43,12 +43,12 @@ String ApplyRule::GetName(void) const
return m_Name;
}
boost::shared_ptr<Expression> ApplyRule::GetExpression(void) const
std::shared_ptr<Expression> ApplyRule::GetExpression(void) const
{
return m_Expression;
}
boost::shared_ptr<Expression> ApplyRule::GetFilter(void) const
std::shared_ptr<Expression> ApplyRule::GetFilter(void) const
{
return m_Filter;
}
@ -68,7 +68,7 @@ String ApplyRule::GetFVVar(void) const
return m_FVVar;
}
boost::shared_ptr<Expression> ApplyRule::GetFTerm(void) const
std::shared_ptr<Expression> ApplyRule::GetFTerm(void) const
{
return m_FTerm;
}
@ -89,8 +89,8 @@ Dictionary::Ptr ApplyRule::GetScope(void) const
}
void ApplyRule::AddRule(const String& sourceType, const String& targetType, const String& name,
const boost::shared_ptr<Expression>& expression, const boost::shared_ptr<Expression>& filter, const String& package, const String& fkvar,
const String& fvvar, const boost::shared_ptr<Expression>& fterm, bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope)
const std::shared_ptr<Expression>& expression, const std::shared_ptr<Expression>& filter, const String& package, const String& fkvar,
const String& fvvar, const std::shared_ptr<Expression>& fterm, bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope)
{
m_Rules[sourceType].push_back(ApplyRule(targetType, name, expression, filter, package, fkvar, fvvar, fterm, ignoreOnError, di, scope));
}

View File

@ -38,12 +38,12 @@ public:
String GetTargetType(void) const;
String GetName(void) const;
boost::shared_ptr<Expression> GetExpression(void) const;
boost::shared_ptr<Expression> GetFilter(void) const;
std::shared_ptr<Expression> GetExpression(void) const;
std::shared_ptr<Expression> GetFilter(void) const;
String GetPackage(void) const;
String GetFKVar(void) const;
String GetFVVar(void) const;
boost::shared_ptr<Expression> GetFTerm(void) const;
std::shared_ptr<Expression> GetFTerm(void) const;
bool GetIgnoreOnError(void) const;
DebugInfo GetDebugInfo(void) const;
Dictionary::Ptr GetScope(void) const;
@ -52,8 +52,8 @@ public:
bool EvaluateFilter(ScriptFrame& frame) const;
static void AddRule(const String& sourceType, const String& targetType, const String& name, const boost::shared_ptr<Expression>& expression,
const boost::shared_ptr<Expression>& filter, const String& package, const String& fkvar, const String& fvvar, const boost::shared_ptr<Expression>& fterm,
static void AddRule(const String& sourceType, const String& targetType, const String& name, const std::shared_ptr<Expression>& expression,
const std::shared_ptr<Expression>& filter, const String& package, const String& fkvar, const String& fvvar, const std::shared_ptr<Expression>& fterm,
bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope);
static std::vector<ApplyRule>& GetRules(const String& type);
@ -67,12 +67,12 @@ public:
private:
String m_TargetType;
String m_Name;
boost::shared_ptr<Expression> m_Expression;
boost::shared_ptr<Expression> m_Filter;
std::shared_ptr<Expression> m_Expression;
std::shared_ptr<Expression> m_Filter;
String m_Package;
String m_FKVar;
String m_FVVar;
boost::shared_ptr<Expression> m_FTerm;
std::shared_ptr<Expression> m_FTerm;
bool m_IgnoreOnError;
DebugInfo m_DebugInfo;
Dictionary::Ptr m_Scope;
@ -81,8 +81,8 @@ private:
static TypeMap m_Types;
static RuleMap m_Rules;
ApplyRule(const String& targetType, const String& name, const boost::shared_ptr<Expression>& expression,
const boost::shared_ptr<Expression>& filter, const String& package, const String& fkvar, const String& fvvar, const boost::shared_ptr<Expression>& fterm,
ApplyRule(const String& targetType, const String& name, const std::shared_ptr<Expression>& expression,
const std::shared_ptr<Expression>& filter, const String& package, const String& fkvar, const String& fvvar, const std::shared_ptr<Expression>& fterm,
bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope);
};

View File

@ -328,13 +328,13 @@ lterm_items_inner: lterm %dprec 2
{
$$ = new std::vector<std::pair<Expression *, EItemInfo> >();
EItemInfo info = { true, @1 };
$$->push_back(std::make_pair($1, info));
$$->emplace_back($1, info);
}
| rterm_no_side_effect
{
$$ = new std::vector<std::pair<Expression *, EItemInfo> >();
EItemInfo info = { false, @1 };
$$->push_back(std::make_pair($1, info));
$$->emplace_back($1, info);
}
| lterm_items_inner sep lterm %dprec 1
{
@ -345,7 +345,7 @@ lterm_items_inner: lterm %dprec 2
if ($3) {
EItemInfo info = { true, @3 };
$$->push_back(std::make_pair($3, info));
$$->emplace_back($3, info);
}
}
| lterm_items_inner sep rterm_no_side_effect %dprec 1
@ -357,7 +357,7 @@ lterm_items_inner: lterm %dprec 2
if ($3) {
EItemInfo info = { false, @3 };
$$->push_back(std::make_pair($3, info));
$$->emplace_back($3, info);
}
}
;

View File

@ -155,7 +155,7 @@ Expression *ConfigCompiler::HandleInclude(const String& relativeBase, const Stri
std::vector<Expression *> expressions;
if (!Utility::Glob(includePath, std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zone, package), GlobFile) && includePath.FindFirstOf("*?") == String::NPos) {
if (!Utility::Glob(includePath, std::bind(&ConfigCompiler::CollectIncludes, std::ref(expressions), _1, zone, package), GlobFile) && includePath.FindFirstOf("*?") == String::NPos) {
std::ostringstream msgbuf;
msgbuf << "Include file '" + path + "' does not exist";
BOOST_THROW_EXCEPTION(ScriptError(msgbuf.str(), debuginfo));
@ -185,7 +185,7 @@ Expression *ConfigCompiler::HandleIncludeRecursive(const String& relativeBase, c
ppath = relativeBase + "/" + path;
std::vector<Expression *> expressions;
Utility::GlobRecursive(ppath, pattern, std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zone, package), GlobFile);
Utility::GlobRecursive(ppath, pattern, std::bind(&ConfigCompiler::CollectIncludes, std::ref(expressions), _1, zone, package), GlobFile);
DictExpression *dict = new DictExpression(expressions);
dict->MakeInline();
@ -205,7 +205,7 @@ void ConfigCompiler::HandleIncludeZone(const String& relativeBase, const String&
RegisterZoneDir(tag, ppath, zoneName);
Utility::GlobRecursive(ppath, pattern, std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile);
Utility::GlobRecursive(ppath, pattern, std::bind(&ConfigCompiler::CollectIncludes, std::ref(expressions), _1, zoneName, package), GlobFile);
}
/**
@ -231,7 +231,7 @@ Expression *ConfigCompiler::HandleIncludeZones(const String& relativeBase, const
}
std::vector<Expression *> expressions;
Utility::Glob(ppath + "/*", std::bind(&ConfigCompiler::HandleIncludeZone, newRelativeBase, tag, _1, pattern, package, boost::ref(expressions)), GlobDirectory);
Utility::Glob(ppath + "/*", std::bind(&ConfigCompiler::HandleIncludeZone, newRelativeBase, tag, _1, pattern, package, std::ref(expressions)), GlobDirectory);
return new DictExpression(expressions);
}

View File

@ -26,6 +26,7 @@
#include "base/registry.hpp"
#include "base/initialize.hpp"
#include "base/singleton.hpp"
#include <future>
#include <iostream>
#include <stack>
@ -127,7 +128,7 @@ public:
static bool HasZoneConfigAuthority(const String& zoneName);
private:
boost::promise<boost::shared_ptr<Expression> > m_Promise;
std::promise<std::shared_ptr<Expression> > m_Promise;
String m_Path;
std::istream *m_Input;

View File

@ -60,8 +60,8 @@ REGISTER_SCRIPTFUNCTION_NS(Internal, run_with_activation_context, &ConfigItem::R
* @param debuginfo Debug information.
*/
ConfigItem::ConfigItem(const Type::Ptr& type, const String& name,
bool abstract, const boost::shared_ptr<Expression>& exprl,
const boost::shared_ptr<Expression>& filter, bool defaultTmpl, bool ignoreOnError,
bool abstract, const std::shared_ptr<Expression>& exprl,
const std::shared_ptr<Expression>& filter, bool defaultTmpl, bool ignoreOnError,
const DebugInfo& debuginfo, const Dictionary::Ptr& scope,
const String& zone, const String& package)
: m_Type(type), m_Name(name), m_Abstract(abstract),
@ -137,7 +137,7 @@ ConfigObject::Ptr ConfigItem::GetObject(void) const
*
* @returns The expression list.
*/
boost::shared_ptr<Expression> ConfigItem::GetExpression(void) const
std::shared_ptr<Expression> ConfigItem::GetExpression(void) const
{
return m_Expression;
}
@ -147,7 +147,7 @@ boost::shared_ptr<Expression> ConfigItem::GetExpression(void) const
*
* @returns The filter expression.
*/
boost::shared_ptr<Expression> ConfigItem::GetFilter(void) const
std::shared_ptr<Expression> ConfigItem::GetFilter(void) const
{
return m_Filter;
}
@ -185,7 +185,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
BOOST_THROW_EXCEPTION(ScriptError("Type '" + GetType() + "' does not exist.", m_DebugInfo));
if (IsAbstract())
return ConfigObject::Ptr();
return nullptr;
ConfigObject::Ptr dobj = static_pointer_cast<ConfigObject>(type->Instantiate(std::vector<Value>()));
@ -211,7 +211,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
m_IgnoredItems.push_back(m_DebugInfo.Path);
}
return ConfigObject::Ptr();
return nullptr;
}
throw;
@ -263,7 +263,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
m_IgnoredItems.push_back(m_DebugInfo.Path);
}
return ConfigObject::Ptr();
return nullptr;
}
ex.SetDebugHint(dhint);
@ -282,7 +282,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
m_IgnoredItems.push_back(m_DebugInfo.Path);
}
return ConfigObject::Ptr();
return nullptr;
}
throw;
@ -378,12 +378,12 @@ ConfigItem::Ptr ConfigItem::GetByTypeAndName(const Type::Ptr& type, const String
auto it = m_Items.find(type);
if (it == m_Items.end())
return ConfigItem::Ptr();
return nullptr;
auto it2 = it->second.find(name);
if (it2 == it->second.end())
return ConfigItem::Ptr();
return nullptr;
return it2->second;
}
@ -404,7 +404,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
if (kv2.second->m_ActivationContext != context)
continue;
items.push_back(std::make_pair(kv2.second, false));
items.emplace_back(kv2.second, false);
}
}
@ -419,7 +419,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
if (item->m_Abstract || item->m_Object)
continue;
items.push_back(std::make_pair(item, true));
items.emplace_back(item, true);
}
m_UnnamedItems.swap(newUnnamedItems);

View File

@ -41,8 +41,8 @@ public:
DECLARE_PTR_TYPEDEFS(ConfigItem);
ConfigItem(const Type::Ptr& type, const String& name, bool abstract,
const boost::shared_ptr<Expression>& exprl,
const boost::shared_ptr<Expression>& filter,
const std::shared_ptr<Expression>& exprl,
const std::shared_ptr<Expression>& filter,
bool defaultTmpl, bool ignoreOnError, const DebugInfo& debuginfo,
const Dictionary::Ptr& scope, const String& zone,
const String& package);
@ -55,8 +55,8 @@ public:
std::vector<ConfigItem::Ptr> GetParents(void) const;
boost::shared_ptr<Expression> GetExpression(void) const;
boost::shared_ptr<Expression> GetFilter(void) const;
std::shared_ptr<Expression> GetExpression(void) const;
std::shared_ptr<Expression> GetFilter(void) const;
void Register(void);
void Unregister(void);
@ -84,8 +84,8 @@ private:
String m_Name; /**< The name. */
bool m_Abstract; /**< Whether this is a template. */
boost::shared_ptr<Expression> m_Expression;
boost::shared_ptr<Expression> m_Filter;
std::shared_ptr<Expression> m_Expression;
std::shared_ptr<Expression> m_Filter;
bool m_DefaultTmpl;
bool m_IgnoreOnError;
DebugInfo m_DebugInfo; /**< Debug information. */

View File

@ -20,7 +20,6 @@
#include "config/configitembuilder.hpp"
#include "base/configtype.hpp"
#include <sstream>
#include <boost/smart_ptr/make_shared.hpp>
using namespace icinga;
@ -74,7 +73,7 @@ void ConfigItemBuilder::AddExpression(Expression *expr)
m_Expressions.push_back(expr);
}
void ConfigItemBuilder::SetFilter(const boost::shared_ptr<Expression>& filter)
void ConfigItemBuilder::SetFilter(const std::shared_ptr<Expression>& filter)
{
m_Filter = filter;
}
@ -138,7 +137,7 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void)
}
#endif /* I2_DEBUG */
boost::shared_ptr<DictExpression> exprl = boost::make_shared<DictExpression>(exprs, m_DebugInfo);
std::shared_ptr<DictExpression> exprl = std::make_shared<DictExpression>(exprs, m_DebugInfo);
exprl->MakeInline();
return new ConfigItem(m_Type, m_Name, m_Abstract, exprl, m_Filter,

View File

@ -52,7 +52,7 @@ public:
void SetIgnoreOnError(bool ignoreOnError);
void AddExpression(Expression *expr);
void SetFilter(const boost::shared_ptr<Expression>& filter);
void SetFilter(const std::shared_ptr<Expression>& filter);
ConfigItem::Ptr Compile(void);
@ -61,7 +61,7 @@ private:
String m_Name; /**< The name. */
bool m_Abstract; /**< Whether the item is abstract. */
std::vector<Expression *> m_Expressions; /**< Expressions for this item. */
boost::shared_ptr<Expression> m_Filter; /**< Filter expression. */
std::shared_ptr<Expression> m_Filter; /**< Filter expression. */
DebugInfo m_DebugInfo; /**< Debug information. */
Dictionary::Ptr m_Scope; /**< variable scope. */
String m_Zone; /**< The zone. */

View File

@ -28,7 +28,6 @@
#include "base/exception.hpp"
#include "base/scriptframe.hpp"
#include "base/convert.hpp"
#include <boost/thread/future.hpp>
#include <map>
namespace icinga
@ -37,7 +36,7 @@ namespace icinga
struct DebugHint
{
public:
DebugHint(const Dictionary::Ptr& hints = Dictionary::Ptr())
DebugHint(const Dictionary::Ptr& hints = nullptr)
: m_Hints(hints)
{ }
@ -217,7 +216,7 @@ I2_CONFIG_API Expression *MakeIndexer(ScopeSpecifier scopeSpec, const String& in
class I2_CONFIG_API OwnedExpression : public Expression
{
public:
OwnedExpression(const boost::shared_ptr<Expression>& expression)
OwnedExpression(const std::shared_ptr<Expression>& expression)
: m_Expression(expression)
{ }
@ -233,7 +232,7 @@ protected:
}
private:
boost::shared_ptr<Expression> m_Expression;
std::shared_ptr<Expression> m_Expression;
};
class I2_CONFIG_API LiteralExpression : public Expression
@ -838,7 +837,7 @@ private:
String m_Name;
std::vector<String> m_Args;
std::map<String, Expression *> *m_ClosedVars;
boost::shared_ptr<Expression> m_Expression;
std::shared_ptr<Expression> m_Expression;
};
class I2_CONFIG_API ApplyExpression : public DebuggableExpression
@ -875,14 +874,14 @@ private:
String m_Type;
String m_Target;
Expression *m_Name;
boost::shared_ptr<Expression> m_Filter;
std::shared_ptr<Expression> m_Filter;
String m_Package;
String m_FKVar;
String m_FVVar;
boost::shared_ptr<Expression> m_FTerm;
std::shared_ptr<Expression> m_FTerm;
bool m_IgnoreOnError;
std::map<String, Expression *> *m_ClosedVars;
boost::shared_ptr<Expression> m_Expression;
std::shared_ptr<Expression> m_Expression;
};
class I2_CONFIG_API ObjectExpression : public DebuggableExpression
@ -917,13 +916,13 @@ private:
bool m_Abstract;
Expression *m_Type;
Expression *m_Name;
boost::shared_ptr<Expression> m_Filter;
std::shared_ptr<Expression> m_Filter;
String m_Zone;
String m_Package;
bool m_DefaultTmpl;
bool m_IgnoreOnError;
std::map<String, Expression *> *m_ClosedVars;
boost::shared_ptr<Expression> m_Expression;
std::shared_ptr<Expression> m_Expression;
};
class I2_CONFIG_API ForExpression : public DebuggableExpression

View File

@ -33,7 +33,6 @@
#include "base/exception.hpp"
#include "base/convert.hpp"
#include "base/objectlock.hpp"
#include <boost/smart_ptr/make_shared.hpp>
#include <map>
#include <vector>
@ -103,14 +102,14 @@ public:
static inline Value FunctionCall(ScriptFrame& frame, const Value& self, const Function::Ptr& func, const std::vector<Value>& arguments)
{
if (!self.IsEmpty() || self.IsString())
return func->Invoke(self, arguments);
return func->InvokeThis(self, arguments);
else
return func->Invoke(arguments);
}
static inline Value NewFunction(ScriptFrame& frame, const String& name, const std::vector<String>& argNames,
std::map<String, Expression *> *closedVars, const boost::shared_ptr<Expression>& expression)
std::map<String, Expression *> *closedVars, const std::shared_ptr<Expression>& expression)
{
auto evaluatedClosedVars = EvaluateClosedVars(frame, closedVars);
@ -132,9 +131,9 @@ public:
return new Function(name, wrapper, argNames);
}
static inline Value NewApply(ScriptFrame& frame, const String& type, const String& target, const String& name, const boost::shared_ptr<Expression>& filter,
const String& package, const String& fkvar, const String& fvvar, const boost::shared_ptr<Expression>& fterm, std::map<String, Expression *> *closedVars,
bool ignoreOnError, const boost::shared_ptr<Expression>& expression, const DebugInfo& debugInfo = DebugInfo())
static inline Value NewApply(ScriptFrame& frame, const String& type, const String& target, const String& name, const std::shared_ptr<Expression>& filter,
const String& package, const String& fkvar, const String& fvvar, const std::shared_ptr<Expression>& fterm, std::map<String, Expression *> *closedVars,
bool ignoreOnError, const std::shared_ptr<Expression>& expression, const DebugInfo& debugInfo = DebugInfo())
{
ApplyRule::AddRule(type, target, name, expression, filter, package, fkvar,
fvvar, fterm, ignoreOnError, debugInfo, EvaluateClosedVars(frame, closedVars));
@ -142,8 +141,8 @@ public:
return Empty;
}
static inline Value NewObject(ScriptFrame& frame, bool abstract, const Type::Ptr& type, const String& name, const boost::shared_ptr<Expression>& filter,
const String& zone, const String& package, bool defaultTmpl, bool ignoreOnError, std::map<String, Expression *> *closedVars, const boost::shared_ptr<Expression>& expression, const DebugInfo& debugInfo = DebugInfo())
static inline Value NewObject(ScriptFrame& frame, bool abstract, const Type::Ptr& type, const String& name, const std::shared_ptr<Expression>& filter,
const String& zone, const String& package, bool defaultTmpl, bool ignoreOnError, std::map<String, Expression *> *closedVars, const std::shared_ptr<Expression>& expression, const DebugInfo& debugInfo = DebugInfo())
{
ConfigItemBuilder::Ptr item = new ConfigItemBuilder(debugInfo);
@ -153,7 +152,7 @@ public:
NameComposer *nc = dynamic_cast<NameComposer *>(type.get());
if (nc)
checkName = nc->MakeName(name, Dictionary::Ptr());
checkName = nc->MakeName(name, nullptr);
}
if (!checkName.IsEmpty()) {

View File

@ -45,5 +45,5 @@ Dictionary::Ptr CommandDbObject::GetConfigFields(void) const
Dictionary::Ptr CommandDbObject::GetStatusFields(void) const
{
return Dictionary::Ptr();
return nullptr;
}

View File

@ -181,13 +181,12 @@ void DbConnection::UpdateProgramStatus(void)
query1.Fields->Set("process_performance_data", (IcingaApplication::GetInstance()->GetEnablePerfdata() ? 1 : 0));
query1.WhereCriteria = new Dictionary();
query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
query1.Priority = PriorityHigh;
queries.push_back(query1);
queries.emplace_back(std::move(query1));
DbQuery query2;
query2.Type = DbQueryNewTransaction;
queries.push_back(query2);
queries.emplace_back(std::move(query2));
DbObject::OnMultipleQueries(queries);

View File

@ -383,8 +383,7 @@ void DbEvents::AddCommentInternal(std::vector<DbQuery>& queries, const Comment::
}
query1.Category = DbCatComment;
query1.Fields = fields1;
queries.push_back(query1);
queries.emplace_back(std::move(query1));
}
void DbEvents::RemoveComment(const Comment::Ptr& comment)
@ -409,7 +408,7 @@ void DbEvents::RemoveCommentInternal(std::vector<DbQuery>& queries, const Commen
query1.WhereCriteria->Set("object_id", checkable);
query1.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(entry_time));
query1.WhereCriteria->Set("name", comment->GetName());
queries.push_back(query1);
queries.emplace_back(std::move(query1));
/* History - update deletion time for service/host */
double now = Utility::GetTime();
@ -429,7 +428,7 @@ void DbEvents::RemoveCommentInternal(std::vector<DbQuery>& queries, const Commen
query2.WhereCriteria->Set("object_id", checkable);
query2.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(entry_time));
query2.WhereCriteria->Set("name", comment->GetName());
queries.push_back(query2);
queries.emplace_back(std::move(query2));
}
/* downtimes */
@ -526,8 +525,7 @@ void DbEvents::AddDowntimeInternal(std::vector<DbQuery>& queries, const Downtime
query1.Category = DbCatDowntime;
query1.Fields = fields1;
queries.push_back(query1);
queries.emplace_back(std::move(query1));
/* host/service status */
if (!historical) {
@ -558,8 +556,7 @@ void DbEvents::AddDowntimeInternal(std::vector<DbQuery>& queries, const Downtime
query2.WhereCriteria->Set("host_object_id", host);
query2.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
queries.push_back(query2);
queries.emplace_back(std::move(query2));
}
}
@ -587,7 +584,7 @@ void DbEvents::RemoveDowntimeInternal(std::vector<DbQuery>& queries, const Downt
query1.WhereCriteria->Set("scheduled_start_time", DbValue::FromTimestamp(downtime->GetStartTime()));
query1.WhereCriteria->Set("scheduled_end_time", DbValue::FromTimestamp(downtime->GetEndTime()));
query1.WhereCriteria->Set("name", downtime->GetName());
queries.push_back(query1);
queries.emplace_back(std::move(query1));
/* History - update actual_end_time, was_cancelled for service (and host in case) */
double now = Utility::GetTime();
@ -616,8 +613,7 @@ void DbEvents::RemoveDowntimeInternal(std::vector<DbQuery>& queries, const Downt
query3.WhereCriteria->Set("scheduled_start_time", DbValue::FromTimestamp(downtime->GetStartTime()));
query3.WhereCriteria->Set("scheduled_end_time", DbValue::FromTimestamp(downtime->GetEndTime()));
query3.WhereCriteria->Set("name", downtime->GetName());
queries.push_back(query3);
queries.emplace_back(std::move(query3));
/* host/service status */
Host::Ptr host;
@ -647,8 +643,7 @@ void DbEvents::RemoveDowntimeInternal(std::vector<DbQuery>& queries, const Downt
query4.WhereCriteria->Set("host_object_id", host);
query4.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
queries.push_back(query4);
queries.emplace_back(std::move(query4));
}
void DbEvents::TriggerDowntime(const Downtime::Ptr& downtime)
@ -908,7 +903,7 @@ void DbEvents::AddNotificationHistory(const Notification::Ptr& notification, con
fields2->Set("instance_id", 0); /* DbConnection class fills in real ID */
query2.Fields = fields2;
queries.push_back(query2);
queries.emplace_back(std::move(query2));
}
DbObject::OnMultipleQueries(queries);

View File

@ -217,8 +217,7 @@ void DbObject::SendVarsConfigUpdateHeavy(void)
query1.Category = DbCatConfig;
query1.WhereCriteria = new Dictionary();
query1.WhereCriteria->Set("object_id", obj);
queries.push_back(query1);
queries.emplace_back(std::move(query1));
DbQuery query2;
query2.Table = "customvariablestatus";
@ -226,8 +225,7 @@ void DbObject::SendVarsConfigUpdateHeavy(void)
query2.Category = DbCatConfig;
query2.WhereCriteria = new Dictionary();
query2.WhereCriteria->Set("object_id", obj);
queries.push_back(query2);
queries.emplace_back(std::move(query2));
Dictionary::Ptr vars = CompatUtility::GetCustomAttributeConfig(custom_var_object);
@ -260,8 +258,7 @@ void DbObject::SendVarsConfigUpdateHeavy(void)
query3.Type = DbQueryInsert;
query3.Category = DbCatConfig;
query3.Fields = fields;
queries.push_back(query3);
queries.emplace_back(std::move(query3));
}
}
@ -313,8 +310,7 @@ void DbObject::SendVarsStatusUpdate(void)
query.WhereCriteria = new Dictionary();
query.WhereCriteria->Set("object_id", obj);
query.WhereCriteria->Set("varname", kv.first);
queries.push_back(query);
queries.emplace_back(std::move(query));
}
OnMultipleQueries(queries);
@ -358,7 +354,7 @@ DbObject::Ptr DbObject::GetOrCreateByObject(const ConfigObject::Ptr& object)
DbType::Ptr dbtype = DbType::GetByName(object->GetReflectionType()->GetName());
if (!dbtype)
return DbObject::Ptr();
return nullptr;
Service::Ptr service;
String name1, name2;

View File

@ -68,7 +68,7 @@ DbType::Ptr DbType::GetByName(const String& name)
auto it = GetTypes().find(typeName);
if (it == GetTypes().end())
return DbType::Ptr();
return nullptr;
return it->second;
}
@ -82,7 +82,7 @@ DbType::Ptr DbType::GetByID(long tid)
return kv.second;
}
return DbType::Ptr();
return nullptr;
}
DbObject::Ptr DbType::GetOrCreateObjectByName(const String& name1, const String& name2)

View File

@ -191,8 +191,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
query1.Category = DbCatConfig;
query1.WhereCriteria = new Dictionary();
query1.WhereCriteria->Set("host_object_id", host);
queries.push_back(query1);
queries.emplace_back(std::move(query1));
if (groups) {
ObjectLock olock(groups);
@ -211,8 +210,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
query2.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
query2.WhereCriteria->Set("hostgroup_id", DbValue::FromObjectInsertID(group));
query2.WhereCriteria->Set("host_object_id", host);
queries.push_back(query2);
queries.emplace_back(std::move(query2));
}
}
@ -226,8 +224,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
query2.Category = DbCatConfig;
query2.WhereCriteria = new Dictionary();
query2.WhereCriteria->Set(GetType()->GetTable() + "_id", DbValue::FromObjectInsertID(GetObject()));
queries.push_back(query2);
queries.emplace_back(std::move(query2));
/* parents */
for (const Checkable::Ptr& checkable : host->GetParents()) {
@ -250,8 +247,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
query1.Type = DbQueryInsert;
query1.Category = DbCatConfig;
query1.Fields = fields1;
queries.push_back(query1);
queries.emplace_back(std::move(query1));
}
DbObject::OnMultipleQueries(queries);
@ -268,8 +264,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
query3.Category = DbCatConfig;
query3.WhereCriteria = new Dictionary();
query3.WhereCriteria->Set("dependent_host_object_id", host);
queries.push_back(query3);
queries.emplace_back(std::move(query3));
for (const Dependency::Ptr& dep : host->GetDependencies()) {
Checkable::Ptr parent = dep->GetParent();
@ -299,8 +294,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
query2.Type = DbQueryInsert;
query2.Category = DbCatConfig;
query2.Fields = fields2;
queries.push_back(query2);
queries.emplace_back(std::move(query2));
}
DbObject::OnMultipleQueries(queries);
@ -316,8 +310,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
query4.Category = DbCatConfig;
query4.WhereCriteria = new Dictionary();
query4.WhereCriteria->Set("host_id", DbValue::FromObjectInsertID(host));
queries.push_back(query4);
queries.emplace_back(std::move(query4));
for (const User::Ptr& user : CompatUtility::GetCheckableNotificationUsers(host)) {
Log(LogDebug, "HostDbObject")
@ -333,8 +326,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
query_contact.Type = DbQueryInsert;
query_contact.Category = DbCatConfig;
query_contact.Fields = fields_contact;
queries.push_back(query_contact);
queries.emplace_back(std::move(query_contact));
}
DbObject::OnMultipleQueries(queries);
@ -350,8 +342,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
query5.Category = DbCatConfig;
query5.WhereCriteria = new Dictionary();
query5.WhereCriteria->Set("host_id", DbValue::FromObjectInsertID(host));
queries.push_back(query5);
queries.emplace_back(std::move(query5));
for (const UserGroup::Ptr& usergroup : CompatUtility::GetCheckableNotificationUserGroups(host)) {
Log(LogDebug, "HostDbObject")
@ -367,8 +358,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
query_contact.Type = DbQueryInsert;
query_contact.Category = DbCatConfig;
query_contact.Fields = fields_contact;
queries.push_back(query_contact);
queries.emplace_back(std::move(query_contact));
}
DbObject::OnMultipleQueries(queries);

View File

@ -47,5 +47,5 @@ Dictionary::Ptr HostGroupDbObject::GetConfigFields(void) const
Dictionary::Ptr HostGroupDbObject::GetStatusFields(void) const
{
return Dictionary::Ptr();
return nullptr;
}

View File

@ -46,10 +46,10 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult
MacroProcessor::ResolverList resolvers;
if (service)
resolvers.push_back(std::make_pair("service", service));
resolvers.push_back(std::make_pair("host", host));
resolvers.push_back(std::make_pair("command", commandObj));
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
resolvers.emplace_back("service", service);
resolvers.emplace_back("host", host);
resolvers.emplace_back("command", commandObj);
resolvers.emplace_back("icinga", IcingaApplication::GetInstance());
String idoType = MacroProcessor::ResolveMacros("$ido_type$", resolvers, checkable->GetLastCheckResult(),
NULL, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros);

View File

@ -185,8 +185,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
query1.Category = DbCatConfig;
query1.WhereCriteria = new Dictionary();
query1.WhereCriteria->Set("service_object_id", service);
queries.push_back(query1);
queries.emplace_back(std::move(query1));
if (groups) {
ObjectLock olock(groups);
@ -205,8 +204,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
query2.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
query2.WhereCriteria->Set("servicegroup_id", DbValue::FromObjectInsertID(group));
query2.WhereCriteria->Set("service_object_id", service);
queries.push_back(query2);
queries.emplace_back(std::move(query2));
}
}
@ -224,8 +222,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
query2.Category = DbCatConfig;
query2.WhereCriteria = new Dictionary();
query2.WhereCriteria->Set("dependent_service_object_id", service);
queries.push_back(query2);
queries.emplace_back(std::move(query2));
for (const Dependency::Ptr& dep : service->GetDependencies()) {
Checkable::Ptr parent = dep->GetParent();
@ -258,8 +255,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
query1.Type = DbQueryInsert;
query1.Category = DbCatConfig;
query1.Fields = fields1;
queries.push_back(query1);
queries.emplace_back(std::move(query1));
}
DbObject::OnMultipleQueries(queries);
@ -276,8 +272,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
query3.Category = DbCatConfig;
query3.WhereCriteria = new Dictionary();
query3.WhereCriteria->Set("service_id", DbValue::FromObjectInsertID(service));
queries.push_back(query3);
queries.emplace_back(std::move(query3));
for (const User::Ptr& user : CompatUtility::GetCheckableNotificationUsers(service)) {
Log(LogDebug, "ServiceDbObject")
@ -293,8 +288,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
query_contact.Type = DbQueryInsert;
query_contact.Category = DbCatConfig;
query_contact.Fields = fields_contact;
queries.push_back(query_contact);
queries.emplace_back(std::move(query_contact));
}
DbObject::OnMultipleQueries(queries);
@ -310,8 +304,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
query4.Category = DbCatConfig;
query4.WhereCriteria = new Dictionary();
query4.WhereCriteria->Set("service_id", DbValue::FromObjectInsertID(service));
queries.push_back(query4);
queries.emplace_back(std::move(query4));
for (const UserGroup::Ptr& usergroup : CompatUtility::GetCheckableNotificationUserGroups(service)) {
Log(LogDebug, "ServiceDbObject")
@ -327,8 +320,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
query_contact.Type = DbQueryInsert;
query_contact.Category = DbCatConfig;
query_contact.Fields = fields_contact;
queries.push_back(query_contact);
queries.emplace_back(std::move(query_contact));
}
DbObject::OnMultipleQueries(queries);

View File

@ -46,5 +46,5 @@ Dictionary::Ptr ServiceGroupDbObject::GetConfigFields(void) const
Dictionary::Ptr ServiceGroupDbObject::GetStatusFields(void) const
{
return Dictionary::Ptr();
return nullptr;
}

View File

@ -94,8 +94,7 @@ void UserDbObject::OnConfigUpdateHeavy(void)
query1.Category = DbCatConfig;
query1.WhereCriteria = new Dictionary();
query1.WhereCriteria->Set("contact_object_id", user);
queries.push_back(query1);
queries.emplace_back(std::move(query1));
if (groups) {
ObjectLock olock(groups);
@ -114,8 +113,7 @@ void UserDbObject::OnConfigUpdateHeavy(void)
query2.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
query2.WhereCriteria->Set("contactgroup_id", DbValue::FromObjectInsertID(group));
query2.WhereCriteria->Set("contact_object_id", user);
queries.push_back(query2);
queries.emplace_back(std::move(query2));
}
}
@ -129,8 +127,7 @@ void UserDbObject::OnConfigUpdateHeavy(void)
query2.Category = DbCatConfig;
query2.WhereCriteria = new Dictionary();
query2.WhereCriteria->Set("contact_id", DbValue::FromObjectInsertID(user));
queries.push_back(query2);
queries.emplace_back(std::move(query2));
Dictionary::Ptr vars = user->GetVars();
@ -155,8 +152,7 @@ void UserDbObject::OnConfigUpdateHeavy(void)
query.Table = "contact_addresses";
query.Category = DbCatConfig;
query.Fields = fields;
queries.push_back(query);
queries.emplace_back(std::move(query));
}
}

View File

@ -44,5 +44,5 @@ Dictionary::Ptr UserGroupDbObject::GetConfigFields(void) const
Dictionary::Ptr UserGroupDbObject::GetStatusFields(void) const
{
return Dictionary::Ptr();
return nullptr;
}

View File

@ -420,7 +420,7 @@ void IdoMysqlConnection::Reconnect(void)
SetObjectActive(dbobj, active);
if (active)
activeDbObjs.push_back(dbobj);
activeDbObjs.emplace_back(std::move(dbobj));
}
SetIDCacheValid(true);
@ -489,7 +489,7 @@ void IdoMysqlConnection::AsyncQuery(const String& query, const std::function<voi
* See https://github.com/Icinga/icinga2/issues/4603 for details.
*/
aq.Callback = callback;
m_AsyncQueries.push_back(aq);
m_AsyncQueries.emplace_back(std::move(aq));
if (m_AsyncQueries.size() > 25000) {
FinishAsyncQueries();
@ -684,12 +684,12 @@ Dictionary::Ptr IdoMysqlConnection::FetchRow(const IdoMysqlResult& result)
row = mysql_fetch_row(result.get());
if (!row)
return Dictionary::Ptr();
return nullptr;
lengths = mysql_fetch_lengths(result.get());
if (!lengths)
return Dictionary::Ptr();
return nullptr;
Dictionary::Ptr dict = new Dictionary();

View File

@ -29,7 +29,7 @@
namespace icinga
{
typedef boost::shared_ptr<MYSQL_RES> IdoMysqlResult;
typedef std::shared_ptr<MYSQL_RES> IdoMysqlResult;
typedef std::function<void (const IdoMysqlResult&)> IdoAsyncCallback;

View File

@ -522,7 +522,7 @@ Dictionary::Ptr IdoPgsqlConnection::FetchRow(const IdoPgsqlResult& result, int r
AssertOnWorkQueue();
if (row >= PQntuples(result.get()))
return Dictionary::Ptr();
return nullptr;
int columns = PQnfields(result.get());

View File

@ -29,7 +29,7 @@
namespace icinga
{
typedef boost::shared_ptr<PGresult> IdoPgsqlResult;
typedef std::shared_ptr<PGresult> IdoPgsqlResult;
/**
* An IDO pgSQL database connection.

View File

@ -54,7 +54,7 @@ void Demo::DemoTimerHandler(void)
ApiListener::Ptr listener = ApiListener::GetInstance();
if (listener) {
MessageOrigin::Ptr origin = new MessageOrigin();
listener->RelayMessage(origin, ConfigObject::Ptr(), message, true);
listener->RelayMessage(origin, nullptr, message, true);
Log(LogInformation, "Demo", "Sent demo::HelloWorld message");
}
}

View File

@ -165,7 +165,7 @@ Dictionary::Ptr ApiActions::SendCustomNotification(const ConfigObject::Ptr& obje
checkable->SetForceNextNotification(true);
Checkable::OnNotificationsRequested(checkable, NotificationCustom, checkable->GetLastCheckResult(),
HttpUtility::GetLastParameter(params, "author"), HttpUtility::GetLastParameter(params, "comment"), MessageOrigin::Ptr());
HttpUtility::GetLastParameter(params, "author"), HttpUtility::GetLastParameter(params, "comment"), nullptr);
return ApiActions::CreateResult(200, "Successfully sent custom notification for object '" + checkable->GetName() + "'.");
}

View File

@ -48,7 +48,7 @@ public:
static Dictionary::Ptr GenerateTicket(const ConfigObject::Ptr& object, const Dictionary::Ptr& params);
private:
static Dictionary::Ptr CreateResult(int code, const String& status, const Dictionary::Ptr& additional = Dictionary::Ptr());
static Dictionary::Ptr CreateResult(int code, const String& status, const Dictionary::Ptr& additional = nullptr);
};
}

View File

@ -371,7 +371,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
if (!in_downtime && !was_flapping && is_flapping) {
/* FlappingStart notifications happen on state changes, not in downtimes */
if (!IsPaused())
OnNotificationsRequested(this, NotificationFlappingStart, cr, "", "", MessageOrigin::Ptr());
OnNotificationsRequested(this, NotificationFlappingStart, cr, "", "", nullptr);
Log(LogNotice, "Checkable")
<< "Flapping Start: Checkable '" << GetName() << "' started flapping (Current flapping value "
@ -381,7 +381,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
} else if (!in_downtime && was_flapping && !is_flapping) {
/* FlappingEnd notifications are independent from state changes, must not happen in downtine */
if (!IsPaused())
OnNotificationsRequested(this, NotificationFlappingEnd, cr, "", "", MessageOrigin::Ptr());
OnNotificationsRequested(this, NotificationFlappingEnd, cr, "", "", nullptr);
Log(LogNotice, "Checkable")
<< "Flapping Stop: Checkable '" << GetName() << "' stopped flapping (Current flapping value "
@ -392,7 +392,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
if (send_notification && !is_flapping) {
if (!IsPaused())
OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "", MessageOrigin::Ptr());
OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "", nullptr);
}
}

View File

@ -35,10 +35,10 @@ void Checkable::RemoveDependency(const Dependency::Ptr& dep)
m_Dependencies.erase(dep);
}
std::set<Dependency::Ptr> Checkable::GetDependencies(void) const
std::vector<Dependency::Ptr> Checkable::GetDependencies(void) const
{
boost::mutex::scoped_lock lock(m_DependencyMutex);
return m_Dependencies;
return std::vector<Dependency::Ptr>(m_Dependencies.begin(), m_Dependencies.end());
}
void Checkable::AddReverseDependency(const Dependency::Ptr& dep)
@ -53,10 +53,10 @@ void Checkable::RemoveReverseDependency(const Dependency::Ptr& dep)
m_ReverseDependencies.erase(dep);
}
std::set<Dependency::Ptr> Checkable::GetReverseDependencies(void) const
std::vector<Dependency::Ptr> Checkable::GetReverseDependencies(void) const
{
boost::mutex::scoped_lock lock(m_DependencyMutex);
return m_ReverseDependencies;
return std::vector<Dependency::Ptr>(m_ReverseDependencies.begin(), m_ReverseDependencies.end());
}
bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency, int rstack) const
@ -80,7 +80,7 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency
if (host && host->GetState() != HostUp && host->GetStateType() == StateTypeHard) {
if (failedDependency)
*failedDependency = Dependency::Ptr();
*failedDependency = nullptr;
return false;
}
@ -96,7 +96,7 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency
}
if (failedDependency)
*failedDependency = Dependency::Ptr();
*failedDependency = nullptr;
return true;
}
@ -148,7 +148,7 @@ void Checkable::GetAllChildrenInternal(std::set<Checkable::Ptr>& children, int l
for (const Checkable::Ptr& checkable : children) {
std::set<Checkable::Ptr> cChildren = checkable->GetChildren();
if (!checkable->GetChildren().empty()) {
if (!cChildren.empty()) {
GetAllChildrenInternal(cChildren, level + 1);
localChildren.insert(cChildren.begin(), cChildren.end());
}

View File

@ -128,7 +128,7 @@ void Checkable::AcknowledgeProblem(const String& author, const String& comment,
SetAcknowledgementExpiry(expiry);
if (notify && !IsPaused())
OnNotificationsRequested(this, NotificationAcknowledgement, GetLastCheckResult(), author, comment, MessageOrigin::Ptr());
OnNotificationsRequested(this, NotificationAcknowledgement, GetLastCheckResult(), author, comment, nullptr);
OnAcknowledgementSet(this, author, comment, type, notify, persistent, expiry, origin);
}
@ -173,7 +173,7 @@ void Checkable::NotifyDowntimeInternal(const Downtime::Ptr& downtime)
Checkable::Ptr checkable = downtime->GetCheckable();
if (!checkable->IsPaused())
OnNotificationsRequested(checkable, NotificationDowntimeStart, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), MessageOrigin::Ptr());
OnNotificationsRequested(checkable, NotificationDowntimeStart, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), nullptr);
}
void Checkable::NotifyDowntimeEnd(const Downtime::Ptr& downtime)
@ -185,7 +185,7 @@ void Checkable::NotifyDowntimeEnd(const Downtime::Ptr& downtime)
Checkable::Ptr checkable = downtime->GetCheckable();
if (!checkable->IsPaused())
OnNotificationsRequested(checkable, NotificationDowntimeEnd, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), MessageOrigin::Ptr());
OnNotificationsRequested(checkable, NotificationDowntimeEnd, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), nullptr);
}
void Checkable::ValidateCheckInterval(double value, const ValidationUtils& utils)

View File

@ -98,8 +98,8 @@ public:
AcknowledgementType GetAcknowledgement(void);
void AcknowledgeProblem(const String& author, const String& comment, AcknowledgementType type, bool notify = true, bool persistent = false, double expiry = 0, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
void ClearAcknowledgement(const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
void AcknowledgeProblem(const String& author, const String& comment, AcknowledgementType type, bool notify = true, bool persistent = false, double expiry = 0, const MessageOrigin::Ptr& origin = nullptr);
void ClearAcknowledgement(const MessageOrigin::Ptr& origin = nullptr);
virtual int GetSeverity(void) const override;
@ -110,7 +110,7 @@ public:
long GetSchedulingOffset(void);
void SetSchedulingOffset(long offset);
void UpdateNextCheck(const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
void UpdateNextCheck(const MessageOrigin::Ptr& origin = nullptr);
bool HasBeenChecked(void) const;
virtual bool IsStateOK(ServiceState state) = 0;
@ -121,9 +121,9 @@ public:
static void UpdateStatistics(const CheckResult::Ptr& cr, CheckableType type);
void ExecuteRemoteCheck(const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr());
void ExecuteRemoteCheck(const Dictionary::Ptr& resolvedMacros = nullptr);
void ExecuteCheck();
void ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
void ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrigin::Ptr& origin = nullptr);
Endpoint::Ptr GetCommandEndpoint(void) const;
@ -174,7 +174,7 @@ public:
void ResetNotificationNumbers(void);
/* Event Handler */
void ExecuteEventHandler(const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr(),
void ExecuteEventHandler(const Dictionary::Ptr& resolvedMacros = nullptr,
bool useResolvedMacros = false);
intrusive_ptr<EventCommand> GetEventCommand(void) const;
@ -185,11 +185,11 @@ public:
/* Dependencies */
void AddDependency(const intrusive_ptr<Dependency>& dep);
void RemoveDependency(const intrusive_ptr<Dependency>& dep);
std::set<intrusive_ptr<Dependency> > GetDependencies(void) const;
std::vector<intrusive_ptr<Dependency> > GetDependencies(void) const;
void AddReverseDependency(const intrusive_ptr<Dependency>& dep);
void RemoveReverseDependency(const intrusive_ptr<Dependency>& dep);
std::set<intrusive_ptr<Dependency> > GetReverseDependencies(void) const;
std::vector<intrusive_ptr<Dependency> > GetReverseDependencies(void) const;
virtual void ValidateCheckInterval(double value, const ValidationUtils& utils) override;
virtual void ValidateMaxCheckAttempts(int value, const ValidationUtils& utils) override;

View File

@ -28,10 +28,10 @@ REGISTER_TYPE(CheckCommand);
void CheckCommand::Execute(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
{
std::vector<Value> arguments;
arguments.push_back(checkable);
arguments.push_back(cr);
arguments.push_back(resolvedMacros);
arguments.push_back(useResolvedMacros);
GetExecute()->Invoke(arguments);
GetExecute()->Invoke({
checkable,
cr,
resolvedMacros,
useResolvedMacros
});
}

View File

@ -38,7 +38,7 @@ public:
DECLARE_OBJECTNAME(CheckCommand);
virtual void Execute(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr(),
const Dictionary::Ptr& resolvedMacros = nullptr,
bool useResolvedMacros = false);
};

View File

@ -24,10 +24,8 @@
using namespace icinga;
REGISTER_TYPE(CheckResult);
INITIALIZE_ONCE(&CheckResult::StaticInitialize);
void CheckResult::StaticInitialize(void)
{
INITIALIZE_ONCE([]() {
ScriptGlobal::Set("ServiceOK", ServiceOK);
ScriptGlobal::Set("ServiceWarning", ServiceWarning);
ScriptGlobal::Set("ServiceCritical", ServiceCritical);
@ -35,7 +33,7 @@ void CheckResult::StaticInitialize(void)
ScriptGlobal::Set("HostUp", HostUp);
ScriptGlobal::Set("HostDown", HostDown);
}
})
double CheckResult::CalculateExecutionTime(void) const
{

View File

@ -38,8 +38,6 @@ public:
double CalculateExecutionTime(void) const;
double CalculateLatency(void) const;
static void StaticInitialize(void);
};
}

View File

@ -704,7 +704,7 @@ void ClusterEvents::SendNotificationsHandler(const Checkable::Ptr& checkable, No
params->Set("author", author);
params->Set("text", text);
listener->RelayMessage(origin, ConfigObject::Ptr(), message, true);
listener->RelayMessage(origin, nullptr, message, true);
}
Value ClusterEvents::SendNotificationsAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
@ -798,7 +798,7 @@ void ClusterEvents::NotificationSentUserHandler(const Notification::Ptr& notific
message->Set("method", "event::NotificationSentUser");
message->Set("params", params);
listener->RelayMessage(origin, ConfigObject::Ptr(), message, true);
listener->RelayMessage(origin, nullptr, message, true);
}
Value ClusterEvents::NotificationSentUserAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
@ -914,7 +914,7 @@ void ClusterEvents::NotificationSentToAllUsersHandler(const Notification::Ptr& n
message->Set("method", "event::NotificationSentToAllUsers");
message->Set("params", params);
listener->RelayMessage(origin, ConfigObject::Ptr(), message, true);
listener->RelayMessage(origin, nullptr, message, true);
}
Value ClusterEvents::NotificationSentToAllUsersAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)

View File

@ -26,6 +26,7 @@
#include "base/timer.hpp"
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/thread/once.hpp>
using namespace icinga;
@ -37,18 +38,8 @@ static Timer::Ptr l_CommentsExpireTimer;
boost::signals2::signal<void (const Comment::Ptr&)> Comment::OnCommentAdded;
boost::signals2::signal<void (const Comment::Ptr&)> Comment::OnCommentRemoved;
INITIALIZE_ONCE(&Comment::StaticInitialize);
REGISTER_TYPE(Comment);
void Comment::StaticInitialize(void)
{
l_CommentsExpireTimer = new Timer();
l_CommentsExpireTimer->SetInterval(60);
l_CommentsExpireTimer->OnTimerExpired.connect(std::bind(&Comment::CommentsExpireTimerHandler));
l_CommentsExpireTimer->Start();
}
String CommentNameComposer::MakeName(const String& shortName, const Object::Ptr& context) const
{
Comment::Ptr comment = dynamic_pointer_cast<Comment>(context);
@ -106,6 +97,15 @@ void Comment::Start(bool runtimeCreated)
{
ObjectImpl<Comment>::Start(runtimeCreated);
static boost::once_flag once = BOOST_ONCE_INIT;
boost::call_once(once, []() {
l_CommentsExpireTimer = new Timer();
l_CommentsExpireTimer->SetInterval(60);
l_CommentsExpireTimer->OnTimerExpired.connect(std::bind(&Comment::CommentsExpireTimerHandler));
l_CommentsExpireTimer->Start();
});
{
boost::mutex::scoped_lock lock(l_CommentMutex);
@ -181,7 +181,7 @@ String Comment::AddComment(const Checkable::Ptr& checkable, CommentType entryTyp
if (!zone.IsEmpty())
attrs->Set("zone", zone);
String config = ConfigObjectUtility::CreateObjectConfig(Comment::TypeInstance, fullName, true, Array::Ptr(), attrs);
String config = ConfigObjectUtility::CreateObjectConfig(Comment::TypeInstance, fullName, true, nullptr, attrs);
Array::Ptr errors = new Array();

View File

@ -50,14 +50,12 @@ public:
static String AddComment(const intrusive_ptr<Checkable>& checkable, CommentType entryType,
const String& author, const String& text, bool persistent, double expireTime,
const String& id = String(), const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
const String& id = String(), const MessageOrigin::Ptr& origin = nullptr);
static void RemoveComment(const String& id, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
static void RemoveComment(const String& id, const MessageOrigin::Ptr& origin = nullptr);
static String GetCommentIDFromLegacyID(int id);
static void StaticInitialize(void);
protected:
virtual void OnAllConfigLoaded(void) override;
virtual void Start(bool runtimeCreated) override;

View File

@ -72,7 +72,7 @@ class Comment : ConfigObject < CommentNameComposer
}}}
navigate {{{
if (GetServiceName().IsEmpty())
return Service::Ptr();
return nullptr;
Host::Ptr host = Host::GetByName(GetHostName());
return host->GetServiceByShortName(GetServiceName());

View File

@ -368,7 +368,7 @@ Dictionary::Ptr CompatUtility::GetCustomAttributeConfig(const CustomVarObject::P
Dictionary::Ptr vars = object->GetVars();
if (!vars)
return Dictionary::Ptr();
return nullptr;
return vars;
}

View File

@ -31,10 +31,7 @@
using namespace icinga;
INITIALIZE_ONCE([]() {
std::vector<String> targets;
targets.push_back("Host");
targets.push_back("Service");
ApplyRule::RegisterType("Dependency", targets);
ApplyRule::RegisterType("Dependency", { "Host", "Service" });
});
bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule)

View File

@ -60,7 +60,7 @@ class Dependency : CustomVarObject < DependencyNameComposer
}}}
navigate {{{
if (GetChildServiceName().IsEmpty())
return Service::Ptr();
return nullptr;
Host::Ptr host = Host::GetByName(GetChildHostName());
return host->GetServiceByShortName(GetChildServiceName());
@ -87,7 +87,7 @@ class Dependency : CustomVarObject < DependencyNameComposer
}}}
navigate {{{
if (GetParentServiceName().IsEmpty())
return Service::Ptr();
return nullptr;
Host::Ptr host = Host::GetByName(GetParentHostName());
return host->GetServiceByShortName(GetParentServiceName());

View File

@ -27,6 +27,7 @@
#include "base/timer.hpp"
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/thread/once.hpp>
using namespace icinga;
@ -41,23 +42,8 @@ boost::signals2::signal<void (const Downtime::Ptr&)> Downtime::OnDowntimeRemoved
boost::signals2::signal<void (const Downtime::Ptr&)> Downtime::OnDowntimeStarted;
boost::signals2::signal<void (const Downtime::Ptr&)> Downtime::OnDowntimeTriggered;
INITIALIZE_ONCE(&Downtime::StaticInitialize);
REGISTER_TYPE(Downtime);
void Downtime::StaticInitialize(void)
{
l_DowntimesStartTimer = new Timer();
l_DowntimesStartTimer->SetInterval(5);
l_DowntimesStartTimer->OnTimerExpired.connect(std::bind(&Downtime::DowntimesStartTimerHandler));
l_DowntimesStartTimer->Start();
l_DowntimesExpireTimer = new Timer();
l_DowntimesExpireTimer->SetInterval(60);
l_DowntimesExpireTimer->OnTimerExpired.connect(std::bind(&Downtime::DowntimesExpireTimerHandler));
l_DowntimesExpireTimer->Start();
}
String DowntimeNameComposer::MakeName(const String& shortName, const Object::Ptr& context) const
{
Downtime::Ptr downtime = dynamic_pointer_cast<Downtime>(context);
@ -115,6 +101,20 @@ void Downtime::Start(bool runtimeCreated)
{
ObjectImpl<Downtime>::Start(runtimeCreated);
static boost::once_flag once = BOOST_ONCE_INIT;
boost::call_once(once, []() {
l_DowntimesStartTimer = new Timer();
l_DowntimesStartTimer->SetInterval(5);
l_DowntimesStartTimer->OnTimerExpired.connect(std::bind(&Downtime::DowntimesStartTimerHandler));
l_DowntimesStartTimer->Start();
l_DowntimesExpireTimer = new Timer();
l_DowntimesExpireTimer->SetInterval(60);
l_DowntimesExpireTimer->OnTimerExpired.connect(std::bind(&Downtime::DowntimesExpireTimerHandler));
l_DowntimesExpireTimer->Start();
});
{
boost::mutex::scoped_lock lock(l_DowntimeMutex);
@ -255,7 +255,7 @@ String Downtime::AddDowntime(const Checkable::Ptr& checkable, const String& auth
if (!zone.IsEmpty())
attrs->Set("zone", zone);
String config = ConfigObjectUtility::CreateObjectConfig(Downtime::TypeInstance, fullName, true, Array::Ptr(), attrs);
String config = ConfigObjectUtility::CreateObjectConfig(Downtime::TypeInstance, fullName, true, nullptr, attrs);
Array::Ptr errors = new Array();

View File

@ -57,16 +57,14 @@ public:
const String& comment, double startTime, double endTime, bool fixed,
const String& triggeredBy, double duration, const String& scheduledDowntime = String(),
const String& scheduledBy = String(), const String& id = String(),
const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
const MessageOrigin::Ptr& origin = nullptr);
static void RemoveDowntime(const String& id, bool cancelled, bool expired = false, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
static void RemoveDowntime(const String& id, bool cancelled, bool expired = false, const MessageOrigin::Ptr& origin = nullptr);
void TriggerDowntime(void);
static String GetDowntimeIDFromLegacyID(int id);
static void StaticInitialize(void);
protected:
virtual void OnAllConfigLoaded(void) override;
virtual void Start(bool runtimeCreated) override;

Some files were not shown because too many files have changed in this diff Show More