]> granicus.if.org Git - icinga2/commitdiff
Refactor #includes (Part 2).
authorGunnar Beutner <gunnar@beutner.name>
Sat, 16 Mar 2013 20:18:53 +0000 (21:18 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Sat, 16 Mar 2013 20:18:53 +0000 (21:18 +0100)
198 files changed:
components/checker/Makefile.am
components/checker/checkercomponent.cpp
components/checker/checkercomponent.h
components/checker/i2-checker.h
components/compat/Makefile.am
components/compat/compatcomponent.cpp
components/compat/compatcomponent.h
components/compat/i2-compat.h
components/delegation/Makefile.am
components/delegation/delegationcomponent.cpp
components/delegation/delegationcomponent.h
components/delegation/i2-delegation.h
components/demo/Makefile.am
components/demo/democomponent.cpp
components/demo/i2-demo.h
components/livestatus/Makefile.am
components/livestatus/andfilter.cpp
components/livestatus/attributefilter.cpp
components/livestatus/combinerfilter.cpp
components/livestatus/combinerfilter.h
components/livestatus/commentstable.cpp
components/livestatus/component.cpp
components/livestatus/component.h
components/livestatus/connection.cpp
components/livestatus/connection.h
components/livestatus/contactgroupstable.cpp
components/livestatus/contactstable.cpp
components/livestatus/downtimestable.cpp
components/livestatus/hoststable.cpp
components/livestatus/i2-livestatus.h
components/livestatus/orfilter.cpp
components/livestatus/query.cpp
components/livestatus/query.h
components/livestatus/servicestable.cpp
components/livestatus/statustable.cpp
components/livestatus/table.cpp
components/livestatus/table.h
components/notification/Makefile.am
components/notification/i2-notification.h
components/notification/notificationcomponent.cpp
components/replication/Makefile.am
components/replication/i2-replication.h
components/replication/replicationcomponent.cpp
components/replication/replicationcomponent.h
icinga-app/Makefile.am
icinga-app/icinga.cpp
lib/base/Makefile.am
lib/base/application.cpp
lib/base/application.h
lib/base/array.cpp
lib/base/array.h
lib/base/asynctask.h
lib/base/attribute.cpp
lib/base/attribute.h
lib/base/connection.cpp
lib/base/connection.h
lib/base/convert.cpp
lib/base/convert.h
lib/base/dictionary.cpp
lib/base/dictionary.h
lib/base/dynamicobject.cpp
lib/base/dynamicobject.h
lib/base/dynamictype.cpp
lib/base/dynamictype.h
lib/base/eventqueue.cpp
lib/base/eventqueue.h
lib/base/exception.cpp
lib/base/exception.h
lib/base/fifo.cpp
lib/base/fifo.h
lib/base/i2-base.h
lib/base/logger.cpp
lib/base/logger.h
lib/base/netstring.cpp
lib/base/netstring.h
lib/base/object.cpp
lib/base/object.h
lib/base/objectlock.cpp
lib/base/objectlock.h
lib/base/process-unix.cpp
lib/base/process-windows.cpp
lib/base/process.cpp
lib/base/process.h
lib/base/qstring.cpp
lib/base/qstring.h
lib/base/registry.h
lib/base/ringbuffer.cpp
lib/base/ringbuffer.h
lib/base/script.cpp
lib/base/script.h
lib/base/scriptfunction.cpp
lib/base/scriptfunction.h
lib/base/scriptinterpreter.cpp
lib/base/scriptinterpreter.h
lib/base/scriptlanguage.cpp
lib/base/scriptlanguage.h
lib/base/scripttask.cpp
lib/base/scripttask.h
lib/base/singleton.h
lib/base/socket.cpp
lib/base/socket.h
lib/base/stacktrace.cpp
lib/base/stacktrace.h
lib/base/stdiostream.cpp
lib/base/stdiostream.h
lib/base/stream.cpp
lib/base/stream.h
lib/base/stream_bio.cpp
lib/base/stream_bio.h
lib/base/streamlogger.cpp
lib/base/streamlogger.h
lib/base/sysloglogger.cpp
lib/base/sysloglogger.h
lib/base/tcpsocket.cpp
lib/base/tcpsocket.h
lib/base/timer.cpp
lib/base/timer.h
lib/base/tlsstream.cpp
lib/base/tlsstream.h
lib/base/unixsocket.cpp
lib/base/unixsocket.h
lib/base/utility.cpp
lib/base/utility.h
lib/base/value.cpp
lib/base/value.h
lib/config/Makefile.am
lib/config/config_lexer.cc
lib/config/config_lexer.ll
lib/config/config_parser.cc
lib/config/config_parser.yy
lib/config/configcompiler.cpp
lib/config/configcompiler.h
lib/config/configcompilercontext.cpp
lib/config/configcompilercontext.h
lib/config/configitem.cpp
lib/config/configitem.h
lib/config/configitembuilder.cpp
lib/config/configitembuilder.h
lib/config/configtype.cpp
lib/config/configtype.h
lib/config/debuginfo.h
lib/config/expression.cpp
lib/config/expression.h
lib/config/expressionlist.cpp
lib/config/expressionlist.h
lib/config/i2-config.h
lib/config/typerule.cpp
lib/config/typerulelist.cpp
lib/config/typerulelist.h
lib/icinga/Makefile.am
lib/icinga/api.cpp
lib/icinga/api.h
lib/icinga/cib.h
lib/icinga/externalcommandprocessor.cpp
lib/icinga/externalcommandprocessor.h
lib/icinga/host.cpp
lib/icinga/host.h
lib/icinga/hostgroup.cpp
lib/icinga/hostgroup.h
lib/icinga/i2-icinga.h
lib/icinga/icingaapplication.cpp
lib/icinga/icingaapplication.h
lib/icinga/macroprocessor.cpp
lib/icinga/macroprocessor.h
lib/icinga/notification.cpp
lib/icinga/notification.h
lib/icinga/nullchecktask.cpp
lib/icinga/nullchecktask.h
lib/icinga/perfdatawriter.cpp
lib/icinga/perfdatawriter.h
lib/icinga/pluginchecktask.cpp
lib/icinga/pluginchecktask.h
lib/icinga/pluginnotificationtask.cpp
lib/icinga/pluginnotificationtask.h
lib/icinga/service-check.cpp
lib/icinga/service-comment.cpp
lib/icinga/service-downtime.cpp
lib/icinga/service-notification.cpp
lib/icinga/service.cpp
lib/icinga/service.h
lib/icinga/servicegroup.cpp
lib/icinga/servicegroup.h
lib/icinga/timeperiod.cpp
lib/icinga/timeperiod.h
lib/icinga/user.cpp
lib/icinga/usergroup.cpp
lib/icinga/usergroup.h
lib/python/Makefile.am
lib/remoting/Makefile.am
lib/remoting/endpoint.cpp
lib/remoting/endpoint.h
lib/remoting/endpointmanager.cpp
lib/remoting/endpointmanager.h
lib/remoting/i2-remoting.h
lib/remoting/jsonrpcconnection.cpp
lib/remoting/jsonrpcconnection.h
lib/remoting/messagepart.cpp
tools/mkembedconfig.c

index 85fb6e02194feb1d25c454bfdbd64a0b4d18cf0f..d7897b28cdff94fc8b357f432bfe6cc6781ec7e9 100644 (file)
@@ -17,10 +17,8 @@ libchecker_la_SOURCES = \
 
 libchecker_la_CPPFLAGS = \
        $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/lib/base \
-       -I${top_srcdir}/lib/config \
-       -I${top_srcdir}/lib/remoting \
-       -I${top_srcdir}/lib/icinga
+       -I${top_srcdir}/lib \
+       -I${top_srcdir}/components
 
 libchecker_la_LDFLAGS = \
        $(BOOST_LDFLAGS) \
index 2ee6cb56d418eb1757cecd4267de303a7799ce8a..136e63cd0556231cb48c4f78b2bdb374d0760d6d 100644 (file)
  ******************************************************************************/
 
 #include "i2-checker.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include <boost/exception/diagnostic_information.hpp>
 
 using namespace icinga;
 
@@ -66,7 +70,7 @@ void CheckerComponent::CheckThreadProc(void)
        boost::mutex::scoped_lock lock(m_Mutex);
 
        for (;;) {
-               typedef nth_index<ServiceSet, 1>::type CheckTimeView;
+               typedef boost::multi_index::nth_index<ServiceSet, 1>::type CheckTimeView;
                CheckTimeView& idx = boost::get<1>(m_IdleServices);
 
                while (idx.begin() == idx.end() && !m_Stopped)
@@ -102,14 +106,14 @@ void CheckerComponent::CheckThreadProc(void)
 
                if (!service->GetForceNextCheck()) {
                        if (!service->GetEnableActiveChecks()) {
-                               Logger::Write(LogDebug, "checker", "Skipping check for service '" + service->GetName() + "': active checks are disabled");
+                               Log(LogDebug, "checker", "Skipping check for service '" + service->GetName() + "': active checks are disabled");
                                check = false;
                        }
 
                        TimePeriod::Ptr tp = service->GetCheckPeriod();
 
                        if (tp && !tp->IsInside(Utility::GetTime())) {
-                               Logger::Write(LogDebug, "checker", "Skipping check for service '" + service->GetName() + "': not in check_period");
+                               Log(LogDebug, "checker", "Skipping check for service '" + service->GetName() + "': not in check_period");
                                check = false;
                        }
                }
@@ -118,7 +122,7 @@ void CheckerComponent::CheckThreadProc(void)
                if (!check) {
                        service->UpdateNextCheck();
 
-                       typedef nth_index<ServiceSet, 1>::type CheckTimeView;
+                       typedef boost::multi_index::nth_index<ServiceSet, 1>::type CheckTimeView;
                        CheckTimeView& idx = boost::get<1>(m_IdleServices);
 
                        idx.insert(service);
@@ -136,13 +140,13 @@ void CheckerComponent::CheckThreadProc(void)
                        service->SetForceNextCheck(false);
                }
 
-               Logger::Write(LogDebug, "checker", "Executing service check for '" + service->GetName() + "'");
+               Log(LogDebug, "checker", "Executing service check for '" + service->GetName() + "'");
 
                try {
                        CheckerComponent::Ptr self = GetSelf();
                        service->BeginExecuteCheck(boost::bind(&CheckerComponent::CheckCompletedHandler, self, service));
-               } catch (const exception& ex) {
-                       Logger::Write(LogCritical, "checker", "Exception occured while checking service '" + service->GetName() + "': " + diagnostic_information(ex));
+               } catch (const std::exception& ex) {
+                       Log(LogCritical, "checker", "Exception occured while checking service '" + service->GetName() + "': " + boost::diagnostic_information(ex));
                }
 
                lock.lock();
@@ -164,14 +168,14 @@ void CheckerComponent::CheckCompletedHandler(const Service::Ptr& service)
                m_CV.notify_all();
        }
 
-       Logger::Write(LogDebug, "checker", "Check finished for service '" + service->GetName() + "'");
+       Log(LogDebug, "checker", "Check finished for service '" + service->GetName() + "'");
 }
 
 void CheckerComponent::ResultTimerHandler(void)
 {
-       Logger::Write(LogDebug, "checker", "ResultTimerHandler entered.");
+       Log(LogDebug, "checker", "ResultTimerHandler entered.");
 
-       stringstream msgbuf;
+       std::ostringstream msgbuf;
 
        {
                boost::mutex::scoped_lock lock(m_Mutex);
@@ -179,7 +183,7 @@ void CheckerComponent::ResultTimerHandler(void)
                msgbuf << "Pending services: " << m_PendingServices.size() << "; Idle services: " << m_IdleServices.size();
        }
 
-       Logger::Write(LogInformation, "checker", msgbuf.str());
+       Log(LogInformation, "checker", msgbuf.str());
 }
 
 void CheckerComponent::CheckerChangedHandler(const Service::Ptr& service)
@@ -206,7 +210,7 @@ void CheckerComponent::NextCheckChangedHandler(const Service::Ptr& service)
        boost::mutex::scoped_lock lock(m_Mutex);
 
        /* remove and re-insert the service from the set in order to force an index update */
-       typedef nth_index<ServiceSet, 0>::type ServiceView;
+       typedef boost::multi_index::nth_index<ServiceSet, 0>::type ServiceView;
        ServiceView& idx = boost::get<0>(m_IdleServices);
 
        ServiceView::iterator it = idx.find(service);
index 0de4306ae9ee20a569c2ff4e53ef1da8b4a9c451..d3139b91ebd7736e8d3a22ee6a782ec64f269749 100644 (file)
 #ifndef CHECKERCOMPONENT_H
 #define CHECKERCOMPONENT_H
 
+#include "base/dynamicobject.h"
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/key_extractors.hpp>
+
 namespace icinga
 {
 
@@ -55,11 +60,11 @@ public:
        typedef shared_ptr<CheckerComponent> Ptr;
        typedef weak_ptr<CheckerComponent> WeakPtr;
 
-       typedef multi_index_container<
+       typedef boost::multi_index_container<
                Service::Ptr,
-               indexed_by<
-                       ordered_unique<identity<Service::Ptr> >,
-                       ordered_non_unique<ServiceNextCheckExtractor>
+               boost::multi_index::indexed_by<
+                       boost::multi_index::ordered_unique<boost::multi_index::identity<Service::Ptr> >,
+                       boost::multi_index::ordered_non_unique<ServiceNextCheckExtractor>
                >
        > ServiceSet;
 
index f21721915f27e0d4f07b747b1b6529afce18e6f0..733bcacfb1b9addd679132a3e7331f579c19d74b 100644 (file)
@@ -26,9 +26,9 @@
  * The Checker component executes service checks.
  */
 
-#include <i2-base.h>
-#include <i2-icinga.h>
+#include "base/i2-base.h"
+#include "icinga/i2-icinga.h"
 
-#include "checkercomponent.h"
+#include "checker/checkercomponent.h"
 
 #endif /* I2CHECKER_H */
index d860666e40772058c1308d396faa50d89b10db4f..5c5851f8a93841c7ca917676d250a3588467df94 100644 (file)
@@ -17,10 +17,8 @@ libcompat_la_SOURCES = \
 
 libcompat_la_CPPFLAGS = \
        $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/lib/base \
-       -I${top_srcdir}/lib/config \
-       -I${top_srcdir}/lib/remoting \
-       -I${top_srcdir}/lib/icinga
+       -I${top_srcdir}/lib \
+       -I${top_srcdir}/components
 
 libcompat_la_LDFLAGS = \
        $(BOOST_LDFLAGS) \
index eea8ed77e8a16384fb2d79c7d1ae3ba634d04a56..d77dd7c746798b25889b64adc157d232d7b695fc 100644 (file)
  ******************************************************************************/
 
 #include "i2-compat.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include "base/exception.h"
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
+#include <boost/exception/diagnostic_information.hpp>
 
 using namespace icinga;
 
@@ -171,13 +178,13 @@ void CompatComponent::CommandPipeThread(const String& commandPath)
                        String command = line;
 
                        try {
-                               Logger::Write(LogInformation, "compat", "Executing external command: " + command);
+                               Log(LogInformation, "compat", "Executing external command: " + command);
 
                                ExternalCommandProcessor::Execute(command);
-                       } catch (const exception& ex) {
-                               stringstream msgbuf;
-                               msgbuf << "External command failed: " << diagnostic_information(ex);
-                               Logger::Write(LogWarning, "compat", msgbuf.str());
+                       } catch (const std::exception& ex) {
+                               std::ostringstream msgbuf;
+                               msgbuf << "External command failed: " << boost::diagnostic_information(ex);
+                               Log(LogWarning, "compat", msgbuf.str());
                        }
                }
 
@@ -297,7 +304,7 @@ void CompatComponent::DumpHostObject(ostream& fp, const Host::Ptr& host)
           << "\t" << "host_name" << "\t" << host->GetName() << "\n"
           << "\t" << "display_name" << "\t" << host->GetDisplayName() << "\n";
 
-       set<Host::Ptr> parents = host->GetParentHosts();
+       std::set<Host::Ptr> parents = host->GetParentHosts();
 
        if (!parents.empty()) {
                fp << "\t" << "parents" << "\t";
@@ -472,7 +479,7 @@ void CompatComponent::DumpServiceObject(ostream& fp, const Service::Ptr& service
  */
 void CompatComponent::StatusTimerHandler(void)
 {
-       Logger::Write(LogInformation, "compat", "Writing compat status information");
+       Log(LogInformation, "compat", "Writing compat status information");
 
        String statuspath = GetStatusPath();
        String objectspath = GetObjectsPath();
@@ -526,12 +533,12 @@ void CompatComponent::StatusTimerHandler(void)
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Host")) {
                Host::Ptr host = static_pointer_cast<Host>(object);
 
-               stringstream tempstatusfp;
+               std::ostringstream tempstatusfp;
                tempstatusfp << std::fixed;
                DumpHostStatus(tempstatusfp, host);
                statusfp << tempstatusfp.str();
 
-               stringstream tempobjectfp;
+               std::ostringstream tempobjectfp;
                tempobjectfp << std::fixed;
                DumpHostObject(tempobjectfp, host);
                objectfp << tempobjectfp.str();
@@ -540,7 +547,7 @@ void CompatComponent::StatusTimerHandler(void)
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("HostGroup")) {
                HostGroup::Ptr hg = static_pointer_cast<HostGroup>(object);
 
-               stringstream tempobjectfp;
+               std::ostringstream tempobjectfp;
                tempobjectfp << std::fixed;
 
                tempobjectfp << "define hostgroup {" << "\n"
@@ -559,12 +566,12 @@ void CompatComponent::StatusTimerHandler(void)
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
                Service::Ptr service = static_pointer_cast<Service>(object);
 
-               stringstream tempstatusfp;
+               std::ostringstream tempstatusfp;
                tempstatusfp << std::fixed;
                DumpServiceStatus(tempstatusfp, service);
                statusfp << tempstatusfp.str();
 
-               stringstream tempobjectfp;
+               std::ostringstream tempobjectfp;
                tempobjectfp << std::fixed;
                DumpServiceObject(tempobjectfp, service);
                objectfp << tempobjectfp.str();
@@ -573,7 +580,7 @@ void CompatComponent::StatusTimerHandler(void)
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("ServiceGroup")) {
                ServiceGroup::Ptr sg = static_pointer_cast<ServiceGroup>(object);
 
-               stringstream tempobjectfp;
+               std::ostringstream tempobjectfp;
                tempobjectfp << std::fixed;
 
                tempobjectfp << "define servicegroup {" << "\n"
@@ -583,7 +590,7 @@ void CompatComponent::StatusTimerHandler(void)
 
                tempobjectfp << "\t" << "members" << "\t";
 
-               vector<String> sglist;
+               std::vector<String> sglist;
                BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
                        Host::Ptr host = service->GetHost();
 
@@ -605,7 +612,7 @@ void CompatComponent::StatusTimerHandler(void)
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("User")) {
                User::Ptr user = static_pointer_cast<User>(object);
 
-               stringstream tempobjectfp;
+               std::ostringstream tempobjectfp;
                tempobjectfp << std::fixed;
 
                tempobjectfp << "define contact {" << "\n"
@@ -624,7 +631,7 @@ void CompatComponent::StatusTimerHandler(void)
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("UserGroup")) {
                UserGroup::Ptr ug = static_pointer_cast<UserGroup>(object);
 
-               stringstream tempobjectfp;
+               std::ostringstream tempobjectfp;
                tempobjectfp << std::fixed;
 
                tempobjectfp << "define contactgroup {" << "\n"
index 9c412dd10db49e4764cbb393064d6343722e7906..ed37e196ed3e665da96500466e69ed585a1d26a4 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef COMPATCOMPONENT_H
 #define COMPATCOMPONENT_H
 
+#include "base/objectlock.h"
+
 namespace icinga
 {
 
@@ -58,12 +60,12 @@ private:
        String GetLogPath(void) const;
        String GetCommandPath(void) const;
 
-       void DumpDowntimes(ostream& fp, const Service::Ptr& owner, CompatObjectType type);
-       void DumpComments(ostream& fp, const Service::Ptr& owner, CompatObjectType type);
-       void DumpHostStatus(ostream& fp, const Host::Ptr& host);
-       void DumpHostObject(ostream& fp, const Host::Ptr& host);
+       void DumpDowntimes(std::ostream& fp, const Service::Ptr& owner, CompatObjectType type);
+       void DumpComments(std::ostream& fp, const Service::Ptr& owner, CompatObjectType type);
+       void DumpHostStatus(std::ostream& fp, const Host::Ptr& host);
+       void DumpHostObject(std::ostream& fp, const Host::Ptr& host);
 
-       void DumpServiceStatusAttrs(ostream& fp, const Service::Ptr& service, CompatObjectType type);
+       void DumpServiceStatusAttrs(std::ostream& fp, const Service::Ptr& service, CompatObjectType type);
 
        template<typename T>
        void DumpNameList(ostream& fp, const T& list)
@@ -96,8 +98,8 @@ private:
                }
        }
 
-       void DumpServiceStatus(ostream& fp, const Service::Ptr& service);
-       void DumpServiceObject(ostream& fp, const Service::Ptr& service);
+       void DumpServiceStatus(std::ostream& fp, const Service::Ptr& service);
+       void DumpServiceObject(std::ostream& fp, const Service::Ptr& service);
 
        void StatusTimerHandler(void);
 };
index 2b64313a1a678b8eb1b4104538bf2b64cf53792c..d50747e026aa8dc598d7e65c71811a9cf1cec660 100644 (file)
@@ -26,9 +26,9 @@
  * The compat component implements compatibility functionality for Icinga 1.x.
  */
 
-#include <i2-base.h>
-#include <i2-remoting.h>
-#include <i2-icinga.h>
+#include "base/i2-base.h"
+#include "remoting/i2-remoting.h"
+#include "icinga/i2-icinga.h"
 
 #include <fstream>
 
index eefa4a044da7c532427f853d463e1ac0acf00138..70596bd820bae91cb82043e99473ae50d2d86ded 100644 (file)
@@ -17,10 +17,8 @@ libdelegation_la_SOURCES = \
 
 libdelegation_la_CPPFLAGS = \
        $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/lib/base \
-       -I${top_srcdir}/lib/config \
-       -I${top_srcdir}/lib/remoting \
-       -I${top_srcdir}/lib/icinga
+       -I${top_srcdir}/lib \
+       -I${top_srcdir}/components
 
 libdelegation_la_LDFLAGS = \
        $(BOOST_LDFLAGS) \
index f7d51db74913d2770b3ecb0cc7d45e4dce27d9ad..0475a2b7b6187b101dc302774a452a2f74306ed1 100644 (file)
  ******************************************************************************/
 
 #include "i2-delegation.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
 #include <algorithm>
+#include "base/dynamictype.h"
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -43,9 +47,9 @@ bool DelegationComponent::IsEndpointChecker(const Endpoint::Ptr& endpoint)
        return (endpoint->HasSubscription("checker"));
 }
 
-set<Endpoint::Ptr> DelegationComponent::GetCheckerCandidates(const Service::Ptr& service) const
+std::set<Endpoint::Ptr> DelegationComponent::GetCheckerCandidates(const Service::Ptr& service) const
 {
-       set<Endpoint::Ptr> candidates;
+       std::set<Endpoint::Ptr> candidates;
 
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Endpoint")) {
                Endpoint::Ptr endpoint = dynamic_pointer_cast<Endpoint>(object);
@@ -75,7 +79,7 @@ set<Endpoint::Ptr> DelegationComponent::GetCheckerCandidates(const Service::Ptr&
 
 void DelegationComponent::DelegationTimerHandler(void)
 {
-       map<Endpoint::Ptr, int> histogram;
+       std::map<Endpoint::Ptr, int> histogram;
 
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Endpoint")) {
                Endpoint::Ptr endpoint = dynamic_pointer_cast<Endpoint>(object);
@@ -83,7 +87,7 @@ void DelegationComponent::DelegationTimerHandler(void)
                histogram[endpoint] = 0;
        }
 
-       vector<Service::Ptr> services;
+       std::vector<Service::Ptr> services;
 
        /* build "checker -> service count" histogram */
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
@@ -115,15 +119,15 @@ void DelegationComponent::DelegationTimerHandler(void)
 
                Endpoint::Ptr oldEndpoint = Endpoint::GetByName(checker);
 
-               set<Endpoint::Ptr> candidates = GetCheckerCandidates(service);
+               std::set<Endpoint::Ptr> candidates = GetCheckerCandidates(service);
 
                int avg_services = 0, overflow_tolerance = 0;
-               vector<Endpoint::Ptr>::iterator cit;
+               std::vector<Endpoint::Ptr>::iterator cit;
 
                if (!candidates.empty()) {
-                       stringstream msgbuf;
+                       std::ostringstream msgbuf;
                        msgbuf << "Service: " << service->GetName() << ", candidates: " << candidates.size();
-                       Logger::Write(LogDebug, "delegation", msgbuf.str());
+                       Log(LogDebug, "delegation", msgbuf.str());
 
                        BOOST_FOREACH(const Endpoint::Ptr& candidate, candidates) {
                                avg_services += histogram[candidate];
@@ -192,7 +196,7 @@ void DelegationComponent::DelegationTimerHandler(void)
 
                                service->ProcessCheckResult(cr);
 
-                               Logger::Write(LogWarning, "delegation", "Can't delegate service: " + service->GetName());
+                               Log(LogWarning, "delegation", "Can't delegate service: " + service->GetName());
                        }
 
                        continue;
@@ -204,12 +208,12 @@ void DelegationComponent::DelegationTimerHandler(void)
        Endpoint::Ptr endpoint;
        int count;
        BOOST_FOREACH(tie(endpoint, count), histogram) {
-               stringstream msgbuf;
+               std::ostringstream msgbuf;
                msgbuf << "histogram: " << endpoint->GetName() << " - " << count;
-               Logger::Write(LogInformation, "delegation", msgbuf.str());
+               Log(LogInformation, "delegation", msgbuf.str());
        }
 
-       stringstream msgbuf;
+       std::ostringstream msgbuf;
        msgbuf << "Updated delegations for " << delegated << " services";
-       Logger::Write(LogInformation, "delegation", msgbuf.str());
+       Log(LogInformation, "delegation", msgbuf.str());
 }
index 2bbf9fa72790b141e226c57f7c1d04da3aedc939..538bcb625968d8fdf67e79056ad21bd7c7765438 100644 (file)
@@ -38,7 +38,7 @@ private:
 
        void DelegationTimerHandler(void);
 
-       set<Endpoint::Ptr> GetCheckerCandidates(const Service::Ptr& service) const;
+       std::set<Endpoint::Ptr> GetCheckerCandidates(const Service::Ptr& service) const;
 
        static bool IsEndpointChecker(const Endpoint::Ptr& endpoint);
 };
index 91e633ee55f6f01f2769324d94e8f04444e4fd15..62502fa94027138aa40b60f3e540fe38818cef0e 100644 (file)
@@ -26,9 +26,9 @@
  * The Delegation component delegates service checks to the checker component.
  */
 
-#include <i2-base.h>
-#include <i2-icinga.h>
+#include "base/i2-base.h"
+#include "icinga/i2-icinga.h"
 
-#include "delegationcomponent.h"
+#include "delegation/delegationcomponent.h"
 
 #endif /* I2DELEGATION_H */
index ae4d86a3d42ef63bd9adc95baae192dfe1282bad..58dd52055181b15f5e0533b4d6a13fd31641d30f 100644 (file)
@@ -17,10 +17,8 @@ libdemo_la_SOURCES = \
 
 libdemo_la_CPPFLAGS = \
        $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/lib/base \
-       -I${top_srcdir}/lib/config \
-       -I${top_srcdir}/lib/remoting \
-       -I${top_srcdir}/lib/icinga
+       -I${top_srcdir}/lib \
+       -I${top_srcdir}/components
 
 libdemo_la_LDFLAGS = \
        $(BOOST_LDFLAGS) \
index d9f7dbf270963a2a60a7c8ce8417f6a9bd40a530..2c89455c05f44fbcb3dc6c18ae8efeed3fd0b470 100644 (file)
@@ -18,6 +18,9 @@
  ******************************************************************************/
 
 #include "i2-demo.h"
+#include "base/dynamictype.h"
+#include "base/logger_fwd.h"
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 
@@ -58,7 +61,7 @@ void DemoComponent::Stop(void)
  */
 void DemoComponent::DemoTimerHandler(void)
 {
-       Logger::Write(LogInformation, "demo", "Sending multicast 'hello world' message.");
+       Log(LogInformation, "demo", "Sending multicast 'hello world' message.");
 
        RequestMessage request;
        request.SetMethod("demo::HelloWorld");
@@ -72,6 +75,6 @@ void DemoComponent::DemoTimerHandler(void)
 void DemoComponent::HelloWorldRequestHandler(const Endpoint::Ptr& sender,
     const RequestMessage&)
 {
-       Logger::Write(LogInformation, "demo", "Got 'hello world' from identity=" +
+       Log(LogInformation, "demo", "Got 'hello world' from identity=" +
            (sender ? sender->GetName() : "(anonymous)"));
 }
index 1daf3f1b5709636c58ec97cdd7b9053e189556be..b5a94187d67f91f9815485a0fe2bd2ea5f6d827c 100644 (file)
  * The demo component periodically sends demo messages.
  */
 
-#include <i2-base.h>
-#include <i2-remoting.h>
-#include <i2-icinga.h>
+#include "base/i2-base.h"
+#include "remoting/i2-remoting.h"
+#include "icinga/i2-icinga.h"
 
-#include "democomponent.h"
+#include "demo/democomponent.h"
 
 #endif /* I2DEMO_H */
index ffa59e53df6b5df62be89d06e5bde99e556751e4..80d64aae415e96073e62ac26b5082bf4f07645e2 100644 (file)
@@ -51,10 +51,8 @@ liblivestatus_la_SOURCES = \
 
 liblivestatus_la_CPPFLAGS = \
        $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/lib/base \
-       -I${top_srcdir}/lib/config \
-       -I${top_srcdir}/lib/remoting \
-       -I${top_srcdir}/lib/icinga
+       -I${top_srcdir}/lib \
+       -I${top_srcdir}/components
 
 liblivestatus_la_LDFLAGS = \
        $(BOOST_LDFLAGS) \
index 087f0d3d0e898ede64a50850ea67d24403f24906..e68a958eb2ce7c95e4f174f77c4d77db847206dc 100644 (file)
@@ -18,6 +18,7 @@
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 using namespace livestatus;
index d3eaf4bab87940643f688ce63c0d0db5c2991a40..0b306597afa19d5f9cf82a73f32e1ecf77966e92 100644 (file)
@@ -18,6 +18,8 @@
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include "base/convert.h"
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 using namespace livestatus;
@@ -42,7 +44,7 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Object::Ptr& object)
 
                        return false; /* Item not found in list. */
                } else {
-                       BOOST_THROW_EXCEPTION(invalid_argument("Invalid operator for column '" + m_Column + "': " + m_Operator + " (expected '>=')."));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid operator for column '" + m_Column + "': " + m_Operator + " (expected '>=')."));
                }
        } else {
                if (m_Operator == "=") {
@@ -77,7 +79,7 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Object::Ptr& object)
                        else
                                return (static_cast<String>(value) >= m_Operand);
                } else {
-                       BOOST_THROW_EXCEPTION(invalid_argument("Unknown operator for column '" + m_Column + "': " + m_Operator));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("Unknown operator for column '" + m_Column + "': " + m_Operator));
                }
        }
 
index ce835802e37597f027a6ccfc34b7f6f9013b98e5..3f8072ae59f546ad3433226d6e5c42bdde8f7fab 100644 (file)
@@ -28,4 +28,4 @@ CombinerFilter::CombinerFilter(void)
 void CombinerFilter::AddSubFilter(const Filter::Ptr& filter)
 {
        m_Filters.push_back(filter);
-}
\ No newline at end of file
+}
index 0e92adeb1d1042142f06bec4e2c6f5543c256c28..8cb55a1a5feff4b36bab7aaff37017f80f330e5a 100644 (file)
@@ -37,7 +37,7 @@ public:
        void AddSubFilter(const Filter::Ptr& filter);
 
 protected:
-       vector<Filter::Ptr> m_Filters;
+       std::vector<Filter::Ptr> m_Filters;
 };
 
 }
index ed272052397c049d2a652efe9c16a2be9a512be8..1d01601e6293c8886d104f64f477ec8f7af20b3f 100644 (file)
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
 #include <boost/tuple/tuple.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 using namespace livestatus;
index b08a08ea859b128edcc94b6067d9ae48737b012a..5d19edaedf94eb4ceb3147486d7fbe87c2e761aa 100644 (file)
@@ -18,6 +18,9 @@
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include "base/dynamictype.h"
+#include "base/logger_fwd.h"
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 using namespace livestatus;
@@ -60,7 +63,7 @@ String LivestatusComponent::GetSocketPath(void) const
 
 void LivestatusComponent::NewClientHandler(const Socket::Ptr& client)
 {
-       Logger::Write(LogInformation, "livestatus", "Client connected");
+       Log(LogInformation, "livestatus", "Client connected");
 
        LivestatusConnection::Ptr lconnection = boost::make_shared<LivestatusConnection>(client);
        lconnection->OnClosed.connect(boost::bind(&LivestatusComponent::ClientClosedHandler, this, _1));
@@ -73,6 +76,6 @@ void LivestatusComponent::ClientClosedHandler(const Connection::Ptr& connection)
 {
        LivestatusConnection::Ptr lconnection = static_pointer_cast<LivestatusConnection>(connection);
 
-       Logger::Write(LogInformation, "livestatus", "Client disconnected");
+       Log(LogInformation, "livestatus", "Client disconnected");
        m_Connections.erase(lconnection);
 }
index c00f7b6d3475f82f5f013249ba47cf133cb2026d..dbb868b693f2f6ea8cc4b01f1908016b5dd470a4 100644 (file)
@@ -39,7 +39,7 @@ private:
        Attribute<String> m_SocketPath;
 
        Socket::Ptr m_Listener;
-       set<LivestatusConnection::Ptr> m_Connections;
+       std::set<LivestatusConnection::Ptr> m_Connections;
 
        void NewClientHandler(const Socket::Ptr& client);
        void ClientClosedHandler(const Connection::Ptr& connection);
index ceca93cfb6cb9500d1f866582f5de81304024361..224337ffc193103320b79a59ff552b5ea361ce68 100644 (file)
@@ -18,6 +18,7 @@
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 using namespace livestatus;
index 029b4f0fa8bc6f6afcc156099bce559c24e47ade..e37887f176407ef3570e66023fa9d6800a88bc07 100644 (file)
@@ -32,7 +32,7 @@ public:
        LivestatusConnection(const Stream::Ptr& stream);
 
 protected:
-       vector<String> m_Lines;
+       std::vector<String> m_Lines;
 
        virtual void ProcessData(void);
 };
index 39638a97af4d7aa4ab2e2609db4544b426f598c2..834986c3cd515e47da0c1ad120803db37ea2a5b7 100644 (file)
@@ -18,6 +18,8 @@
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include "base/dynamictype.h"
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 using namespace livestatus;
index 473bd3481cbb0d4073ea25403db15d3a3ab4e84b..f01d313457ecd181f98fc5f48a60f41141d9333f 100644 (file)
@@ -18,6 +18,8 @@
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include "base/dynamictype.h"
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 using namespace livestatus;
index 1e1b111381a683ceaf6f6978d1a80c0e5b20ab61..684cc51c6d583d3cdeb80cac8437fc17120269d9 100644 (file)
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
 #include <boost/tuple/tuple.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 using namespace livestatus;
index cb64f2411c9877f6befde6c67d271aafa74f5214..e6fcd3c99b7e3cd839f4dd8e9e1755ab68632d88 100644 (file)
@@ -18,6 +18,8 @@
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include "base/dynamictype.h"
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 using namespace livestatus;
index db0fe09939b42d3b3814df9079c2597561b8653f..8d0994fb3f0b4ff3c45efa7d2eacf4292d82a3a8 100644 (file)
  * The livestatus component implements livestatus queries.
  */
 
-#include <i2-base.h>
-#include <i2-remoting.h>
-#include <i2-icinga.h>
+#include "base/i2-base.h"
+#include "remoting/i2-remoting.h"
+#include "icinga/i2-icinga.h"
 
 using namespace icinga;
 
-#include "connection.h"
-#include "column.h"
-#include "table.h"
-#include "filter.h"
-#include "combinerfilter.h"
-#include "orfilter.h"
-#include "andfilter.h"
-#include "negatefilter.h"
-#include "attributefilter.h"
-#include "query.h"
-#include "statustable.h"
-#include "contactgroupstable.h"
-#include "contactstable.h"
-#include "hoststable.h"
-#include "servicestable.h"
-#include "commentstable.h"
-#include "downtimestable.h"
-#include "component.h"
+#include "livestatus/connection.h"
+#include "livestatus/column.h"
+#include "livestatus/table.h"
+#include "livestatus/filter.h"
+#include "livestatus/combinerfilter.h"
+#include "livestatus/orfilter.h"
+#include "livestatus/andfilter.h"
+#include "livestatus/negatefilter.h"
+#include "livestatus/attributefilter.h"
+#include "livestatus/query.h"
+#include "livestatus/statustable.h"
+#include "livestatus/contactgroupstable.h"
+#include "livestatus/contactstable.h"
+#include "livestatus/hoststable.h"
+#include "livestatus/servicestable.h"
+#include "livestatus/commentstable.h"
+#include "livestatus/downtimestable.h"
+#include "livestatus/component.h"
 
 #endif /* I2LIVESTATUS_H */
index a05bdf3076457ff56a3f10e0fbc08983371af431..f142a77b3a7ce9a01720d8655d0037e70bd2058f 100644 (file)
@@ -18,6 +18,7 @@
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 using namespace livestatus;
index 45280b5917ff8b5f78d2851e2ebedbee07198650..302a7541e5afaa9b1a79245ab92d090ae869412c 100644 (file)
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include "base/convert.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
 #include <boost/algorithm/string/classification.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 using namespace livestatus;
 
-Query::Query(const vector<String>& lines)
+Query::Query(const std::vector<String>& lines)
        : m_KeepAlive(false), m_OutputFormat("csv"), m_ColumnHeaders(true), m_Limit(-1)
 {
        String line = lines[0];
@@ -31,7 +36,7 @@ Query::Query(const vector<String>& lines)
        size_t sp_index = line.FindFirstOf(" ");
 
        if (sp_index == String::NPos)
-               BOOST_THROW_EXCEPTION(runtime_error("Livestatus header must contain a verb."));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Livestatus header must contain a verb."));
 
        String verb = line.SubStr(0, sp_index);
        String target = line.SubStr(sp_index + 1);
@@ -49,7 +54,7 @@ Query::Query(const vector<String>& lines)
                return;
        }
 
-       deque<Filter::Ptr> filters, stats;
+       std::deque<Filter::Ptr> filters, stats;
 
        for (unsigned int i = 1; i < lines.size(); i++) {
                line = lines[i];
@@ -67,7 +72,7 @@ Query::Query(const vector<String>& lines)
                else if (header == "ColumnHeaders")
                        m_ColumnHeaders = (params == "on");
                else if (header == "Filter" || header == "Stats") {
-                       vector<String> tokens = params.Split(boost::is_any_of(" "));
+                       std::vector<String> tokens = params.Split(boost::is_any_of(" "));
 
                        if (tokens.size() == 2)
                                tokens.push_back("");
@@ -101,10 +106,10 @@ Query::Query(const vector<String>& lines)
                        if (negate)
                                filter = boost::make_shared<NegateFilter>(filter);
 
-                       deque<Filter::Ptr>& deq = (header == "Filter") ? filters : stats;
+                       std::deque<Filter::Ptr>& deq = (header == "Filter") ? filters : stats;
                        deq.push_back(filter);
                } else if (header == "Or" || header == "And") {
-                       deque<Filter::Ptr>& deq = (header == "Or" || header == "And") ? filters : stats;
+                       std::deque<Filter::Ptr>& deq = (header == "Or" || header == "And") ? filters : stats;
 
                        int num = Convert::ToLong(params);
                        CombinerFilter::Ptr filter;
@@ -128,7 +133,7 @@ Query::Query(const vector<String>& lines)
 
                        deq.push_back(filter);
                } else if (header == "Negate" || header == "StatsNegate") {
-                       deque<Filter::Ptr>& deq = (header == "Negate") ? filters : stats;
+                       std::deque<Filter::Ptr>& deq = (header == "Negate") ? filters : stats;
 
                        if (deq.empty()) {
                                m_Verb = "ERROR";
@@ -155,7 +160,7 @@ Query::Query(const vector<String>& lines)
        m_Stats.swap(stats);
 }
 
-void Query::PrintResultSet(ostream& fp, const vector<String>& columns, const Array::Ptr& rs)
+void Query::PrintResultSet(ostream& fp, const std::vector<String>& columns, const Array::Ptr& rs)
 {
        if (m_OutputFormat == "csv" && m_Columns.size() == 0 && m_ColumnHeaders) {
                bool first = true;
@@ -197,7 +202,7 @@ void Query::PrintResultSet(ostream& fp, const vector<String>& columns, const Arr
 
 void Query::ExecuteGetHelper(const Stream::Ptr& stream)
 {
-       Logger::Write(LogInformation, "livestatus", "Table: " + m_Table);
+       Log(LogInformation, "livestatus", "Table: " + m_Table);
 
        Table::Ptr table = Table::GetByName(m_Table);
 
@@ -207,8 +212,8 @@ void Query::ExecuteGetHelper(const Stream::Ptr& stream)
                return;
        }
 
-       vector<Object::Ptr> objects = table->FilterRows(m_Filter);
-       vector<String> columns;
+       std::vector<Object::Ptr> objects = table->FilterRows(m_Filter);
+       std::vector<String> columns;
        
        if (m_Columns.size() > 0)
                columns = m_Columns;
@@ -230,7 +235,7 @@ void Query::ExecuteGetHelper(const Stream::Ptr& stream)
                        rs->Add(row);
                }
        } else {
-               vector<int> stats(m_Stats.size(), 0);
+               std::vector<int> stats(m_Stats.size(), 0);
 
                BOOST_FOREACH(const Object::Ptr& object, objects) {
                        int index = 0;
@@ -251,7 +256,7 @@ void Query::ExecuteGetHelper(const Stream::Ptr& stream)
                m_ColumnHeaders = false;
        }
 
-       stringstream result;
+       std::ostringstream result;
        PrintResultSet(result, columns, rs);
 
        SendResponse(stream, 200, result.str());
@@ -259,7 +264,7 @@ void Query::ExecuteGetHelper(const Stream::Ptr& stream)
 
 void Query::ExecuteCommandHelper(const Stream::Ptr& stream)
 {
-       Logger::Write(LogInformation, "livestatus", "Executing command: " + m_Command);
+       Log(LogInformation, "livestatus", "Executing command: " + m_Command);
        ExternalCommandProcessor::Execute(m_Command);
        SendResponse(stream, 200, "");
 }
@@ -292,7 +297,7 @@ void Query::PrintFixed16(const Stream::Ptr& stream, int code, const String& data
 void Query::Execute(const Stream::Ptr& stream)
 {
        try {
-       Logger::Write(LogInformation, "livestatus", "Executing livestatus query: " + m_Verb);
+       Log(LogInformation, "livestatus", "Executing livestatus query: " + m_Verb);
 
        if (m_Verb == "GET")
                ExecuteGetHelper(stream);
@@ -301,7 +306,7 @@ void Query::Execute(const Stream::Ptr& stream)
        else if (m_Verb == "ERROR")
                ExecuteErrorHelper(stream);
        else
-               BOOST_THROW_EXCEPTION(runtime_error("Invalid livestatus query verb."));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Invalid livestatus query verb."));
        } catch (const std::exception& ex) {
                SendResponse(stream, 452, boost::diagnostic_information(ex));
        }
index 2477c993f61f692f6811c4318a7af274b8aba19a..cab0dbb3aa948efb1b4a88a4a3049023948d2a64 100644 (file)
@@ -32,7 +32,7 @@ public:
        typedef shared_ptr<Query> Ptr;
        typedef weak_ptr<Query> WeakPtr;
 
-       Query(const vector<String>& lines);
+       Query(const std::vector<String>& lines);
 
        void Execute(const Stream::Ptr& stream);
 
@@ -43,10 +43,10 @@ private:
 
        /* Parameters for GET queries. */
        String m_Table;
-       vector<String> m_Columns;
+       std::vector<String> m_Columns;
 
        Filter::Ptr m_Filter;
-       deque<Filter::Ptr> m_Stats;
+       std::deque<Filter::Ptr> m_Stats;
 
        String m_OutputFormat;
        bool m_ColumnHeaders;
@@ -61,7 +61,7 @@ private:
        int m_ErrorCode;
        String m_ErrorMessage;
 
-       void PrintResultSet(ostream& fp, const vector<String>& columns, const Array::Ptr& rs);
+       void PrintResultSet(ostream& fp, const std::vector<String>& columns, const Array::Ptr& rs);
 
        void ExecuteGetHelper(const Stream::Ptr& stream);
        void ExecuteCommandHelper(const Stream::Ptr& stream);
index 97fe4e2973c0e478063c65672a27ff8a855c573c..f589ffe20aaa60f182f674588840229aeb894660 100644 (file)
@@ -18,6 +18,8 @@
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include "base/dynamictype.h"
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 using namespace livestatus;
index e35415c7b78057fb83f6c4ba9e5e2411f591c76e..d0f93c5dc8127c9732ae69ff580b43961fbd84be 100644 (file)
@@ -18,6 +18,7 @@
  ******************************************************************************/
 
 #include "i2-livestatus.h"
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 using namespace livestatus;
index c3fdeede450e151e45d119e837f225091eeaf210..aecc9c6986a13335f4ad0de1027fa9f8319d77cb 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "i2-livestatus.h"
 #include <boost/tuple/tuple.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 using namespace livestatus;
@@ -48,9 +50,9 @@ Table::Ptr Table::GetByName(const String& name)
 
 void Table::AddColumn(const String& name, const Column& column)
 {
-       pair<String, Column> item = make_pair(name, column);
+       std::pair<String, Column> item = std::make_pair(name, column);
 
-       pair<map<String, Column>::iterator, bool> ret = m_Columns.insert(item);
+       std::pair<std::map<String, Column>::iterator, bool> ret = m_Columns.insert(item);
 
        if (!ret.second)
                ret.first->second = column;
@@ -58,17 +60,17 @@ void Table::AddColumn(const String& name, const Column& column)
 
 Column Table::GetColumn(const String& name) const
 {
-       map<String, Column>::const_iterator it = m_Columns.find(name);
+       std::map<String, Column>::const_iterator it = m_Columns.find(name);
 
        if (it == m_Columns.end())
-               BOOST_THROW_EXCEPTION(invalid_argument("Column '" + name + "' does not exist."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Column '" + name + "' does not exist."));
 
        return it->second;
 }
 
-vector<String> Table::GetColumnNames(void) const
+std::vector<String> Table::GetColumnNames(void) const
 {
-       vector<String> names;
+       std::vector<String> names;
 
        String name;
        BOOST_FOREACH(boost::tie(name, boost::tuples::ignore), m_Columns) {
@@ -78,16 +80,16 @@ vector<String> Table::GetColumnNames(void) const
        return names;
 }
 
-vector<Object::Ptr> Table::FilterRows(const Filter::Ptr& filter)
+std::vector<Object::Ptr> Table::FilterRows(const Filter::Ptr& filter)
 {
-       vector<Object::Ptr> rs;
+       std::vector<Object::Ptr> rs;
 
        FetchRows(boost::bind(&Table::FilteredAddRow, this, boost::ref(rs), filter, _1));
 
        return rs;
 }
 
-void Table::FilteredAddRow(vector<Object::Ptr>& rs, const Filter::Ptr& filter, const Object::Ptr& object)
+void Table::FilteredAddRow(std::vector<Object::Ptr>& rs, const Filter::Ptr& filter, const Object::Ptr& object)
 {
        if (!filter || filter->Apply(GetSelf(), object))
                rs.push_back(object);
index ac35f893804f469e5ab6cdf50415e11abf8a4143..91f4dd0fdf811d5f62a67613211107fc234c2de0 100644 (file)
@@ -41,11 +41,11 @@ public:
        
        virtual String GetName(void) const = 0;
 
-       vector<Object::Ptr> FilterRows(const shared_ptr<Filter>& filter);
+       std::vector<Object::Ptr> FilterRows(const shared_ptr<Filter>& filter);
 
        void AddColumn(const String& name, const Column& column);
        Column GetColumn(const String& name) const;
-       vector<String> GetColumnNames(void) const;
+       std::vector<String> GetColumnNames(void) const;
 
 protected:
        Table(void);
@@ -59,9 +59,9 @@ protected:
        static Value EmptyDictionaryAccessor(const Object::Ptr&);
 
 private:
-       map<String, Column> m_Columns;
+       std::map<String, Column> m_Columns;
 
-       void FilteredAddRow(vector<Object::Ptr>& rs, const shared_ptr<Filter>& filter, const Object::Ptr& object);
+       void FilteredAddRow(std::vector<Object::Ptr>& rs, const shared_ptr<Filter>& filter, const Object::Ptr& object);
 };
 
 }
index fa643d3beecbfa0b30ca5b59c79c31e534de2e42..fd19df7c15adff701755e6b3a6e4162c8c2fbe72 100644 (file)
@@ -17,10 +17,8 @@ libnotification_la_SOURCES = \
 
 libnotification_la_CPPFLAGS = \
        $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/lib/base \
-       -I${top_srcdir}/lib/config \
-       -I${top_srcdir}/lib/remoting \
-       -I${top_srcdir}/lib/icinga
+       -I${top_srcdir}/lib \
+       -I${top_srcdir}/components
 
 libnotification_la_LDFLAGS = \
        $(BOOST_LDFLAGS) \
index 12d3b5eff932548147a47a31d9f0772af068f0fc..6b649bafee17d0379e69eb3618d20ab0b1ac5474 100644 (file)
  * The notification component is in charge of sending downtime notifications.
  */
 
-#include <i2-base.h>
-#include <i2-remoting.h>
-#include <i2-icinga.h>
+#include "base/i2-base.h"
+#include "remoting/i2-remoting.h"
+#include "icinga/i2-icinga.h"
 
-#include "notificationcomponent.h"
+#include "notification/notificationcomponent.h"
 
 #endif /* I2NOTIFICATION_H */
index da823f3d3d8d7b55276d80e7682a307125ba7b56..ba358e99f1e73e939c0adfbce68130a7dadd44b0 100644 (file)
  ******************************************************************************/
 
 #include "i2-notification.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
index b05ddf6b265f4b26b10c5022657d3980d1f473e2..02a883cbdc18a815bc7dc16ac325284ad90cb780 100644 (file)
@@ -17,10 +17,8 @@ libreplication_la_SOURCES = \
 
 libreplication_la_CPPFLAGS = \
        $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/lib/base \
-       -I${top_srcdir}/lib/config \
-       -I${top_srcdir}/lib/remoting \
-       -I${top_srcdir}/lib/icinga
+       -I${top_srcdir}/lib \
+       -I${top_srcdir}/components
 
 libreplication_la_LDFLAGS = \
        $(BOOST_LDFLAGS) \
index cefae32d50468f4ba6e76fa606e8453fd9b6e926..c1946c9f02876e28ad640f8ecdc8ff9bd7707c08 100644 (file)
  * Replicates Icinga 2 objects to remote instances.
  */
 
-#include <i2-base.h>
-#include <i2-remoting.h>
-#include <i2-icinga.h>
+#include "base/i2-base.h"
+#include "remoting/i2-remoting.h"
+#include "icinga/i2-icinga.h"
 
-#include "replicationcomponent.h"
+#include "replication/replicationcomponent.h"
 
 #endif /* I2REPLICATION_H */
index 559c1d2022855e62c68793e5db12ca35c230969d..a080775829615aab537e7807092e344de9f34838 100644 (file)
  ******************************************************************************/
 
 #include "i2-replication.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -94,7 +98,7 @@ void ReplicationComponent::EndpointConnectedHandler(const Endpoint::Ptr& endpoin
 
        DynamicType::Ptr type;
        BOOST_FOREACH(const DynamicType::Ptr& dt, DynamicType::GetTypes()) {
-               set<DynamicObject::Ptr> objects;
+               std::set<DynamicObject::Ptr> objects;
 
                {
                        ObjectLock olock(dt);
@@ -159,14 +163,14 @@ void ReplicationComponent::LocalObjectUnregisteredHandler(const DynamicObject::P
            MakeObjectMessage(object, "config::ObjectRemoved", 0, false));
 }
 
-void ReplicationComponent::TransactionClosingHandler(double tx, const set<DynamicObject::WeakPtr>& modifiedObjects)
+void ReplicationComponent::TransactionClosingHandler(double tx, const std::set<DynamicObject::WeakPtr>& modifiedObjects)
 {
        if (modifiedObjects.empty())
                return;
 
-       stringstream msgbuf;
+       std::ostringstream msgbuf;
        msgbuf << "Sending " << modifiedObjects.size() << " replication updates.";
-       Logger::Write(LogDebug, "replication", msgbuf.str());
+       Log(LogDebug, "replication", msgbuf.str());
 
        BOOST_FOREACH(const DynamicObject::WeakPtr& wobject, modifiedObjects) {
                DynamicObject::Ptr object = wobject.lock();
@@ -227,13 +231,13 @@ void ReplicationComponent::RemoteObjectUpdateHandler(const RequestMessage& reque
                        return;
                }
 
-               Logger::Write(LogDebug, "replication", "Received object from source: " + source);
+               Log(LogDebug, "replication", "Received object from source: " + source);
 
                object->SetSource(source);
                object->Register();
        } else {
                if (object->IsLocal())
-                       BOOST_THROW_EXCEPTION(invalid_argument("Replicated remote object is marked as local."));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("Replicated remote object is marked as local."));
 
                // TODO: disallow config updates depending on endpoint config
 
index 3ac10d9b9c145bfbfeb24b0e7a9165ee15de4919..3eea4be7fc6e38f471c1331c88db1c254da61bf9 100644 (file)
@@ -43,7 +43,7 @@ private:
 
        void LocalObjectRegisteredHandler(const DynamicObject::Ptr& object);
        void LocalObjectUnregisteredHandler(const DynamicObject::Ptr& object);
-       void TransactionClosingHandler(double tx, const set<DynamicObject::WeakPtr>& modifiedObjects);
+       void TransactionClosingHandler(double tx, const std::set<DynamicObject::WeakPtr>& modifiedObjects);
        void FlushObjectHandler(double tx, const DynamicObject::Ptr& object);
 
        void RemoteObjectUpdateHandler(const RequestMessage& request);
index 6a83d397b617ec315c497e1dcca0a36b5bb4d594..c24931cbcad44b6bf1d430ac4f0a283b14b9265c 100644 (file)
@@ -10,11 +10,8 @@ icinga2_CPPFLAGS = \
        -DI2_ICINGALAUNCHER_BUILD \
        $(LTDLINCL) \
        $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/lib/base \
-       -I${top_srcdir}/lib/config \
-       -I${top_srcdir}/lib/remoting \
-       -I${top_srcdir}/lib/icinga \
-       -I${top_srcdir}
+       -I${top_srcdir}/lib \
+       -I${top_srcdir}/components
 
 icinga2_LDFLAGS = \
        $(BOOST_LDFLAGS) \
index 64d6bea9ffecae658a19401f9dc02ca178feb18b..af35c0d767689867345d3d051cb81236a0110ec3 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include <i2-icinga.h>
+#include "base/i2-base.h"
+#include "config/i2-config.h"
+#include "base/application.h"
+#include "base/logger_fwd.h"
 #include <boost/program_options.hpp>
 #include <boost/tuple/tuple.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 #ifndef _WIN32
 #      include "icinga-version.h"
@@ -45,7 +50,7 @@ static bool LoadConfigFiles(bool validateOnly)
 
        ConfigCompilerContext::SetContext(&context);
 
-       BOOST_FOREACH(const String& configPath, g_AppParams["config"].as<vector<String> >()) {
+       BOOST_FOREACH(const String& configPath, g_AppParams["config"].as<std::vector<String> >()) {
                ConfigCompiler::CompileFile(configPath);
        }
 
@@ -73,10 +78,10 @@ static bool LoadConfigFiles(bool validateOnly)
 
        BOOST_FOREACH(const ConfigCompilerError& error, context.GetErrors()) {
                if (error.Warning) {
-                       Logger::Write(LogWarning, "icinga-app", "Config warning: " + error.Message);
+                       Log(LogWarning, "icinga-app", "Config warning: " + error.Message);
                } else {
                        hasError = true;
-                       Logger::Write(LogCritical, "icinga-app", "Config error: " + error.Message);
+                       Log(LogCritical, "icinga-app", "Config error: " + error.Message);
                }
        }
 
@@ -105,7 +110,7 @@ static bool LoadConfigFiles(bool validateOnly)
 static void ReloadConfigTimerHandler(void)
 {
        if (g_ReloadConfig) {
-               Logger::Write(LogInformation, "icinga-app", "Received SIGHUP. Reloading config files.");
+               Log(LogInformation, "icinga-app", "Received SIGHUP. Reloading config files.");
                LoadConfigFiles(false);
 
                g_ReloadConfig = false;
@@ -164,19 +169,19 @@ int main(int argc, char **argv)
        desc.add_options()
                ("help", "show this help message")
                ("version,V", "show version information")
-               ("library,l", po::value<vector<String> >(), "load a library")
-               ("include,I", po::value<vector<String> >(), "add include search directory")
-               ("config,c", po::value<vector<String> >(), "parse a configuration file")
+               ("library,l", po::value<std::vector<String> >(), "load a library")
+               ("include,I", po::value<std::vector<String> >(), "add include search directory")
+               ("config,c", po::value<std::vector<String> >(), "parse a configuration file")
                ("validate,v", "exit after validating the configuration")
                ("debug,x", "enable debugging")
        ;
 
        try {
                po::store(po::parse_command_line(argc, argv, desc), g_AppParams);
-       } catch (const exception& ex) {
-               stringstream msgbuf;
+       } catch (const std::exception& ex) {
+               std::ostringstream msgbuf;
                msgbuf << "Error while parsing command-line options: " << ex.what();
-               Logger::Write(LogCritical, "icinga-app", msgbuf.str());
+               Log(LogCritical, "icinga-app", msgbuf.str());
                return EXIT_FAILURE;
        }
 
@@ -218,14 +223,14 @@ int main(int argc, char **argv)
                return EXIT_SUCCESS;
        }
 
-       Logger::Write(LogInformation, "icinga-app", "Icinga application loader"
+       Log(LogInformation, "icinga-app", "Icinga application loader"
 #ifndef _WIN32
            " (version: " ICINGA_VERSION ")"
 #endif /* _WIN32 */
            );
 
        String searchDir = Application::GetPkgLibDir();
-       Logger::Write(LogInformation, "base", "Adding library search dir: " + searchDir);
+       Log(LogInformation, "base", "Adding library search dir: " + searchDir);
 
 #ifdef _WIN32
        SetDllDirectory(searchDir.CStr());
@@ -236,7 +241,7 @@ int main(int argc, char **argv)
        (void) Utility::LoadExtensionLibrary("icinga");
 
        if (g_AppParams.count("library")) {
-               BOOST_FOREACH(const String& libraryName, g_AppParams["library"].as<vector<String> >()) {
+               BOOST_FOREACH(const String& libraryName, g_AppParams["library"].as<std::vector<String> >()) {
                        (void) Utility::LoadExtensionLibrary(libraryName);
                }
        }
@@ -244,13 +249,13 @@ int main(int argc, char **argv)
        ConfigCompiler::AddIncludeSearchDir(Application::GetPkgDataDir());
 
        if (g_AppParams.count("include")) {
-               BOOST_FOREACH(const String& includePath, g_AppParams["include"].as<vector<String> >()) {
+               BOOST_FOREACH(const String& includePath, g_AppParams["include"].as<std::vector<String> >()) {
                        ConfigCompiler::AddIncludeSearchDir(includePath);
                }
        }
 
        if (g_AppParams.count("config") == 0) {
-               Logger::Write(LogCritical, "icinga-app", "You need to specify at least one config file (using the --config option).");
+               Log(LogCritical, "icinga-app", "You need to specify at least one config file (using the --config option).");
 
                return EXIT_FAILURE;
        }
@@ -261,14 +266,14 @@ int main(int argc, char **argv)
                return EXIT_FAILURE;
 
        if (validateOnly) {
-               Logger::Write(LogInformation, "icinga-app", "Finished validating the configuration file(s).");
+               Log(LogInformation, "icinga-app", "Finished validating the configuration file(s).");
                return EXIT_SUCCESS;
        }
 
        Application::Ptr app = Application::GetInstance();
 
        if (!app)
-               BOOST_THROW_EXCEPTION(runtime_error("Configuration must create an Application object."));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Configuration must create an Application object."));
 
 #ifndef _WIN32
        struct sigaction sa;
index b0d180d8af9f6a3601836432035713475ab80d55..059cb1119f8039fad77c418606f559d2757b10f5 100644 (file)
@@ -4,6 +4,9 @@
 pkglib_LTLIBRARIES =  \
        libbase.la
 
+EXTRA_DIST = \
+       i2-base.cpp
+
 libbase_la_SOURCES =  \
        application.cpp \
        application.h \
@@ -28,10 +31,10 @@ libbase_la_SOURCES =  \
        exception.h \
        fifo.cpp \
        fifo.h \
-       i2-base.cpp \
        i2-base.h \
        logger.cpp \
        logger.h \
+       logger_fwd.h \
        netstring.cpp \
        netstring.h \
        object.cpp \
@@ -92,6 +95,7 @@ libbase_la_CPPFLAGS = \
        $(LTDLINCL) \
        $(BOOST_CPPFLAGS) \
        $(OPENSSL_INCLUDES) \
+       -I${top_srcdir}/lib \
        -I${top_srcdir}/third-party/execvpe \
        -I${top_srcdir}/third-party/mmatch \
        -I${top_srcdir}/third-party/cJSON
index 17aad626a64db0a8faa547f1c3ffd056ed590795..dfd189fd91f8ab1d13ac85ac736303a9f5eb3d24 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/application.h"
+#include "base/stacktrace.h"
+#include "base/timer.h"
+#include "base/logger_fwd.h"
+#include "base/exception.h"
+#include "base/objectlock.h"
+#include <sstream>
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/thread/thread.hpp>
 #include <boost/bind.hpp>
+#include <boost/make_shared.hpp>
+#include <boost/foreach.hpp>
+#include <boost/exception/diagnostic_information.hpp>
 
 using namespace icinga;
 
@@ -41,7 +50,7 @@ Application::Application(const Dictionary::Ptr& serializedUpdate)
        : DynamicObject(serializedUpdate), m_PidFile(NULL)
 {
        if (!IsLocal())
-               BOOST_THROW_EXCEPTION(runtime_error("Application objects must be local."));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Application objects must be local."));
 
 #ifdef _WIN32
        /* disable GUI-based error messages for LoadLibrary() */
@@ -113,7 +122,7 @@ void Application::SetArgV(char **argv)
 void Application::ShutdownTimerHandler(void)
 {
        if (m_ShuttingDown) {
-               Logger::Write(LogInformation, "base", "Shutting down Icinga...");
+               Log(LogInformation, "base", "Shutting down Icinga...");
                Application::GetInstance()->OnShutdown();
 
                DynamicObject::DeactivateObjects();
@@ -160,11 +169,11 @@ void Application::TimeWatchThreadProc(void)
 
                if (abs(timeDiff) > 15) {
                        /* We made a significant jump in time. */
-                       stringstream msgbuf;
+                       std::ostringstream msgbuf;
                        msgbuf << "We jumped "
                               << (timeDiff < 0 ? "forward" : "backward")
                               << " in time: " << abs(timeDiff) << " seconds";
-                       Logger::Write(LogInformation, "base", msgbuf.str());
+                       Log(LogInformation, "base", msgbuf.str());
 
                        Timer::AdjustTimers(-timeDiff);
                }
@@ -218,7 +227,7 @@ String Application::GetExePath(const String& argv0)
        if (!foundSlash) {
                const char *pathEnv = getenv("PATH");
                if (pathEnv != NULL) {
-                       vector<String> paths;
+                       std::vector<String> paths;
                        boost::algorithm::split(paths, pathEnv, boost::is_any_of(":"));
 
                        bool foundPath = false;
@@ -234,7 +243,7 @@ String Application::GetExePath(const String& argv0)
 
                        if (!foundPath) {
                                executablePath.Clear();
-                               BOOST_THROW_EXCEPTION(runtime_error("Could not determine executable path."));
+                               BOOST_THROW_EXCEPTION(std::runtime_error("Could not determine executable path."));
                        }
                }
        }
@@ -375,7 +384,7 @@ void Application::ExceptionHandler(void)
                throw;
        } catch (const std::exception& ex) {
                std::cerr << std::endl
-                         << diagnostic_information(ex)
+                         << boost::diagnostic_information(ex)
                          << std::endl;
 
                has_trace = (boost::get_error_info<StackTraceErrorInfo>(ex) != NULL);
@@ -473,7 +482,7 @@ void Application::UpdatePidFile(const String& filename)
                m_PidFile = fopen(filename.CStr(), "w");
 
        if (m_PidFile == NULL)
-               BOOST_THROW_EXCEPTION(runtime_error("Could not open PID file '" + filename + "'"));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Could not open PID file '" + filename + "'"));
 
 #ifndef _WIN32
        int fd = fileno(m_PidFile);
@@ -481,7 +490,7 @@ void Application::UpdatePidFile(const String& filename)
        Utility::SetCloExec(fd);
 
        if (flock(fd, LOCK_EX | LOCK_NB) < 0) {
-               Logger::Write(LogCritical, "base", "Could not lock PID file. Make sure that only one instance of the application is running.");
+               Log(LogCritical, "base", "Could not lock PID file. Make sure that only one instance of the application is running.");
 
                _exit(EXIT_FAILURE);
        }
index 00dbf3ab00022158619a8c29474621eb2d4389f0..68e0ed3a76fd0e3cf3bbb36ba140d9167277b5bc 100644 (file)
 #ifndef APPLICATION_H
 #define APPLICATION_H
 
+#include "base/i2-base.h"
+#include "base/eventqueue.h"
+#include "base/dynamicobject.h"
+
 namespace icinga {
 
 class Component;
index c545bdd5497a68e9d42e1b9a4d34cb5d5f174a0e..db570f33a8c552f22f0713d43f8ccc731c6465cc 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/array.h"
+#include "base/objectlock.h"
+#include "base/utility.h"
 #include <cJSON.h>
+#include <boost/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -197,7 +201,7 @@ Array::Ptr Array::FromJson(cJSON *json)
        Array::Ptr array = boost::make_shared<Array>();
 
        if (json->type != cJSON_Array)
-               BOOST_THROW_EXCEPTION(invalid_argument("JSON type must be cJSON_Array."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("JSON type must be cJSON_Array."));
 
        for (cJSON *i = json->child; i != NULL; i = i->next) {
                array->Add(Value::FromJson(i));
index 5a07245baf206dd015cb9adf2cc11af47276e7f7..cefba286d55be38f0737cea52d6bd5836b4245e0 100644 (file)
 #ifndef ARRAY_H
 #define ARRAY_H
 
+#include "base/i2-base.h"
+#include "base/value.h"
+#include <vector>
+
 namespace icinga
 {
 
@@ -37,7 +41,7 @@ public:
        /**
         * An iterator that can be used to iterate over array elements.
         */
-       typedef vector<Value>::iterator Iterator;
+       typedef std::vector<Value>::iterator Iterator;
 
        Array(void);
 
@@ -62,7 +66,7 @@ public:
        cJSON *ToJson(void) const;
 
 private:
-       vector<Value> m_Data; /**< The data for the array. */
+       std::vector<Value> m_Data; /**< The data for the array. */
        bool m_Sealed; /**< Whether the array is read-only. */
 };
 
index 9e4a84d8310c94c3d922b5d49d914905ffe79c43..3dccdc44582bdd70665bd7d7410f8d0caa6529ae 100644 (file)
 #ifndef ASYNCTASK_H
 #define ASYNCTASK_H
 
+#include "base/i2-base.h"
+#include "base/object.h"
+#include "base/utility.h"
 #include <boost/function.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition_variable.hpp>
 #include <boost/bind.hpp>
+#include <boost/exception_ptr.hpp>
 
 namespace icinga
 {
@@ -104,7 +108,7 @@ public:
                        m_CV.wait(lock);
 
                if (m_ResultRetrieved)
-                       BOOST_THROW_EXCEPTION(runtime_error("GetResult called on an AsyncTask whose result was already retrieved."));
+                       BOOST_THROW_EXCEPTION(std::runtime_error("GetResult called on an AsyncTask whose result was already retrieved."));
 
                m_ResultRetrieved = true;
 
@@ -183,7 +187,7 @@ private:
        {
                try {
                        Run();
-               } catch (const exception&) {
+               } catch (...) {
                        FinishException(boost::current_exception());
                }
        }
index c1deadc273eb645b7c7d2444ae190ae4c3b6ef9c..d5229139cab70164b7518f06718df0fe5671742e 100644 (file)
@@ -17,7 +17,8 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/attribute.h"
+#include "base/utility.h"
 
 using namespace icinga;
 
index 70bc6bf1684896371fe3fa8366d9ab577a5bc0cd..973eba755335ee38fd049e324f679bf07b31d362 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef ATTRIBUTE_H
 #define ATTRIBUTE_H
 
+#include "base/value.h"
+
 namespace icinga
 {
 
index 6fb0c7947a11c049d4d7f9b96925afa353b60d9c..91cca228e515e387a6c32737758ea66d4fb22f7e 100644 (file)
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/connection.h"
 #include <boost/bind.hpp>
 
 using namespace icinga;
index 4c8701c59c2025fb16e653d6d3c5ab3e143eec28..4b81d41f600f105c51d3923c747c7a0a4f745acc 100644 (file)
 #ifndef CONNECTION_H
 #define CONNECTION_H
 
+#include "base/i2-base.h"
+#include "base/stream.h"
+#include <boost/signals2.hpp>
+
 namespace icinga
 {
 
@@ -35,7 +39,7 @@ public:
 
        void Close(void);
 
-       signals2::signal<void (const Connection::Ptr&)> OnClosed;
+       boost::signals2::signal<void (const Connection::Ptr&)> OnClosed;
 
 protected:
        virtual void ProcessData(void) = 0;
index 6a55d643f11341307765e0c7dd4720b5d3a4b3f2..afe6ba7ac0f1bd17d12ec741c1c9472326980aa3 100644 (file)
@@ -17,7 +17,8 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/convert.h"
+#include <sstream>
 #include <boost/lexical_cast.hpp>
 
 using namespace icinga;
@@ -39,7 +40,7 @@ bool Convert::ToBool(const String& val)
 
 String Convert::ToString(long val)
 {
-       stringstream cs;
+       std::ostringstream cs;
        cs << val;
        return cs.str();
 }
index 54b4357c08aa85a149e309d206a844349c3f4a4e..45da18f1b6fbb79d647c17ef7fc5d00cf88054d1 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef CONVERT_H
 #define CONVERT_H
 
+#include "base/i2-base.h"
+#include "base/value.h"
+
 namespace icinga
 {
 
index 86f1ce2fa9d709ae98c95750f8bb12c9fe9ec933..7a529a6067bc85b16e973837b9f5640851083c0c 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/dictionary.h"
+#include "base/objectlock.h"
+#include "base/utility.h"
 #include <cJSON.h>
 #include <boost/tuple/tuple.hpp>
+#include <boost/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -36,7 +40,7 @@ struct DictionaryKeyLessComparer
         * @returns true if the first key is less than the second key, false
         *               otherwise
         */
-       bool operator()(const pair<String, Value>& a, const char *b)
+       bool operator()(const std::pair<String, Value>& a, const char *b)
        {
                return a.first < b;
        }
@@ -49,7 +53,7 @@ struct DictionaryKeyLessComparer
         * @returns true if the first key is less than the second key, false
         *               otherwise
         */
-       bool operator()(const char *a, const pair<String, Value>& b)
+       bool operator()(const char *a, const std::pair<String, Value>& b)
        {
                return a < b.first;
        }
@@ -74,7 +78,7 @@ Value Dictionary::Get(const char *key) const
        ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
-       map<String, Value>::const_iterator it;
+       std::map<String, Value>::const_iterator it;
 
        it = std::lower_bound(m_Data.begin(), m_Data.end(), key, DictionaryKeyLessComparer());
 
@@ -115,8 +119,8 @@ void Dictionary::Set(const String& key, const Value& value)
 
        ASSERT(!m_Sealed);
 
-       pair<map<String, Value>::iterator, bool> ret;
-       ret = m_Data.insert(make_pair(key, value));
+       std::pair<std::map<String, Value>::iterator, bool> ret;
+       ret = m_Data.insert(std::make_pair(key, value));
        if (!ret.second)
                ret.first->second = value;
 }
@@ -268,7 +272,7 @@ Dictionary::Ptr Dictionary::FromJson(cJSON *json)
        Dictionary::Ptr dictionary = boost::make_shared<Dictionary>();
 
        if (json->type != cJSON_Object)
-               BOOST_THROW_EXCEPTION(invalid_argument("JSON type must be cJSON_Object."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("JSON type must be cJSON_Object."));
 
        for (cJSON *i = json->child; i != NULL; i = i->next) {
                dictionary->Set(i->string, Value::FromJson(i));
index cd933dd78a5035d8192cae2d1dbdcb93ec37d6d3..2bb9061afe12ad12b26b180f5186d2324f255bb3 100644 (file)
 #ifndef DICTIONARY_H
 #define DICTIONARY_H
 
+#include "base/i2-base.h"
+#include "base/object.h"
+#include "base/value.h"
+#include <map>
+
 namespace icinga
 {
 
@@ -37,7 +42,7 @@ public:
        /**
         * An iterator that can be used to iterate over dictionary elements.
         */
-       typedef map<String, Value>::iterator Iterator;
+       typedef std::map<String, Value>::iterator Iterator;
 
        Dictionary(void);
 
@@ -63,7 +68,7 @@ public:
        cJSON *ToJson(void) const;
 
 private:
-       map<String, Value> m_Data; /**< The data for the dictionary. */
+       std::map<String, Value> m_Data; /**< The data for the dictionary. */
        bool m_Sealed; /**< Whether the dictionary is read-only. */
 };
 
index 38e9b380edcd4981c2fd3e581d8c0e524ebc3097..f46da775a2fe4b9bfac8108d00947d9bbb41631e 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/dynamicobject.h"
+#include "base/dynamictype.h"
+#include "base/netstring.h"
+#include "base/registry.h"
+#include "base/stdiostream.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include "base/exception.h"
+#include <fstream>
+#include <boost/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
 double DynamicObject::m_CurrentTx = 0;
-set<DynamicObject::WeakPtr> DynamicObject::m_ModifiedObjects;
+std::set<DynamicObject::WeakPtr> DynamicObject::m_ModifiedObjects;
 boost::mutex DynamicObject::m_TransactionMutex;
 boost::once_flag DynamicObject::m_TransactionOnce = BOOST_ONCE_INIT;
 Timer::Ptr DynamicObject::m_TransactionTimer;
 
-signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnRegistered;
-signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnUnregistered;
-signals2::signal<void (double, const set<DynamicObject::WeakPtr>&)> DynamicObject::OnTransactionClosing;
-signals2::signal<void (double, const DynamicObject::Ptr&)> DynamicObject::OnFlushObject;
+boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnRegistered;
+boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnUnregistered;
+boost::signals2::signal<void (double, const std::set<DynamicObject::WeakPtr>&)> DynamicObject::OnTransactionClosing;
+boost::signals2::signal<void (double, const DynamicObject::Ptr&)> DynamicObject::OnFlushObject;
 
 DynamicObject::DynamicObject(const Dictionary::Ptr& serializedObject)
        : m_ConfigTx(0), m_Registered(false)
@@ -42,7 +52,7 @@ DynamicObject::DynamicObject(const Dictionary::Ptr& serializedObject)
        RegisterAttribute("methods", Attribute_Config, &m_Methods);
 
        if (!serializedObject->Contains("configTx"))
-               BOOST_THROW_EXCEPTION(invalid_argument("Serialized object must contain a config snapshot."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Serialized object must contain a config snapshot."));
 
        /* apply config state from the config item/remote update;
         * The DynamicType::CreateObject function takes care of restoring
@@ -196,8 +206,8 @@ void DynamicObject::InternalRegisterAttribute(const String& name,
 
        AttributeHolder attr(type, boundAttribute);
 
-       pair<DynamicObject::AttributeIterator, bool> tt;
-       tt = m_Attributes.insert(make_pair(name, attr));
+       std::pair<DynamicObject::AttributeIterator, bool> tt;
+       tt = m_Attributes.insert(std::make_pair(name, attr));
 
        if (!tt.second) {
                tt.first->second.SetType(type);
@@ -232,7 +242,7 @@ void DynamicObject::Touch(const String& name)
        AttributeIterator it = m_Attributes.find(name);
 
        if (it == m_Attributes.end())
-               BOOST_THROW_EXCEPTION(runtime_error("Touch() called for unknown attribute: " + name));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Touch() called for unknown attribute: " + name));
 
        it->second.SetTx(GetCurrentTx());
 
@@ -272,10 +282,10 @@ void DynamicObject::InternalSetAttribute(const String& name, const Value& data,
                AttributeHolder attr(Attribute_Transient);
                attr.SetValue(tx, data);
 
-               m_Attributes.insert(make_pair(name, attr));
+               m_Attributes.insert(std::make_pair(name, attr));
        } else {
                if (!allowEditConfig && (it->second.GetType() & Attribute_Config))
-                       BOOST_THROW_EXCEPTION(runtime_error("Config properties are immutable: '" + name + "'."));
+                       BOOST_THROW_EXCEPTION(std::runtime_error("Config properties are immutable: '" + name + "'."));
 
                it->second.SetValue(tx, data);
 
@@ -425,7 +435,7 @@ void DynamicObject::Unregister(void)
 }
 
 ScriptTask::Ptr DynamicObject::MakeMethodTask(const String& method,
-    const vector<Value>& arguments)
+    const std::vector<Value>& arguments)
 {
        Dictionary::Ptr methods;
 
@@ -442,7 +452,7 @@ ScriptTask::Ptr DynamicObject::MakeMethodTask(const String& method,
        ScriptFunction::Ptr func = ScriptFunctionRegistry::GetInstance()->GetItem(funcName);
 
        if (!func)
-               BOOST_THROW_EXCEPTION(invalid_argument("Function '" + funcName + "' does not exist."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Function '" + funcName + "' does not exist."));
 
        return boost::make_shared<ScriptTask>(func, arguments);
 }
@@ -452,15 +462,15 @@ ScriptTask::Ptr DynamicObject::MakeMethodTask(const String& method,
  */
 void DynamicObject::DumpObjects(const String& filename)
 {
-       Logger::Write(LogInformation, "base", "Dumping program state to file '" + filename + "'");
+       Log(LogInformation, "base", "Dumping program state to file '" + filename + "'");
 
        String tempFilename = filename + ".tmp";
 
-       fstream fp;
+       std::fstream fp;
        fp.open(tempFilename.CStr(), std::ios_base::out);
 
        if (!fp)
-               BOOST_THROW_EXCEPTION(runtime_error("Could not open '" + filename + "' file"));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Could not open '" + filename + "' file"));
 
        StdioStream::Ptr sfp = boost::make_shared<StdioStream>(&fp, false);
        sfp->Start();
@@ -517,7 +527,7 @@ void DynamicObject::DumpObjects(const String& filename)
  */
 void DynamicObject::RestoreObjects(const String& filename)
 {
-       Logger::Write(LogInformation, "base", "Restoring program state from file '" + filename + "'");
+       Log(LogInformation, "base", "Restoring program state from file '" + filename + "'");
 
        std::fstream fp;
        fp.open(filename.CStr(), std::ios_base::in);
@@ -542,7 +552,7 @@ void DynamicObject::RestoreObjects(const String& filename)
                DynamicType::Ptr dt = DynamicType::GetByName(type);
 
                if (!dt)
-                       BOOST_THROW_EXCEPTION(invalid_argument("Invalid type: " + type));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid type: " + type));
 
                DynamicObject::Ptr object = dt->GetObject(name);
 
@@ -558,9 +568,9 @@ void DynamicObject::RestoreObjects(const String& filename)
 
        sfp->Close();
 
-       stringstream msgbuf;
+       std::ostringstream msgbuf;
        msgbuf << "Restored " << restored << " objects";
-       Logger::Write(LogInformation, "base", msgbuf.str());
+       Log(LogInformation, "base", msgbuf.str());
 }
 
 void DynamicObject::DeactivateObjects(void)
@@ -598,7 +608,7 @@ void DynamicObject::Flush(void)
 void DynamicObject::NewTx(void)
 {
        double tx;
-       set<DynamicObject::WeakPtr> objects;
+       std::set<DynamicObject::WeakPtr> objects;
 
        {
                boost::mutex::scoped_lock lock(m_TransactionMutex);
@@ -614,7 +624,7 @@ void DynamicObject::NewTx(void)
                if (!object || !object->IsRegistered())
                        continue;
 
-               set<String, string_iless> attrs;
+               std::set<String, string_iless> attrs;
 
                {
                        ObjectLock olock(object);
index 467692833841a1611f5d40b26f5a06a187e5e795..8ed56a98e276ae0967f90ae2b0f477a27c879fe7 100644 (file)
 #ifndef DYNAMICOBJECT_H
 #define DYNAMICOBJECT_H
 
+#include "base/i2-base.h"
+#include "base/timer.h"
+#include "base/attribute.h"
+#include "base/scripttask.h"
+#include "base/object.h"
+#include "base/dictionary.h"
+#include <map>
+#include <set>
 #include <boost/thread/once.hpp>
 
 namespace icinga
@@ -39,7 +47,7 @@ public:
        typedef shared_ptr<DynamicObject> Ptr;
        typedef weak_ptr<DynamicObject> WeakPtr;
 
-       typedef map<String, AttributeHolder, string_iless> AttributeMap;
+       typedef std::map<String, AttributeHolder, string_iless> AttributeMap;
        typedef AttributeMap::iterator AttributeIterator;
        typedef AttributeMap::const_iterator AttributeConstIterator;
 
@@ -60,13 +68,13 @@ public:
 
        void ClearAttributesByType(AttributeType type);
 
-       static signals2::signal<void (const DynamicObject::Ptr&)> OnRegistered;
-       static signals2::signal<void (const DynamicObject::Ptr&)> OnUnregistered;
-       static signals2::signal<void (double, const set<DynamicObject::WeakPtr>&)> OnTransactionClosing;
-       static signals2::signal<void (double, const DynamicObject::Ptr&)> OnFlushObject;
+       static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnRegistered;
+       static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnUnregistered;
+       static boost::signals2::signal<void (double, const std::set<DynamicObject::WeakPtr>&)> OnTransactionClosing;
+       static boost::signals2::signal<void (double, const DynamicObject::Ptr&)> OnFlushObject;
 
        ScriptTask::Ptr MakeMethodTask(const String& method,
-           const vector<Value>& arguments);
+           const std::vector<Value>& arguments);
 
        shared_ptr<DynamicType> GetType(void) const;
        String GetName(void) const;
@@ -110,7 +118,7 @@ private:
 
        mutable boost::mutex m_AttributeMutex;
        AttributeMap m_Attributes;
-       set<String, string_iless> m_ModifiedAttributes;
+       std::set<String, string_iless> m_ModifiedAttributes;
        double m_ConfigTx;
 
        Attribute<String> m_Name;
@@ -127,7 +135,7 @@ private:
 
        /* This has to be a set of raw pointers because the DynamicObject
         * constructor has to be able to insert objects into this list. */
-       static set<DynamicObject::WeakPtr> m_ModifiedObjects;
+       static std::set<DynamicObject::WeakPtr> m_ModifiedObjects;
        static boost::mutex m_TransactionMutex;
        static boost::once_flag m_TransactionOnce;
        static Timer::Ptr m_TransactionTimer;
index 7efbb2102478d2ab67ba7039c62438ca513e43f0..a5ac1bd20857fb7e5be902d94a088c908cfdcfad 100644 (file)
@@ -17,7 +17,8 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
 
 using namespace icinga;
 
@@ -61,13 +62,13 @@ DynamicType::TypeSet DynamicType::GetTypes(void)
        return InternalGetTypeSet(); /* Making a copy of the set here. */
 }
 
-set<DynamicObject::Ptr> DynamicType::GetObjects(const String& type)
+std::set<DynamicObject::Ptr> DynamicType::GetObjects(const String& type)
 {
        DynamicType::Ptr dt = GetByName(type);
        return dt->GetObjects();
 }
 
-set<DynamicObject::Ptr> DynamicType::GetObjects(void) const
+std::set<DynamicObject::Ptr> DynamicType::GetObjects(void) const
 {
        ObjectLock olock(this);
 
@@ -92,7 +93,7 @@ void DynamicType::RegisterObject(const DynamicObject::Ptr& object)
                        if (it->second == object)
                                return;
 
-                       BOOST_THROW_EXCEPTION(runtime_error("RegisterObject() found existing object with the same name: " + name));
+                       BOOST_THROW_EXCEPTION(std::runtime_error("RegisterObject() found existing object with the same name: " + name));
                }
 
                m_ObjectMap[name] = object;
@@ -143,7 +144,7 @@ void DynamicType::RegisterType(const DynamicType::Ptr& type)
        DynamicType::TypeMap::const_iterator tt = InternalGetTypeMap().find(type->GetName());
 
        if (tt != InternalGetTypeMap().end())
-               BOOST_THROW_EXCEPTION(runtime_error("Cannot register class for type '" +
+               BOOST_THROW_EXCEPTION(std::runtime_error("Cannot register class for type '" +
                    type->GetName() + "': Objects of this type already exist."));
 
        InternalGetTypeMap()[type->GetName()] = type;
index 9507b18f5ecb7f98b7762ff139f6c615691b600e..b4e65670d6dbb1f0c7efe5221be90bbe97998d86 100644 (file)
 #ifndef DYNAMICTYPE_H
 #define DYNAMICTYPE_H
 
+#include "base/i2-base.h"
+#include "base/registry.h"
+#include "base/dynamicobject.h"
+#include <map>
+#include <set>
 #include <boost/function.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
 
 namespace icinga
 {
@@ -47,23 +53,23 @@ public:
        void RegisterObject(const DynamicObject::Ptr& object);
        void UnregisterObject(const DynamicObject::Ptr& object);
 
-       static set<DynamicType::Ptr> GetTypes(void);
-       set<DynamicObject::Ptr> GetObjects(void) const;
+       static std::set<DynamicType::Ptr> GetTypes(void);
+       std::set<DynamicObject::Ptr> GetObjects(void) const;
 
-       static set<DynamicObject::Ptr> GetObjects(const String& type);
+       static std::set<DynamicObject::Ptr> GetObjects(const String& type);
 
 private:
        String m_Name;
        ObjectFactory m_ObjectFactory;
 
-       typedef map<String, DynamicObject::Ptr, string_iless> ObjectMap;
-       typedef set<DynamicObject::Ptr> ObjectSet;
+       typedef std::map<String, DynamicObject::Ptr, string_iless> ObjectMap;
+       typedef std::set<DynamicObject::Ptr> ObjectSet;
 
        ObjectMap m_ObjectMap;
        ObjectSet m_ObjectSet;
 
-       typedef map<String, DynamicType::Ptr, string_iless> TypeMap;
-       typedef set<DynamicType::Ptr> TypeSet;
+       typedef std::map<String, DynamicType::Ptr, string_iless> TypeMap;
+       typedef std::set<DynamicType::Ptr> TypeSet;
 
        static TypeMap& InternalGetTypeMap(void);
        static TypeSet& InternalGetTypeSet(void);
index 3fa30df408230fc4bd2cdde03d32d482eb0dec1d..dfb4eb140e59bf12ef07fe40325bbccbeb90bde3 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/eventqueue.h"
+#include "base/logger_fwd.h"
+#include "base/convert.h"
+#include "base/utility.h"
+#include <sstream>
 #include <boost/bind.hpp>
+#include <boost/exception/diagnostic_information.hpp>
 
 using namespace icinga;
 
@@ -107,13 +112,13 @@ void EventQueue::QueueThreadProc(void)
                try {
                        event();
                } catch (const std::exception& ex) {
-                       stringstream msgbuf;
+                       std::ostringstream msgbuf;
                        msgbuf << "Exception thrown in event handler: " << std::endl
-                              << diagnostic_information(ex);
+                              << boost::diagnostic_information(ex);
 
-                       Logger::Write(LogCritical, "base", msgbuf.str());
+                       Log(LogCritical, "base", msgbuf.str());
                } catch (...) {
-                       Logger::Write(LogCritical, "base", "Exception of unknown type thrown in event handler.");
+                       Log(LogCritical, "base", "Exception of unknown type thrown in event handler.");
                }
 
 #ifdef _DEBUG
@@ -143,7 +148,7 @@ void EventQueue::QueueThreadProc(void)
                        msgbuf << "Event call took " << (et - st) << "s";
 #      endif /* RUSAGE_THREAD */
 
-                       Logger::Write(LogWarning, "base", msgbuf.str());
+                       Log(LogWarning, "base", msgbuf.str());
                }
 #endif /* _DEBUG */
        }
@@ -174,6 +179,6 @@ void EventQueue::ReportThreadProc(void)
                        pending = m_Events.size();
                }
 
-               Logger::Write(LogInformation, "base", "Pending tasks: " + Convert::ToString(pending));
+               Log(LogInformation, "base", "Pending tasks: " + Convert::ToString(pending));
        }
 }
index 3637fab89ca2504b8211c1fbdb2d25965a59e2cd..944a0870cd34cc5ed9ad786ba3249f82ea0ca021 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef EVENTQUEUE_H
 #define EVENTQUEUE_H
 
+#include "base/i2-base.h"
+#include <stack>
 #include <boost/function.hpp>
 #include <boost/thread/thread.hpp>
 #include <boost/thread/mutex.hpp>
@@ -28,8 +30,6 @@
 namespace icinga
 {
 
-class Timer;
-
 /**
  * An event queue.
  *
@@ -55,7 +55,7 @@ private:
        boost::condition_variable m_CV;
 
        bool m_Stopped;
-       stack<Callback> m_Events;
+       std::stack<Callback> m_Events;
 
        void QueueThreadProc(void);
        void ReportThreadProc(void);
index 1fd586de2fe33cf863bb6a5a8ae84a884f0cc02f..e703426588c31615bc59d02dbc4a3555a50db49c 100644 (file)
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/exception.h"
 
 using namespace icinga;
 
index 3d6e87b2998a3abd6151c7ee2522df14cd60b348..d058c1a1619a470b2bc7af8a8b7da69eba00f002 100644 (file)
 #ifndef EXCEPTION_H
 #define EXCEPTION_H
 
+#include "base/i2-base.h"
+#include "base/stacktrace.h"
+#include <sstream>
 #include <boost/thread/tss.hpp>
 
+#ifdef _WIN32
+#      include <boost/algorithm/string/trim.hpp>
+#endif /* _WIN32 */
+
 namespace icinga
 {
 
@@ -30,7 +37,7 @@ namespace icinga
  *
  * @ingroup base
  */
-class I2_BASE_API Exception //: public virtual exception
+class I2_BASE_API Exception
 {
 public:
        static StackTrace *GetLastStackTrace(void);
@@ -51,7 +58,7 @@ typedef boost::error_info<struct errinfo_win32_error_, int> errinfo_win32_error;
 
 inline std::string to_string(const errinfo_win32_error& e)
 {
-       stringstream tmp;
+       std::ostringstream tmp;
        int code = e.value();
 
        char *message;
@@ -80,7 +87,7 @@ typedef boost::error_info<struct errinfo_openssl_error_, int> errinfo_openssl_er
 
 inline std::string to_string(const errinfo_openssl_error& e)
 {
-       stringstream tmp;
+       std::ostringstream tmp;
        int code = e.value();
 
        const char *message = ERR_error_string(code, NULL);
index 6c5bc236c657789990054502a057dddbe9040915..f352e5c5fb4760e7de48f6f0e985d0a264bb0664 100644 (file)
@@ -17,9 +17,8 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
-
-using std::bad_alloc;
+#include "base/fifo.h"
+#include "base/utility.h"
 
 using namespace icinga;
 
@@ -60,7 +59,7 @@ void FIFO::ResizeBuffer(size_t newSize)
        char *newBuffer = static_cast<char *>(realloc(m_Buffer, newSize));
 
        if (newBuffer == NULL)
-               BOOST_THROW_EXCEPTION(bad_alloc());
+               BOOST_THROW_EXCEPTION(std::bad_alloc());
 
        m_Buffer = newBuffer;
 
index f654d62bfdb40df1f25fbd29b771ac6e23905c53..6a701e24de3243de86d74f8824a2630fb431c47a 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef FIFO_H
 #define FIFO_H
 
+#include "base/i2-base.h"
+#include "base/stream.h"
+
 namespace icinga
 {
 
index d176c6b91dd8b11183a00ebfcd8297f8997f3aab..20af10eb5c15df46a58f9bd678de997d6890b62b 100644 (file)
 #include <sys/stat.h>
 #include <signal.h>
 
-#include <string>
 #include <exception>
 #include <stdexcept>
-#include <sstream>
-#include <vector>
-#include <set>
-#include <iostream>
-#include <fstream>
-#include <list>
-#include <typeinfo>
-#include <map>
-#include <list>
-#include <algorithm>
-#include <deque>
-#include <stack>
-#include <iterator>
 
-using std::vector;
-using std::map;
-using std::list;
-using std::set;
-using std::multimap;
-using std::multiset;
-using std::pair;
-using std::deque;
-using std::stack;
-using std::make_pair;
-
-using std::stringstream;
-using std::istream;
-using std::ostream;
-using std::fstream;
-using std::ifstream;
-using std::ofstream;
-using std::iostream;
-
-using std::exception;
-using std::bad_alloc;
-using std::bad_cast;
-using std::runtime_error;
-using std::logic_error;
-using std::invalid_argument;
-using std::domain_error;
-
-using std::type_info;
-
-#include <boost/smart_ptr.hpp>
-#include <boost/make_shared.hpp>
-#include <boost/bind.hpp>
-#include <boost/signals2.hpp>
-#include <boost/foreach.hpp>
-#include <boost/exception/diagnostic_information.hpp>
+#include <boost/smart_ptr/shared_ptr.hpp>
+#include <boost/smart_ptr/weak_ptr.hpp>
 #include <boost/exception/error_info.hpp>
 #include <boost/exception/errinfo_api_function.hpp>
 #include <boost/exception/errinfo_errno.hpp>
 #include <boost/exception/errinfo_file_name.hpp>
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/multi_index/key_extractors.hpp>
 
 using boost::shared_ptr;
 using boost::weak_ptr;
 using boost::dynamic_pointer_cast;
 using boost::static_pointer_cast;
-using boost::diagnostic_information;
 using boost::errinfo_api_function;
 using boost::errinfo_errno;
 using boost::errinfo_file_name;
-using boost::multi_index_container;
-using boost::multi_index::indexed_by;
-using boost::multi_index::identity;
-using boost::multi_index::ordered_unique;
-using boost::multi_index::ordered_non_unique;
-using boost::multi_index::nth_index;
-
-namespace signals2 = boost::signals2;
 
 #if defined(__APPLE__) && defined(__MACH__)
 #      pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -162,54 +103,10 @@ namespace signals2 = boost::signals2;
 #include <openssl/ssl.h>
 #include <openssl/err.h>
 
-#if HAVE_GCC_ABI_DEMANGLE
-#      include <cxxabi.h>
-#endif /* HAVE_GCC_ABI_DEMANGLE */
-
 #ifdef I2_BASE_BUILD
 #      define I2_BASE_API I2_EXPORT
 #else /* I2_BASE_BUILD */
 #      define I2_BASE_API I2_IMPORT
 #endif /* I2_BASE_BUILD */
 
-#include "qstring.h"
-#include "utility.h"
-#include "stacktrace.h"
-#include "object.h"
-#include "objectlock.h"
-#include "exception.h"
-#include "eventqueue.h"
-#include "value.h"
-#include "convert.h"
-#include "dictionary.h"
-#include "array.h"
-#include "ringbuffer.h"
-#include "timer.h"
-#include "stream.h"
-#include "stream_bio.h"
-#include "connection.h"
-#include "netstring.h"
-#include "fifo.h"
-#include "stdiostream.h"
-#include "socket.h"
-#include "tcpsocket.h"
-#include "unixsocket.h"
-#include "tlsstream.h"
-#include "asynctask.h"
-#include "process.h"
-#include "singleton.h"
-#include "registry.h"
-#include "scriptfunction.h"
-#include "scripttask.h"
-#include "attribute.h"
-#include "dynamicobject.h"
-#include "dynamictype.h"
-#include "script.h"
-#include "scriptinterpreter.h"
-#include "scriptlanguage.h"
-#include "logger.h"
-#include "application.h"
-#include "streamlogger.h"
-#include "sysloglogger.h"
-
 #endif /* I2BASE_H */
index 1c92dce60aa23f2a1f8394c063d5cf42a6908a43..e9e8490607c3afdaa7ba483cee30019cf9d1ee5d 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/application.h"
+#include "base/streamlogger.h"
+#include "base/sysloglogger.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include <boost/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -36,14 +42,14 @@ Logger::Logger(const Dictionary::Ptr& serializedUpdate)
        RegisterAttribute("severity", Attribute_Config, &m_Severity);
 
        if (!IsLocal())
-               BOOST_THROW_EXCEPTION(runtime_error("Logger objects must be local."));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Logger objects must be local."));
 }
 
 void Logger::Start(void)
 {
        String type = m_Type;
        if (type.IsEmpty())
-               BOOST_THROW_EXCEPTION(runtime_error("Logger objects must have a 'type' property."));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Logger objects must have a 'type' property."));
 
        ILogger::Ptr impl;
 
@@ -51,12 +57,12 @@ void Logger::Start(void)
 #ifndef _WIN32
                impl = boost::make_shared<SyslogLogger>();
 #else /* _WIN32 */
-               BOOST_THROW_EXCEPTION(invalid_argument("Syslog is not supported on Windows."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Syslog is not supported on Windows."));
 #endif /* _WIN32 */
        } else if (type == "file") {
                String path = m_Path;
                if (path.IsEmpty())
-                       BOOST_THROW_EXCEPTION(invalid_argument("'log' object of type 'file' must have a 'path' property"));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("'log' object of type 'file' must have a 'path' property"));
 
                StreamLogger::Ptr slogger = boost::make_shared<StreamLogger>();
                slogger->OpenFile(path);
@@ -65,7 +71,7 @@ void Logger::Start(void)
        } else if (type == "console") {
                impl = boost::make_shared<StreamLogger>(&std::cout);
        } else {
-               BOOST_THROW_EXCEPTION(runtime_error("Unknown log type: " + type));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Unknown log type: " + type));
        }
 
        impl->m_Config = GetSelf();
@@ -80,7 +86,7 @@ void Logger::Start(void)
  * @param facility The log facility.
  * @param message The message.
  */
-void Logger::Write(LogSeverity severity, const String& facility,
+void icinga::Log(LogSeverity severity, const String& facility,
     const String& message)
 {
        LogEntry entry;
@@ -89,7 +95,7 @@ void Logger::Write(LogSeverity severity, const String& facility,
        entry.Facility = facility;
        entry.Message = message;
 
-       ForwardLogEntry(entry);
+       Logger::ForwardLogEntry(entry);
 }
 
 /**
@@ -159,7 +165,7 @@ String Logger::SeverityToString(LogSeverity severity)
                case LogCritical:
                        return "critical";
                default:
-                       BOOST_THROW_EXCEPTION(invalid_argument("Invalid severity."));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid severity."));
        }
 }
 
@@ -179,7 +185,7 @@ LogSeverity Logger::StringToSeverity(const String& severity)
        else if (severity == "critical")
                return LogCritical;
        else
-               BOOST_THROW_EXCEPTION(invalid_argument("Invalid severity: " + severity));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid severity: " + severity));
 }
 
 /**
index c150bb3e2a0ca7105e6a2f1ab27b23e32c23495d..504bb0edd603c737a86f5283fe2e1b645fbe78a7 100644 (file)
 #ifndef LOGGER_H
 #define LOGGER_H
 
-namespace icinga
-{
+#include "base/i2-base.h"
+#include "base/dynamicobject.h"
+#include "base/logger_fwd.h"
 
-/**
- * Log severity.
- *
- * @ingroup base
- */
-enum LogSeverity
+namespace icinga
 {
-       LogDebug,
-       LogInformation,
-       LogWarning,
-       LogCritical
-};
 
 /**
  * A lot entry.
@@ -89,9 +80,6 @@ public:
 
        explicit Logger(const Dictionary::Ptr& serializedUpdate);
 
-       static void Write(LogSeverity severity, const String& facility,
-           const String& message);
-
        static String SeverityToString(LogSeverity severity);
        static LogSeverity StringToSeverity(const String& severity);
 
@@ -109,6 +97,9 @@ private:
        ILogger::Ptr m_Impl;
 
        static void ForwardLogEntry(const LogEntry& entry);
+
+       friend void Log(LogSeverity severity, const String& facility,
+           const String& message);
 };
 
 }
index dc95cf4c39ffaf609692e0e63b4aeb5a6cfb7377..6da9b07ca653bb73deeb7e1412df376d00998437 100644 (file)
@@ -17,7 +17,8 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/netstring.h"
+#include <sstream>
 
 using namespace icinga;
 
@@ -38,7 +39,7 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
        char *buffer = static_cast<char *>(malloc(buffer_length));
 
        if (buffer == NULL)
-               BOOST_THROW_EXCEPTION(bad_alloc());
+               BOOST_THROW_EXCEPTION(std::bad_alloc());
 
        peek_length = stream->Peek(buffer, buffer_length);
 
@@ -51,7 +52,7 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
        /* no leading zeros allowed */
        if (buffer[0] == '0' && isdigit(buffer[1])) {
                free(buffer);
-               BOOST_THROW_EXCEPTION(invalid_argument("Invalid netString (leading zero)"));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid netString (leading zero)"));
        }
 
        size_t len, i;
@@ -61,7 +62,7 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
                /* length specifier must have at most 9 characters */
                if (i >= 9) {
                        free(buffer);
-                       BOOST_THROW_EXCEPTION(invalid_argument("Length specifier must not exceed 9 characters"));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("Length specifier must not exceed 9 characters"));
                }
 
                len = len * 10 + (buffer[i] - '0');
@@ -74,7 +75,7 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
 
        if (new_buffer == NULL) {
                free(buffer);
-               BOOST_THROW_EXCEPTION(bad_alloc());
+               BOOST_THROW_EXCEPTION(std::bad_alloc());
        }
 
        buffer = new_buffer;
@@ -87,13 +88,13 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
        /* check for the colon delimiter */
        if (buffer[i] != ':') {
                free(buffer);
-               BOOST_THROW_EXCEPTION(invalid_argument("Invalid NetString (missing :)"));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid NetString (missing :)"));
        }
 
        /* check for the comma delimiter after the String */
        if (buffer[i + 1 + len] != ',') {
                free(buffer);
-               BOOST_THROW_EXCEPTION(invalid_argument("Invalid NetString (missing ,)"));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid NetString (missing ,)"));
        }
 
        *str = String(&buffer[i + 1], &buffer[i + 1 + len]);
@@ -115,7 +116,7 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
  */
 void NetString::WriteStringToStream(const Stream::Ptr& stream, const String& str)
 {
-       stringstream prefixbuf;
+       std::ostringstream prefixbuf;
        prefixbuf << str.GetLength() << ":";
 
        String prefix = prefixbuf.str();
index 9b4efc872143f5f38c73401180f754fd1391efef..750c514bb1beebf2cc85ec0a9893e65ebc2f02be 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef NETSTRING_H
 #define NETSTRING_H
 
+#include "base/i2-base.h"
+#include "base/stream.h"
+
 namespace icinga
 {
 
index d2dc11e7ece8de9a3b0c7a5b59461e832680194c..39d783348dabdfe6a5aa02c8744f9e1d9e9a7ad2 100644 (file)
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/object.h"
 
 using namespace icinga;
 
index fb49f39d5a731228f30d6fe932c8dc58e487eeb5..d67dd223e084fa4dbb9e447eb7adc3aad4aab33d 100644 (file)
@@ -20,7 +20,9 @@
 #ifndef OBJECT_H
 #define OBJECT_H
 
+#include "base/i2-base.h"
 #include <boost/thread/mutex.hpp>
+#include <boost/smart_ptr/enable_shared_from_this.hpp>
 
 namespace icinga
 {
index 7aacc67aaeea23ae63930f4549e5ab7198fa05af..727585644699f8baddefa1b94e4843e3d06213a3 100644 (file)
@@ -17,7 +17,8 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/objectlock.h"
+#include "base/utility.h"
 
 using namespace icinga;
 
index 6b43580ee6a3978c4cdeab8971767c05c420f72f..dee1b5618aa6ec7c72719cd0ba31517f3ad25c5e 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef OBJECTLOCK_H
 #define OBJECTLOCK_H
 
+#include "base/object.h"
+
 namespace icinga
 {
 
index ceadd927670eb220a9cd59c4f9766bd7e4ca16b4..5660508c7b9b29a3471bf61dc2ca06fae6241602 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/process.h"
+#include "base/exception.h"
+#include "base/convert.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include <map>
 #include <boost/bind.hpp>
 #include <boost/tuple/tuple.hpp>
+#include <boost/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 #ifndef _WIN32
 #include <execvpe.h>
@@ -93,11 +100,11 @@ void Process::Initialize(void)
 
 void Process::WorkerThreadProc(int taskFd)
 {
-       map<int, Process::Ptr> tasks;
+       std::map<int, Process::Ptr> tasks;
        pollfd *pfds = NULL;
 
        for (;;) {
-               map<int, Process::Ptr>::iterator it, prev;
+               std::map<int, Process::Ptr>::iterator it, prev;
 
                pfds = (pollfd *)realloc(pfds, (1 + tasks.size()) * sizeof(pollfd));
 
@@ -138,7 +145,7 @@ void Process::WorkerThreadProc(int taskFd)
                                continue;
 
                        if (pfds[i].fd == taskFd) {
-                               vector<Process::Ptr> new_tasks;
+                               std::vector<Process::Ptr> new_tasks;
 
                                unsigned int want = MaxTasksPerThread - tasks.size();
 
@@ -377,7 +384,7 @@ bool Process::RunTask(void)
        if (WIFEXITED(status)) {
                exitcode = WEXITSTATUS(status);
        } else if (WIFSIGNALED(status)) {
-               stringstream outputbuf;
+               std::ostringstream outputbuf;
                outputbuf << "Process was terminated by signal " << WTERMSIG(status);
                output = outputbuf.str();
                exitcode = 128;
@@ -396,7 +403,7 @@ void Process::StatusTimerHandler(void)
 {
        boost::mutex::scoped_lock lock(m_Mutex);
        if (m_Tasks.size() > 50)
-               Logger::Write(LogCritical, "base", "More than 50 waiting Process tasks: " +
+               Log(LogCritical, "base", "More than 50 waiting Process tasks: " +
                    Convert::ToString(m_Tasks.size()));
 }
 
index 3140a799800b56c6eebe23df15f02c4160c249dc..3ca4bb07367c4d45be298e8b55ff535f48966ffa 100644 (file)
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/process.h"
 
 #ifdef _WIN32
 using namespace icinga;
index 70a55354a5e325bef2a282d52c22cbf0f945c15f..814a9833a122d43ae2378a622a29b4ba82c41d12 100644 (file)
  ******************************************************************************/
 
 #include "i2-base.h"
+#include "base/process.h"
+#include "base/array.h"
+#include "base/objectlock.h"
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
 boost::once_flag Process::m_ThreadOnce = BOOST_ONCE_INIT;
 boost::mutex Process::m_Mutex;
-deque<Process::Ptr> Process::m_Tasks;
+std::deque<Process::Ptr> Process::m_Tasks;
 
-Process::Process(const vector<String>& arguments, const Dictionary::Ptr& extraEnvironment)
+Process::Process(const std::vector<String>& arguments, const Dictionary::Ptr& extraEnvironment)
        : AsyncTask<Process, ProcessResult>(), m_Arguments(arguments), m_ExtraEnvironment(extraEnvironment)
 {
        {
@@ -38,9 +42,9 @@ Process::Process(const vector<String>& arguments, const Dictionary::Ptr& extraEn
 #endif /* _WIN32 */
 }
 
-vector<String> Process::SplitCommand(const Value& command)
+std::vector<String> Process::SplitCommand(const Value& command)
 {
-       vector<String> args;
+       std::vector<String> args;
 
        if (command.IsObjectType<Array>()) {
                Array::Ptr arguments = command;
index 1c32b7ddf23012a580adaa4d9cdab0bd3a6a3951..6d3de29ac151d53a2311ee61af79d42f989b6fac 100644 (file)
 #ifndef PROCESS_H
 #define PROCESS_H
 
+#include "base/i2-base.h"
+#include "base/timer.h"
+#include "base/asynctask.h"
+#include "base/dictionary.h"
+#include <sstream>
+#include <deque>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition_variable.hpp>
 #include <boost/thread/once.hpp>
@@ -52,13 +58,13 @@ public:
        typedef shared_ptr<Process> Ptr;
        typedef weak_ptr<Process> WeakPtr;
 
-       static const deque<Process::Ptr>::size_type MaxTasksPerThread = 512;
+       static const std::deque<Process::Ptr>::size_type MaxTasksPerThread = 512;
 
-       Process(const vector<String>& arguments, const Dictionary::Ptr& extraEnvironment = Dictionary::Ptr());
+       Process(const std::vector<String>& arguments, const Dictionary::Ptr& extraEnvironment = Dictionary::Ptr());
 
-       static vector<String> SplitCommand(const Value& command);
+       static std::vector<String> SplitCommand(const Value& command);
 private:
-       vector<String> m_Arguments;
+       std::vector<String> m_Arguments;
        Dictionary::Ptr m_ExtraEnvironment;
 
 #ifndef _WIN32
@@ -66,14 +72,14 @@ private:
        int m_FD;
 #endif /* _WIN32 */
 
-       stringstream m_OutputStream;
+       std::ostringstream m_OutputStream;
 
        ProcessResult m_Result;
 
        virtual void Run(void);
 
        static boost::mutex m_Mutex;
-       static deque<Process::Ptr> m_Tasks;
+       static std::deque<Process::Ptr> m_Tasks;
 #ifndef _WIN32
        static boost::condition_variable m_CV;
        static int m_TaskFd;
index 8318040aa05abc85538741ac45a436a82add9f16..2a094fb68f6ce7fa0f7e6e85311bb98c17a9804d 100644 (file)
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/qstring.h"
 #include <boost/algorithm/string/trim.hpp>
 #include <boost/algorithm/string/join.hpp>
 #include <boost/algorithm/string/compare.hpp>
@@ -131,7 +131,7 @@ void String::Replace(size_t first, size_t second, const String& str)
        m_Data.replace(first, second, str);
 }
 
-String Join(const vector<String>& strings, const char *delim)
+String Join(const std::vector<String>& strings, const char *delim)
 {
        return boost::algorithm::join(strings, delim);
 }
@@ -171,13 +171,13 @@ String::ConstIterator String::End(void) const
        return m_Data.end();
 }
 
-ostream& icinga::operator<<(ostream& stream, const String& str)
+std::ostream& icinga::operator<<(std::ostream& stream, const String& str)
 {
        stream << static_cast<std::string>(str);
        return stream;
 }
 
-istream& icinga::operator>>(istream& stream, String& str)
+std::istream& icinga::operator>>(std::istream& stream, String& str)
 {
        std::string tstr;
        stream >> tstr;
index 1aeebe92951a68a272b2e7ec3ba6ac61bc1d9d3f..0354797a3db48b338b0dc5849fc4b509c971139d 100644 (file)
 #ifndef STRING_H
 #define STRING_H
 
+#include "base/i2-base.h"
+#include <ostream>
+#include <istream>
+#include <vector>
 #include <boost/algorithm/string/split.hpp>
 
 namespace icinga {
@@ -76,14 +80,14 @@ public:
        void Replace(size_t first, size_t second, const String& str);
 
        template<typename Predicate>
-       vector<String> Split(const Predicate& predicate) const
+       std::vector<String> Split(const Predicate& predicate) const
        {
-               vector<String> tokens;
+               std::vector<String> tokens;
                boost::algorithm::split(tokens, m_Data, predicate);
                return tokens;
        }
 
-       static String Join(const vector<String>& strings, const char *delim);
+       static String Join(const std::vector<String>& strings, const char *delim);
 
        void Trim(void);
 
@@ -107,8 +111,8 @@ private:
        std::string m_Data;
 };
 
-I2_BASE_API ostream& operator<<(ostream& stream, const String& str);
-I2_BASE_API istream& operator>>(istream& stream, String& str);
+I2_BASE_API std::ostream& operator<<(std::ostream& stream, const String& str);
+I2_BASE_API std::istream& operator>>(std::istream& stream, String& str);
 
 I2_BASE_API String operator+(const String& lhs, const String& rhs);
 I2_BASE_API String operator+(const String& lhs, const char *rhs);
index b32721f4db4d47f27a20abf1154b28ba3ab387b9..d80a3d6e1406245be8cdb0a65a85752c66412a48 100644 (file)
 #ifndef REGISTRY_H
 #define REGISTRY_H
 
+#include "base/i2-base.h"
+#include "base/singleton.h"
+#include "base/qstring.h"
+#include <map>
+#include <boost/thread/mutex.hpp>
+#include <boost/signals2.hpp>
+
 namespace icinga
 {
 
@@ -32,7 +39,7 @@ template<typename T>
 class I2_BASE_API Registry
 {
 public:
-       typedef map<String, T, string_iless> ItemMap;
+       typedef std::map<String, T, string_iless> ItemMap;
 
        static Registry<T> *GetInstance(void)
        {
@@ -91,8 +98,8 @@ public:
                return m_Items; /* Makes a copy of the map. */
        }
 
-       signals2::signal<void (const String&, const T&)> OnRegistered;
-       signals2::signal<void (const String&)> OnUnregistered;
+       boost::signals2::signal<void (const String&, const T&)> OnRegistered;
+       boost::signals2::signal<void (const String&)> OnUnregistered;
 
 private:
        mutable boost::mutex m_Mutex;
index 00b850cf471bb606e5b1bdfefcfafcd4dd0a6c58..11bf5cd9f94eaa814df482bb564c1ca50328c199 100644 (file)
@@ -17,7 +17,8 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/ringbuffer.h"
+#include "base/objectlock.h"
 
 using namespace icinga;
 
index 44ba731152190e6bf8f3728799aef70af8ce96db..200ffecdf4a9ba1662629abbf5b99cc14f0f05e1 100644 (file)
 #ifndef RINGBUFFER_H
 #define RINGBUFFER_H
 
+#include "base/i2-base.h"
+#include "base/object.h"
+#include <vector>
+
 namespace icinga
 {
 
@@ -34,7 +38,7 @@ public:
        typedef shared_ptr<RingBuffer> Ptr;
        typedef weak_ptr<RingBuffer> WeakPtr;
 
-       typedef vector<int>::size_type SizeType;
+       typedef std::vector<int>::size_type SizeType;
 
        RingBuffer(SizeType slots);
 
@@ -43,7 +47,7 @@ public:
        int GetValues(SizeType span) const;
 
 private:
-       vector<int> m_Slots;
+       std::vector<int> m_Slots;
        SizeType m_TimeValue;
 };
 
index 38ea3d9305ee7bbe21ad8e1f8822a805968c8152..405c660a44e5dc3826bd678a2384a937baa4a9f5 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/script.h"
+#include "base/scriptlanguage.h"
+#include "base/dynamictype.h"
+#include "base/logger_fwd.h"
+#include "base/objectlock.h"
 
 using namespace icinga;
 
@@ -81,7 +85,7 @@ void Script::OnAttributeUpdate(const String& name)
  */
 void Script::SpawnInterpreter(void)
 {
-       Logger::Write(LogInformation, "base", "Reloading script '" + GetName() + "'");
+       Log(LogInformation, "base", "Reloading script '" + GetName() + "'");
 
        ScriptLanguage::Ptr language = ScriptLanguage::GetByName(GetLanguage());
        m_Interpreter = language->CreateInterpreter(GetSelf());
index 970c18e962baf53263c6573dd706748fe21e18d0..7c359c7d0c0c242d8140ff07128f0a1a694859eb 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef SCRIPT_H
 #define SCRIPT_H
 
+#include "base/i2-base.h"
+#include "base/dynamicobject.h"
+
 namespace icinga
 {
 
index dfa8904e49a6c4e1fb08d6f3b104205605042d2a..f82bbe083d89df26f6dd38bad3fefde9a12fc4d0 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/registry.h"
+#include "base/scriptfunction.h"
+#include "base/scripttask.h"
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 
@@ -28,7 +31,13 @@ ScriptFunction::ScriptFunction(const Callback& function)
 /**
  * @threadsafety Always.
  */
-void ScriptFunction::Invoke(const ScriptTask::Ptr& task, const vector<Value>& arguments)
+void ScriptFunction::Invoke(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
 {
        m_Callback(task, arguments);
 }
+
+RegisterFunctionHelper::RegisterFunctionHelper(const String& name, const ScriptFunction::Callback& function)
+{
+       ScriptFunction::Ptr func = boost::make_shared<ScriptFunction>(function);
+       ScriptFunctionRegistry::GetInstance()->Register(name, func);
+}
index eb471f6675992bb1ee7d32d1d550c1c93e5241e8..57894d4d4e6d3111ab289fbade2fd2fe1889fac6 100644 (file)
 #ifndef SCRIPTFUNCTION_H
 #define SCRIPTFUNCTION_H
 
+#include "base/i2-base.h"
+#include "base/registry.h"
+#include "base/value.h"
+#include <vector>
 #include <boost/function.hpp>
 
 namespace icinga
@@ -38,14 +42,14 @@ public:
        typedef shared_ptr<ScriptFunction> Ptr;
        typedef weak_ptr<ScriptFunction> WeakPtr;
 
-       typedef boost::function<void (const shared_ptr<ScriptTask>&, const vector<Value>& arguments)> Callback;
+       typedef boost::function<void (const shared_ptr<ScriptTask>&, const std::vector<Value>& arguments)> Callback;
 
        explicit ScriptFunction(const Callback& function);
 
 private:
        Callback m_Callback;
 
-       void Invoke(const shared_ptr<ScriptTask>& task, const vector<Value>& arguments);
+       void Invoke(const shared_ptr<ScriptTask>& task, const std::vector<Value>& arguments);
 
        friend class ScriptTask;
 };
@@ -63,14 +67,10 @@ class I2_BASE_API ScriptFunctionRegistry : public Registry<ScriptFunction::Ptr>
  *
  * @ingroup base
  */
-class RegisterFunctionHelper
+class I2_BASE_API RegisterFunctionHelper
 {
 public:
-       RegisterFunctionHelper(const String& name, const ScriptFunction::Callback& function)
-       {
-               ScriptFunction::Ptr func = boost::make_shared<ScriptFunction>(function);
-               ScriptFunctionRegistry::GetInstance()->Register(name, func);
-       }
+       RegisterFunctionHelper(const String& name, const ScriptFunction::Callback& function);
 };
 
 #define REGISTER_SCRIPTFUNCTION(name, callback) \
index 9929823f3538f5b4b1a059f8754c4a5ace7c44c3..67a08adaefcaf7f42eb3d423d02b0355084f158c 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/scriptinterpreter.h"
+#include "base/objectlock.h"
+#include <boost/bind.hpp>
+#include <boost/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
index 6ff25f18c54d8fb03b4ace4a1e61dd47e8462f92..8a9e410eb604186e856555a8881f5b2f358a8fd6 100644 (file)
 #ifndef SCRIPTINTERPRETER_H
 #define SCRIPTINTERPRETER_H
 
+#include "base/i2-base.h"
+#include "base/script.h"
+#include <vector>
+#include <set>
+
 namespace icinga
 {
 
@@ -40,13 +45,13 @@ protected:
        ScriptInterpreter(const Script::Ptr& script);
 
        virtual void ProcessCall(const ScriptTask::Ptr& task, const String& function,
-           const vector<Value>& arguments) = 0;
+           const std::vector<Value>& arguments) = 0;
 
        void SubscribeFunction(const String& name);
        void UnsubscribeFunction(const String& name);
 
 private:
-       set<String> m_SubscribedFunctions;
+       std::set<String> m_SubscribedFunctions;
 };
 
 }
index 7fb44de309dfc726e71a042a44670f5e83810325..6f7a82ac9889b3c3f34a9ba4f6a26e4d23a16c61 100644 (file)
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/scriptlanguage.h"
 
 using namespace icinga;
 
@@ -51,7 +51,7 @@ ScriptLanguage::Ptr ScriptLanguage::GetByName(const String& name)
 {
        boost::mutex::scoped_lock lock(GetMutex());
 
-       map<String, ScriptLanguage::Ptr>::iterator it;
+       std::map<String, ScriptLanguage::Ptr>::iterator it;
 
        it = GetLanguages().find(name);
 
@@ -67,8 +67,8 @@ boost::mutex& ScriptLanguage::GetMutex(void)
        return mutex;
 }
 
-map<String, ScriptLanguage::Ptr>& ScriptLanguage::GetLanguages(void)
+std::map<String, ScriptLanguage::Ptr>& ScriptLanguage::GetLanguages(void)
 {
-       static map<String, ScriptLanguage::Ptr> languages;
+       static std::map<String, ScriptLanguage::Ptr> languages;
        return languages;
 }
index 4c3c903ca2c1086c7f2323357d89b320c8886209..edf9ace1f5a3d56efc10173b50a46971e9e81916 100644 (file)
 #ifndef SCRIPTLANGUAGE_H
 #define SCRIPTLANGUAGE_H
 
+#include "base/i2-base.h"
+#include "base/scriptinterpreter.h"
+#include <map>
+
 namespace icinga
 {
 
@@ -48,7 +52,7 @@ protected:
 
 private:
        static boost::mutex& GetMutex(void);
-       static map<String, ScriptLanguage::Ptr>& GetLanguages(void);
+       static std::map<String, ScriptLanguage::Ptr>& GetLanguages(void);
 };
 
 /**
index 5ef9030b5542e3c6cdcfea87f3ed50b1bbf6875f..06bbc67b7242e68d380e1f2a1880908c426749f9 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/scripttask.h"
 
 using namespace icinga;
 
 ScriptTask::ScriptTask(const ScriptFunction::Ptr& function,
-    const vector<Value>& arguments)
+    const std::vector<Value>& arguments)
        : AsyncTask<ScriptTask, Value>(), m_Function(function),
          m_Arguments(arguments)
 { }
index 71d5912cfbe3b242a74aa1d9ba440511295d18db..3048b5e76e9171c3b3a5df50116b11cd0b6d8ab4 100644 (file)
 #ifndef SCRIPTTASK_H
 #define SCRIPTTASK_H
 
+#include "base/i2-base.h"
+#include "base/asynctask.h"
+#include "base/scriptfunction.h"
+#include <vector>
+
 namespace icinga
 {
 
@@ -34,14 +39,14 @@ public:
        typedef shared_ptr<ScriptTask> Ptr;
        typedef weak_ptr<ScriptTask> WeakPtr;
 
-       ScriptTask(const ScriptFunction::Ptr& function, const vector<Value>& arguments);
+       ScriptTask(const ScriptFunction::Ptr& function, const std::vector<Value>& arguments);
 
 protected:
        virtual void Run(void);
 
 private:
        ScriptFunction::Ptr m_Function;
-       vector<Value> m_Arguments;
+       std::vector<Value> m_Arguments;
 };
 
 }
index 4f65da04a00145232ddea57e77624bc6164fe026..59039b8138c5a6157b463a339e85b6c3e4f47fab 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef SINGLETON_H
 #define SINGLETON_H
 
+#include "base/i2-base.h"
+#include <boost/thread/mutex.hpp>
+
 namespace icinga
 {
 
index e0b061a875909bc3233f122a118699807279d63d..487f5b86b9d740e1c87a049a5f54af2b3c446e12 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/socket.h"
+#include "base/objectlock.h"
+#include "base/utility.h"
+#include <sstream>
 #include <boost/bind.hpp>
+#include <boost/make_shared.hpp>
 
 using namespace icinga;
 
@@ -179,7 +183,7 @@ String Socket::GetAddressFromSockaddr(sockaddr *address, socklen_t len)
 #endif /* _WIN32 */
        }
 
-       stringstream s;
+       std::ostringstream s;
        s << "[" << host << "]:" << service;
        return s.str();
 }
@@ -400,7 +404,7 @@ size_t Socket::GetAvailableBytes(void) const
        ObjectLock olock(this);
 
        if (m_Listening)
-               throw new logic_error("Socket does not support GetAvailableBytes().");
+               throw new std::logic_error("Socket does not support GetAvailableBytes().");
 
        return m_RecvQueue->GetAvailableBytes();
 }
@@ -418,7 +422,7 @@ size_t Socket::Read(void *buffer, size_t size)
                ObjectLock olock(this);
 
                if (m_Listening)
-                       throw new logic_error("Socket does not support Read().");
+                       throw new std::logic_error("Socket does not support Read().");
        }
 
        if (m_RecvQueue->GetAvailableBytes() == 0)
@@ -440,7 +444,7 @@ size_t Socket::Peek(void *buffer, size_t size)
                ObjectLock olock(this);
 
                if (m_Listening)
-                       throw new logic_error("Socket does not support Peek().");
+                       throw new std::logic_error("Socket does not support Peek().");
        }
 
        if (m_RecvQueue->GetAvailableBytes() == 0)
@@ -461,7 +465,7 @@ void Socket::Write(const void *buffer, size_t size)
                ObjectLock olock(this);
 
                if (m_Listening)
-                       throw new logic_error("Socket does not support Write().");
+                       throw new std::logic_error("Socket does not support Write().");
        }
 
        m_SendQueue->Write(buffer, size);
@@ -596,7 +600,7 @@ void Socket::HandleReadableClient(void)
 
 void Socket::HandleWritableServer(void)
 {
-       throw logic_error("This should never happen.");
+       throw std::logic_error("This should never happen.");
 }
 
 /**
index 8b0286dc847e63dbab9bb57a824a605c5f1217e9..1a8368242ab5d72526d8b07e4e3a2ce7aae86bea 100644 (file)
 #ifndef SOCKET_H
 #define SOCKET_H
 
+#include "base/i2-base.h"
+#include "base/fifo.h"
 #include <boost/thread/thread.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition_variable.hpp>
+#include <boost/signals2.hpp>
 
 namespace icinga {
 
@@ -56,7 +59,7 @@ public:
 
        void Listen(void);
 
-       signals2::signal<void (const Socket::Ptr&, const Socket::Ptr&)> OnNewClient;
+       boost::signals2::signal<void (const Socket::Ptr&, const Socket::Ptr&)> OnNewClient;
 
 protected:
        void SetFD(SOCKET fd);
index a2a7f0c062499a3637c6486ae452557e4c2eb31a..86f7dfa1bcd15f84b28dfc325e49824c3e1f6abf 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/stacktrace.h"
+#include "base/qstring.h"
+#include "base/utility.h"
+
 #if HAVE_BACKTRACE_SYMBOLS
 #      include <execinfo.h>
 #endif /* HAVE_BACKTRACE_SYMBOLS */
@@ -102,7 +105,7 @@ void StackTrace::Initialize(void)
  *                    the one this function is executing in).
  * @returns true if the stacktrace was printed, false otherwise.
  */
-void StackTrace::Print(ostream& fp, int ignoreFrames) const
+void StackTrace::Print(std::ostream& fp, int ignoreFrames) const
 {
        fp << std::endl << "Stacktrace:" << std::endl;
 
@@ -171,7 +174,7 @@ void StackTrace::Print(ostream& fp, int ignoreFrames) const
 #endif /* _WIN32 */
 }
 
-ostream& icinga::operator<<(ostream& stream, const StackTrace& trace)
+std::ostream& icinga::operator<<(std::ostream& stream, const StackTrace& trace)
 {
        trace.Print(stream, 1);
 
index 41f3c0df5e8c715a8a611f733b44e191f6cbf1b4..b98535e8e35b0c9b53a4aa58f919c828ab0a66d8 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef STACKTRACE_H
 #define STACKTRACE_H
 
+#include "base/i2-base.h"
+#include <ostream>
 #include <boost/thread/once.hpp>
 
 namespace icinga
@@ -38,7 +40,7 @@ public:
        explicit StackTrace(PEXCEPTION_POINTERS exi);
 #endif /* _WIN32 */
 
-       void Print(ostream& fp, int ignoreFrames = 0) const;
+       void Print(std::ostream& fp, int ignoreFrames = 0) const;
 
 private:
        void *m_Frames[64];
@@ -49,7 +51,7 @@ private:
        static void Initialize(void);
 };
 
-I2_BASE_API ostream& operator<<(ostream& stream, const StackTrace& trace);
+I2_BASE_API std::ostream& operator<<(std::ostream& stream, const StackTrace& trace);
 
 }
 
index 859912ea30edbab01b90566542d9de3936e5fa63..8266614c6282d0c60d3b5c6fdb736ab455a8b178 100644 (file)
@@ -17,7 +17,9 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/stdiostream.h"
+#include "base/objectlock.h"
+#include <boost/make_shared.hpp>
 
 using namespace icinga;
 
@@ -28,7 +30,7 @@ using namespace icinga;
  * @param ownsStream Whether the new object owns the inner stream. If true
  *                                      the stream's destructor deletes the inner stream.
  */
-StdioStream::StdioStream(iostream *innerStream, bool ownsStream)
+StdioStream::StdioStream(std::iostream *innerStream, bool ownsStream)
        : m_InnerStream(innerStream), m_OwnsStream(ownsStream),
          m_ReadAheadBuffer(boost::make_shared<FIFO>())
 {
index a7b002116faecf7102275663bbe2ecf036de558d..e6c09ead6bb524cc1d23b5b2f19fcf12f572a99f 100644 (file)
 #ifndef STDIOSTREAM_H
 #define STDIOSTREAM_H
 
+#include "base/i2-base.h"
+#include "base/fifo.h"
+#include <iostream>
+
 namespace icinga {
 
 class StdioStream : public Stream
@@ -28,7 +32,7 @@ public:
        typedef shared_ptr<StdioStream> Ptr;
        typedef weak_ptr<StdioStream> WeakPtr;
 
-       StdioStream(iostream *innerStream, bool ownsStream);
+       StdioStream(std::iostream *innerStream, bool ownsStream);
        ~StdioStream(void);
 
        virtual void Start(void);
@@ -41,7 +45,7 @@ public:
        virtual void Close(void);
 
 private:
-       iostream *m_InnerStream;
+       std::iostream *m_InnerStream;
        bool m_OwnsStream;
        FIFO::Ptr m_ReadAheadBuffer;
 };
index 9200e5e6e26c5cf63b6a950e21a34d707eadf137..d8040e0d2c10d72827d3a21d7785c22d1f036af0 100644 (file)
@@ -17,7 +17,9 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/stream.h"
+#include "base/objectlock.h"
+#include "base/utility.h"
 #include <boost/algorithm/string/trim.hpp>
 
 using namespace icinga;
index 1235f16dcea6e1ef4e9850264c75e61941666c46..67fce2bf5c803ddce7806ea384ce6859aa049e91 100644 (file)
 #ifndef STREAM_H
 #define STREAM_H
 
+#include "base/i2-base.h"
+#include "base/object.h"
+#include "base/qstring.h"
 #include <boost/exception_ptr.hpp>
+#include <boost/signals2.hpp>
 
 namespace icinga
 {
@@ -91,9 +95,9 @@ public:
        boost::exception_ptr GetException(void);
        void CheckException(void);
 
-       signals2::signal<void (const Stream::Ptr&)> OnConnected;
-       signals2::signal<void (const Stream::Ptr&)> OnDataAvailable;
-       signals2::signal<void (const Stream::Ptr&)> OnClosed;
+       boost::signals2::signal<void (const Stream::Ptr&)> OnConnected;
+       boost::signals2::signal<void (const Stream::Ptr&)> OnDataAvailable;
+       boost::signals2::signal<void (const Stream::Ptr&)> OnClosed;
 
 protected:
        void SetConnected(bool connected);
index 7f7051e3e52ca55d8b57718f659fb0d551927c18..9640003a40815647543bcaf43e476cfc5b6a6b3c 100644 (file)
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/stream_bio.h"
 
 using namespace icinga;
 
index 3f40f919557fa12775eb7fe292a15bda5c15ceed..14ddf76a48af3ceb319846d91c7e354895aeddaa 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef STREAMBIO_H
 #define STREAMBIO_H
 
+#include "base/i2-base.h"
+#include "base/stream.h"
+
 namespace icinga
 {
 
@@ -28,4 +31,4 @@ void I2Stream_check_exception(BIO *bi);
 
 }
 
-#endif /* STREAMBIO_H */
\ No newline at end of file
+#endif /* STREAMBIO_H */
index 3b149cca739e7a45a5ba9d4d5d6f6a336379b62f..128d69c2a83a09f3b1919973eae6355e810f4ff5 100644 (file)
@@ -17,7 +17,9 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/streamlogger.h"
+#include "base/objectlock.h"
+#include <fstream>
 
 using namespace icinga;
 
@@ -35,7 +37,7 @@ StreamLogger::StreamLogger(void)
  *
  * @param stream The stream.
  */
-StreamLogger::StreamLogger(ostream *stream)
+StreamLogger::StreamLogger(std::ostream *stream)
        : ILogger(), m_Stream(stream), m_OwnsStream(false), m_Tty(IsTty(*stream))
 { }
 
@@ -53,13 +55,13 @@ StreamLogger::~StreamLogger(void)
  */
 void StreamLogger::OpenFile(const String& filename)
 {
-       ofstream *stream = new ofstream();
+       std::ofstream *stream = new std::ofstream();
 
        try {
-               stream->open(filename.CStr(), fstream::out | fstream::trunc);
+               stream->open(filename.CStr(), std::fstream::out | std::fstream::trunc);
 
                if (!stream->good())
-                       BOOST_THROW_EXCEPTION(runtime_error("Could not open logfile '" + filename + "'"));
+                       BOOST_THROW_EXCEPTION(std::runtime_error("Could not open logfile '" + filename + "'"));
        } catch (...) {
                delete stream;
                throw;
@@ -80,7 +82,7 @@ void StreamLogger::OpenFile(const String& filename)
  * @param entry The log entry.
  * @threadsafety Always.
  */
-void StreamLogger::ProcessLogEntry(ostream& stream, bool tty, const LogEntry& entry)
+void StreamLogger::ProcessLogEntry(std::ostream& stream, bool tty, const LogEntry& entry)
 {
        String timestamp = Utility::FormatDateTime("%Y/%m/%d %H:%M:%S %z", entry.Timestamp);
 
@@ -125,7 +127,7 @@ void StreamLogger::ProcessLogEntry(const LogEntry& entry)
 /**
  * @threadsafety Always.
  */
-bool StreamLogger::IsTty(ostream& stream)
+bool StreamLogger::IsTty(std::ostream& stream)
 {
 #ifndef _WIN32
        /* Eww... */
index 8bcaa0359d88a295edc446f22fed715d19a76e72..d985ba9595cb6511ffbfd12dd798a7dcce52eac2 100644 (file)
 #ifndef STREAMLOGGER_H
 #define STREAMLOGGER_H
 
+#include "base/i2-base.h"
+#include "base/logger.h"
+#include <ostream>
+
 namespace icinga
 {
 
@@ -35,20 +39,20 @@ public:
        typedef weak_ptr<StreamLogger> WeakPtr;
 
        StreamLogger(void);
-       explicit StreamLogger(ostream *stream);
+       explicit StreamLogger(std::ostream *stream);
        ~StreamLogger(void);
 
        void OpenFile(const String& filename);
 
-       static void ProcessLogEntry(ostream& stream, bool tty, const LogEntry& entry);
-        static bool IsTty(ostream& stream);
+       static void ProcessLogEntry(std::ostream& stream, bool tty, const LogEntry& entry);
+        static bool IsTty(std::ostream& stream);
 
 protected:
        virtual void ProcessLogEntry(const LogEntry& entry);
 
 private:
        static boost::mutex m_Mutex;
-       ostream *m_Stream;
+       std::ostream *m_Stream;
        bool m_OwnsStream;
         bool m_Tty;
 };
index 6ebf5234e7fcd24bec44cc7fde2a9a01c339693c..f0507908976190bf0e55f1cbcb261e2194bab7ab 100644 (file)
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/sysloglogger.h"
 
 #ifndef _WIN32
 using namespace icinga;
index 291658d70952868538d69f690b15e99c533e10c4..4f3c9e811aa467eabebbc0ce43da03c817faaf26 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef SYSLOGLOGGER_H
 #define SYSLOGLOGGER_H
 
+#include "base/i2-base.h"
+#include "base/logger.h"
+
 #ifndef _WIN32
 namespace icinga
 {
index bf36ca76868bf7a1efcec5f3a4a9a9741dfefe91..c08e40e4e891aa678607f3dcc3e4b337c96ded84 100644 (file)
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/tcpsocket.h"
 
 using namespace icinga;
 
@@ -101,7 +101,7 @@ void TcpSocket::Bind(String node, String service, int family)
        freeaddrinfo(result);
 
        if (fd == INVALID_SOCKET)
-               BOOST_THROW_EXCEPTION(runtime_error("Could not create a suitable socket."));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Could not create a suitable socket."));
 }
 
 /**
@@ -169,5 +169,5 @@ void TcpSocket::Connect(const String& node, const String& service)
        freeaddrinfo(result);
 
        if (fd == INVALID_SOCKET)
-               BOOST_THROW_EXCEPTION(runtime_error("Could not create a suitable socket."));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Could not create a suitable socket."));
 }
index 2d8f6b4c3079f76077c08cb90b9d05339f46e230..48a4c0d0e36b62a390b2bb6a38118770f65f81bc 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef TCPSOCKET_H
 #define TCPSOCKET_H
 
+#include "base/i2-base.h"
+#include "base/socket.h"
+
 namespace icinga
 {
 
index 2c8612e2784b33f9d66414cd7d3ec61cad665bf2..5916c12f20acbcd81b36c4686bb24b66ce1f1501 100644 (file)
@@ -17,7 +17,8 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/timer.h"
+#include "base/application.h"
 #include <boost/bind.hpp>
 
 using namespace icinga;
@@ -216,7 +217,7 @@ void Timer::AdjustTimers(double adjustment)
 
        double now = Utility::GetTime();
 
-       typedef nth_index<TimerSet, 1>::type TimerView;
+       typedef boost::multi_index::nth_index<TimerSet, 1>::type TimerView;
        TimerView& idx = boost::get<1>(m_Timers);
 
        TimerView::iterator it;
@@ -245,7 +246,7 @@ void Timer::TimerThreadProc(void)
        for (;;) {
                boost::mutex::scoped_lock lock(m_Mutex);
 
-               typedef nth_index<TimerSet, 1>::type NextTimerView;
+               typedef boost::multi_index::nth_index<TimerSet, 1>::type NextTimerView;
                NextTimerView& idx = boost::get<1>(m_Timers);
 
                /* Wait until there is at least one timer. */
index d95432d3eccadc81a47bef4469bef6525be6ecfb..47716241fcb0afa3c1628b55175e7de445c1c0fe 100644 (file)
 #ifndef TIMER_H
 #define TIMER_H
 
+#include "base/i2-base.h"
+#include "base/object.h"
+#include <list>
 #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 <boost/signals2.hpp>
 
 namespace icinga {
 
@@ -49,7 +56,7 @@ public:
        typedef shared_ptr<Timer> Ptr;
        typedef weak_ptr<Timer> WeakPtr;
 
-       typedef list<Timer::WeakPtr> CollectionType;
+       typedef std::list<Timer::WeakPtr> CollectionType;
 
        Timer(void);
 
@@ -64,7 +71,7 @@ public:
        void Reschedule(double next = -1);
        double GetNext(void) const;
 
-       signals2::signal<void(const Timer::Ptr&)> OnTimerExpired;
+       boost::signals2::signal<void(const Timer::Ptr&)> OnTimerExpired;
 
        static void Initialize(void);
        static void Uninitialize(void);
@@ -74,11 +81,11 @@ private:
        double m_Next; /**< When the next event should happen. */
        bool m_Started; /**< Whether the timer is enabled. */
 
-       typedef multi_index_container<
+       typedef boost::multi_index_container<
                Timer::WeakPtr,
-               indexed_by<
-                       ordered_unique<identity<Timer::WeakPtr> >,
-                       ordered_non_unique<TimerNextExtractor>
+               boost::multi_index::indexed_by<
+                       boost::multi_index::ordered_unique<boost::multi_index::identity<Timer::WeakPtr> >,
+                       boost::multi_index::ordered_non_unique<TimerNextExtractor>
                >
        > TimerSet;
 
index bcf608131ebce5cb9b3499523d72530647fa3ea9..3c9c6234859b5c2f9fa833ea8bfa2f6623c954fa 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/tlsstream.h"
+#include "base/stream_bio.h"
+#include "base/objectlock.h"
+#include "base/utility.h"
+#include "base/exception.h"
 #include <boost/bind.hpp>
+#include <boost/make_shared.hpp>
 
 using namespace icinga;
 
@@ -54,7 +59,7 @@ void TlsStream::Start(void)
        }
 
        if (!m_SSL)
-               BOOST_THROW_EXCEPTION(logic_error("No X509 client certificate was specified."));
+               BOOST_THROW_EXCEPTION(std::logic_error("No X509 client certificate was specified."));
 
        if (!m_SSLIndexInitialized) {
                m_SSLIndex = SSL_get_ex_new_index(0, const_cast<char *>("TlsStream"), NULL, NULL, NULL);
index 659d48e4cc7d3db11c8ab11f9c28de482d7b4795..3d1d1cf0d5717bd6da47b6c8f2d4326b74a33a08 100644 (file)
 #ifndef TLSSTREAM_H
 #define TLSSTREAM_H
 
+#include "base/i2-base.h"
+#include "base/stream.h"
+#include "base/fifo.h"
+
 namespace icinga
 {
 
index 4075eb015a5b718215f0d80ec814d5a80250c0c8..c09a3a8b67b970428eeafc7df1fdb0a5d7ef9e05 100644 (file)
@@ -17,7 +17,8 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/unixsocket.h"
+#include "base/exception.h"
 
 #ifndef _WIN32
 using namespace icinga;
index 3f278a101d2ec471ea0ff5a9dca9232d58146ea2..a828496999464456fd928768ccd694c46073629b 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef UNIXSOCKET_H
 #define UNIXSOCKET_H
 
+#include "base/i2-base.h"
+#include "base/socket.h"
+
 #ifndef _WIN32
 namespace icinga
 {
index 99fca04329e967b75ad11c0e301986e2559cb589..a22291a44ae4777af87706f5b084907cd8ebcd21 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/utility.h"
+#include "base/application.h"
+#include "base/logger_fwd.h"
+#include "base/exception.h"
 #include <mmatch.h>
 #include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid_generators.hpp>
 #include <boost/uuid/uuid_io.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/function.hpp>
+#include <boost/foreach.hpp>
+
+#if HAVE_GCC_ABI_DEMANGLE
+#      include <cxxabi.h>
+#endif /* HAVE_GCC_ABI_DEMANGLE */
 
 using namespace icinga;
 
@@ -58,7 +66,7 @@ String Utility::DemangleSymbolName(const String& sym)
  * @param ti A type_info object.
  * @returns The type name of the object.
  */
-String Utility::GetTypeName(const type_info& ti)
+String Utility::GetTypeName(const std::type_info& ti)
 {
        return DemangleSymbolName(ti.name());
 }
@@ -224,7 +232,7 @@ String Utility::DirName(const String& path)
 #endif /* _WIN32 */
 
        if (dir == NULL)
-               BOOST_THROW_EXCEPTION(bad_alloc());
+               BOOST_THROW_EXCEPTION(std::bad_alloc());
 
        String result;
 
@@ -262,7 +270,7 @@ String Utility::BaseName(const String& path)
        String result;
 
        if (dir == NULL)
-               BOOST_THROW_EXCEPTION(bad_alloc());
+               BOOST_THROW_EXCEPTION(std::bad_alloc());
 
 #ifndef _WIN32
        result = basename(dir);
@@ -369,7 +377,7 @@ Utility::LoadExtensionLibrary(const String& library)
        path = "lib" + library + ".la";
 #endif /* _WIN32 */
 
-       Logger::Write(LogInformation, "base", "Loading library '" + path + "'");
+       Log(LogInformation, "base", "Loading library '" + path + "'");
 
 #ifdef _WIN32
        HMODULE hModule = LoadLibrary(path.CStr());
@@ -384,7 +392,7 @@ Utility::LoadExtensionLibrary(const String& library)
        lt_dlhandle hModule = lt_dlopen(path.CStr());
 
        if (hModule == NULL) {
-               BOOST_THROW_EXCEPTION(runtime_error("Could not load library '" + path + "': " +  lt_dlerror()));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Could not load library '" + path + "': " +  lt_dlerror()));
        }
 #endif /* _WIN32 */
 
index 65eef9fe537a74de87b5449c2f0b51a7ef7c2f7d..0248a14c63dde7aa2c21c071bdf48e45473e7942 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef UTILITY_H
 #define UTILITY_H
 
+#include "base/i2-base.h"
+#include "base/qstring.h"
+#include <typeinfo>
 #include <boost/function.hpp>
 
 namespace icinga
@@ -34,7 +37,7 @@ class I2_BASE_API Utility
 {
 public:
        static String DemangleSymbolName(const String& sym);
-       static String GetTypeName(const type_info& ti);
+       static String GetTypeName(const std::type_info& ti);
 
        static shared_ptr<SSL_CTX> MakeSSLContext(const String& pubkey, const String& privkey, const String& cakey);
        static String GetCertificateCN(const shared_ptr<X509>& certificate);
index d82ce5b968906651808a63a02415d2cdf2fc5501..d63912a8c5937869a79a158d25308a370378f496 100644 (file)
@@ -17,7 +17,9 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "i2-base.h"
+#include "base/application.h"
+#include "base/array.h"
+#include "base/logger_fwd.h"
 #include <cJSON.h>
 #include <boost/lexical_cast.hpp>
 
@@ -85,7 +87,7 @@ Value::operator String(void) const
                        object = boost::get<Object::Ptr>(m_Value).get();
                        return "Object of type '" + Utility::GetTypeName(typeid(*object)) + "'";
                default:
-                       BOOST_THROW_EXCEPTION(runtime_error("Unknown value type."));
+                       BOOST_THROW_EXCEPTION(std::runtime_error("Unknown value type."));
        }
 }
 
@@ -111,7 +113,7 @@ Value Value::FromJson(cJSON *json)
        else if (json->type == cJSON_NULL)
                return Value();
        else
-               BOOST_THROW_EXCEPTION(invalid_argument("Unsupported JSON type."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Unsupported JSON type."));
 }
 
 /**
@@ -161,7 +163,7 @@ cJSON *Value::ToJson(void) const
                                Array::Ptr array = *this;
                                return array->ToJson();
                        } else {
-                               Logger::Write(LogDebug, "base", "Ignoring unknown object while converting variant to JSON.");
+                               Log(LogDebug, "base", "Ignoring unknown object while converting variant to JSON.");
                                return cJSON_CreateNull();
                        }
 
@@ -169,7 +171,7 @@ cJSON *Value::ToJson(void) const
                        return cJSON_CreateNull();
 
                default:
-                       BOOST_THROW_EXCEPTION(runtime_error("Invalid variant type."));
+                       BOOST_THROW_EXCEPTION(std::runtime_error("Invalid variant type."));
        }
 }
 
@@ -184,7 +186,7 @@ Value Value::Deserialize(const String& jsonString)
        cJSON *json = cJSON_Parse(jsonString.CStr());
 
        if (!json)
-               BOOST_THROW_EXCEPTION(runtime_error("Invalid JSON String"));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Invalid JSON String"));
 
        Value value = FromJson(json);
        cJSON_Delete(json);
index 41bf94986d726b09dbf4af8136e1f54da3a020ba..393ae7b7618a2b7355fa96e440fb59f865b3054c 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef VALUE_H
 #define VALUE_H
 
+#include "base/object.h"
+#include "base/qstring.h"
 #include <boost/variant.hpp>
 
 struct cJSON;
@@ -82,7 +84,7 @@ public:
                Object::Ptr object = dynamic_pointer_cast<Object>(value);
 
                if (!object)
-                       BOOST_THROW_EXCEPTION(invalid_argument("shared_ptr value type must inherit from Object class."));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("shared_ptr value type must inherit from Object class."));
 
                m_Value = object;
        }
@@ -99,7 +101,7 @@ public:
                shared_ptr<T> object = dynamic_pointer_cast<T>(boost::get<Object::Ptr>(m_Value));
 
                if (!object)
-                       BOOST_THROW_EXCEPTION(bad_cast());
+                       BOOST_THROW_EXCEPTION(std::bad_cast());
 
                return object;
        }
index 4deccb76480fd40968a68d3129c6ea24f429c96b..1e2f14e9cc9f81d31d7b0c14037311c8371a277a 100644 (file)
@@ -9,7 +9,8 @@ BUILT_SOURCES = config_parser.h
 AM_YFLAGS = -d
 
 EXTRA_DIST = \
-       base-type.conf
+       base-type.conf \
+       i2-config.cpp
 
 .conf.cpp: $(top_builddir)/tools/mkembedconfig.c
        $(top_builddir)/tools/mkembedconfig $< $@
@@ -22,7 +23,6 @@ libconfig_la_SOURCES = \
        configcompilercontext.h \
        config_lexer.ll \
        config_parser.yy \
-       i2-config.cpp \
        i2-config.h \
        configitem.cpp \
        configitem.h \
@@ -43,7 +43,7 @@ libconfig_la_SOURCES = \
 libconfig_la_CPPFLAGS = \
        -DI2_CONFIG_BUILD \
        $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/lib/base
+       -I${top_srcdir}/lib
 
 libconfig_la_LDFLAGS = \
        $(BOOST_LDFLAGS) \
index de89a6e0a7d7daa9f59edf84172950fdda4c4449..d6e67899ecf47567c16141593da29b8f2fd1290a 100644 (file)
@@ -8,7 +8,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_SUBMINOR_VERSION 37
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -158,15 +158,7 @@ typedef void* yyscan_t;
 
 /* Size of default input buffer. */
 #ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
 #define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
 #endif
 
 /* The state buf must be large enough to hold one state per character in the main buffer.
@@ -178,6 +170,11 @@ typedef void* yyscan_t;
 typedef struct yy_buffer_state *YY_BUFFER_STATE;
 #endif
 
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
 #define EOB_ACT_CONTINUE_SCAN 0
 #define EOB_ACT_END_OF_FILE 1
 #define EOB_ACT_LAST_MATCH 2
@@ -213,11 +210,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
 
 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
 
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
 #ifndef YY_STRUCT_YY_BUFFER_STATE
 #define YY_STRUCT_YY_BUFFER_STATE
 struct yy_buffer_state
@@ -235,7 +227,7 @@ struct yy_buffer_state
        /* Number of characters read into yy_ch_buf, not including EOB
         * characters.
         */
-       int yy_n_chars;
+       yy_size_t yy_n_chars;
 
        /* Whether we "own" the buffer - i.e., we know we created it,
         * and can realloc() it to grow it, and should free() it to
@@ -314,7 +306,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
 
 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
 
 void *yyalloc (yy_size_t ,yyscan_t yyscanner );
 void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
@@ -346,7 +338,7 @@ void yyfree (void * ,yyscan_t yyscanner );
 
 /* Begin user sect3 */
 
-#define yywrap(n) 1
+#define yywrap(yyscanner) 1
 #define YY_SKIP_YYWRAP
 
 typedef unsigned char YY_CHAR;
@@ -635,6 +627,7 @@ static yyconst flex_int32_t yy_rule_can_match_eol[57] =
 
 #include "i2-config.h"
 #include "config_parser.h"
+#include <sstream>
 
 using namespace icinga;
 
@@ -686,7 +679,7 @@ static void lb_append_char(lex_buf *lb, char new_char)
        char *new_buf = (char *)realloc(lb->buf, new_len);
 
        if (new_buf == NULL && new_len > 0)
-               throw bad_alloc();
+               throw std::bad_alloc();
 
        lb->buf = new_buf;
        lb->size++;
@@ -697,7 +690,7 @@ static void lb_append_char(lex_buf *lb, char new_char)
 
 
 
-#line 701 "config_lexer.cc"
+#line 694 "config_lexer.cc"
 
 #define INITIAL 0
 #define C_COMMENT 1
@@ -729,8 +722,8 @@ struct yyguts_t
     size_t yy_buffer_stack_max; /**< capacity of stack. */
     YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
     char yy_hold_char;
-    int yy_n_chars;
-    int yyleng_r;
+    yy_size_t yy_n_chars;
+    yy_size_t yyleng_r;
     char *yy_c_buf_p;
     int yy_init;
     int yy_start;
@@ -787,7 +780,7 @@ FILE *yyget_out (yyscan_t yyscanner );
 
 void yyset_out  (FILE * out_str ,yyscan_t yyscanner );
 
-int yyget_leng (yyscan_t yyscanner );
+yy_size_t yyget_leng (yyscan_t yyscanner );
 
 char *yyget_text (yyscan_t yyscanner );
 
@@ -841,12 +834,7 @@ static int input (yyscan_t yyscanner );
 
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
 #define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
 #endif
 
 /* Copy whatever the last rule matched to the standard output. */
@@ -950,11 +938,11 @@ YY_DECL
        register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 91 "config_lexer.ll"
+#line 92 "config_lexer.ll"
 
        lex_buf string_buf;
 
-#line 958 "config_lexer.cc"
+#line 946 "config_lexer.cc"
 
     yylval = yylval_param;
 
@@ -1051,12 +1039,12 @@ do_action:      /* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 94 "config_lexer.ll"
+#line 95 "config_lexer.ll"
 { lb_init(&string_buf); BEGIN(STRING); }
        YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 96 "config_lexer.ll"
+#line 97 "config_lexer.ll"
 {
        BEGIN(INITIAL);
 
@@ -1070,9 +1058,9 @@ YY_RULE_SETUP
 case 3:
 /* rule 3 can match eol */
 YY_RULE_SETUP
-#line 106 "config_lexer.ll"
+#line 107 "config_lexer.ll"
 {
-       stringstream msgbuf;
+       std::ostringstream msgbuf;
        msgbuf << "Unterminated string found: " << *yylloc;
        ConfigCompilerContext::GetContext()->AddError(false, msgbuf.str());
        BEGIN(INITIAL);
@@ -1080,7 +1068,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 113 "config_lexer.ll"
+#line 114 "config_lexer.ll"
 {
        /* octal escape sequence */
        int result;
@@ -1089,7 +1077,7 @@ YY_RULE_SETUP
 
        if (result > 0xff) {
                /* error, constant is out-of-bounds */
-               stringstream msgbuf;
+               std::ostringstream msgbuf;
                msgbuf << "Constant is out-of-bounds: " << yytext << " " << *yylloc;
                ConfigCompilerContext::GetContext()->AddError(false, msgbuf.str());
        }
@@ -1099,50 +1087,50 @@ YY_RULE_SETUP
        YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 129 "config_lexer.ll"
+#line 130 "config_lexer.ll"
 {
        /* generate error - bad escape sequence; something
         * like '\48' or '\0777777'
         */
-       stringstream msgbuf;
+       std::ostringstream msgbuf;
        msgbuf << "Bad escape sequence found: " << yytext << " " << *yylloc;
        ConfigCompilerContext::GetContext()->AddError(false, msgbuf.str());
                                }
        YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 138 "config_lexer.ll"
+#line 139 "config_lexer.ll"
 { lb_append_char(&string_buf, '\n'); }
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 139 "config_lexer.ll"
+#line 140 "config_lexer.ll"
 { lb_append_char(&string_buf, '\t'); }
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 140 "config_lexer.ll"
+#line 141 "config_lexer.ll"
 { lb_append_char(&string_buf, '\r'); }
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 141 "config_lexer.ll"
+#line 142 "config_lexer.ll"
 { lb_append_char(&string_buf, '\b'); }
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 142 "config_lexer.ll"
+#line 143 "config_lexer.ll"
 { lb_append_char(&string_buf, '\f'); }
        YY_BREAK
 case 11:
 /* rule 11 can match eol */
 YY_RULE_SETUP
-#line 143 "config_lexer.ll"
+#line 144 "config_lexer.ll"
 { lb_append_char(&string_buf, yytext[1]); }
        YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 145 "config_lexer.ll"
+#line 146 "config_lexer.ll"
 {
        char *yptr = yytext;
 
@@ -1152,12 +1140,12 @@ YY_RULE_SETUP
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 152 "config_lexer.ll"
+#line 153 "config_lexer.ll"
 { lb_init(&string_buf); BEGIN(HEREDOC); }
        YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 154 "config_lexer.ll"
+#line 155 "config_lexer.ll"
 {
        BEGIN(INITIAL);
 
@@ -1171,224 +1159,224 @@ YY_RULE_SETUP
 case 15:
 /* rule 15 can match eol */
 YY_RULE_SETUP
-#line 164 "config_lexer.ll"
+#line 165 "config_lexer.ll"
 { lb_append_char(&string_buf, yytext[0]); }
        YY_BREAK
 
 case 16:
 YY_RULE_SETUP
-#line 167 "config_lexer.ll"
+#line 168 "config_lexer.ll"
 BEGIN(C_COMMENT);
        YY_BREAK
 
 
 case 17:
 YY_RULE_SETUP
-#line 171 "config_lexer.ll"
+#line 172 "config_lexer.ll"
 BEGIN(INITIAL);
        YY_BREAK
 case 18:
 /* rule 18 can match eol */
 YY_RULE_SETUP
-#line 172 "config_lexer.ll"
+#line 173 "config_lexer.ll"
 /* ignore comment */
        YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 173 "config_lexer.ll"
+#line 174 "config_lexer.ll"
 /* ignore star */
        YY_BREAK
 
 case 20:
 YY_RULE_SETUP
-#line 176 "config_lexer.ll"
+#line 177 "config_lexer.ll"
 /* ignore C++-style comments */
        YY_BREAK
 case 21:
 /* rule 21 can match eol */
 YY_RULE_SETUP
-#line 177 "config_lexer.ll"
+#line 178 "config_lexer.ll"
 /* ignore whitespace */
        YY_BREAK
 
 case 22:
 YY_RULE_SETUP
-#line 180 "config_lexer.ll"
+#line 181 "config_lexer.ll"
 return T_TYPE;
        YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 181 "config_lexer.ll"
+#line 182 "config_lexer.ll"
 { yylval->type = TypeDictionary; return T_TYPE_DICTIONARY; }
        YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 182 "config_lexer.ll"
+#line 183 "config_lexer.ll"
 { yylval->type = TypeArray; return T_TYPE_ARRAY; }
        YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 183 "config_lexer.ll"
+#line 184 "config_lexer.ll"
 { yylval->type = TypeNumber; return T_TYPE_NUMBER; }
        YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 184 "config_lexer.ll"
+#line 185 "config_lexer.ll"
 { yylval->type = TypeString; return T_TYPE_STRING; }
        YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 185 "config_lexer.ll"
+#line 186 "config_lexer.ll"
 { yylval->type = TypeScalar; return T_TYPE_SCALAR; }
        YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 186 "config_lexer.ll"
+#line 187 "config_lexer.ll"
 { yylval->type = TypeAny; return T_TYPE_ANY; }
        YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 187 "config_lexer.ll"
+#line 188 "config_lexer.ll"
 { return T_VALIDATOR; }
        YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 188 "config_lexer.ll"
+#line 189 "config_lexer.ll"
 { return T_REQUIRE; }
        YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 189 "config_lexer.ll"
+#line 190 "config_lexer.ll"
 { return T_ATTRIBUTE; }
        YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 190 "config_lexer.ll"
+#line 191 "config_lexer.ll"
 return T_ABSTRACT;
        YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 191 "config_lexer.ll"
+#line 192 "config_lexer.ll"
 return T_LOCAL;
        YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 192 "config_lexer.ll"
+#line 193 "config_lexer.ll"
 return T_OBJECT;
        YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 193 "config_lexer.ll"
+#line 194 "config_lexer.ll"
 return T_TEMPLATE;
        YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 194 "config_lexer.ll"
+#line 195 "config_lexer.ll"
 return T_INCLUDE;
        YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 195 "config_lexer.ll"
+#line 196 "config_lexer.ll"
 return T_LIBRARY;
        YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 196 "config_lexer.ll"
+#line 197 "config_lexer.ll"
 return T_INHERITS;
        YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 197 "config_lexer.ll"
+#line 198 "config_lexer.ll"
 return T_NULL;
        YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 198 "config_lexer.ll"
+#line 199 "config_lexer.ll"
 return T_PARTIAL;
        YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 199 "config_lexer.ll"
+#line 200 "config_lexer.ll"
 { yylval->num = 1; return T_NUMBER; }
        YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 200 "config_lexer.ll"
+#line 201 "config_lexer.ll"
 { yylval->num = 0; return T_NUMBER; }
        YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 201 "config_lexer.ll"
+#line 202 "config_lexer.ll"
 { yylval->text = strdup(yytext); return T_IDENTIFIER; }
        YY_BREAK
 case 44:
 /* rule 44 can match eol */
 YY_RULE_SETUP
-#line 202 "config_lexer.ll"
+#line 203 "config_lexer.ll"
 { yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING_ANGLE; }
        YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 203 "config_lexer.ll"
+#line 204 "config_lexer.ll"
 { yylval->num = strtod(yytext, NULL) / 1000; return T_NUMBER; }
        YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 204 "config_lexer.ll"
+#line 205 "config_lexer.ll"
 { yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; }
        YY_BREAK
 case 47:
 YY_RULE_SETUP
-#line 205 "config_lexer.ll"
+#line 206 "config_lexer.ll"
 { yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; }
        YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 206 "config_lexer.ll"
+#line 207 "config_lexer.ll"
 { yylval->num = strtod(yytext, NULL); return T_NUMBER; }
        YY_BREAK
 case 49:
 YY_RULE_SETUP
-#line 207 "config_lexer.ll"
+#line 208 "config_lexer.ll"
 { yylval->num = strtod(yytext, NULL); return T_NUMBER; }
        YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 208 "config_lexer.ll"
+#line 209 "config_lexer.ll"
 { yylval->op = OperatorSet; return T_EQUAL; }
        YY_BREAK
 case 51:
 YY_RULE_SETUP
-#line 209 "config_lexer.ll"
+#line 210 "config_lexer.ll"
 { yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
        YY_BREAK
 case 52:
 YY_RULE_SETUP
-#line 210 "config_lexer.ll"
+#line 211 "config_lexer.ll"
 { yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
        YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 211 "config_lexer.ll"
+#line 212 "config_lexer.ll"
 { yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
        YY_BREAK
 case 54:
 YY_RULE_SETUP
-#line 212 "config_lexer.ll"
+#line 213 "config_lexer.ll"
 { yylval->op = OperatorDivide; return T_DIVIDE_EQUAL; }
        YY_BREAK
 
 case 55:
 YY_RULE_SETUP
-#line 215 "config_lexer.ll"
+#line 216 "config_lexer.ll"
 return yytext[0];
        YY_BREAK
 case 56:
 YY_RULE_SETUP
-#line 217 "config_lexer.ll"
+#line 218 "config_lexer.ll"
 ECHO;
        YY_BREAK
-#line 1392 "config_lexer.cc"
+#line 1380 "config_lexer.cc"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(C_COMMENT):
 case YY_STATE_EOF(STRING):
@@ -1579,21 +1567,21 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 
        else
                {
-                       int num_to_read =
+                       yy_size_t num_to_read =
                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
                while ( num_to_read <= 0 )
                        { /* Not enough room in the buffer - grow it. */
 
                        /* just a shorter name for the current buffer */
-                       YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+                       YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
 
                        int yy_c_buf_p_offset =
                                (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
 
                        if ( b->yy_is_our_buffer )
                                {
-                               int new_size = b->yy_buf_size * 2;
+                               yy_size_t new_size = b->yy_buf_size * 2;
 
                                if ( new_size <= 0 )
                                        b->yy_buf_size += b->yy_buf_size / 8;
@@ -1624,7 +1612,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 
                /* Read in more data. */
                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-                       yyg->yy_n_chars, (size_t) num_to_read );
+                       yyg->yy_n_chars, num_to_read );
 
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
                }
@@ -1721,6 +1709,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
        yy_is_jam = (yy_current_state == 196);
 
+       (void)yyg;
        return yy_is_jam ? 0 : yy_current_state;
 }
 
@@ -1737,7 +1726,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
        if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
                { /* need to shift things up to make room */
                /* +2 for EOB chars. */
-               register int number_to_move = yyg->yy_n_chars + 2;
+               register yy_size_t number_to_move = yyg->yy_n_chars + 2;
                register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
                                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
                register char *source =
@@ -1791,7 +1780,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 
                else
                        { /* need more input */
-                       int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
+                       yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
                        ++yyg->yy_c_buf_p;
 
                        switch ( yy_get_next_buffer( yyscanner ) )
@@ -2078,7 +2067,7 @@ void yypop_buffer_state (yyscan_t yyscanner)
  */
 static void yyensure_buffer_stack (yyscan_t yyscanner)
 {
-       int num_to_alloc;
+       yy_size_t num_to_alloc;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
        if (!yyg->yy_buffer_stack) {
@@ -2176,7 +2165,7 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
+YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len , yyscan_t yyscanner)
 {
        YY_BUFFER_STATE b;
        char *buf;
@@ -2291,7 +2280,7 @@ FILE *yyget_out  (yyscan_t yyscanner)
 /** Get the length of the current token.
  * @param yyscanner The scanner object.
  */
-int yyget_leng  (yyscan_t yyscanner)
+yy_size_t yyget_leng  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yyleng;
@@ -2327,7 +2316,7 @@ void yyset_lineno (int  line_number , yyscan_t yyscanner)
 
         /* lineno is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner); 
+           YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
     
     yylineno = line_number;
 }
@@ -2342,7 +2331,7 @@ void yyset_column (int  column_no , yyscan_t yyscanner)
 
         /* column is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "yyset_column called with no buffer" , yyscanner); 
+           YY_FATAL_ERROR( "yyset_column called with no buffer" );
     
     yycolumn = column_no;
 }
@@ -2578,7 +2567,7 @@ void yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 217 "config_lexer.ll"
+#line 218 "config_lexer.ll"
 
 
 
index 7db94e622569bef33f12f5712390a66e7e50995d..fec02f982105c9c94b6978df6ccf60d3e6ca291d 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "i2-config.h"
 #include "config_parser.h"
+#include <sstream>
 
 using namespace icinga;
 
@@ -71,7 +72,7 @@ static void lb_append_char(lex_buf *lb, char new_char)
        char *new_buf = (char *)realloc(lb->buf, new_len);
 
        if (new_buf == NULL && new_len > 0)
-               throw bad_alloc();
+               throw std::bad_alloc();
 
        lb->buf = new_buf;
        lb->size++;
@@ -104,7 +105,7 @@ static void lb_append_char(lex_buf *lb, char new_char)
                                }
 
 <STRING>\n                     {
-       stringstream msgbuf;
+       std::ostringstream msgbuf;
        msgbuf << "Unterminated string found: " << *yylloc;
        ConfigCompilerContext::GetContext()->AddError(false, msgbuf.str());
        BEGIN(INITIAL);
@@ -118,7 +119,7 @@ static void lb_append_char(lex_buf *lb, char new_char)
 
        if (result > 0xff) {
                /* error, constant is out-of-bounds */
-               stringstream msgbuf;
+               std::ostringstream msgbuf;
                msgbuf << "Constant is out-of-bounds: " << yytext << " " << *yylloc;
                ConfigCompilerContext::GetContext()->AddError(false, msgbuf.str());
        }
@@ -130,7 +131,7 @@ static void lb_append_char(lex_buf *lb, char new_char)
        /* generate error - bad escape sequence; something
         * like '\48' or '\0777777'
         */
-       stringstream msgbuf;
+       std::ostringstream msgbuf;
        msgbuf << "Bad escape sequence found: " << yytext << " " << *yylloc;
        ConfigCompilerContext::GetContext()->AddError(false, msgbuf.str());
                                }
index f6e5541480031486cdb8e0955c8fcbd11677e55a..f763ee6f5948d4e6e10107096059d96cdc9df86c 100644 (file)
@@ -1,8 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.5.  */
+/* A Bison parser, made by GNU Bison 2.7.  */
 
 /* Bison implementation for Yacc-like parsers in C
    
-      Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
+      Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.5"
+#define YYBISON_VERSION "2.7"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
 /* Pull parsers.  */
 #define YYPULL 1
 
-/* Using locations.  */
-#define YYLSP_NEEDED 1
 
 
 
 /* Copy the first part of user declarations.  */
 
+/* Line 371 of yacc.c  */
+#line 68 "config_parser.cc"
 
-/* Line 268 of yacc.c  */
-#line 71 "config_parser.cc"
-
-/* Enabling traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
+# ifndef YY_NULL
+#  if defined __cplusplus && 201103L <= __cplusplus
+#   define YY_NULL nullptr
+#  else
+#   define YY_NULL 0
+#  endif
+# endif
 
 /* Enabling verbose error messages.  */
 #ifdef YYERROR_VERBOSE
 # define YYERROR_VERBOSE 1
 #endif
 
-/* Enabling the token table.  */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
+/* In a future release of Bison, this section will be replaced
+   by #include "y.tab.h".  */
+#ifndef YY_YY_CONFIG_PARSER_HH_INCLUDED
+# define YY_YY_CONFIG_PARSER_HH_INCLUDED
+/* Enabling traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
 #endif
-
 /* "%code requires" blocks.  */
-
-/* Line 288 of yacc.c  */
+/* Line 387 of yacc.c  */
 #line 1 "config_parser.yy"
 
 /******************************************************************************
  ******************************************************************************/
 
 #include "i2-config.h"
+#include <sstream>
+#include <stack>
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 
@@ -119,9 +127,8 @@ using namespace icinga;
 
 
 
-
-/* Line 288 of yacc.c  */
-#line 125 "config_parser.cc"
+/* Line 387 of yacc.c  */
+#line 132 "config_parser.cc"
 
 /* Tokens.  */
 #ifndef YYTOKENTYPE
@@ -191,13 +198,11 @@ using namespace icinga;
 
 
 
-
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
 {
-
-/* Line 293 of yacc.c  */
-#line 38 "config_parser.yy"
+/* Line 387 of yacc.c  */
+#line 41 "config_parser.yy"
 
        char *text;
        double num;
@@ -206,9 +211,8 @@ typedef union YYSTYPE
        icinga::TypeSpecifier type;
 
 
-
-/* Line 293 of yacc.c  */
-#line 212 "config_parser.cc"
+/* Line 387 of yacc.c  */
+#line 216 "config_parser.cc"
 } YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -229,30 +233,45 @@ typedef struct YYLTYPE
 #endif
 
 
-/* Copy the second part of user declarations.  */
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (ConfigCompiler *context);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+#endif /* !YY_YY_CONFIG_PARSER_HH_INCLUDED  */
 
-/* Line 343 of yacc.c  */
-#line 85 "config_parser.yy"
+/* Copy the second part of user declarations.  */
+/* Line 390 of yacc.c  */
+#line 88 "config_parser.yy"
 
 
 int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner);
 
 void yyerror(YYLTYPE *locp, ConfigCompiler *, const char *err)
 {
-       stringstream message;
+       std::ostringstream message;
        message << *locp << ": " << err;
        ConfigCompilerContext::GetContext()->AddError(false, message.str());
 }
 
 int yyparse(ConfigCompiler *context);
 
-static stack<ExpressionList::Ptr> m_ExpressionLists;
-static stack<Array::Ptr> m_Arrays;
+static std::stack<ExpressionList::Ptr> m_ExpressionLists;
+static std::stack<Array::Ptr> m_Arrays;
 static ConfigItemBuilder::Ptr m_Item;
 static bool m_Abstract;
 static bool m_Local;
 
-static stack<TypeRuleList::Ptr> m_RuleLists;
+static std::stack<TypeRuleList::Ptr> m_RuleLists;
 static ConfigType::Ptr m_Type;
 
 void ConfigCompiler::Compile(void)
@@ -261,7 +280,7 @@ void ConfigCompiler::Compile(void)
 
        try {
                yyparse(this);
-       } catch (const exception& ex) {
+       } catch (const std::exception& ex) {
                ConfigCompilerContext::GetContext()->AddError(false, boost::diagnostic_information(ex));
        }
 }
@@ -269,9 +288,8 @@ void ConfigCompiler::Compile(void)
 #define scanner (context->GetScanner())
 
 
-
-/* Line 343 of yacc.c  */
-#line 275 "config_parser.cc"
+/* Line 390 of yacc.c  */
+#line 293 "config_parser.cc"
 
 #ifdef short
 # undef short
@@ -324,24 +342,24 @@ typedef short int yytype_int16;
 # if defined YYENABLE_NLS && YYENABLE_NLS
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-#   define YY_(msgid) dgettext ("bison-runtime", msgid)
+#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
 #  endif
 # endif
 # ifndef YY_
-#  define YY_(msgid) msgid
+#  define YY_(Msgid) Msgid
 # endif
 #endif
 
 /* Suppress unused-variable warnings by "using" E.  */
 #if ! defined lint || defined __GNUC__
-# define YYUSE(e) ((void) (e))
+# define YYUSE(E) ((void) (E))
 #else
-# define YYUSE(e) /* empty */
+# define YYUSE(E) /* empty */
 #endif
 
 /* Identity function, used to suppress warnings about constant conditions.  */
 #ifndef lint
-# define YYID(n) (n)
+# define YYID(N) (N)
 #else
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
@@ -377,6 +395,7 @@ YYID (yyi)
 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
 #     ifndef EXIT_SUCCESS
 #      define EXIT_SUCCESS 0
 #     endif
@@ -470,20 +489,20 @@ union yyalloc
 #endif
 
 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from FROM to TO.  The source and destination do
+/* Copy COUNT objects from SRC to DST.  The source and destination do
    not overlap.  */
 # ifndef YYCOPY
 #  if defined __GNUC__ && 1 < __GNUC__
-#   define YYCOPY(To, From, Count) \
-      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+#   define YYCOPY(Dst, Src, Count) \
+      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
 #  else
-#   define YYCOPY(To, From, Count)             \
-      do                                       \
-       {                                       \
-         YYSIZE_T yyi;                         \
-         for (yyi = 0; yyi < (Count); yyi++)   \
-           (To)[yyi] = (From)[yyi];            \
-       }                                       \
+#   define YYCOPY(Dst, Src, Count)              \
+      do                                        \
+        {                                       \
+          YYSIZE_T yyi;                         \
+          for (yyi = 0; yyi < (Count); yyi++)   \
+            (Dst)[yyi] = (Src)[yyi];            \
+        }                                       \
       while (YYID (0))
 #  endif
 # endif
@@ -587,18 +606,18 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   123,   123,   124,   127,   127,   127,   127,   130,   135,
-     141,   147,   148,   156,   155,   185,   188,   195,   194,   206,
-     207,   209,   210,   211,   214,   219,   224,   231,   240,   241,
-     248,   249,   250,   251,   252,   253,   260,   265,   260,   290,
-     291,   296,   297,   300,   304,   310,   311,   314,   321,   322,
-     326,   325,   337,   338,   340,   341,   342,   345,   353,   369,
-     370,   371,   372,   373,   380,   379,   391,   392,   394,   395,
-     399,   405,   410,   414,   418,   424,   425
+       0,   126,   126,   127,   130,   130,   130,   130,   133,   138,
+     144,   150,   151,   159,   158,   188,   191,   198,   197,   209,
+     210,   212,   213,   214,   217,   222,   227,   234,   243,   244,
+     251,   252,   253,   254,   255,   256,   263,   268,   263,   293,
+     294,   299,   300,   303,   307,   313,   314,   317,   324,   325,
+     329,   328,   340,   341,   343,   344,   345,   348,   356,   372,
+     373,   374,   375,   376,   383,   382,   394,   395,   397,   398,
+     402,   408,   413,   417,   421,   427,   428
 };
 #endif
 
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+#if YYDEBUG || YYERROR_VERBOSE || 1
 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
 static const char *const yytname[] =
@@ -618,7 +637,7 @@ static const char *const yytname[] =
   "object_inherits_item", "object_inherits_specifier", "expressionlist",
   "$@5", "expressions", "expressions_inner", "expression", "operator",
   "array", "$@6", "array_items", "array_items_inner", "simplevalue",
-  "value", 0
+  "value", YY_NULL
 };
 #endif
 
@@ -729,10 +748,10 @@ static const yytype_int8 yytable[] =
       49
 };
 
-#define yypact_value_is_default(yystate) \
-  ((yystate) == (-72))
+#define yypact_value_is_default(Yystate) \
+  (!!((Yystate) == (-72)))
 
-#define yytable_value_is_error(yytable_value) \
+#define yytable_value_is_error(Yytable_value) \
   YYID (0)
 
 static const yytype_int8 yycheck[] =
@@ -791,23 +810,24 @@ static const yytype_uint8 yystos[] =
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
-#define YYBACKUP(Token, Value)                                 \
-do                                                             \
-  if (yychar == YYEMPTY && yylen == 1)                         \
-    {                                                          \
-      yychar = (Token);                                                \
-      yylval = (Value);                                                \
-      YYPOPSTACK (1);                                          \
-      goto yybackup;                                           \
-    }                                                          \
-  else                                                         \
-    {                                                          \
+#define YYBACKUP(Token, Value)                                  \
+do                                                              \
+  if (yychar == YYEMPTY)                                        \
+    {                                                           \
+      yychar = (Token);                                         \
+      yylval = (Value);                                         \
+      YYPOPSTACK (yylen);                                       \
+      yystate = *yyssp;                                         \
+      goto yybackup;                                            \
+    }                                                           \
+  else                                                          \
+    {                                                           \
       yyerror (&yylloc, context, YY_("syntax error: cannot back up")); \
       YYERROR;                                                 \
     }                                                          \
 while (YYID (0))
 
-
+/* Error token number */
 #define YYTERROR       1
 #define YYERRCODE      256
 
@@ -816,27 +836,28 @@ while (YYID (0))
    If N is 0, then set CURRENT to the empty location which ends
    the previous symbol: RHS[0] (always defined).  */
 
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
 #ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)                               \
-    do                                                                 \
-      if (YYID (N))                                                    \
-       {                                                               \
-         (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
-         (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
-         (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
-         (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
-       }                                                               \
-      else                                                             \
-       {                                                               \
-         (Current).first_line   = (Current).last_line   =              \
-           YYRHSLOC (Rhs, 0).last_line;                                \
-         (Current).first_column = (Current).last_column =              \
-           YYRHSLOC (Rhs, 0).last_column;                              \
-       }                                                               \
+# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
+    do                                                                  \
+      if (YYID (N))                                                     \
+        {                                                               \
+          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
+          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
+          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
+          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
+        }                                                               \
+      else                                                              \
+        {                                                               \
+          (Current).first_line   = (Current).last_line   =              \
+            YYRHSLOC (Rhs, 0).last_line;                                \
+          (Current).first_column = (Current).last_column =              \
+            YYRHSLOC (Rhs, 0).last_column;                              \
+        }                                                               \
     while (YYID (0))
 #endif
 
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+
 
 /* YY_LOCATION_PRINT -- Print the location on the stream.
    This macro was not mandated originally: define only if we know
@@ -844,10 +865,46 @@ while (YYID (0))
 
 #ifndef YY_LOCATION_PRINT
 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
-#  define YY_LOCATION_PRINT(File, Loc)                 \
-     fprintf (File, "%d.%d-%d.%d",                     \
-             (Loc).first_line, (Loc).first_column,     \
-             (Loc).last_line,  (Loc).last_column)
+
+/* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
+
+__attribute__((__unused__))
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static unsigned
+yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
+#else
+static unsigned
+yy_location_print_ (yyo, yylocp)
+    FILE *yyo;
+    YYLTYPE const * const yylocp;
+#endif
+{
+  unsigned res = 0;
+  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
+  if (0 <= yylocp->first_line)
+    {
+      res += fprintf (yyo, "%d", yylocp->first_line);
+      if (0 <= yylocp->first_column)
+        res += fprintf (yyo, ".%d", yylocp->first_column);
+    }
+  if (0 <= yylocp->last_line)
+    {
+      if (yylocp->first_line < yylocp->last_line)
+        {
+          res += fprintf (yyo, "-%d", yylocp->last_line);
+          if (0 <= end_col)
+            res += fprintf (yyo, ".%d", end_col);
+        }
+      else if (0 <= end_col && yylocp->first_column < end_col)
+        res += fprintf (yyo, "-%d", end_col);
+    }
+  return res;
+ }
+
+#  define YY_LOCATION_PRINT(File, Loc)          \
+  yy_location_print_ (File, &(Loc))
+
 # else
 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
 # endif
@@ -855,7 +912,6 @@ while (YYID (0))
 
 
 /* YYLEX -- calling `yylex' with the right arguments.  */
-
 #ifdef YYLEX_PARAM
 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
 #else
@@ -907,6 +963,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context)
     ConfigCompiler *context;
 #endif
 {
+  FILE *yyo = yyoutput;
+  YYUSE (yyo);
   if (!yyvaluep)
     return;
   YYUSE (yylocationp);
@@ -920,7 +978,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context)
   switch (yytype)
     {
       default:
-       break;
+        break;
     }
 }
 
@@ -1166,12 +1224,11 @@ static int
 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                 yytype_int16 *yyssp, int yytoken)
 {
-  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+  YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
   YYSIZE_T yysize = yysize0;
-  YYSIZE_T yysize1;
   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
   /* Internationalized format string. */
-  const char *yyformat = 0;
+  const char *yyformat = YY_NULL;
   /* Arguments of yyformat. */
   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
   /* Number of reported tokens (one for the "unexpected", one per
@@ -1231,11 +1288,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                     break;
                   }
                 yyarg[yycount++] = yytname[yyx];
-                yysize1 = yysize + yytnamerr (0, yytname[yyx]);
-                if (! (yysize <= yysize1
-                       && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-                  return 2;
-                yysize = yysize1;
+                {
+                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
+                  if (! (yysize <= yysize1
+                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                    return 2;
+                  yysize = yysize1;
+                }
               }
         }
     }
@@ -1255,10 +1314,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
 # undef YYCASE_
     }
 
-  yysize1 = yysize + yystrlen (yyformat);
-  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-    return 2;
-  yysize = yysize1;
+  {
+    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+      return 2;
+    yysize = yysize1;
+  }
 
   if (*yymsg_alloc < yysize)
     {
@@ -1322,25 +1383,11 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, context)
     {
 
       default:
-       break;
+        break;
     }
 }
 
 
-/* Prevent warnings from -Wmissing-prototypes.  */
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (ConfigCompiler *context);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
 
 
 /*----------.
@@ -1372,11 +1419,40 @@ yyparse (context)
 /* The lookahead symbol.  */
 int yychar;
 
+
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+    _Pragma ("GCC diagnostic push") \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+    _Pragma ("GCC diagnostic pop")
+#else
+/* Default value used for initialization, for pacifying older GCCs
+   or non-GCC compilers.  */
+static YYSTYPE yyval_default;
+# define YY_INITIAL_VALUE(Value) = Value
+#endif
+static YYLTYPE yyloc_default
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+  = { 1, 1, 1, 1 }
+# endif
+;
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
 /* The semantic value of the lookahead symbol.  */
-YYSTYPE yylval;
+YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
 
 /* Location data for the lookahead symbol.  */
-YYLTYPE yylloc;
+YYLTYPE yylloc = yyloc_default;
+
 
     /* Number of syntax errors so far.  */
     int yynerrs;
@@ -1390,7 +1466,7 @@ YYLTYPE yylloc;
        `yyvs': related to semantic values.
        `yyls': related to locations.
 
-       Refer to the stacks thru separate pointers, to allow yyoverflow
+       Refer to the stacks through separate pointers, to allow yyoverflow
        to reallocate them elsewhere.  */
 
     /* The state stack.  */
@@ -1416,7 +1492,7 @@ YYLTYPE yylloc;
   int yyn;
   int yyresult;
   /* Lookahead token as an internal (translated) token number.  */
-  int yytoken;
+  int yytoken = 0;
   /* The variables used to return semantic value and location from the
      action routines.  */
   YYSTYPE yyval;
@@ -1435,10 +1511,9 @@ YYLTYPE yylloc;
      Keep to zero when no symbol should be popped.  */
   int yylen = 0;
 
-  yytoken = 0;
-  yyss = yyssa;
-  yyvs = yyvsa;
-  yyls = yylsa;
+  yyssp = yyss = yyssa;
+  yyvsp = yyvs = yyvsa;
+  yylsp = yyls = yylsa;
   yystacksize = YYINITDEPTH;
 
   YYDPRINTF ((stderr, "Starting parse\n"));
@@ -1447,21 +1522,7 @@ YYLTYPE yylloc;
   yyerrstatus = 0;
   yynerrs = 0;
   yychar = YYEMPTY; /* Cause a token to be read.  */
-
-  /* Initialize stack pointers.
-     Waste one element of value and location stack
-     so that they stay on the same level as the state stack.
-     The wasted elements are never initialized.  */
-  yyssp = yyss;
-  yyvsp = yyvs;
-  yylsp = yyls;
-
-#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
-  /* Initialize the default location before parsing starts.  */
-  yylloc.first_line   = yylloc.last_line   = 1;
-  yylloc.first_column = yylloc.last_column = 1;
-#endif
-
+  yylsp[0] = yylloc;
   goto yysetstate;
 
 /*------------------------------------------------------------.
@@ -1607,7 +1668,9 @@ yybackup:
   yychar = YYEMPTY;
 
   yystate = yyn;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
   *++yylsp = yylloc;
   goto yynewstate;
 
@@ -1645,9 +1708,8 @@ yyreduce:
   switch (yyn)
     {
         case 8:
-
-/* Line 1806 of yacc.c  */
-#line 131 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 134 "config_parser.yy"
     {
                context->HandleInclude((yyvsp[(2) - (2)].text), false, yylloc);
                free((yyvsp[(2) - (2)].text));
@@ -1655,9 +1717,8 @@ yyreduce:
     break;
 
   case 9:
-
-/* Line 1806 of yacc.c  */
-#line 136 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 139 "config_parser.yy"
     {
                context->HandleInclude((yyvsp[(2) - (2)].text), true, yylloc);
                free((yyvsp[(2) - (2)].text));
@@ -1665,9 +1726,8 @@ yyreduce:
     break;
 
   case 10:
-
-/* Line 1806 of yacc.c  */
-#line 142 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 145 "config_parser.yy"
     {
                context->HandleLibrary((yyvsp[(2) - (2)].text));
                free((yyvsp[(2) - (2)].text));
@@ -1675,9 +1735,8 @@ yyreduce:
     break;
 
   case 12:
-
-/* Line 1806 of yacc.c  */
-#line 149 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 152 "config_parser.yy"
     {
                (yyval.text) = (yyvsp[(1) - (1)].text);
                free((yyvsp[(1) - (1)].text));
@@ -1685,9 +1744,8 @@ yyreduce:
     break;
 
   case 13:
-
-/* Line 1806 of yacc.c  */
-#line 156 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 159 "config_parser.yy"
     {
                String name = String((yyvsp[(3) - (3)].text));
                free((yyvsp[(3) - (3)].text));
@@ -1696,7 +1754,7 @@ yyreduce:
 
                if (!m_Type) {
                        if ((yyvsp[(1) - (3)].num))
-                               BOOST_THROW_EXCEPTION(invalid_argument("Partial type definition for unknown type '" + name + "'"));
+                               BOOST_THROW_EXCEPTION(std::invalid_argument("Partial type definition for unknown type '" + name + "'"));
 
                        m_Type = boost::make_shared<ConfigType>(name, yylloc);
                        ConfigCompilerContext::GetContext()->AddType(m_Type);
@@ -1705,9 +1763,8 @@ yyreduce:
     break;
 
   case 14:
-
-/* Line 1806 of yacc.c  */
-#line 171 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 174 "config_parser.yy"
     {
                TypeRuleList::Ptr ruleList = *(yyvsp[(6) - (6)].variant);
                m_Type->GetRuleList()->AddRules(ruleList);
@@ -1722,36 +1779,32 @@ yyreduce:
     break;
 
   case 15:
-
-/* Line 1806 of yacc.c  */
-#line 185 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 188 "config_parser.yy"
     {
                (yyval.num) = 0;
        }
     break;
 
   case 16:
-
-/* Line 1806 of yacc.c  */
-#line 189 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 192 "config_parser.yy"
     {
                (yyval.num) = 1;
        }
     break;
 
   case 17:
-
-/* Line 1806 of yacc.c  */
-#line 195 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 198 "config_parser.yy"
     {
                m_RuleLists.push(boost::make_shared<TypeRuleList>());
        }
     break;
 
   case 18:
-
-/* Line 1806 of yacc.c  */
-#line 200 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 203 "config_parser.yy"
     {
                (yyval.variant) = new Value(m_RuleLists.top());
                m_RuleLists.pop();
@@ -1759,9 +1812,8 @@ yyreduce:
     break;
 
   case 24:
-
-/* Line 1806 of yacc.c  */
-#line 215 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 218 "config_parser.yy"
     {
                m_RuleLists.top()->AddRequire((yyvsp[(2) - (2)].text));
                free((yyvsp[(2) - (2)].text));
@@ -1769,9 +1821,8 @@ yyreduce:
     break;
 
   case 25:
-
-/* Line 1806 of yacc.c  */
-#line 220 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 223 "config_parser.yy"
     {
                m_RuleLists.top()->SetValidator((yyvsp[(2) - (2)].text));
                free((yyvsp[(2) - (2)].text));
@@ -1779,9 +1830,8 @@ yyreduce:
     break;
 
   case 26:
-
-/* Line 1806 of yacc.c  */
-#line 225 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 228 "config_parser.yy"
     {
                TypeRule rule((yyvsp[(2) - (3)].type), (yyvsp[(3) - (3)].text), TypeRuleList::Ptr(), yylloc);
                free((yyvsp[(3) - (3)].text));
@@ -1791,9 +1841,8 @@ yyreduce:
     break;
 
   case 27:
-
-/* Line 1806 of yacc.c  */
-#line 232 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 235 "config_parser.yy"
     {
                TypeRule rule((yyvsp[(2) - (4)].type), (yyvsp[(3) - (4)].text), *(yyvsp[(4) - (4)].variant), yylloc);
                free((yyvsp[(3) - (4)].text));
@@ -1803,9 +1852,8 @@ yyreduce:
     break;
 
   case 29:
-
-/* Line 1806 of yacc.c  */
-#line 242 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 245 "config_parser.yy"
     {
                m_Type->SetParent((yyvsp[(2) - (2)].text));
                free((yyvsp[(2) - (2)].text));
@@ -1813,18 +1861,16 @@ yyreduce:
     break;
 
   case 35:
-
-/* Line 1806 of yacc.c  */
-#line 254 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 257 "config_parser.yy"
     {
                (yyval.type) = (yyvsp[(1) - (1)].type);
        }
     break;
 
   case 36:
-
-/* Line 1806 of yacc.c  */
-#line 260 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 263 "config_parser.yy"
     {
                m_Abstract = false;
                m_Local = false;
@@ -1832,9 +1878,8 @@ yyreduce:
     break;
 
   case 37:
-
-/* Line 1806 of yacc.c  */
-#line 265 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 268 "config_parser.yy"
     {
                m_Item = boost::make_shared<ConfigItemBuilder>(yylloc);
 
@@ -1849,9 +1894,8 @@ yyreduce:
     break;
 
   case 38:
-
-/* Line 1806 of yacc.c  */
-#line 277 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 280 "config_parser.yy"
     {
                ExpressionList::Ptr exprl = *(yyvsp[(7) - (7)].variant);
                delete (yyvsp[(7) - (7)].variant);
@@ -1866,36 +1910,32 @@ yyreduce:
     break;
 
   case 40:
-
-/* Line 1806 of yacc.c  */
-#line 292 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 295 "config_parser.yy"
     {
                m_Abstract = true;
        }
     break;
 
   case 43:
-
-/* Line 1806 of yacc.c  */
-#line 301 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 304 "config_parser.yy"
     {
                m_Abstract = true;
        }
     break;
 
   case 44:
-
-/* Line 1806 of yacc.c  */
-#line 305 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 308 "config_parser.yy"
     {
                m_Local = true;
        }
     break;
 
   case 47:
-
-/* Line 1806 of yacc.c  */
-#line 315 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 318 "config_parser.yy"
     {
                m_Item->AddParent((yyvsp[(1) - (1)].text));
                free((yyvsp[(1) - (1)].text));
@@ -1903,18 +1943,16 @@ yyreduce:
     break;
 
   case 50:
-
-/* Line 1806 of yacc.c  */
-#line 326 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 329 "config_parser.yy"
     {
                m_ExpressionLists.push(boost::make_shared<ExpressionList>());
        }
     break;
 
   case 51:
-
-/* Line 1806 of yacc.c  */
-#line 331 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 334 "config_parser.yy"
     {
                (yyval.variant) = new Value(m_ExpressionLists.top());
                m_ExpressionLists.pop();
@@ -1922,9 +1960,8 @@ yyreduce:
     break;
 
   case 57:
-
-/* Line 1806 of yacc.c  */
-#line 346 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 349 "config_parser.yy"
     {
                Expression expr((yyvsp[(1) - (3)].text), (yyvsp[(2) - (3)].op), *(yyvsp[(3) - (3)].variant), yylloc);
                free((yyvsp[(1) - (3)].text));
@@ -1935,9 +1972,8 @@ yyreduce:
     break;
 
   case 58:
-
-/* Line 1806 of yacc.c  */
-#line 354 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 357 "config_parser.yy"
     {
                Expression subexpr((yyvsp[(3) - (6)].text), (yyvsp[(5) - (6)].op), *(yyvsp[(6) - (6)].variant), yylloc);
                free((yyvsp[(3) - (6)].text));
@@ -1954,27 +1990,24 @@ yyreduce:
     break;
 
   case 63:
-
-/* Line 1806 of yacc.c  */
-#line 374 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 377 "config_parser.yy"
     {
                (yyval.op) = (yyvsp[(1) - (1)].op);
        }
     break;
 
   case 64:
-
-/* Line 1806 of yacc.c  */
-#line 380 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 383 "config_parser.yy"
     {
                m_Arrays.push(boost::make_shared<Array>());
        }
     break;
 
   case 65:
-
-/* Line 1806 of yacc.c  */
-#line 385 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 388 "config_parser.yy"
     {
                (yyval.variant) = new Value(m_Arrays.top());
                m_Arrays.pop();
@@ -1982,27 +2015,24 @@ yyreduce:
     break;
 
   case 69:
-
-/* Line 1806 of yacc.c  */
-#line 396 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 399 "config_parser.yy"
     {
                m_Arrays.top()->Add(*(yyvsp[(1) - (1)].variant));
        }
     break;
 
   case 70:
-
-/* Line 1806 of yacc.c  */
-#line 400 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 403 "config_parser.yy"
     {
                m_Arrays.top()->Add(*(yyvsp[(3) - (3)].variant));
        }
     break;
 
   case 71:
-
-/* Line 1806 of yacc.c  */
-#line 406 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 409 "config_parser.yy"
     {
                (yyval.variant) = new Value((yyvsp[(1) - (1)].text));
                free((yyvsp[(1) - (1)].text));
@@ -2010,45 +2040,40 @@ yyreduce:
     break;
 
   case 72:
-
-/* Line 1806 of yacc.c  */
-#line 411 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 414 "config_parser.yy"
     {
                (yyval.variant) = new Value((yyvsp[(1) - (1)].num));
        }
     break;
 
   case 73:
-
-/* Line 1806 of yacc.c  */
-#line 415 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 418 "config_parser.yy"
     {
                (yyval.variant) = new Value();
        }
     break;
 
   case 74:
-
-/* Line 1806 of yacc.c  */
-#line 419 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 422 "config_parser.yy"
     {
                (yyval.variant) = (yyvsp[(1) - (1)].variant);
        }
     break;
 
   case 76:
-
-/* Line 1806 of yacc.c  */
-#line 426 "config_parser.yy"
+/* Line 1792 of yacc.c  */
+#line 429 "config_parser.yy"
     {
                (yyval.variant) = (yyvsp[(1) - (1)].variant);
        }
     break;
 
 
-
-/* Line 1806 of yacc.c  */
-#line 2052 "config_parser.cc"
+/* Line 1792 of yacc.c  */
+#line 2077 "config_parser.cc"
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -2213,7 +2238,9 @@ yyerrlab1:
       YY_STACK_PRINT (yyss, yyssp);
     }
 
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
   yyerror_range[2] = yylloc;
   /* Using YYLLOC is tempting, but would change the location of
@@ -2242,7 +2269,7 @@ yyabortlab:
   yyresult = 1;
   goto yyreturn;
 
-#if !defined(yyoverflow) || YYERROR_VERBOSE
+#if !defined yyoverflow || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
 `-------------------------------------------------*/
@@ -2284,8 +2311,6 @@ yyreturn:
 }
 
 
-
-/* Line 2067 of yacc.c  */
-#line 430 "config_parser.yy"
-
+/* Line 2055 of yacc.c  */
+#line 433 "config_parser.yy"
 
index 77ca9b10d304a257497fd23c080af1379d82c7dc..7be4649ca953a546dddb14246e36298e74f79640 100644 (file)
@@ -19,6 +19,9 @@
  ******************************************************************************/
 
 #include "i2-config.h"
+#include <sstream>
+#include <stack>
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 
@@ -88,20 +91,20 @@ int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner);
 
 void yyerror(YYLTYPE *locp, ConfigCompiler *, const char *err)
 {
-       stringstream message;
+       std::ostringstream message;
        message << *locp << ": " << err;
        ConfigCompilerContext::GetContext()->AddError(false, message.str());
 }
 
 int yyparse(ConfigCompiler *context);
 
-static stack<ExpressionList::Ptr> m_ExpressionLists;
-static stack<Array::Ptr> m_Arrays;
+static std::stack<ExpressionList::Ptr> m_ExpressionLists;
+static std::stack<Array::Ptr> m_Arrays;
 static ConfigItemBuilder::Ptr m_Item;
 static bool m_Abstract;
 static bool m_Local;
 
-static stack<TypeRuleList::Ptr> m_RuleLists;
+static std::stack<TypeRuleList::Ptr> m_RuleLists;
 static ConfigType::Ptr m_Type;
 
 void ConfigCompiler::Compile(void)
@@ -110,7 +113,7 @@ void ConfigCompiler::Compile(void)
 
        try {
                yyparse(this);
-       } catch (const exception& ex) {
+       } catch (const std::exception& ex) {
                ConfigCompilerContext::GetContext()->AddError(false, boost::diagnostic_information(ex));
        }
 }
@@ -161,7 +164,7 @@ type: partial_specifier T_TYPE identifier
 
                if (!m_Type) {
                        if ($1)
-                               BOOST_THROW_EXCEPTION(invalid_argument("Partial type definition for unknown type '" + name + "'"));
+                               BOOST_THROW_EXCEPTION(std::invalid_argument("Partial type definition for unknown type '" + name + "'"));
 
                        m_Type = boost::make_shared<ConfigType>(name, yylloc);
                        ConfigCompilerContext::GetContext()->AddType(m_Type);
index 4dfae8edc898f29d30334720bfcd918425dd2d2e..5432406a54935a212c271784d0a37b7a41063e20 100644 (file)
  ******************************************************************************/
 
 #include "i2-config.h"
+#include "base/logger_fwd.h"
+#include <sstream>
+#include <fstream>
+#include <boost/foreach.hpp>
 
 using std::ifstream;
 
 using namespace icinga;
 
-vector<String> ConfigCompiler::m_IncludeSearchDirs;
+std::vector<String> ConfigCompiler::m_IncludeSearchDirs;
 
 /**
  * Constructor for the ConfigCompiler class.
@@ -33,7 +37,7 @@ vector<String> ConfigCompiler::m_IncludeSearchDirs;
  * @param input Input stream for the configuration file.
  * @param includeHandler Handler function for #include directives.
  */
-ConfigCompiler::ConfigCompiler(const String& path, istream *input,
+ConfigCompiler::ConfigCompiler(const String& path, std::istream *input,
     HandleIncludeFunc includeHandler)
        : m_Path(path), m_Input(input), m_HandleInclude(includeHandler)
 {
@@ -118,9 +122,9 @@ void ConfigCompiler::HandleLibrary(const String& library)
  * @param stream The input stream.
  * @returns Configuration items.
  */
-void ConfigCompiler::CompileStream(const String& path, istream *stream)
+void ConfigCompiler::CompileStream(const String& path, std::istream *stream)
 {
-       stream->exceptions(istream::badbit);
+       stream->exceptions(std::istream::badbit);
 
        ConfigCompiler ctx(path, stream);
        ctx.Compile();
@@ -134,13 +138,13 @@ void ConfigCompiler::CompileStream(const String& path, istream *stream)
  */
 void ConfigCompiler::CompileFile(const String& path)
 {
-       ifstream stream;
-       stream.open(path.CStr(), ifstream::in);
+       std::ifstream stream;
+       stream.open(path.CStr(), std::ifstream::in);
 
        if (!stream)
-               BOOST_THROW_EXCEPTION(invalid_argument("Could not open config file: " + path));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Could not open config file: " + path));
 
-       Logger::Write(LogInformation, "config", "Compiling config file: " + path);
+       Log(LogInformation, "config", "Compiling config file: " + path);
 
        return CompileStream(path, &stream);
 }
@@ -154,7 +158,7 @@ void ConfigCompiler::CompileFile(const String& path)
  */
 void ConfigCompiler::CompileText(const String& path, const String& text)
 {
-       stringstream stream(text);
+       std::stringstream stream(text);
        return CompileStream(path, &stream);
 }
 
@@ -190,12 +194,12 @@ void ConfigCompiler::HandleFileInclude(const String& include, bool search,
                }
        }
 
-       vector<ConfigItem::Ptr> items;
+       std::vector<ConfigItem::Ptr> items;
 
        if (!Utility::Glob(includePath, boost::bind(&ConfigCompiler::CompileFile, _1))) {
-               stringstream msgbuf;
+               std::ostringstream msgbuf;
                msgbuf << "Include file '" + include + "' does not exist (or no files found for pattern): " << debuginfo;
-               BOOST_THROW_EXCEPTION(invalid_argument(msgbuf.str()));
+               BOOST_THROW_EXCEPTION(std::invalid_argument(msgbuf.str()));
        }
 }
 
@@ -206,7 +210,7 @@ void ConfigCompiler::HandleFileInclude(const String& include, bool search,
  */
 void ConfigCompiler::AddIncludeSearchDir(const String& dir)
 {
-       Logger::Write(LogInformation, "config", "Adding include search dir: " + dir);
+       Log(LogInformation, "config", "Adding include search dir: " + dir);
 
        m_IncludeSearchDirs.push_back(dir);
 }
index 2858b9af4cfa70b45ec7943ad70110131fbb1881..6420c1c53e364d9f8aa28026e361687be4506455 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef CONFIGCOMPILER_H
 #define CONFIGCOMPILER_H
 
+#include "base/registry.h"
+#include <iostream>
+
 namespace icinga
 {
 
@@ -34,13 +37,13 @@ class I2_CONFIG_API ConfigCompiler
 public:
        typedef boost::function<void (const String&, bool, const DebugInfo&)> HandleIncludeFunc;
 
-       explicit ConfigCompiler(const String& path, istream *input = &cin,
+       explicit ConfigCompiler(const String& path, std::istream *input,
            HandleIncludeFunc includeHandler = &ConfigCompiler::HandleFileInclude);
        virtual ~ConfigCompiler(void);
 
        void Compile(void);
 
-       static void CompileStream(const String& path, istream *stream);
+       static void CompileStream(const String& path, std::istream *stream);
        static void CompileFile(const String& path);
        static void CompileText(const String& path, const String& text);
 
@@ -60,13 +63,13 @@ public:
 
 private:
        String m_Path;
-       istream *m_Input;
+       std::istream *m_Input;
 
        HandleIncludeFunc m_HandleInclude;
 
        void *m_Scanner;
 
-       static vector<String> m_IncludeSearchDirs;
+       static std::vector<String> m_IncludeSearchDirs;
 
        void InitializeScanner(void);
        void DestroyScanner(void);
index 8540795124211bc22546a6a4b3d5bfd22549bf01..82e4a1ac4582d593b2e2743b33e8bf5c7b170c3e 100644 (file)
@@ -18,6 +18,8 @@
  ******************************************************************************/
 
 #include "i2-config.h"
+#include "base/logger_fwd.h"
+#include <boost/foreach.hpp>
 
 using std::ifstream;
 
@@ -32,14 +34,14 @@ ConfigCompilerContext::ConfigCompilerContext(void)
 void ConfigCompilerContext::AddItem(const ConfigItem::Ptr& item)
 {
        m_Items.push_back(item);
-       m_ItemsMap[make_pair(item->GetType(), item->GetName())] = item;
+       m_ItemsMap[std::make_pair(item->GetType(), item->GetName())] = item;
 }
 
 ConfigItem::Ptr ConfigCompilerContext::GetItem(const String& type, const String& name) const
 {
-       map<pair<String, String>, ConfigItem::Ptr>::const_iterator it;
+       std::map<std::pair<String, String>, ConfigItem::Ptr>::const_iterator it;
 
-       it = m_ItemsMap.find(make_pair(type, name));
+       it = m_ItemsMap.find(std::make_pair(type, name));
 
        if (it == m_ItemsMap.end())
                return ConfigItem::Ptr();
@@ -47,7 +49,7 @@ ConfigItem::Ptr ConfigCompilerContext::GetItem(const String& type, const String&
        return it->second;
 }
 
-vector<ConfigItem::Ptr> ConfigCompilerContext::GetItems(void) const
+std::vector<ConfigItem::Ptr> ConfigCompilerContext::GetItems(void) const
 {
        return m_Items;
 }
@@ -59,7 +61,7 @@ void ConfigCompilerContext::AddType(const ConfigType::Ptr& type)
 
 ConfigType::Ptr ConfigCompilerContext::GetType(const String& name) const
 {
-       map<String, ConfigType::Ptr>::const_iterator it;
+       std::map<String, ConfigType::Ptr>::const_iterator it;
 
        it = m_Types.find(name);
 
@@ -74,7 +76,7 @@ void ConfigCompilerContext::AddError(bool warning, const String& message)
        m_Errors.push_back(ConfigCompilerError(warning, message));
 }
 
-vector<ConfigCompilerError> ConfigCompilerContext::GetErrors(void) const
+std::vector<ConfigCompilerError> ConfigCompilerContext::GetErrors(void) const
 {
        return m_Errors;
 }
@@ -133,7 +135,7 @@ void ConfigCompilerContext::ActivateItems(void)
 {
        ASSERT(m_Context == NULL);
 
-       Logger::Write(LogInformation, "config", "Activating config items in compilation unit '" + m_Unit + "'");
+       Log(LogInformation, "config", "Activating config items in compilation unit '" + m_Unit + "'");
        BOOST_FOREACH(const ConfigItem::Ptr& item, m_Items) {
                item->Commit();
        }
index e4b79bf0d595f9c53d258ed629799419ce31efa7..ef5358f6b6cd15ddeeba8aea4ff42cc79fdb2418 100644 (file)
@@ -52,13 +52,13 @@ public:
 
        void AddItem(const ConfigItem::Ptr& item);
        ConfigItem::Ptr GetItem(const String& type, const String& name) const;
-       vector<ConfigItem::Ptr> GetItems(void) const;
+       std::vector<ConfigItem::Ptr> GetItems(void) const;
 
        void AddType(const ConfigType::Ptr& type);
        ConfigType::Ptr GetType(const String& name) const;
 
        void AddError(bool warning, const String& message);
-       vector<ConfigCompilerError> GetErrors(void) const;
+       std::vector<ConfigCompilerError> GetErrors(void) const;
 
        void SetFlags(int flags);
        int GetFlags(void) const;
@@ -76,12 +76,12 @@ private:
 
         int m_Flags;
 
-       vector<shared_ptr<ConfigItem> > m_Items;
-        map<pair<String, String>, shared_ptr<ConfigItem> > m_ItemsMap;
+       std::vector<shared_ptr<ConfigItem> > m_Items;
+        std::map<std::pair<String, String>, shared_ptr<ConfigItem> > m_ItemsMap;
 
-        map<String, shared_ptr<ConfigType> > m_Types;
+        std::map<String, shared_ptr<ConfigType> > m_Types;
 
-        vector<ConfigCompilerError> m_Errors;
+        std::vector<ConfigCompilerError> m_Errors;
 
        static ConfigCompilerContext *m_Context;
 };
index ece51dc80bc521df25d3558bb82c727bbc2f7f85..48c53c16d970bab10111bce2e96efab299e2ce22 100644 (file)
  ******************************************************************************/
 
 #include "i2-config.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include <sstream>
 #include <boost/tuple/tuple.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
 boost::mutex ConfigItem::m_Mutex;
 ConfigItem::ItemMap ConfigItem::m_Items;
-signals2::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnCommitted;
-signals2::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnRemoved;
+boost::signals2::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnCommitted;
+boost::signals2::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnRemoved;
 
 /**
  * Constructor for the ConfigItem class.
@@ -40,7 +46,7 @@ signals2::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnRemoved;
  */
 ConfigItem::ConfigItem(const String& type, const String& name,
     const String& unit, bool abstract, const ExpressionList::Ptr& exprl,
-    const vector<String>& parents, const DebugInfo& debuginfo)
+    const std::vector<String>& parents, const DebugInfo& debuginfo)
        : m_Type(type), m_Name(name), m_Unit(unit), m_Abstract(abstract),
          m_ExpressionList(exprl), m_Parents(parents), m_DebugInfo(debuginfo)
 {
@@ -111,7 +117,7 @@ ExpressionList::Ptr ConfigItem::GetExpressionList(void) const
  *
  * @returns The list of parents.
  */
-vector<String> ConfigItem::GetParents(void) const
+std::vector<String> ConfigItem::GetParents(void) const
 {
        return m_Parents;
 }
@@ -148,10 +154,10 @@ void ConfigItem::InternalLink(const Dictionary::Ptr& dictionary) const
                        parent = ConfigItem::GetObject(m_Type, name);
 
                if (!parent) {
-                       stringstream message;
+                       std::ostringstream message;
                        message << "Parent object '" << name << "' does not"
                            " exist (" << m_DebugInfo << ")";
-                       BOOST_THROW_EXCEPTION(domain_error(message.str()));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument(message.str()));
                }
 
                parent->InternalLink(dictionary);
@@ -172,16 +178,16 @@ DynamicObject::Ptr ConfigItem::Commit(void)
 
        String type, name;
 
-       Logger::Write(LogDebug, "base", "Commit called for ConfigItem Type=" + GetType() + ", Name=" + GetName());
+       Log(LogDebug, "base", "Commit called for ConfigItem Type=" + GetType() + ", Name=" + GetName());
 
        /* Make sure the type is valid. */
        DynamicType::Ptr dtype = DynamicType::GetByName(GetType());
 
        if (!dtype)
-               BOOST_THROW_EXCEPTION(runtime_error("Type '" + GetType() + "' does not exist."));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Type '" + GetType() + "' does not exist."));
 
        /* Try to find an existing item with the same type and name. */
-       pair<String, String> ikey = make_pair(GetType(), GetName());
+       std::pair<String, String> ikey = std::make_pair(GetType(), GetName());
        ConfigItem::Ptr oldItem;
 
        {
@@ -193,7 +199,7 @@ DynamicObject::Ptr ConfigItem::Commit(void)
                        oldItem = it->second;
        }
 
-       set<ConfigItem::WeakPtr> children;
+       std::set<ConfigItem::WeakPtr> children;
 
        if (oldItem) {
                ObjectLock olock(oldItem);
@@ -318,7 +324,7 @@ void ConfigItem::Unregister(void)
                ObjectLock olock(this);
 
                ConfigItem::ItemMap::iterator it;
-               it = m_Items.find(make_pair(m_Type, m_Name));
+               it = m_Items.find(std::make_pair(m_Type, m_Name));
 
                if (it != m_Items.end())
                        m_Items.erase(it);
@@ -382,7 +388,7 @@ ConfigItem::Ptr ConfigItem::GetObject(const String& type, const String& name)
 
        ConfigItem::ItemMap::iterator it;
 
-       it = m_Items.find(make_pair(type, name));
+       it = m_Items.find(std::make_pair(type, name));
 
        if (it != m_Items.end())
                return it->second;
@@ -396,7 +402,7 @@ ConfigItem::Ptr ConfigItem::GetObject(const String& type, const String& name)
  *
  * @param fp The stream.
  */
-void ConfigItem::Dump(ostream& fp) const
+void ConfigItem::Dump(std::ostream& fp) const
 {
        ObjectLock olock(this);
 
@@ -426,12 +432,12 @@ void ConfigItem::Dump(ostream& fp) const
  */
 void ConfigItem::UnloadUnit(const String& unit)
 {
-       vector<ConfigItem::Ptr> obsoleteItems;
+       std::vector<ConfigItem::Ptr> obsoleteItems;
 
        {
                boost::mutex::scoped_lock lock(m_Mutex);
 
-               Logger::Write(LogInformation, "config", "Unloading config items from compilation unit '" + unit + "'");
+               Log(LogInformation, "config", "Unloading config items from compilation unit '" + unit + "'");
 
                ConfigItem::Ptr item;
                BOOST_FOREACH(boost::tie(boost::tuples::ignore, item), m_Items) {
index 73018d7e1bd80af63f6e62b6c45be533acf53175..ff0c6a9d2055ca0422f9adfe2595775a8336a571 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef CONFIGITEM_H
 #define CONFIGITEM_H
 
+#include "base/dynamicobject.h"
+
 namespace icinga
 {
 
@@ -35,7 +37,7 @@ public:
        typedef weak_ptr<ConfigItem> WeakPtr;
 
        ConfigItem(const String& type, const String& name, const String& unit,
-           bool abstract, const ExpressionList::Ptr& exprl, const vector<String>& parents,
+           bool abstract, const ExpressionList::Ptr& exprl, const std::vector<String>& parents,
            const DebugInfo& debuginfo);
 
        String GetType(void) const;
@@ -43,14 +45,14 @@ public:
        String GetUnit(void) const;
        bool IsAbstract(void) const;
 
-       vector<String> GetParents(void) const;
+       std::vector<String> GetParents(void) const;
 
        ExpressionList::Ptr GetExpressionList(void) const;
 
        DynamicObject::Ptr Commit(void);
        void Unregister(void);
 
-       void Dump(ostream& fp) const;
+       void Dump(std::ostream& fp) const;
 
        DynamicObject::Ptr GetDynamicObject(void) const;
 
@@ -63,8 +65,8 @@ public:
 
        static void UnloadUnit(const String& unit);
 
-       static signals2::signal<void (const ConfigItem::Ptr&)> OnCommitted;
-       static signals2::signal<void (const ConfigItem::Ptr&)> OnRemoved;
+       static boost::signals2::signal<void (const ConfigItem::Ptr&)> OnCommitted;
+       static boost::signals2::signal<void (const ConfigItem::Ptr&)> OnRemoved;
 
 private:
        void InternalLink(const Dictionary::Ptr& dictionary) const;
@@ -79,19 +81,19 @@ private:
        bool m_Abstract; /**< Whether this is a template. */
 
        ExpressionList::Ptr m_ExpressionList;
-       vector<String> m_Parents; /**< The names of parent configuration
+       std::vector<String> m_Parents; /**< The names of parent configuration
                                       items. */
        DebugInfo m_DebugInfo; /**< Debug information. */
 
        DynamicObject::WeakPtr m_DynamicObject; /**< The instantiated version
                                                  * of this configuration
                                                 * item */
-        set<ConfigItem::WeakPtr> m_ChildObjects; /**< Instantiated items
+        std::set<ConfigItem::WeakPtr> m_ChildObjects; /**< Instantiated items
                                                      * that inherit from this item */
 
        static boost::mutex m_Mutex;
 
-       typedef map<pair<String, String>, ConfigItem::Ptr> ItemMap;
+       typedef std::map<std::pair<String, String>, ConfigItem::Ptr> ItemMap;
        static ItemMap m_Items; /**< All registered configuration items. */
 
        static ConfigItem::Ptr GetObjectUnlocked(const String& type,
index 6c6b12f654e995a92660f542b536b7f08a93faf1..c34cbd5d8fa0682b828fc27b6fe11b62434845e9 100644 (file)
  ******************************************************************************/
 
 #include "i2-config.h"
+#include "base/dynamictype.h"
+#include <boost/smart_ptr/make_shared.hpp>
+#include <sstream>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -88,21 +92,21 @@ void ConfigItemBuilder::AddExpressionList(const ExpressionList::Ptr& exprl)
 ConfigItem::Ptr ConfigItemBuilder::Compile(void)
 {
        if (m_Type.IsEmpty()) {
-               stringstream msgbuf;
+               std::ostringstream msgbuf;
                msgbuf << "The type name of an object may not be empty: " << m_DebugInfo;
-               BOOST_THROW_EXCEPTION(invalid_argument(msgbuf.str()));
+               BOOST_THROW_EXCEPTION(std::invalid_argument(msgbuf.str()));
        }
 
        if (!DynamicType::GetByName(m_Type)) {
-               stringstream msgbuf;
+               std::ostringstream msgbuf;
                msgbuf << "The type '" + m_Type + "' is unknown: " << m_DebugInfo;
-               BOOST_THROW_EXCEPTION(invalid_argument(msgbuf.str()));
+               BOOST_THROW_EXCEPTION(std::invalid_argument(msgbuf.str()));
        }
 
        if (m_Name.IsEmpty()) {
-               stringstream msgbuf;
+               std::ostringstream msgbuf;
                msgbuf << "The name of an object may not be empty: " << m_DebugInfo;
-               BOOST_THROW_EXCEPTION(invalid_argument(msgbuf.str()));
+               BOOST_THROW_EXCEPTION(std::invalid_argument(msgbuf.str()));
        }
 
        BOOST_FOREACH(const String& parent, m_Parents) {
@@ -119,9 +123,9 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void)
                        item = ConfigItem::GetObject(m_Type, parent);
 
                if (!item) {
-                       stringstream msgbuf;
+                       std::ostringstream msgbuf;
                        msgbuf << "The parent config item '" + parent + "' does not exist: " << m_DebugInfo;
-                       BOOST_THROW_EXCEPTION(invalid_argument(msgbuf.str()));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument(msgbuf.str()));
                }
        }
 
index 2fc3175b389c301d16ec3c52b4aa4d9f7970ccba..26f57601da4c2999e9f23fd1c870adc16881d245 100644 (file)
@@ -59,7 +59,7 @@ private:
        String m_Unit; /**< The compilation unit. */
        bool m_Local; /**< Whether the item is local. */
        bool m_Abstract; /**< Whether the item is abstract. */
-       vector<String> m_Parents; /**< The names of parent configuration
+       std::vector<String> m_Parents; /**< The names of parent configuration
                                       items. */
        ExpressionList::Ptr m_ExpressionList; /**< Expressions for this item. */
        DebugInfo m_DebugInfo; /**< Debug information. */
index ec074cc5b6da1f5ddb94bf6728efdaf6bd15aba7..dae44df33d25ff564b44cd08324ad364ecce3fde 100644 (file)
  ******************************************************************************/
 
 #include "i2-config.h"
+#include "base/objectlock.h"
+#include "base/convert.h"
 #include <boost/tuple/tuple.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -59,7 +63,7 @@ void ConfigType::ValidateItem(const ConfigItem::Ptr& item) const
        if (item->IsAbstract())
                return;
 
-       vector<String> locations;
+       std::vector<String> locations;
        locations.push_back("Object '" + item->GetName() + "' (Type: '" + item->GetType() + "')");
 
        ConfigType::Ptr parent;
@@ -70,7 +74,7 @@ void ConfigType::ValidateItem(const ConfigItem::Ptr& item) const
                parent = ConfigCompilerContext::GetContext()->GetType(m_Parent);
        }
 
-       vector<TypeRuleList::Ptr> ruleLists;
+       std::vector<TypeRuleList::Ptr> ruleLists;
        if (parent) {
                ObjectLock plock(parent);
                ruleLists.push_back(parent->m_RuleList);
@@ -84,7 +88,7 @@ void ConfigType::ValidateItem(const ConfigItem::Ptr& item) const
 /**
  * @threadsafety Always.
  */
-String ConfigType::LocationToString(const vector<String>& locations)
+String ConfigType::LocationToString(const std::vector<String>& locations)
 {
        bool first = true;
        String stack;
@@ -104,7 +108,7 @@ String ConfigType::LocationToString(const vector<String>& locations)
  * @threadsafety Always.
  */
 void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary,
-    const vector<TypeRuleList::Ptr>& ruleLists, vector<String>& locations)
+    const std::vector<TypeRuleList::Ptr>& ruleLists, std::vector<String>& locations)
 {
        BOOST_FOREACH(const TypeRuleList::Ptr& ruleList, ruleLists) {
                BOOST_FOREACH(const String& require, ruleList->GetRequires()) {
@@ -126,9 +130,9 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary,
                        ScriptFunction::Ptr func = ScriptFunctionRegistry::GetInstance()->GetItem(validator);
 
                        if (!func)
-                               BOOST_THROW_EXCEPTION(invalid_argument("Validator function '" + validator + "' does not exist."));
+                               BOOST_THROW_EXCEPTION(std::invalid_argument("Validator function '" + validator + "' does not exist."));
 
-                       vector<Value> arguments;
+                       std::vector<Value> arguments;
                        arguments.push_back(LocationToString(locations));
                        arguments.push_back(dictionary);
 
@@ -144,7 +148,7 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary,
        Value value;
        BOOST_FOREACH(boost::tie(key, value), dictionary) {
                TypeValidationResult overallResult = ValidationUnknownField;
-               vector<TypeRuleList::Ptr> subRuleLists;
+               std::vector<TypeRuleList::Ptr> subRuleLists;
 
                locations.push_back("Attribute '" + key + "'");
 
@@ -185,7 +189,7 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary,
  * @threadsafety Always.
  */
 void ConfigType::ValidateArray(const Array::Ptr& array,
-    const vector<TypeRuleList::Ptr>& ruleLists, vector<String>& locations)
+    const std::vector<TypeRuleList::Ptr>& ruleLists, std::vector<String>& locations)
 {
        BOOST_FOREACH(const TypeRuleList::Ptr& ruleList, ruleLists) {
                BOOST_FOREACH(const String& require, ruleList->GetRequires()) {
@@ -207,9 +211,9 @@ void ConfigType::ValidateArray(const Array::Ptr& array,
                        ScriptFunction::Ptr func = ScriptFunctionRegistry::GetInstance()->GetItem(validator);
 
                        if (!func)
-                               BOOST_THROW_EXCEPTION(invalid_argument("Validator function '" + validator + "' does not exist."));
+                               BOOST_THROW_EXCEPTION(std::invalid_argument("Validator function '" + validator + "' does not exist."));
 
-                       vector<Value> arguments;
+                       std::vector<Value> arguments;
                        arguments.push_back(LocationToString(locations));
                        arguments.push_back(array);
 
@@ -228,7 +232,7 @@ void ConfigType::ValidateArray(const Array::Ptr& array,
                index++;
 
                TypeValidationResult overallResult = ValidationUnknownField;
-               vector<TypeRuleList::Ptr> subRuleLists;
+               std::vector<TypeRuleList::Ptr> subRuleLists;
 
                locations.push_back("Attribute '" + key + "'");
 
index f0e8b89b814d2dfd94d1899a1f497d27763b4521..5ce363a719415dbb2439b862e6edd418be4200a2 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef CONFIGTYPE_H\r
 #define CONFIGTYPE_H\r
 \r
+#include "base/array.h"\r
+\r
 namespace icinga\r
 {\r
 \r
@@ -54,11 +56,11 @@ private:
        DebugInfo m_DebugInfo; /**< Debug information. */\r
 \r
        static void ValidateDictionary(const Dictionary::Ptr& dictionary,\r
-           const vector<TypeRuleList::Ptr>& ruleLists, vector<String>& locations);\r
+           const std::vector<TypeRuleList::Ptr>& ruleLists, std::vector<String>& locations);\r
        static void ValidateArray(const Array::Ptr& array,\r
-           const vector<TypeRuleList::Ptr>& ruleLists, vector<String>& locations);\r
+           const std::vector<TypeRuleList::Ptr>& ruleLists, std::vector<String>& locations);\r
 \r
-       static String LocationToString(const vector<String>& locations);\r
+       static String LocationToString(const std::vector<String>& locations);\r
 };\r
 \r
 }\r
index 7918f70addf8b57ec63dcb4052a4be5ee5f69b9e..318b32f1f3d80a38b945eb8ac9ecf0a98e6243fe 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef DEBUGINFO_H
 #define DEBUGINFO_H
 
+#include "base/qstring.h"
+
 namespace icinga
 {
 
@@ -64,7 +66,7 @@ struct DebugInfo
  * @param val The DebugInfo struct.
  * @returns The output stream.
  */
-inline ostream& operator<<(ostream& out, const DebugInfo& val)
+inline std::ostream& operator<<(std::ostream& out, const DebugInfo& val)
 {
        out << "in " << val.Path << ": "
            << val.FirstLine << ":" << val.FirstColumn
index 6779ee76cb720097aab1991f79e511a0439c05ec..9425c3ea6236d2debaf2c96fb4cb8971ff8dbedf 100644 (file)
  ******************************************************************************/
 
 #include "i2-config.h"
+#include "base/objectlock.h"
+#include <sstream>
 #include <boost/tuple/tuple.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -47,7 +51,7 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
        switch (m_Operator) {
                case OperatorExecute:
                        if (!valueExprl)
-                               BOOST_THROW_EXCEPTION(invalid_argument("Operand for OperatorExecute must be an ExpressionList."));
+                               BOOST_THROW_EXCEPTION(std::invalid_argument("Operand for OperatorExecute must be an ExpressionList."));
 
                        valueExprl->Execute(dictionary);
 
@@ -70,12 +74,12 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
 
                        if (!dict) {
                                if (!oldValue.IsEmpty()) {
-                                       stringstream message;
+                                       std::ostringstream message;
                                        message << "Wrong argument types for"
                                            " += (non-dictionary and"
                                            " dictionary) ("
                                                << m_DebugInfo << ")";
-                                       BOOST_THROW_EXCEPTION(domain_error(message.str()));
+                                       BOOST_THROW_EXCEPTION(std::invalid_argument(message.str()));
                                }
 
                                dict = boost::make_shared<Dictionary>();
@@ -94,22 +98,22 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
                                        dict->Set(key, value);
                                }
                        } else {
-                               stringstream message;
+                               std::ostringstream message;
                                message << "+= only works for dictionaries ("
                                        << m_DebugInfo << ")";
-                               BOOST_THROW_EXCEPTION(domain_error(message.str()));
+                               BOOST_THROW_EXCEPTION(std::invalid_argument(message.str()));
                        }
 
                        break;
 
                default:
-                       BOOST_THROW_EXCEPTION(runtime_error("Not yet implemented."));
+                       BOOST_THROW_EXCEPTION(std::runtime_error("Not yet implemented."));
        }
 
        dictionary->Set(m_Key, newValue);
 }
 
-void Expression::DumpValue(ostream& fp, int indent, const Value& value, bool inlineDict)
+void Expression::DumpValue(std::ostream& fp, int indent, const Value& value, bool inlineDict)
 {
        ExpressionList::Ptr valueExprl;
        Dictionary::Ptr valueDict;
@@ -157,13 +161,13 @@ void Expression::DumpValue(ostream& fp, int indent, const Value& value, bool inl
                return;
        }
 
-       BOOST_THROW_EXCEPTION(runtime_error("Encountered unknown type while dumping value."));
+       BOOST_THROW_EXCEPTION(std::runtime_error("Encountered unknown type while dumping value."));
 }
 
 /**
  * @threadsafety Always.
  */
-void Expression::Dump(ostream& fp, int indent) const
+void Expression::Dump(std::ostream& fp, int indent) const
 {
        if (m_Operator == OperatorExecute) {
                DumpValue(fp, indent, m_Value, true);
@@ -183,7 +187,7 @@ void Expression::Dump(ostream& fp, int indent) const
                        fp << "+=";
                        break;
                default:
-                       BOOST_THROW_EXCEPTION(runtime_error("Not yet implemented."));
+                       BOOST_THROW_EXCEPTION(std::runtime_error("Not yet implemented."));
        }
 
        fp << " ";
index 1fff1aeb67b6cb7877381aff6e98487dc5f494a5..1c660c0ed436f8828fecce1522bcceba2b487f94 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef EXPRESSION_H
 #define EXPRESSION_H
 
+#include "base/dictionary.h"
+
 namespace icinga
 {
 
@@ -50,7 +52,7 @@ public:
            const DebugInfo& debuginfo);
 
        void Execute(const Dictionary::Ptr& dictionary) const;
-       void Dump(ostream& fp, int indent = 0) const;
+       void Dump(std::ostream& fp, int indent = 0) const;
 
 private:
        String m_Key;
@@ -58,7 +60,7 @@ private:
        Value m_Value;
        DebugInfo m_DebugInfo;
 
-       static void DumpValue(ostream& fp, int indent, const Value& value, bool inlineDict = false);
+       static void DumpValue(std::ostream& fp, int indent, const Value& value, bool inlineDict = false);
 };
 
 }
index 651d11413fb0f0699e2554420106b3e21afe19e4..b1a97930e3916f964f83566ab2ae98d9a5e98a17 100644 (file)
@@ -18,6 +18,7 @@
  ******************************************************************************/
 
 #include "i2-config.h"
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -60,9 +61,9 @@ void ExpressionList::Execute(const Dictionary::Ptr& dictionary) const
  * @param fp The stream.
  * @param indent The indentation level.
  */
-void ExpressionList::Dump(ostream& fp, int indent) const
+void ExpressionList::Dump(std::ostream& fp, int indent) const
 {
        BOOST_FOREACH(const Expression& expression, m_Expressions) {
                expression.Dump(fp, indent);
        }
-}
\ No newline at end of file
+}
index 1ce75d688b8af363abebbfe5da7b4ae8179e3ebb..8ab611743a665c9fd946231bf6955c8d42745bba 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef EXPRESSIONLIST_H
 #define EXPRESSIONLIST_H
 
+#include "base/dictionary.h"
+
 namespace icinga
 {
 
@@ -37,12 +39,12 @@ public:
        void AddExpression(const Expression& expression);
 
        void Execute(const Dictionary::Ptr& dictionary) const;
-       void Dump(ostream& fp, int indent) const;
+       void Dump(std::ostream& fp, int indent) const;
 
        size_t GetLength(void) const;
 
 private:
-       vector<Expression> m_Expressions;
+       std::vector<Expression> m_Expressions;
 };
 
 }
index 0a3eb71c365042805a9ba4bee5dbdcab685b6ae2..260adb94a0fe15f044905e8c5be5df4d887889d9 100644 (file)
  * at runtime.
  */
 
-#include <i2-base.h>
-
-#include <stack>
-#include <fstream>
-
-using std::stack;
-using std::istream;
-using std::ostream;
-using std::cin;
-using std::endl;
+//#include "base/i2-base.h"
 
 #ifdef I2_CONFIG_BUILD
 #      define I2_CONFIG_API I2_EXPORT
@@ -45,7 +36,7 @@ using std::endl;
 #      define I2_CONFIG_API I2_IMPORT
 #endif /* I2_CONFIG_BUILD */
 
-#include "debuginfo.h"
+/*#include "debuginfo.h"
 #include "typerulelist.h"
 #include "typerule.h"
 #include "expression.h"
@@ -54,6 +45,6 @@ using std::endl;
 #include "configtype.h"
 #include "configitembuilder.h"
 #include "configcompiler.h"
-#include "configcompilercontext.h"
+#include "configcompilercontext.h"*/
 
 #endif /* I2CONFIG_H */
index 2eab05bf122fbc4031aedf2772f691712fe8ce0a..68cda5f63d91d2ae8f8cf38049b4aeea2114512d 100644 (file)
@@ -18,6 +18,7 @@
  ******************************************************************************/
 
 #include "i2-config.h"
+#include "base/convert.h"
 
 using namespace icinga;
 
index f1ab7860bed6222af76d3ad496791418bc0c7df0..7f27f44965400ae3d9af6e4cc4ffe45a41623826 100644 (file)
@@ -18,6 +18,7 @@
  ******************************************************************************/\r
 \r
 #include "i2-config.h"\r
+#include <boost/foreach.hpp>\r
 \r
 using namespace icinga;\r
 \r
@@ -56,7 +57,7 @@ void TypeRuleList::AddRequire(const String& attr)
  *\r
  * @returns The list of required attributes.\r
  */\r
-vector<String> TypeRuleList::GetRequires(void) const\r
+std::vector<String> TypeRuleList::GetRequires(void) const\r
 {\r
        return m_Requires;\r
 }\r
index 6c26213f28858b7b3a55ba7a4065250ab6cb4b9d..078fff4c255acae3b49a92b9de2e6e06d4ebddff 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef TYPERULELIST_H\r
 #define TYPERULELIST_H\r
 \r
+#include "base/value.h"\r
+\r
 namespace icinga\r
 {\r
 \r
@@ -51,7 +53,7 @@ public:
 \r
        void AddRequire(const String& attr);\r
        void AddRequires(const TypeRuleList::Ptr& ruleList);\r
-       vector<String> GetRequires(void) const;\r
+       std::vector<String> GetRequires(void) const;\r
 \r
        void AddRule(const TypeRule& rule);\r
        void AddRules(const TypeRuleList::Ptr& ruleList);\r
@@ -62,8 +64,8 @@ public:
 \r
 private:\r
        String m_Validator;\r
-       vector<String> m_Requires;\r
-       vector<TypeRule> m_Rules;\r
+       std::vector<String> m_Requires;\r
+       std::vector<TypeRule> m_Rules;\r
 };\r
 \r
 }\r
index e2ff440abd6c93c8a3ee41c8f512f63db2eb8600..ee2db2677dcd2b86ed8504514c6b0bbfd027a756 100644 (file)
@@ -5,7 +5,8 @@ pkglib_LTLIBRARIES =  \
        libicinga.la
 
 EXTRA_DIST = \
-       icinga-type.conf
+       icinga-type.conf \
+       i2-icinga.cpp
 
 .conf.cpp: $(top_builddir)/tools/mkembedconfig.c
        $(top_builddir)/tools/mkembedconfig $< $@
@@ -23,7 +24,6 @@ libicinga_la_SOURCES =  \
        hostgroup.cpp \
        hostgroup.h \
        host.h \
-       i2-icinga.cpp \
        i2-icinga.h \
        icinga-type.cpp \
        icingaapplication.cpp \
@@ -60,10 +60,7 @@ libicinga_la_SOURCES =  \
 libicinga_la_CPPFLAGS = \
        -DI2_ICINGA_BUILD \
        $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/lib/base \
-       -I${top_srcdir}/lib/config \
-       -I${top_srcdir}/lib/remoting \
-       -I${top_srcdir}
+       -I${top_srcdir}/lib
 
 libicinga_la_LDFLAGS = \
        $(BOOST_LDFLAGS) \
index 837efc4f375d76d5cb7ddf473ce245f430b3d0cd..29cea119ad0fa92cebec911cba6082138c7c303b 100644 (file)
@@ -18,6 +18,7 @@
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "base/logger_fwd.h"
 
 using namespace icinga;
 
@@ -26,14 +27,14 @@ REGISTER_SCRIPTFUNCTION(GetAnswerToEverything, &API::GetAnswerToEverything);
 /**
  * @threadsafety Always.
  */
-void API::GetAnswerToEverything(const ScriptTask::Ptr& task, const vector<Value>& arguments)
+void API::GetAnswerToEverything(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Text argument required."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Text argument required."));
 
        String text = arguments[0];
 
-       Logger::Write(LogInformation, "icinga", "Hello from the Icinga 2 API: " + text);
+       Log(LogInformation, "icinga", "Hello from the Icinga 2 API: " + text);
 
        task->FinishResult(42);
 }
index d37e7983398b3c1099e40abbe4e8e3a5df444907..3b222eda21f03e84fd5672dc98374111630f39ef 100644 (file)
@@ -31,7 +31,7 @@ namespace icinga
 class I2_ICINGA_API API
 {
 public:
-       static void GetAnswerToEverything(const ScriptTask::Ptr& task, const vector<Value>& arguments);
+       static void GetAnswerToEverything(const ScriptTask::Ptr& task, const std::vector<Value>& arguments);
 
 private:
        API(void);
index 3f7e1c036d455a588bf4afcbef4f1f235cb88c42..232fb72ea2d03b6b6dc4cd21933a0dd478064fe4 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef CIB_H
 #define CIB_H
 
+#include "base/ringbuffer.h"
+
 namespace icinga
 {
 
index 96751c109b91a085d48e8cd9c006ecc0afe8d514..b0430517be4063d30b920377fd7bdffb224d8134 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "base/convert.h"
+#include "base/logger_fwd.h"
+#include "base/objectlock.h"
 #include <boost/algorithm/string/classification.hpp>
+#include <boost/foreach.hpp>
+#include <boost/exception/diagnostic_information.hpp>
 
 using namespace icinga;
 
 boost::once_flag ExternalCommandProcessor::m_InitializeOnce = BOOST_ONCE_INIT;
 boost::mutex ExternalCommandProcessor::m_Mutex;
-map<String, ExternalCommandProcessor::Callback> ExternalCommandProcessor::m_Commands;
+std::map<String, ExternalCommandProcessor::Callback> ExternalCommandProcessor::m_Commands;
 
 /**
  * @threadsafety Always.
@@ -35,12 +40,12 @@ void ExternalCommandProcessor::Execute(const String& line)
                return;
 
        if (line[0] != '[')
-               BOOST_THROW_EXCEPTION(invalid_argument("Missing timestamp in command: " + line));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Missing timestamp in command: " + line));
 
        size_t pos = line.FindFirstOf("]");
 
        if (pos == String::NPos)
-               BOOST_THROW_EXCEPTION(invalid_argument("Missing timestamp in command: " + line));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Missing timestamp in command: " + line));
 
        String timestamp = line.SubStr(1, pos - 1);
        String args = line.SubStr(pos + 2, String::NPos);
@@ -48,21 +53,21 @@ void ExternalCommandProcessor::Execute(const String& line)
        double ts = Convert::ToDouble(timestamp);
 
        if (ts == 0)
-               BOOST_THROW_EXCEPTION(invalid_argument("Invalid timestamp in command: " + line));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid timestamp in command: " + line));
 
-       vector<String> argv = args.Split(boost::is_any_of(";"));
+       std::vector<String> argv = args.Split(boost::is_any_of(";"));
 
        if (argv.empty())
-               BOOST_THROW_EXCEPTION(invalid_argument("Missing arguments in command: " + line));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Missing arguments in command: " + line));
 
-       vector<String> argvExtra(argv.begin() + 1, argv.end());
+       std::vector<String> argvExtra(argv.begin() + 1, argv.end());
        Execute(ts, argv[0], argvExtra);
 }
 
 /**
  * @threadsafety Always.
  */
-void ExternalCommandProcessor::Execute(double time, const String& command, const vector<String>& arguments)
+void ExternalCommandProcessor::Execute(double time, const String& command, const std::vector<String>& arguments)
 {
        boost::call_once(m_InitializeOnce, &ExternalCommandProcessor::Initialize);
 
@@ -71,11 +76,11 @@ void ExternalCommandProcessor::Execute(double time, const String& command, const
        {
                boost::mutex::scoped_lock lock(m_Mutex);
 
-               map<String, ExternalCommandProcessor::Callback>::iterator it;
+               std::map<String, ExternalCommandProcessor::Callback>::iterator it;
                it = m_Commands.find(command);
 
                if (it == m_Commands.end())
-                       BOOST_THROW_EXCEPTION(invalid_argument("The external command '" + command + "' does not exist."));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("The external command '" + command + "' does not exist."));
 
                callback = it->second;
        }
@@ -156,17 +161,17 @@ void ExternalCommandProcessor::RegisterCommand(const String& command, const Exte
        m_Commands[command] = callback;
 }
 
-void ExternalCommandProcessor::ProcessHostCheckResult(double time, const vector<String>& arguments)
+void ExternalCommandProcessor::ProcessHostCheckResult(double time, const std::vector<String>& arguments)
 {
        if (arguments.size() < 3)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 3 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 3 arguments."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
        Service::Ptr hc = host->GetHostCheckService();
 
        if (!hc->GetEnablePassiveChecks())
-               BOOST_THROW_EXCEPTION(invalid_argument("Got passive check result for host '" + arguments[0] + "' which has passive checks disabled."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Got passive check result for host '" + arguments[0] + "' which has passive checks disabled."));
 
        int exitStatus = Convert::ToDouble(arguments[1]);
        Dictionary::Ptr result = PluginCheckTask::ParseCheckOutput(arguments[2]);
@@ -178,7 +183,7 @@ void ExternalCommandProcessor::ProcessHostCheckResult(double time, const vector<
        result->Set("execution_end", time);
        result->Set("active", 0);
 
-       Logger::Write(LogInformation, "icinga", "Processing passive check result for host '" + arguments[0] + "'");
+       Log(LogInformation, "icinga", "Processing passive check result for host '" + arguments[0] + "'");
        hc->ProcessCheckResult(result);
 
        {
@@ -191,15 +196,15 @@ void ExternalCommandProcessor::ProcessHostCheckResult(double time, const vector<
        }
 }
 
-void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const vector<String>& arguments)
+void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const std::vector<String>& arguments)
 {
        if (arguments.size() < 4)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 4 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 4 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
        if (!service->GetEnablePassiveChecks())
-               BOOST_THROW_EXCEPTION(invalid_argument("Got passive check result for service '" + arguments[1] + "' which has passive checks disabled."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Got passive check result for service '" + arguments[1] + "' which has passive checks disabled."));
 
        int exitStatus = Convert::ToDouble(arguments[2]);
        Dictionary::Ptr result = PluginCheckTask::ParseCheckOutput(arguments[3]);
@@ -211,7 +216,7 @@ void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const vect
        result->Set("execution_end", time);
        result->Set("active", 0);
 
-       Logger::Write(LogInformation, "icinga", "Processing passive check result for service '" + arguments[1] + "'");
+       Log(LogInformation, "icinga", "Processing passive check result for service '" + arguments[1] + "'");
        service->ProcessCheckResult(result);
 
        {
@@ -224,10 +229,10 @@ void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const vect
        }
 }
 
-void ExternalCommandProcessor::ScheduleHostCheck(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleHostCheck(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
@@ -236,12 +241,12 @@ void ExternalCommandProcessor::ScheduleHostCheck(double, const vector<String>& a
        double planned_check = Convert::ToDouble(arguments[1]);
 
        if (planned_check > hc->GetNextCheck()) {
-               Logger::Write(LogInformation, "icinga", "Ignoring reschedule request for host '" +
+               Log(LogInformation, "icinga", "Ignoring reschedule request for host '" +
                    arguments[0] + "' (next check is already sooner than requested check time)");
                return;
        }
 
-       Logger::Write(LogInformation, "icinga", "Rescheduling next check for host '" + arguments[0] + "'");
+       Log(LogInformation, "icinga", "Rescheduling next check for host '" + arguments[0] + "'");
 
        {
                ObjectLock olock(hc);
@@ -250,16 +255,16 @@ void ExternalCommandProcessor::ScheduleHostCheck(double, const vector<String>& a
        }
 }
 
-void ExternalCommandProcessor::ScheduleForcedHostCheck(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleForcedHostCheck(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
        Service::Ptr hc = host->GetHostCheckService();
 
-       Logger::Write(LogInformation, "icinga", "Rescheduling next check for host '" + arguments[0] + "'");
+       Log(LogInformation, "icinga", "Rescheduling next check for host '" + arguments[0] + "'");
 
        {
                ObjectLock olock(hc);
@@ -269,22 +274,22 @@ void ExternalCommandProcessor::ScheduleForcedHostCheck(double, const vector<Stri
        }
 }
 
-void ExternalCommandProcessor::ScheduleSvcCheck(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleSvcCheck(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 3)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 3 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 3 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
        double planned_check = Convert::ToDouble(arguments[2]);
 
        if (planned_check > service->GetNextCheck()) {
-               Logger::Write(LogInformation, "icinga", "Ignoring reschedule request for service '" +
+               Log(LogInformation, "icinga", "Ignoring reschedule request for service '" +
                    arguments[1] + "' (next check is already sooner than requested check time)");
                return;
        }
 
-       Logger::Write(LogInformation, "icinga", "Rescheduling next check for service '" + arguments[1] + "'");
+       Log(LogInformation, "icinga", "Rescheduling next check for service '" + arguments[1] + "'");
 
        {
                ObjectLock olock(service);
@@ -293,14 +298,14 @@ void ExternalCommandProcessor::ScheduleSvcCheck(double, const vector<String>& ar
        }
 }
 
-void ExternalCommandProcessor::ScheduleForcedSvcCheck(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleForcedSvcCheck(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 3)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 3 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 3 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
-       Logger::Write(LogInformation, "icinga", "Rescheduling next check for service '" + arguments[1] + "'");
+       Log(LogInformation, "icinga", "Rescheduling next check for service '" + arguments[1] + "'");
 
        {
                ObjectLock olock(service);
@@ -310,14 +315,14 @@ void ExternalCommandProcessor::ScheduleForcedSvcCheck(double, const vector<Strin
        }
 }
 
-void ExternalCommandProcessor::EnableHostCheck(double, const vector<String>& arguments)
+void ExternalCommandProcessor::EnableHostCheck(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Enabling active checks for host '" + arguments[0] + "'");
+       Log(LogInformation, "icinga", "Enabling active checks for host '" + arguments[0] + "'");
        Service::Ptr hc = host->GetHostCheckService();
 
        if (!hc)
@@ -330,14 +335,14 @@ void ExternalCommandProcessor::EnableHostCheck(double, const vector<String>& arg
        }
 }
 
-void ExternalCommandProcessor::DisableHostCheck(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DisableHostCheck(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Disabling active checks for host '" + arguments[0] + "'");
+       Log(LogInformation, "icinga", "Disabling active checks for host '" + arguments[0] + "'");
        Service::Ptr hc = host->GetHostCheckService();
 
        if (!hc)
@@ -350,14 +355,14 @@ void ExternalCommandProcessor::DisableHostCheck(double, const vector<String>& ar
        }
 }
 
-void ExternalCommandProcessor::EnableSvcCheck(double, const vector<String>& arguments)
+void ExternalCommandProcessor::EnableSvcCheck(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
-       Logger::Write(LogInformation, "icinga", "Enabling active checks for service '" + arguments[1] + "'");
+       Log(LogInformation, "icinga", "Enabling active checks for service '" + arguments[1] + "'");
 
        {
                ObjectLock olock(service);
@@ -366,14 +371,14 @@ void ExternalCommandProcessor::EnableSvcCheck(double, const vector<String>& argu
        }
 }
 
-void ExternalCommandProcessor::DisableSvcCheck(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DisableSvcCheck(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
-       Logger::Write(LogInformation, "icinga", "Disabling active checks for service '" + arguments[1] + "'");
+       Log(LogInformation, "icinga", "Disabling active checks for service '" + arguments[1] + "'");
 
        {
                ObjectLock olock(service);
@@ -382,23 +387,23 @@ void ExternalCommandProcessor::DisableSvcCheck(double, const vector<String>& arg
        }
 }
 
-void ExternalCommandProcessor::ShutdownProcess(double, const vector<String>&)
+void ExternalCommandProcessor::ShutdownProcess(double, const std::vector<String>&)
 {
-       Logger::Write(LogInformation, "icinga", "Shutting down Icinga via external command.");
+       Log(LogInformation, "icinga", "Shutting down Icinga via external command.");
        Application::RequestShutdown();
 }
 
-void ExternalCommandProcessor::ScheduleForcedHostSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleForcedHostSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        double planned_check = Convert::ToDouble(arguments[1]);
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
        BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
-               Logger::Write(LogInformation, "icinga", "Rescheduling next check for service '" + service->GetName() + "'");
+               Log(LogInformation, "icinga", "Rescheduling next check for service '" + service->GetName() + "'");
 
                {
                        ObjectLock olock(service);
@@ -409,10 +414,10 @@ void ExternalCommandProcessor::ScheduleForcedHostSvcChecks(double, const vector<
        }
 }
 
-void ExternalCommandProcessor::ScheduleHostSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleHostSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        double planned_check = Convert::ToDouble(arguments[1]);
 
@@ -420,12 +425,12 @@ void ExternalCommandProcessor::ScheduleHostSvcChecks(double, const vector<String
 
        BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
                if (planned_check > service->GetNextCheck()) {
-                       Logger::Write(LogInformation, "icinga", "Ignoring reschedule request for service '" +
+                       Log(LogInformation, "icinga", "Ignoring reschedule request for service '" +
                            service->GetName() + "' (next check is already sooner than requested check time)");
                        continue;
                }
 
-               Logger::Write(LogInformation, "icinga", "Rescheduling next check for service '" + service->GetName() + "'");
+               Log(LogInformation, "icinga", "Rescheduling next check for service '" + service->GetName() + "'");
 
                {
                        ObjectLock olock(service);
@@ -435,28 +440,28 @@ void ExternalCommandProcessor::ScheduleHostSvcChecks(double, const vector<String
        }
 }
 
-void ExternalCommandProcessor::EnableHostSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::EnableHostSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
        BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
-               Logger::Write(LogInformation, "icinga", "Enabling active checks for service '" + service->GetName() + "'");
+               Log(LogInformation, "icinga", "Enabling active checks for service '" + service->GetName() + "'");
                service->SetEnableActiveChecks(true);
        }
 }
 
-void ExternalCommandProcessor::DisableHostSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DisableHostSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 arguments."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
        BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
-               Logger::Write(LogInformation, "icinga", "Disabling active checks for service '" + service->GetName() + "'");
+               Log(LogInformation, "icinga", "Disabling active checks for service '" + service->GetName() + "'");
 
                {
                        ObjectLock olock(service);
@@ -466,27 +471,27 @@ void ExternalCommandProcessor::DisableHostSvcChecks(double, const vector<String>
        }
 }
 
-void ExternalCommandProcessor::AcknowledgeSvcProblem(double, const vector<String>& arguments)
+void ExternalCommandProcessor::AcknowledgeSvcProblem(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 7)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 7 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 7 arguments."));
 
        bool sticky = Convert::ToBool(arguments[2]);
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
        if (service->GetState() == StateOK)
-               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' is OK."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("The service '" + arguments[1] + "' is OK."));
 
-       Logger::Write(LogInformation, "icinga", "Setting acknowledgement for service '" + service->GetName() + "'");
+       Log(LogInformation, "icinga", "Setting acknowledgement for service '" + service->GetName() + "'");
 
        service->AcknowledgeProblem(sticky ? AcknowledgementSticky : AcknowledgementNormal);
 }
 
-void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const vector<String>& arguments)
+void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 8 arguments."));
 
        bool sticky = Convert::ToBool(arguments[2]);
        double timestamp = Convert::ToDouble(arguments[5]);
@@ -494,87 +499,87 @@ void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const vector<
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
        if (service->GetState() == StateOK)
-               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' is OK."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("The service '" + arguments[1] + "' is OK."));
 
-       Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for service '" + service->GetName() + "'");
+       Log(LogInformation, "icinga", "Setting timed acknowledgement for service '" + service->GetName() + "'");
 
        service->AcknowledgeProblem(sticky ? AcknowledgementSticky : AcknowledgementNormal, timestamp);
 }
 
-void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const vector<String>& arguments)
+void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
-       Logger::Write(LogInformation, "icinga", "Removing acknowledgement for service '" + service->GetName() + "'");
+       Log(LogInformation, "icinga", "Removing acknowledgement for service '" + service->GetName() + "'");
 
        service->ClearAcknowledgement();
 }
 
-void ExternalCommandProcessor::AcknowledgeHostProblem(double, const vector<String>& arguments)
+void ExternalCommandProcessor::AcknowledgeHostProblem(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 6)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 6 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 6 arguments."));
 
        bool sticky = Convert::ToBool(arguments[1]);
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Setting acknowledgement for host '" + host->GetName() + "'");
+       Log(LogInformation, "icinga", "Setting acknowledgement for host '" + host->GetName() + "'");
        Service::Ptr service = host->GetHostCheckService();
        if (service) {
                if (service->GetState() == StateOK)
-                       BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' is OK."));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("The host '" + arguments[0] + "' is OK."));
 
                service->AcknowledgeProblem(sticky ? AcknowledgementSticky : AcknowledgementNormal);
        }
 }
 
-void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const vector<String>& arguments)
+void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 7)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 7 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 7 arguments."));
 
        bool sticky = Convert::ToBool(arguments[1]);
        double timestamp = Convert::ToDouble(arguments[4]);
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for host '" + host->GetName() + "'");
+       Log(LogInformation, "icinga", "Setting timed acknowledgement for host '" + host->GetName() + "'");
        Service::Ptr service = host->GetHostCheckService();
        if (service) {
                if (service->GetState() == StateOK)
-                       BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' is OK."));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("The host '" + arguments[0] + "' is OK."));
 
                service->AcknowledgeProblem(sticky ? AcknowledgementSticky : AcknowledgementNormal, timestamp);
        }
 }
 
-void ExternalCommandProcessor::RemoveHostAcknowledgement(double, const vector<String>& arguments)
+void ExternalCommandProcessor::RemoveHostAcknowledgement(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Removing acknowledgement for host '" + host->GetName() + "'");
+       Log(LogInformation, "icinga", "Removing acknowledgement for host '" + host->GetName() + "'");
        Service::Ptr service = host->GetHostCheckService();
        if (service)
                service->ClearAcknowledgement();
 }
 
-void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
 
        BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
                BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
-                       Logger::Write(LogInformation, "icinga", "Enabling active checks for service '" + service->GetName() + "'");
+                       Log(LogInformation, "icinga", "Enabling active checks for service '" + service->GetName() + "'");
 
                        {
                                ObjectLock olock(service);
@@ -585,16 +590,16 @@ void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const vector<Str
        }
 }
 
-void ExternalCommandProcessor::DisableHostgroupSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DisableHostgroupSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
 
        BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
                BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
-                       Logger::Write(LogInformation, "icinga", "Disabling active checks for service '" + service->GetName() + "'");
+                       Log(LogInformation, "icinga", "Disabling active checks for service '" + service->GetName() + "'");
 
                        {
                                ObjectLock olock(service);
@@ -605,15 +610,15 @@ void ExternalCommandProcessor::DisableHostgroupSvcChecks(double, const vector<St
        }
 }
 
-void ExternalCommandProcessor::EnableServicegroupSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::EnableServicegroupSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
 
        BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
-               Logger::Write(LogInformation, "icinga", "Enabling active checks for service '" + service->GetName() + "'");
+               Log(LogInformation, "icinga", "Enabling active checks for service '" + service->GetName() + "'");
 
                {
                        ObjectLock olock(service);
@@ -623,15 +628,15 @@ void ExternalCommandProcessor::EnableServicegroupSvcChecks(double, const vector<
        }
 }
 
-void ExternalCommandProcessor::DisableServicegroupSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DisableServicegroupSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
 
        BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
-               Logger::Write(LogInformation, "icinga", "Disabling active checks for service '" + service->GetName() + "'");
+               Log(LogInformation, "icinga", "Disabling active checks for service '" + service->GetName() + "'");
 
                {
                        ObjectLock olock(service);
@@ -641,14 +646,14 @@ void ExternalCommandProcessor::DisableServicegroupSvcChecks(double, const vector
        }
 }
 
-void ExternalCommandProcessor::EnablePassiveHostChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::EnablePassiveHostChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Enabling passive checks for host '" + arguments[0] + "'");
+       Log(LogInformation, "icinga", "Enabling passive checks for host '" + arguments[0] + "'");
        Service::Ptr hc = host->GetHostCheckService();
 
        if (!hc)
@@ -661,14 +666,14 @@ void ExternalCommandProcessor::EnablePassiveHostChecks(double, const vector<Stri
        }
 }
 
-void ExternalCommandProcessor::DisablePassiveHostChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DisablePassiveHostChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 arguments."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Disabling passive checks for host '" + arguments[0] + "'");
+       Log(LogInformation, "icinga", "Disabling passive checks for host '" + arguments[0] + "'");
        Service::Ptr hc = host->GetHostCheckService();
 
        if (!hc)
@@ -681,14 +686,14 @@ void ExternalCommandProcessor::DisablePassiveHostChecks(double, const vector<Str
        }
 }
 
-void ExternalCommandProcessor::EnablePassiveSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::EnablePassiveSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
-       Logger::Write(LogInformation, "icinga", "Enabling passive checks for service '" + arguments[1] + "'");
+       Log(LogInformation, "icinga", "Enabling passive checks for service '" + arguments[1] + "'");
 
        {
                ObjectLock olock(service);
@@ -697,14 +702,14 @@ void ExternalCommandProcessor::EnablePassiveSvcChecks(double, const vector<Strin
        }
 }
 
-void ExternalCommandProcessor::DisablePassiveSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DisablePassiveSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
-       Logger::Write(LogInformation, "icinga", "Disabling passive checks for service '" + arguments[1] + "'");
+       Log(LogInformation, "icinga", "Disabling passive checks for service '" + arguments[1] + "'");
 
        {
                ObjectLock olock(service);
@@ -713,15 +718,15 @@ void ExternalCommandProcessor::DisablePassiveSvcChecks(double, const vector<Stri
        }
 }
 
-void ExternalCommandProcessor::EnableServicegroupPassiveSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::EnableServicegroupPassiveSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
 
        BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
-               Logger::Write(LogInformation, "icinga", "Enabling passive checks for service '" + service->GetName() + "'");
+               Log(LogInformation, "icinga", "Enabling passive checks for service '" + service->GetName() + "'");
 
                {
                        ObjectLock olock(service);
@@ -731,15 +736,15 @@ void ExternalCommandProcessor::EnableServicegroupPassiveSvcChecks(double, const
        }
 }
 
-void ExternalCommandProcessor::DisableServicegroupPassiveSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DisableServicegroupPassiveSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
 
        BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
-               Logger::Write(LogInformation, "icinga", "Disabling passive checks for service '" + service->GetName() + "'");
+               Log(LogInformation, "icinga", "Disabling passive checks for service '" + service->GetName() + "'");
 
                {
                        ObjectLock olock(service);
@@ -749,16 +754,16 @@ void ExternalCommandProcessor::DisableServicegroupPassiveSvcChecks(double, const
        }
 }
 
-void ExternalCommandProcessor::EnableHostgroupPassiveSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::EnableHostgroupPassiveSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
 
        BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
                BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
-                       Logger::Write(LogInformation, "icinga", "Enabling passive checks for service '" + service->GetName() + "'");
+                       Log(LogInformation, "icinga", "Enabling passive checks for service '" + service->GetName() + "'");
 
                        {
                                ObjectLock olock(service);
@@ -769,16 +774,16 @@ void ExternalCommandProcessor::EnableHostgroupPassiveSvcChecks(double, const vec
        }
 }
 
-void ExternalCommandProcessor::DisableHostgroupPassiveSvcChecks(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DisableHostgroupPassiveSvcChecks(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
 
        BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
                BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
-                       Logger::Write(LogInformation, "icinga", "Disabling passive checks for service '" + service->GetName() + "'");
+                       Log(LogInformation, "icinga", "Disabling passive checks for service '" + service->GetName() + "'");
 
                        {
                                ObjectLock olock(service);
@@ -789,31 +794,31 @@ void ExternalCommandProcessor::DisableHostgroupPassiveSvcChecks(double, const ve
        }
 }
 
-void ExternalCommandProcessor::ProcessFile(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ProcessFile(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        String file = arguments[0];
        bool del = Convert::ToBool(arguments[1]);
 
-       ifstream ifp;
-       ifp.exceptions(ifstream::badbit);
+       std::ifstream ifp;
+       ifp.exceptions(std::ifstream::badbit);
 
-       ifp.open(file.CStr(), ifstream::in);
+       ifp.open(file.CStr(), std::ifstream::in);
 
        while(ifp.good()) {
                std::string line;
                std::getline(ifp, line);
 
                try {
-                       Logger::Write(LogInformation, "compat", "Executing external command: " + line);
+                       Log(LogInformation, "compat", "Executing external command: " + line);
 
                        Execute(line);
-               } catch (const exception& ex) {
-                       stringstream msgbuf;
-                       msgbuf << "External command failed: " << diagnostic_information(ex);
-                       Logger::Write(LogWarning, "icinga", msgbuf.str());
+               } catch (const std::exception& ex) {
+                       std::ostringstream msgbuf;
+                       msgbuf << "External command failed: " << boost::diagnostic_information(ex);
+                       Log(LogWarning, "icinga", msgbuf.str());
                }
        }
 
@@ -823,10 +828,10 @@ void ExternalCommandProcessor::ProcessFile(double, const vector<String>& argumen
                (void) unlink(file.CStr());
 }
 
-void ExternalCommandProcessor::ScheduleSvcDowntime(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleSvcDowntime(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 9)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 9 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 9 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
@@ -835,27 +840,27 @@ void ExternalCommandProcessor::ScheduleSvcDowntime(double, const vector<String>&
        if (triggeredByLegacy != 0)
                triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy);
 
-       Logger::Write(LogInformation, "icinga", "Creating downtime for service " + service->GetName());
+       Log(LogInformation, "icinga", "Creating downtime for service " + service->GetName());
        (void) service->AddDowntime(arguments[7], arguments[8],
            Convert::ToDouble(arguments[2]), Convert::ToDouble(arguments[3]),
            Convert::ToBool(arguments[4]), triggeredBy, Convert::ToDouble(arguments[6]));
 }
 
-void ExternalCommandProcessor::DelSvcDowntime(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DelSvcDowntime(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        int id = Convert::ToLong(arguments[0]);
-       Logger::Write(LogInformation, "icinga", "Removing downtime ID " + arguments[0]);
+       Log(LogInformation, "icinga", "Removing downtime ID " + arguments[0]);
        String rid = Service::GetDowntimeIDFromLegacyID(id);
        Service::RemoveDowntime(rid);
 }
 
-void ExternalCommandProcessor::ScheduleHostDowntime(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleHostDowntime(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 8 arguments."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
@@ -864,7 +869,7 @@ void ExternalCommandProcessor::ScheduleHostDowntime(double, const vector<String>
        if (triggeredByLegacy != 0)
                triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy);
 
-       Logger::Write(LogInformation, "icinga", "Creating downtime for host " + host->GetName());
+       Log(LogInformation, "icinga", "Creating downtime for host " + host->GetName());
        Service::Ptr service = host->GetHostCheckService();
        if (service) {
                (void) service->AddDowntime(arguments[6], arguments[7],
@@ -873,21 +878,21 @@ void ExternalCommandProcessor::ScheduleHostDowntime(double, const vector<String>
        }
 }
 
-void ExternalCommandProcessor::DelHostDowntime(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DelHostDowntime(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        int id = Convert::ToLong(arguments[0]);
-       Logger::Write(LogInformation, "icinga", "Removing downtime ID " + arguments[0]);
+       Log(LogInformation, "icinga", "Removing downtime ID " + arguments[0]);
        String rid = Service::GetDowntimeIDFromLegacyID(id);
        Service::RemoveDowntime(rid);
 }
 
-void ExternalCommandProcessor::ScheduleHostSvcDowntime(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleHostSvcDowntime(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 8 argument."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
@@ -897,17 +902,17 @@ void ExternalCommandProcessor::ScheduleHostSvcDowntime(double, const vector<Stri
                triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy);
 
        BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
-               Logger::Write(LogInformation, "icinga", "Creating downtime for service " + service->GetName());
+               Log(LogInformation, "icinga", "Creating downtime for service " + service->GetName());
                (void) service->AddDowntime(arguments[6], arguments[7],
                    Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]),
                    Convert::ToBool(arguments[3]), triggeredBy, Convert::ToDouble(arguments[5]));
        }
 }
 
-void ExternalCommandProcessor::ScheduleHostgroupHostDowntime(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleHostgroupHostDowntime(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 8 arguments."));
 
        HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
 
@@ -917,7 +922,7 @@ void ExternalCommandProcessor::ScheduleHostgroupHostDowntime(double, const vecto
                triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy);
 
        BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
-               Logger::Write(LogInformation, "icinga", "Creating downtime for host " + host->GetName());
+               Log(LogInformation, "icinga", "Creating downtime for host " + host->GetName());
                Service::Ptr service = host->GetHostCheckService();
                if (service) {
                        (void) service->AddDowntime(arguments[6], arguments[7],
@@ -927,10 +932,10 @@ void ExternalCommandProcessor::ScheduleHostgroupHostDowntime(double, const vecto
        }
 }
 
-void ExternalCommandProcessor::ScheduleHostgroupSvcDowntime(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleHostgroupSvcDowntime(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 8 arguments."));
 
        HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
 
@@ -943,7 +948,7 @@ void ExternalCommandProcessor::ScheduleHostgroupSvcDowntime(double, const vector
         * over all hosts in the host group - otherwise we might end up creating multiple
         * downtimes for some services. */
 
-       set<Service::Ptr> services;
+       std::set<Service::Ptr> services;
 
        BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
                BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
@@ -952,17 +957,17 @@ void ExternalCommandProcessor::ScheduleHostgroupSvcDowntime(double, const vector
        }
 
        BOOST_FOREACH(const Service::Ptr& service, services) {
-               Logger::Write(LogInformation, "icinga", "Creating downtime for service " + service->GetName());
+               Log(LogInformation, "icinga", "Creating downtime for service " + service->GetName());
                (void) service->AddDowntime(arguments[6], arguments[7],
                    Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]),
                    Convert::ToBool(arguments[3]), triggeredBy, Convert::ToDouble(arguments[5]));
        }
 }
 
-void ExternalCommandProcessor::ScheduleServicegroupHostDowntime(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleServicegroupHostDowntime(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 8 arguments."));
 
        ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
 
@@ -975,7 +980,7 @@ void ExternalCommandProcessor::ScheduleServicegroupHostDowntime(double, const ve
         * over all services in the service group - otherwise we might end up creating multiple
         * downtimes for some hosts. */
 
-       set<Service::Ptr> services;
+       std::set<Service::Ptr> services;
 
        BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
                Host::Ptr host = service->GetHost();
@@ -985,17 +990,17 @@ void ExternalCommandProcessor::ScheduleServicegroupHostDowntime(double, const ve
        }
 
        BOOST_FOREACH(const Service::Ptr& service, services) {
-               Logger::Write(LogInformation, "icinga", "Creating downtime for service " + service->GetName());
+               Log(LogInformation, "icinga", "Creating downtime for service " + service->GetName());
                (void) service->AddDowntime(arguments[6], arguments[7],
                    Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]),
                    Convert::ToBool(arguments[3]), triggeredBy, Convert::ToDouble(arguments[5]));
        }
 }
 
-void ExternalCommandProcessor::ScheduleServicegroupSvcDowntime(double, const vector<String>& arguments)
+void ExternalCommandProcessor::ScheduleServicegroupSvcDowntime(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 8 arguments."));
 
        ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
 
@@ -1005,116 +1010,116 @@ void ExternalCommandProcessor::ScheduleServicegroupSvcDowntime(double, const vec
                triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy);
 
        BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
-               Logger::Write(LogInformation, "icinga", "Creating downtime for service " + service->GetName());
+               Log(LogInformation, "icinga", "Creating downtime for service " + service->GetName());
                (void) service->AddDowntime(arguments[6], arguments[7],
                    Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]),
                    Convert::ToBool(arguments[3]), triggeredBy, Convert::ToDouble(arguments[5]));
        }
 }
 
-void ExternalCommandProcessor::AddHostComment(double, const vector<String>& arguments)
+void ExternalCommandProcessor::AddHostComment(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 4)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 4 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 4 arguments."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Creating comment for host " + host->GetName());
+       Log(LogInformation, "icinga", "Creating comment for host " + host->GetName());
        Service::Ptr service = host->GetHostCheckService();
        if (service)
                (void) service->AddComment(CommentUser, arguments[2], arguments[3], 0);
 }
 
-void ExternalCommandProcessor::DelHostComment(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DelHostComment(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        int id = Convert::ToLong(arguments[0]);
-       Logger::Write(LogInformation, "icinga", "Removing comment ID " + arguments[0]);
+       Log(LogInformation, "icinga", "Removing comment ID " + arguments[0]);
        String rid = Service::GetCommentIDFromLegacyID(id);
        Service::RemoveComment(rid);
 }
 
-void ExternalCommandProcessor::AddSvcComment(double, const vector<String>& arguments)
+void ExternalCommandProcessor::AddSvcComment(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 5)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 5 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 5 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
-       Logger::Write(LogInformation, "icinga", "Creating comment for service " + service->GetName());
+       Log(LogInformation, "icinga", "Creating comment for service " + service->GetName());
        (void) service->AddComment(CommentUser, arguments[3], arguments[4], 0);
 }
 
-void ExternalCommandProcessor::DelSvcComment(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DelSvcComment(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        int id = Convert::ToLong(arguments[0]);
-       Logger::Write(LogInformation, "icinga", "Removing comment ID " + arguments[0]);
+       Log(LogInformation, "icinga", "Removing comment ID " + arguments[0]);
 
        String rid = Service::GetCommentIDFromLegacyID(id);
        Service::RemoveComment(rid);
 }
 
-void ExternalCommandProcessor::DelAllHostComments(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DelAllHostComments(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Removing all comments for host " + host->GetName());
+       Log(LogInformation, "icinga", "Removing all comments for host " + host->GetName());
        Service::Ptr service = host->GetHostCheckService();
        if (service)
                service->RemoveAllComments();
 }
 
-void ExternalCommandProcessor::DelAllSvcComments(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DelAllSvcComments(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
-       Logger::Write(LogInformation, "icinga", "Removing all comments for service " + service->GetName());
+       Log(LogInformation, "icinga", "Removing all comments for service " + service->GetName());
        service->RemoveAllComments();
 }
 
-void ExternalCommandProcessor::SendCustomHostNotification(double, const vector<String>& arguments)
+void ExternalCommandProcessor::SendCustomHostNotification(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 4)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 4 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 4 arguments."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Sending custom notification for host " + host->GetName());
+       Log(LogInformation, "icinga", "Sending custom notification for host " + host->GetName());
        Service::Ptr service = host->GetHostCheckService();
        if (service)
                service->RequestNotifications(NotificationCustom, service->GetLastCheckResult());
 }
 
-void ExternalCommandProcessor::SendCustomSvcNotification(double, const vector<String>& arguments)
+void ExternalCommandProcessor::SendCustomSvcNotification(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 5)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 5 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 5 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
-       Logger::Write(LogInformation, "icinga", "Sending custom notification for service " + service->GetName());
+       Log(LogInformation, "icinga", "Sending custom notification for service " + service->GetName());
        service->RequestNotifications(NotificationCustom, service->GetLastCheckResult());
 }
 
-void ExternalCommandProcessor::DelayHostNotification(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DelayHostNotification(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Delaying notifications for host " + host->GetName());
+       Log(LogInformation, "icinga", "Delaying notifications for host " + host->GetName());
        Service::Ptr hc = host->GetHostCheckService();
        if (!hc)
                return;
@@ -1126,14 +1131,14 @@ void ExternalCommandProcessor::DelayHostNotification(double, const vector<String
        }
 }
 
-void ExternalCommandProcessor::DelaySvcNotification(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DelaySvcNotification(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 3)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 3 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 3 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
-       Logger::Write(LogInformation, "icinga", "Delaying notifications for service " + service->GetName());
+       Log(LogInformation, "icinga", "Delaying notifications for service " + service->GetName());
 
        {
                ObjectLock olock(service);
@@ -1142,14 +1147,14 @@ void ExternalCommandProcessor::DelaySvcNotification(double, const vector<String>
        }
 }
 
-void ExternalCommandProcessor::EnableHostNotifications(double, const vector<String>& arguments)
+void ExternalCommandProcessor::EnableHostNotifications(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Enabling notifications for host '" + arguments[0] + "'");
+       Log(LogInformation, "icinga", "Enabling notifications for host '" + arguments[0] + "'");
        Service::Ptr hc = host->GetHostCheckService();
 
        if (!hc)
@@ -1162,14 +1167,14 @@ void ExternalCommandProcessor::EnableHostNotifications(double, const vector<Stri
        }
 }
 
-void ExternalCommandProcessor::DisableHostNotifications(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DisableHostNotifications(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 1 argument."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
-       Logger::Write(LogInformation, "icinga", "Disabling notifications for host '" + arguments[0] + "'");
+       Log(LogInformation, "icinga", "Disabling notifications for host '" + arguments[0] + "'");
        Service::Ptr hc = host->GetHostCheckService();
 
        if (!hc)
@@ -1182,14 +1187,14 @@ void ExternalCommandProcessor::DisableHostNotifications(double, const vector<Str
        }
 }
 
-void ExternalCommandProcessor::EnableSvcNotifications(double, const vector<String>& arguments)
+void ExternalCommandProcessor::EnableSvcNotifications(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
-       Logger::Write(LogInformation, "icinga", "Enabling notifications for service '" + arguments[1] + "'");
+       Log(LogInformation, "icinga", "Enabling notifications for service '" + arguments[1] + "'");
 
        {
                ObjectLock olock(service);
@@ -1198,14 +1203,14 @@ void ExternalCommandProcessor::EnableSvcNotifications(double, const vector<Strin
        }
 }
 
-void ExternalCommandProcessor::DisableSvcNotifications(double, const vector<String>& arguments)
+void ExternalCommandProcessor::DisableSvcNotifications(double, const std::vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Expected 2 arguments."));
 
        Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
 
-       Logger::Write(LogInformation, "icinga", "Disabling notifications for service '" + arguments[1] + "'");
+       Log(LogInformation, "icinga", "Disabling notifications for service '" + arguments[1] + "'");
 
        {
                ObjectLock olock(service);
index f31ff4f3ce60c3dfdbfce089221e1b0b2071b416..4c5c4b5806dff219917274659454dba6bec263d4 100644 (file)
@@ -26,14 +26,14 @@ namespace icinga
 class I2_ICINGA_API ExternalCommandProcessor {
 public:
        static void Execute(const String& line);
-       static void Execute(double time, const String& command, const vector<String>& arguments);
+       static void Execute(double time, const String& command, const std::vector<String>& arguments);
 
 private:
-       typedef boost::function<void (double time, const vector<String>& arguments)> Callback;
+       typedef boost::function<void (double time, const std::vector<String>& arguments)> Callback;
 
        static boost::once_flag m_InitializeOnce;
        static boost::mutex m_Mutex;
-       static map<String, Callback> m_Commands;
+       static std::map<String, Callback> m_Commands;
 
        ExternalCommandProcessor(void);
 
@@ -41,63 +41,63 @@ private:
 
        static void RegisterCommand(const String& command, const Callback& callback);
 
-       static void ProcessHostCheckResult(double time, const vector<String>& arguments);
-       static void ProcessServiceCheckResult(double time, const vector<String>& arguments);
-       static void ScheduleHostCheck(double time, const vector<String>& arguments);
-       static void ScheduleForcedHostCheck(double time, const vector<String>& arguments);
-       static void ScheduleSvcCheck(double time, const vector<String>& arguments);
-       static void ScheduleForcedSvcCheck(double time, const vector<String>& arguments);
-       static void EnableHostCheck(double time, const vector<String>& arguments);
-       static void DisableHostCheck(double time, const vector<String>& arguments);
-       static void EnableSvcCheck(double time, const vector<String>& arguments);
-       static void DisableSvcCheck(double time, const vector<String>& arguments);
-       static void ShutdownProcess(double time, const vector<String>& arguments);
-       static void ScheduleForcedHostSvcChecks(double time, const vector<String>& arguments);
-       static void ScheduleHostSvcChecks(double time, const vector<String>& arguments);
-       static void EnableHostSvcChecks(double time, const vector<String>& arguments);
-       static void DisableHostSvcChecks(double time, const vector<String>& arguments);
-       static void AcknowledgeSvcProblem(double time, const vector<String>& arguments);
-       static void AcknowledgeSvcProblemExpire(double time, const vector<String>& arguments);
-       static void RemoveSvcAcknowledgement(double time, const vector<String>& arguments);
-       static void AcknowledgeHostProblem(double time, const vector<String>& arguments);
-       static void AcknowledgeHostProblemExpire(double time, const vector<String>& arguments);
-       static void RemoveHostAcknowledgement(double time, const vector<String>& arguments);
-       static void EnableHostgroupSvcChecks(double time, const vector<String>& arguments);
-       static void DisableHostgroupSvcChecks(double time, const vector<String>& arguments);
-       static void EnableServicegroupSvcChecks(double time, const vector<String>& arguments);
-       static void DisableServicegroupSvcChecks(double time, const vector<String>& arguments);
-       static void EnablePassiveHostChecks(double time, const vector<String>& arguments);
-       static void DisablePassiveHostChecks(double time, const vector<String>& arguments);
-       static void EnablePassiveSvcChecks(double time, const vector<String>& arguments);
-       static void DisablePassiveSvcChecks(double time, const vector<String>& arguments);
-       static void EnableServicegroupPassiveSvcChecks(double time, const vector<String>& arguments);
-       static void DisableServicegroupPassiveSvcChecks(double time, const vector<String>& arguments);
-       static void EnableHostgroupPassiveSvcChecks(double time, const vector<String>& arguments);
-       static void DisableHostgroupPassiveSvcChecks(double time, const vector<String>& arguments);
-       static void ProcessFile(double time, const vector<String>& arguments);
-       static void ScheduleSvcDowntime(double time, const vector<String>& arguments);
-       static void DelSvcDowntime(double time, const vector<String>& arguments);
-       static void ScheduleHostDowntime(double time, const vector<String>& arguments);
-       static void DelHostDowntime(double time, const vector<String>& arguments);
-       static void ScheduleHostSvcDowntime(double time, const vector<String>& arguments);
-       static void ScheduleHostgroupHostDowntime(double time, const vector<String>& arguments);
-       static void ScheduleHostgroupSvcDowntime(double time, const vector<String>& arguments);
-       static void ScheduleServicegroupHostDowntime(double time, const vector<String>& arguments);
-       static void ScheduleServicegroupSvcDowntime(double time, const vector<String>& arguments);
-       static void AddHostComment(double time, const vector<String>& arguments);
-       static void DelHostComment(double time, const vector<String>& arguments);
-       static void AddSvcComment(double time, const vector<String>& arguments);
-       static void DelSvcComment(double time, const vector<String>& arguments);
-       static void DelAllHostComments(double time, const vector<String>& arguments);
-       static void DelAllSvcComments(double time, const vector<String>& arguments);
-       static void SendCustomHostNotification(double time, const vector<String>& arguments);
-       static void SendCustomSvcNotification(double time, const vector<String>& arguments);
-       static void DelayHostNotification(double time, const vector<String>& arguments);
-       static void DelaySvcNotification(double time, const vector<String>& arguments);
-       static void EnableHostNotifications(double time, const vector<String>& arguments);
-       static void DisableHostNotifications(double time, const vector<String>& arguments);
-       static void EnableSvcNotifications(double time, const vector<String>& arguments);
-       static void DisableSvcNotifications(double time, const vector<String>& arguments);
+       static void ProcessHostCheckResult(double time, const std::vector<String>& arguments);
+       static void ProcessServiceCheckResult(double time, const std::vector<String>& arguments);
+       static void ScheduleHostCheck(double time, const std::vector<String>& arguments);
+       static void ScheduleForcedHostCheck(double time, const std::vector<String>& arguments);
+       static void ScheduleSvcCheck(double time, const std::vector<String>& arguments);
+       static void ScheduleForcedSvcCheck(double time, const std::vector<String>& arguments);
+       static void EnableHostCheck(double time, const std::vector<String>& arguments);
+       static void DisableHostCheck(double time, const std::vector<String>& arguments);
+       static void EnableSvcCheck(double time, const std::vector<String>& arguments);
+       static void DisableSvcCheck(double time, const std::vector<String>& arguments);
+       static void ShutdownProcess(double time, const std::vector<String>& arguments);
+       static void ScheduleForcedHostSvcChecks(double time, const std::vector<String>& arguments);
+       static void ScheduleHostSvcChecks(double time, const std::vector<String>& arguments);
+       static void EnableHostSvcChecks(double time, const std::vector<String>& arguments);
+       static void DisableHostSvcChecks(double time, const std::vector<String>& arguments);
+       static void AcknowledgeSvcProblem(double time, const std::vector<String>& arguments);
+       static void AcknowledgeSvcProblemExpire(double time, const std::vector<String>& arguments);
+       static void RemoveSvcAcknowledgement(double time, const std::vector<String>& arguments);
+       static void AcknowledgeHostProblem(double time, const std::vector<String>& arguments);
+       static void AcknowledgeHostProblemExpire(double time, const std::vector<String>& arguments);
+       static void RemoveHostAcknowledgement(double time, const std::vector<String>& arguments);
+       static void EnableHostgroupSvcChecks(double time, const std::vector<String>& arguments);
+       static void DisableHostgroupSvcChecks(double time, const std::vector<String>& arguments);
+       static void EnableServicegroupSvcChecks(double time, const std::vector<String>& arguments);
+       static void DisableServicegroupSvcChecks(double time, const std::vector<String>& arguments);
+       static void EnablePassiveHostChecks(double time, const std::vector<String>& arguments);
+       static void DisablePassiveHostChecks(double time, const std::vector<String>& arguments);
+       static void EnablePassiveSvcChecks(double time, const std::vector<String>& arguments);
+       static void DisablePassiveSvcChecks(double time, const std::vector<String>& arguments);
+       static void EnableServicegroupPassiveSvcChecks(double time, const std::vector<String>& arguments);
+       static void DisableServicegroupPassiveSvcChecks(double time, const std::vector<String>& arguments);
+       static void EnableHostgroupPassiveSvcChecks(double time, const std::vector<String>& arguments);
+       static void DisableHostgroupPassiveSvcChecks(double time, const std::vector<String>& arguments);
+       static void ProcessFile(double time, const std::vector<String>& arguments);
+       static void ScheduleSvcDowntime(double time, const std::vector<String>& arguments);
+       static void DelSvcDowntime(double time, const std::vector<String>& arguments);
+       static void ScheduleHostDowntime(double time, const std::vector<String>& arguments);
+       static void DelHostDowntime(double time, const std::vector<String>& arguments);
+       static void ScheduleHostSvcDowntime(double time, const std::vector<String>& arguments);
+       static void ScheduleHostgroupHostDowntime(double time, const std::vector<String>& arguments);
+       static void ScheduleHostgroupSvcDowntime(double time, const std::vector<String>& arguments);
+       static void ScheduleServicegroupHostDowntime(double time, const std::vector<String>& arguments);
+       static void ScheduleServicegroupSvcDowntime(double time, const std::vector<String>& arguments);
+       static void AddHostComment(double time, const std::vector<String>& arguments);
+       static void DelHostComment(double time, const std::vector<String>& arguments);
+       static void AddSvcComment(double time, const std::vector<String>& arguments);
+       static void DelSvcComment(double time, const std::vector<String>& arguments);
+       static void DelAllHostComments(double time, const std::vector<String>& arguments);
+       static void DelAllSvcComments(double time, const std::vector<String>& arguments);
+       static void SendCustomHostNotification(double time, const std::vector<String>& arguments);
+       static void SendCustomSvcNotification(double time, const std::vector<String>& arguments);
+       static void DelayHostNotification(double time, const std::vector<String>& arguments);
+       static void DelaySvcNotification(double time, const std::vector<String>& arguments);
+       static void EnableHostNotifications(double time, const std::vector<String>& arguments);
+       static void DisableHostNotifications(double time, const std::vector<String>& arguments);
+       static void EnableSvcNotifications(double time, const std::vector<String>& arguments);
+       static void DisableSvcNotifications(double time, const std::vector<String>& arguments);
 };
 
 }
index 5b9ef6f41b7ca26bd6d27a8fe40a932d4926e458..7d4be7238a2fd9a04a9df5705188895357d2a5dc 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
 #include <boost/tuple/tuple.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
 boost::mutex Host::m_ServiceMutex;
-map<String, map<String, Service::WeakPtr> > Host::m_ServicesCache;
+std::map<String, std::map<String, Service::WeakPtr> > Host::m_ServicesCache;
 bool Host::m_ServicesCacheNeedsUpdate = false;
 Timer::Ptr Host::m_ServicesCacheTimer;
 
@@ -112,7 +117,7 @@ bool Host::IsReachable(void) const
 {
        ASSERT(!OwnsLock());
 
-       set<Service::Ptr> parentServices = GetParentServices();
+       std::set<Service::Ptr> parentServices = GetParentServices();
 
        BOOST_FOREACH(const Service::Ptr& service, parentServices) {
                ObjectLock olock(service);
@@ -133,7 +138,7 @@ bool Host::IsReachable(void) const
                return false;
        }
 
-       set<Host::Ptr> parentHosts = GetParentHosts();
+       std::set<Host::Ptr> parentHosts = GetParentHosts();
 
        BOOST_FOREACH(const Host::Ptr& host, parentHosts) {
                Service::Ptr hc = host->GetHostCheckService();
@@ -230,7 +235,7 @@ void Host::UpdateSlaveServices(void)
                        if (svcdesc.IsScalar())
                                svcname = svcdesc;
 
-                       stringstream namebuf;
+                       std::ostringstream namebuf;
                        namebuf << GetName() << "-" << svcname;
                        String name = namebuf.str();
 
@@ -244,7 +249,7 @@ void Host::UpdateSlaveServices(void)
                        CopyServiceAttributes<false>(this, builder);
 
                        if (!svcdesc.IsObjectType<Dictionary>())
-                               BOOST_THROW_EXCEPTION(invalid_argument("Service description must be either a string or a dictionary."));
+                               BOOST_THROW_EXCEPTION(std::invalid_argument("Service description must be either a string or a dictionary."));
 
                        Dictionary::Ptr service = svcdesc;
 
@@ -300,9 +305,9 @@ void Host::OnAttributeChanged(const String& name)
        }
 }
 
-set<Service::Ptr> Host::GetServices(void) const
+std::set<Service::Ptr> Host::GetServices(void) const
 {
-       set<Service::Ptr> services;
+       std::set<Service::Ptr> services;
 
        boost::mutex::scoped_lock lock(m_ServiceMutex);
 
@@ -349,9 +354,9 @@ void Host::RefreshServicesCache(void)
                m_ServicesCacheNeedsUpdate = false;
        }
 
-       Logger::Write(LogDebug, "icinga", "Updating Host services cache.");
+       Log(LogDebug, "icinga", "Updating Host services cache.");
 
-       map<String, map<String, Service::WeakPtr> > newServicesCache;
+       std::map<String, std::map<String, Service::WeakPtr> > newServicesCache;
 
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
                const Service::Ptr& service = static_pointer_cast<Service>(object);
@@ -370,13 +375,13 @@ void Host::RefreshServicesCache(void)
        m_ServicesCache.swap(newServicesCache);
 }
 
-void Host::ValidateServiceDictionary(const ScriptTask::Ptr& task, const vector<Value>& arguments)
+void Host::ValidateServiceDictionary(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Location must be specified."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Missing argument: Location must be specified."));
 
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Attribute dictionary must be specified."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Missing argument: Attribute dictionary must be specified."));
 
        String location = arguments[0];
        Dictionary::Ptr attrs = arguments[1];
@@ -385,10 +390,10 @@ void Host::ValidateServiceDictionary(const ScriptTask::Ptr& task, const vector<V
        String key;
        Value value;
        BOOST_FOREACH(boost::tie(key, value), attrs) {
-               vector<String> templates;
+               std::vector<String> templates;
 
                if (!value.IsObjectType<Dictionary>())
-                       BOOST_THROW_EXCEPTION(invalid_argument("Service description must be a dictionary."));
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("Service description must be a dictionary."));
 
                Dictionary::Ptr serviceDesc = value;
 
@@ -431,8 +436,8 @@ Service::Ptr Host::GetServiceByShortName(const Value& name) const
                {
                        boost::mutex::scoped_lock lock(m_ServiceMutex);
 
-                       map<String, Service::WeakPtr>& services = m_ServicesCache[GetName()];
-                       map<String, Service::WeakPtr>::iterator it = services.find(name);
+                       std::map<String, Service::WeakPtr>& services = m_ServicesCache[GetName()];
+                       std::map<String, Service::WeakPtr>::iterator it = services.find(name);
 
                        if (it != services.end()) {
                                Service::Ptr service = it->second.lock();
@@ -450,13 +455,13 @@ Service::Ptr Host::GetServiceByShortName(const Value& name) const
 
                return Service::GetByNamePair(dict->Get("host"), dict->Get("service"));
        } else {
-               BOOST_THROW_EXCEPTION(invalid_argument("Host/Service name pair is invalid."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Host/Service name pair is invalid."));
        }
 }
 
-set<Host::Ptr> Host::GetParentHosts(void) const
+std::set<Host::Ptr> Host::GetParentHosts(void) const
 {
-       set<Host::Ptr> parents;
+       std::set<Host::Ptr> parents;
 
        Array::Ptr dependencies = GetHostDependencies();
 
@@ -489,9 +494,9 @@ Service::Ptr Host::GetHostCheckService(void) const
        return GetServiceByShortName(host_check);
 }
 
-set<Service::Ptr> Host::GetParentServices(void) const
+std::set<Service::Ptr> Host::GetParentServices(void) const
 {
-       set<Service::Ptr> parents;
+       std::set<Service::Ptr> parents;
 
        Array::Ptr dependencies = GetServiceDependencies();
 
index f573b319080bfd8a7a0ab4409fd99242fa9fe24e..e91d665b3e5c6cfa993d08af568e7ff9b7f00c02 100644 (file)
@@ -75,14 +75,14 @@ public:
        Dictionary::Ptr CalculateDynamicMacros(void) const;
 
        shared_ptr<Service> GetHostCheckService(void) const;
-       set<Host::Ptr> GetParentHosts(void) const;
-       set<shared_ptr<Service> > GetParentServices(void) const;
+       std::set<Host::Ptr> GetParentHosts(void) const;
+       std::set<shared_ptr<Service> > GetParentServices(void) const;
 
        bool IsReachable() const;
 
        shared_ptr<Service> GetServiceByShortName(const Value& name) const;
 
-       set<shared_ptr<Service> > GetServices(void) const;
+       std::set<shared_ptr<Service> > GetServices(void) const;
        static void InvalidateServicesCache(void);
 
        static void ValidateServiceDictionary(const ScriptTask::Ptr& task,
@@ -110,7 +110,7 @@ private:
        Dictionary::Ptr m_SlaveServices;
 
        static boost::mutex m_ServiceMutex;
-       static map<String, map<String, weak_ptr<Service> > > m_ServicesCache;
+       static std::map<String, std::map<String, weak_ptr<Service> > > m_ServicesCache;
        static bool m_ServicesCacheNeedsUpdate;
        static Timer::Ptr m_ServicesCacheTimer;
 
index 3ed2141f8440d5dc6f316b8858612ea6593e6958..2dccfe20a6323cfb66d425809308d0a7c6a53915 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "base/dynamictype.h"
+#include "base/logger_fwd.h"
+#include "base/objectlock.h"
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
 boost::mutex HostGroup::m_Mutex;
-map<String, vector<Host::WeakPtr> > HostGroup::m_MembersCache;
+std::map<String, std::vector<Host::WeakPtr> > HostGroup::m_MembersCache;
 bool HostGroup::m_MembersCacheNeedsUpdate = false;
 Timer::Ptr HostGroup::m_MembersCacheTimer;
 
@@ -86,7 +91,7 @@ HostGroup::Ptr HostGroup::GetByName(const String& name)
        DynamicObject::Ptr configObject = DynamicObject::GetObject("HostGroup", name);
 
        if (!configObject)
-               BOOST_THROW_EXCEPTION(invalid_argument("HostGroup '" + name + "' does not exist."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("HostGroup '" + name + "' does not exist."));
 
        return dynamic_pointer_cast<HostGroup>(configObject);
 }
@@ -94,9 +99,9 @@ HostGroup::Ptr HostGroup::GetByName(const String& name)
 /**
  * @threadsafety Always.
  */
-set<Host::Ptr> HostGroup::GetMembers(void) const
+std::set<Host::Ptr> HostGroup::GetMembers(void) const
 {
-       set<Host::Ptr> hosts;
+       std::set<Host::Ptr> hosts;
 
        {
                boost::mutex::scoped_lock lock(m_Mutex);
@@ -148,9 +153,9 @@ void HostGroup::RefreshMembersCache(void)
                m_MembersCacheNeedsUpdate = false;
        }
 
-       Logger::Write(LogDebug, "icinga", "Updating HostGroup members cache.");
+       Log(LogDebug, "icinga", "Updating HostGroup members cache.");
 
-       map<String, vector<Host::WeakPtr> > newMembersCache;
+       std::map<String, std::vector<Host::WeakPtr> > newMembersCache;
 
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Host")) {
                const Host::Ptr& host = static_pointer_cast<Host>(object);
index dd4480019bb7898a16b64ad141eac40cb939bf1f..5ec1681cf230aaefe396d3c67a88ede7dd85bcb5 100644 (file)
@@ -43,7 +43,7 @@ public:
        String GetNotesUrl(void) const;
        String GetActionUrl(void) const;
 
-       set<Host::Ptr> GetMembers(void) const;
+       std::set<Host::Ptr> GetMembers(void) const;
 
        static void InvalidateMembersCache(void);
 
@@ -56,7 +56,7 @@ private:
        Attribute<String> m_ActionUrl;
 
        static boost::mutex m_Mutex;
-       static map<String, vector<Host::WeakPtr> > m_MembersCache;
+       static std::map<String, std::vector<Host::WeakPtr> > m_MembersCache;
        static bool m_MembersCacheNeedsUpdate;
        static Timer::Ptr m_MembersCacheTimer;
 
index 3a2010f11404aaa4a32516769daa15906d80445c..1b9d734ffead39cc304b905ab6bf1a02c82de730 100644 (file)
@@ -27,9 +27,9 @@
  * common to all components (e.g. hosts, services, etc.).
  */
 
-#include <i2-base.h>
-#include <i2-config.h>
-#include <i2-remoting.h>
+#include "base/i2-base.h"
+#include "config/i2-config.h"
+#include "remoting/i2-remoting.h"
 
 #ifdef I2_ICINGA_BUILD
 #      define I2_ICINGA_API I2_EXPORT
index ae504f6a7c7bf18ff4b51c963483521a8caf5d41..9ab690a76911fc6a24d2371877a9c829eee4d9b3 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "base/dynamictype.h"
+#include "base/logger_fwd.h"
+#include "base/objectlock.h"
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 
@@ -47,7 +51,7 @@ IcingaApplication::IcingaApplication(const Dictionary::Ptr& serializedUpdate)
  */
 int IcingaApplication::Main(void)
 {
-       Logger::Write(LogDebug, "icinga", "In IcingaApplication::Main()");
+       Log(LogDebug, "icinga", "In IcingaApplication::Main()");
 
        m_StartTime = Utility::GetTime();
 
@@ -57,7 +61,7 @@ int IcingaApplication::Main(void)
                /* set up SSL context */
                shared_ptr<X509> cert = Utility::GetX509Certificate(GetCertificateFile());
                String identity = Utility::GetCertificateCN(cert);
-               Logger::Write(LogInformation, "icinga", "My identity: " + identity);
+               Log(LogInformation, "icinga", "My identity: " + identity);
                EndpointManager::GetInstance()->SetIdentity(identity);
 
                m_SSLContext = Utility::MakeSSLContext(GetCertificateFile(), GetCertificateFile(), GetCAFile());
@@ -80,7 +84,7 @@ int IcingaApplication::Main(void)
 
        RunEventLoop();
 
-       Logger::Write(LogInformation, "icinga", "Icinga has shut down.");
+       Log(LogInformation, "icinga", "Icinga has shut down.");
 
        return EXIT_SUCCESS;
 }
index 78c4dc805504a7f5f4b248cbef6ca22e545bb664..cb25260d67724afe8d6a70a1833b8521b7e7b841 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef ICINGAAPPLICATION_H
 #define ICINGAAPPLICATION_H
 
+#include "base/application.h"
+
 namespace icinga
 {
 
index 66b2941817876444d48aea2d57580f33bee9f413..5b5a28bd9104c50b82c111c40e3410db1c328ee1 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "base/objectlock.h"
 #include <boost/tuple/tuple.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -45,7 +48,7 @@ Value MacroProcessor::ResolveMacros(const Value& cmd, const Dictionary::Ptr& mac
 
                result = resultArr;
        } else {
-               BOOST_THROW_EXCEPTION(invalid_argument("Command is not a string or array."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Command is not a string or array."));
        }
 
        return result;
@@ -64,12 +67,12 @@ String MacroProcessor::InternalResolveMacros(const String& str, const Dictionary
                pos_second = result.FindFirstOf("$", pos_first + 1);
 
                if (pos_second == String::NPos)
-                       BOOST_THROW_EXCEPTION(runtime_error("Closing $ not found in macro format string."));
+                       BOOST_THROW_EXCEPTION(std::runtime_error("Closing $ not found in macro format string."));
 
                String name = result.SubStr(pos_first + 1, pos_second - pos_first - 1);
 
                if (!macros || !macros->Contains(name))
-                       BOOST_THROW_EXCEPTION(runtime_error("Macro '" + name + "' is not defined."));
+                       BOOST_THROW_EXCEPTION(std::runtime_error("Macro '" + name + "' is not defined."));
 
                String value = macros->Get(name);
                result.Replace(pos_first, pos_second - pos_first + 1, value);
@@ -82,7 +85,7 @@ String MacroProcessor::InternalResolveMacros(const String& str, const Dictionary
 /**
  * @threadsafety Always.
  */
-Dictionary::Ptr MacroProcessor::MergeMacroDicts(const vector<Dictionary::Ptr>& dicts)
+Dictionary::Ptr MacroProcessor::MergeMacroDicts(const std::vector<Dictionary::Ptr>& dicts)
 {
        Dictionary::Ptr result = boost::make_shared<Dictionary>();
 
index e25042eaf293e5189a10358807afaaf0dc6f418a..bad3136c644393aa58a5b0f148afa7e8305638c6 100644 (file)
@@ -32,7 +32,7 @@ class I2_ICINGA_API MacroProcessor
 {
 public:
        static Value ResolveMacros(const Value& str, const Dictionary::Ptr& macros);
-       static Dictionary::Ptr MergeMacroDicts(const vector<Dictionary::Ptr>& macroDicts);
+       static Dictionary::Ptr MergeMacroDicts(const std::vector<Dictionary::Ptr>& macroDicts);
 
 private:
        MacroProcessor(void);
index c02ff98527b8b4c6c498eb941319caea66c43d77..816d8ede6ec8f5f7fe4de5ba0128f40231dc46fd 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
 #include <boost/tuple/tuple.hpp>
+#include <boost/foreach.hpp>
+#include <boost/exception/diagnostic_information.hpp>
 
 using namespace icinga;
 
@@ -85,9 +90,9 @@ Dictionary::Ptr Notification::GetMacros(void) const
 /**
  * @threadsafety Always.
  */
-set<User::Ptr> Notification::GetUsers(void) const
+std::set<User::Ptr> Notification::GetUsers(void) const
 {
-       set<User::Ptr> result;
+       std::set<User::Ptr> result;
 
        Array::Ptr users = m_Users;
 
@@ -110,9 +115,9 @@ set<User::Ptr> Notification::GetUsers(void) const
 /**
  * @threadsafety Always.
  */
-set<UserGroup::Ptr> Notification::GetGroups(void) const
+std::set<UserGroup::Ptr> Notification::GetGroups(void) const
 {
-       set<UserGroup::Ptr> result;
+       std::set<UserGroup::Ptr> result;
 
        Array::Ptr groups = m_Groups;
 
@@ -166,18 +171,18 @@ void Notification::BeginExecuteNotification(NotificationType type, const Diction
 
        Dictionary::Ptr macros = cr->Get("macros");
 
-       set<User::Ptr> allUsers;
+       std::set<User::Ptr> allUsers;
 
-       set<User::Ptr> users = GetUsers();
+       std::set<User::Ptr> users = GetUsers();
        std::copy(users.begin(), users.end(), std::inserter(allUsers, allUsers.begin()));
 
        BOOST_FOREACH(const UserGroup::Ptr& ug, GetGroups()) {
-               set<User::Ptr> members = ug->GetMembers();
+               std::set<User::Ptr> members = ug->GetMembers();
                std::copy(members.begin(), members.end(), std::inserter(allUsers, allUsers.begin()));
        }
 
        BOOST_FOREACH(const User::Ptr& user, allUsers) {
-               Logger::Write(LogDebug, "icinga", "Sending notification for user " + user->GetName());
+               Log(LogDebug, "icinga", "Sending notification for user " + user->GetName());
                BeginExecuteNotificationHelper(macros, type, user);
        }
 
@@ -194,7 +199,7 @@ void Notification::BeginExecuteNotificationHelper(const Dictionary::Ptr& notific
 {
        ASSERT(!OwnsLock());
 
-       vector<Dictionary::Ptr> macroDicts;
+       std::vector<Dictionary::Ptr> macroDicts;
 
        if (user) {
                macroDicts.push_back(user->GetMacros());
@@ -207,7 +212,7 @@ void Notification::BeginExecuteNotificationHelper(const Dictionary::Ptr& notific
 
        Notification::Ptr self = GetSelf();
 
-       vector<Value> arguments;
+       std::vector<Value> arguments;
        arguments.push_back(self);
        arguments.push_back(macros);
        arguments.push_back(type);
@@ -215,7 +220,7 @@ void Notification::BeginExecuteNotificationHelper(const Dictionary::Ptr& notific
        ScriptTask::Ptr task = MakeMethodTask("notify", arguments);
 
        if (!task) {
-               Logger::Write(LogWarning, "icinga", "Notification object '" + GetName() + "' doesn't have a 'notify' method.");
+               Log(LogWarning, "icinga", "Notification object '" + GetName() + "' doesn't have a 'notify' method.");
 
                return;
        }
@@ -246,14 +251,14 @@ void Notification::NotificationCompletedHandler(const ScriptTask::Ptr& task)
        try {
                task->GetResult();
 
-               Logger::Write(LogInformation, "icinga", "Completed sending notification for service '" + GetService()->GetName() + "'");
-       } catch (const exception& ex) {
-               stringstream msgbuf;
+               Log(LogInformation, "icinga", "Completed sending notification for service '" + GetService()->GetName() + "'");
+       } catch (const std::exception& ex) {
+               std::ostringstream msgbuf;
                msgbuf << "Exception occured during notification for service '"
-                      << GetService()->GetName() << "': " << diagnostic_information(ex);
+                      << GetService()->GetName() << "': " << boost::diagnostic_information(ex);
                String message = msgbuf.str();
 
-               Logger::Write(LogWarning, "icinga", message);
+               Log(LogWarning, "icinga", message);
        }
 }
 
index a02f71802db101caa8e0bb494c9b59105215fc2b..8eb616ade77ffd1567b71a8dfd4f7f8d315cb93d 100644 (file)
@@ -60,8 +60,8 @@ public:
        shared_ptr<Service> GetService(void) const;
        Value GetNotificationCommand(void) const;
        Dictionary::Ptr GetMacros(void) const;
-       set<User::Ptr> GetUsers(void) const;
-       set<UserGroup::Ptr> GetGroups(void) const;
+       std::set<User::Ptr> GetUsers(void) const;
+       std::set<UserGroup::Ptr> GetGroups(void) const;
 
        void BeginExecuteNotification(NotificationType type, const Dictionary::Ptr& cr);
 
@@ -78,7 +78,7 @@ private:
        Attribute<String> m_HostName;
        Attribute<String> m_Service;
 
-       set<ScriptTask::Ptr> m_Tasks;
+       std::set<ScriptTask::Ptr> m_Tasks;
 
        void NotificationCompletedHandler(const ScriptTask::Ptr& task);
 
index f413ba896b1ff97b845816258f62f20f2f97cf90..eddf62abc511bc8414642e2709f5573380470cdd 100644 (file)
@@ -18,6 +18,7 @@
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 
@@ -26,10 +27,10 @@ REGISTER_SCRIPTFUNCTION(NullCheck,  &NullCheckTask::ScriptFunc);
 /**
  * @threadsafety Always.
  */
-void NullCheckTask::ScriptFunc(const ScriptTask::Ptr& task, const vector<Value>& arguments)
+void NullCheckTask::ScriptFunc(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Service must be specified."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Missing argument: Service must be specified."));
 
        Dictionary::Ptr cr = boost::make_shared<Dictionary>();
        cr->Set("state", StateUnknown);
index 18c6cc1906fd06f8da2d05786e1cdd7115fd4149..e748e92d607367651034807cae06b38a73f92b3c 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef NULLCHECKTASK_H
 #define NULLCHECKTASK_H
 
+#include "base/scripttask.h"
+
 namespace icinga
 {
 
@@ -31,7 +33,7 @@ namespace icinga
 class I2_ICINGA_API NullCheckTask
 {
 public:
-       static void ScriptFunc(const ScriptTask::Ptr& task, const vector<Value>& arguments);
+       static void ScriptFunc(const ScriptTask::Ptr& task, const std::vector<Value>& arguments);
 
 private:
        NullCheckTask(void);
index 8ce2c7d3edffb05fb32d705223df322da8bdfb64..571f11f6fbbed2c3a4961b0fbcd0f413f5840e0e 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include "base/convert.h"
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 
@@ -162,7 +167,7 @@ void PerfdataWriter::RotateFile(void)
        m_OutputFile.open(tempFile.CStr());
 
        if (!m_OutputFile.good())
-               Logger::Write(LogWarning, "icinga", "Could not open perfdata file '" + tempFile + "' for writing. Perfdata will be lost.");
+               Log(LogWarning, "icinga", "Could not open perfdata file '" + tempFile + "' for writing. Perfdata will be lost.");
 }
 
 /**
index 17eb257d03ba9fea10c57a49382c1415c43d00c7..af37c2275ef476ccef32449ae412621d730e33ee 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef PERFDATAWRITER_H
 #define PERFDATAWRITER_H
 
+#include "base/dynamicobject.h"
+#include <fstream>
+
 namespace icinga
 {
 
@@ -58,7 +61,7 @@ private:
        Timer::Ptr m_RotationTimer;
        void RotationTimerHandler(void);
 
-       ofstream m_OutputFile;
+       std::ofstream m_OutputFile;
        void RotateFile(void);
 };
 
index e46d5ac419d5007543f8219bca45ee4046f3835d..5c17dbe5974bb0ec960bdd90ca42e69eaa465284 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "i2-icinga.h"
 #include <boost/algorithm/string/classification.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -31,13 +33,13 @@ PluginCheckTask::PluginCheckTask(const ScriptTask::Ptr& task, const Process::Ptr
 /**
  * @threadsafety Always.
  */
-void PluginCheckTask::ScriptFunc(const ScriptTask::Ptr& task, const vector<Value>& arguments)
+void PluginCheckTask::ScriptFunc(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Service must be specified."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Missing argument: Service must be specified."));
 
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Macros must be specified."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Missing argument: Macros must be specified."));
 
        Service::Ptr service = arguments[0];
        Dictionary::Ptr macros = arguments[1];
@@ -105,7 +107,7 @@ Dictionary::Ptr PluginCheckTask::ParseCheckOutput(const String& output)
        String text;
        String perfdata;
 
-       vector<String> lines = output.Split(boost::is_any_of("\r\n"));
+       std::vector<String> lines = output.Split(boost::is_any_of("\r\n"));
 
        BOOST_FOREACH (const String& line, lines) {
                size_t delim = line.FindFirstOf("|");
index ddbd35a4e603b634cc924c13bfd8b11b3736e12c..71cdcf62148e4e777f01aa8672455fb424fb65ff 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef PLUGINCHECKTASK_H
 #define PLUGINCHECKTASK_H
 
+#include "base/scripttask.h"
+#include "base/process.h"
+
 namespace icinga
 {
 
@@ -31,7 +34,7 @@ namespace icinga
 class I2_ICINGA_API PluginCheckTask
 {
 public:
-       static void ScriptFunc(const ScriptTask::Ptr& task, const vector<Value>& arguments);
+       static void ScriptFunc(const ScriptTask::Ptr& task, const std::vector<Value>& arguments);
 
        static ServiceState ExitStatusToState(int exitStatus);
        static Dictionary::Ptr ParseCheckOutput(const String& output);
index 74d1f7e6ced0672217b6a2867e7b096eb390d711..975d861365c17fa8a443907e0670d03fc05c744b 100644 (file)
@@ -18,6 +18,8 @@
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "base/logger_fwd.h"
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 
@@ -31,16 +33,16 @@ PluginNotificationTask::PluginNotificationTask(const ScriptTask::Ptr& task, cons
 /**
  * @threadsafety Always.
  */
-void PluginNotificationTask::ScriptFunc(const ScriptTask::Ptr& task, const vector<Value>& arguments)
+void PluginNotificationTask::ScriptFunc(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
 {
        if (arguments.size() < 1)
-               BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Notification target must be specified."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Missing argument: Notification target must be specified."));
 
        if (arguments.size() < 2)
-               BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Macros must be specified."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Missing argument: Macros must be specified."));
 
        if (arguments.size() < 3)
-               BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Notification type must be specified."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Missing argument: Notification type must be specified."));
 
        Notification::Ptr notification = arguments[0];
        Dictionary::Ptr macros = arguments[1];
@@ -74,11 +76,11 @@ void PluginNotificationTask::ProcessFinishedHandler(PluginNotificationTask ct)
                pr = ct.m_Process->GetResult();
 
                if (pr.ExitStatus != 0) {
-                       stringstream msgbuf;
+                       std::ostringstream msgbuf;
                        msgbuf << "Notification command '" << ct.m_Command << "' for service '"
                               << ct.m_ServiceName << "' failed; exit status: "
                               << pr.ExitStatus << ", output: " << pr.Output;
-                       Logger::Write(LogWarning, "icinga", msgbuf.str());
+                       Log(LogWarning, "icinga", msgbuf.str());
                }
 
                ct.m_Task->FinishResult(Empty);
index f418c71b411a75cf35875a10dc96519e9aaafa1c..c9a55f299b67f22fe1a6f807420af81c16e094f8 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef PLUGINNOTIFICATIONTASK_H
 #define PLUGINNOTIFICATIONTASK_H
 
+#include "base/scripttask.h"
+#include "base/process.h"
+
 namespace icinga
 {
 
@@ -31,7 +34,7 @@ namespace icinga
 class I2_ICINGA_API PluginNotificationTask
 {
 public:
-       static void ScriptFunc(const ScriptTask::Ptr& task, const vector<Value>& arguments);
+       static void ScriptFunc(const ScriptTask::Ptr& task, const std::vector<Value>& arguments);
 
 private:
        static void ProcessFinishedHandler(PluginNotificationTask ct);
index 444f179c3fb6bcf04e5947441153b5a11c3364cd..330655cf673adc941a3cada9a3aff535fa204fb5 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "icinga/service.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
+#include <boost/exception/diagnostic_information.hpp>
 
 using namespace icinga;
 
@@ -25,8 +32,8 @@ const int Service::DefaultMaxCheckAttempts = 3;
 const double Service::DefaultCheckInterval = 5 * 60;
 const double Service::CheckIntervalDivisor = 5.0;
 
-signals2::signal<void (const Service::Ptr&)> Service::OnCheckerChanged;
-signals2::signal<void (const Service::Ptr&)> Service::OnNextCheckChanged;
+boost::signals2::signal<void (const Service::Ptr&)> Service::OnCheckerChanged;
+boost::signals2::signal<void (const Service::Ptr&)> Service::OnNextCheckChanged;
 
 /**
  * @threadsafety Always.
@@ -611,7 +618,7 @@ void Service::BeginExecuteCheck(const boost::function<void (void)>& callback)
 
        Service::Ptr self = GetSelf();
 
-       vector<Value> arguments;
+       std::vector<Value> arguments;
        arguments.push_back(self);
        arguments.push_back(macros);
 
@@ -644,13 +651,13 @@ void Service::CheckCompletedHandler(const Dictionary::Ptr& checkInfo,
 
                if (vresult.IsObjectType<Dictionary>())
                        result = vresult;
-       } catch (const exception& ex) {
-               stringstream msgbuf;
+       } catch (const std::exception& ex) {
+               std::ostringstream msgbuf;
                msgbuf << "Exception occured during check for service '"
-                      << GetName() << "': " << diagnostic_information(ex);
+                      << GetName() << "': " << boost::diagnostic_information(ex);
                String message = msgbuf.str();
 
-               Logger::Write(LogWarning, "icinga", message);
+               Log(LogWarning, "icinga", message);
 
                result = boost::make_shared<Dictionary>();
                result->Set("state", StateUnknown);
index 3844c96359ba4f4c963e7b57408096cc4bcebf9c..e2e777eaf6e8f201852eb4bd3b68dc5995a7f4f6 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "icinga/service.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
 int Service::m_NextCommentID = 1;
 boost::mutex Service::m_CommentMutex;
-map<int, String> Service::m_LegacyCommentsCache;
-map<String, Service::WeakPtr> Service::m_CommentsCache;
+std::map<int, String> Service::m_LegacyCommentsCache;
+std::map<String, Service::WeakPtr> Service::m_CommentsCache;
 bool Service::m_CommentsCacheNeedsUpdate = false;
 Timer::Ptr Service::m_CommentsCacheTimer;
 Timer::Ptr Service::m_CommentsExpireTimer;
@@ -124,7 +130,7 @@ String Service::GetCommentIDFromLegacyID(int id)
 {
        boost::mutex::scoped_lock lock(m_CommentMutex);
 
-       map<int, String>::iterator it = m_LegacyCommentsCache.find(id);
+       std::map<int, String>::iterator it = m_LegacyCommentsCache.find(id);
 
        if (it == m_LegacyCommentsCache.end())
                return Empty;
@@ -204,10 +210,10 @@ void Service::RefreshCommentsCache(void)
                m_CommentsCacheNeedsUpdate = false;
        }
 
-       Logger::Write(LogDebug, "icinga", "Updating Service comments cache.");
+       Log(LogDebug, "icinga", "Updating Service comments cache.");
 
-       map<int, String> newLegacyCommentsCache;
-       map<String, Service::WeakPtr> newCommentsCache;
+       std::map<int, String> newLegacyCommentsCache;
+       std::map<String, Service::WeakPtr> newCommentsCache;
 
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
                Service::Ptr service = dynamic_pointer_cast<Service>(object);
@@ -264,7 +270,7 @@ void Service::RemoveExpiredComments(void)
        if (!comments)
                return;
 
-       vector<String> expiredComments;
+       std::vector<String> expiredComments;
 
        {
                ObjectLock olock(comments);
index d04176f74f77349f0520419bc5686e38554bda7c..fdba26daea095b1769c0748f4ea1741ca06e5216 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "icinga/service.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
 #include <boost/tuple/tuple.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
 int Service::m_NextDowntimeID = 1;
 boost::mutex Service::m_DowntimeMutex;
-map<int, String> Service::m_LegacyDowntimesCache;
-map<String, Service::WeakPtr> Service::m_DowntimesCache;
+std::map<int, String> Service::m_LegacyDowntimesCache;
+std::map<String, Service::WeakPtr> Service::m_DowntimesCache;
 bool Service::m_DowntimesCacheNeedsUpdate = false;
 Timer::Ptr Service::m_DowntimesCacheTimer;
 Timer::Ptr Service::m_DowntimesExpireTimer;
@@ -180,7 +186,7 @@ String Service::GetDowntimeIDFromLegacyID(int id)
 {
        boost::mutex::scoped_lock lock(m_DowntimeMutex);
 
-       map<int, String>::iterator it = m_LegacyDowntimesCache.find(id);
+       std::map<int, String>::iterator it = m_LegacyDowntimesCache.find(id);
 
        if (it == m_LegacyDowntimesCache.end())
                return Empty;
@@ -279,10 +285,10 @@ void Service::RefreshDowntimesCache(void)
                m_DowntimesCacheNeedsUpdate = false;
        }
 
-       Logger::Write(LogDebug, "icinga", "Updating Service downtimes cache.");
+       Log(LogDebug, "icinga", "Updating Service downtimes cache.");
 
-       map<int, String> newLegacyDowntimesCache;
-       map<String, Service::WeakPtr> newDowntimesCache;
+       std::map<int, String> newLegacyDowntimesCache;
+       std::map<String, Service::WeakPtr> newDowntimesCache;
 
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
                Service::Ptr service = dynamic_pointer_cast<Service>(object);
@@ -338,7 +344,7 @@ void Service::RemoveExpiredDowntimes(void)
        if (!downtimes)
                return;
 
-       vector<String> expiredDowntimes;
+       std::vector<String> expiredDowntimes;
 
        {
                ObjectLock olock(downtimes);
index 17795bd72c46855f98e68bebc8fa49e2dec807b8..bad86a97b240d533699e2730bc46ebb0fe9bb33c 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "icinga/service.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
 #include <boost/tuple/tuple.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
+#include <boost/exception/diagnostic_information.hpp>
 
 using namespace icinga;
 
 boost::mutex Service::m_NotificationMutex;
-map<String, set<Notification::WeakPtr> > Service::m_NotificationsCache;
+std::map<String, std::set<Notification::WeakPtr> > Service::m_NotificationsCache;
 bool Service::m_NotificationsCacheNeedsUpdate = false;
 Timer::Ptr Service::m_NotificationsCacheTimer;
 
@@ -47,7 +53,7 @@ void Service::RequestNotifications(NotificationType type, const Dictionary::Ptr&
        params.SetType(type);
        params.SetCheckResult(cr);
 
-       Logger::Write(LogDebug, "icinga", "Sending notification anycast request for service '" + GetName() + "'");
+       Log(LogDebug, "icinga", "Sending notification anycast request for service '" + GetName() + "'");
        EndpointManager::GetInstance()->SendAnycastMessage(Endpoint::Ptr(), msg);
 }
 
@@ -57,27 +63,27 @@ void Service::RequestNotifications(NotificationType type, const Dictionary::Ptr&
 void Service::SendNotifications(NotificationType type, const Dictionary::Ptr& cr)
 {
        if (!GetEnableNotifications()) {
-               Logger::Write(LogInformation, "icinga", "Notifications are disabled for service '" + GetName() + "'.");
+               Log(LogInformation, "icinga", "Notifications are disabled for service '" + GetName() + "'.");
                return;
        }
 
-       Logger::Write(LogInformation, "icinga", "Sending notifications for service '" + GetName() + "'");
+       Log(LogInformation, "icinga", "Sending notifications for service '" + GetName() + "'");
 
-       set<Notification::Ptr> notifications = GetNotifications();
+       std::set<Notification::Ptr> notifications = GetNotifications();
 
        if (notifications.empty())
-               Logger::Write(LogInformation, "icinga", "Service '" + GetName() + "' does not have any notifications.");
+               Log(LogInformation, "icinga", "Service '" + GetName() + "' does not have any notifications.");
 
        BOOST_FOREACH(const Notification::Ptr& notification, notifications) {
                try {
                        notification->BeginExecuteNotification(type, cr);
-               } catch (const exception& ex) {
-                       stringstream msgbuf;
+               } catch (const std::exception& ex) {
+                       std::ostringstream msgbuf;
                        msgbuf << "Exception occured during notification for service '"
-                              << GetName() << "': " << diagnostic_information(ex);
+                              << GetName() << "': " << boost::diagnostic_information(ex);
                        String message = msgbuf.str();
 
-                       Logger::Write(LogWarning, "icinga", message);
+                       Log(LogWarning, "icinga", message);
                }
        }
 }
@@ -116,9 +122,9 @@ void Service::RefreshNotificationsCache(void)
                m_NotificationsCacheNeedsUpdate = false;
        }
 
-       Logger::Write(LogDebug, "icinga", "Updating Service notifications cache.");
+       Log(LogDebug, "icinga", "Updating Service notifications cache.");
 
-       map<String, set<Notification::WeakPtr> > newNotificationsCache;
+       std::map<String, std::set<Notification::WeakPtr> > newNotificationsCache;
 
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Notification")) {
                const Notification::Ptr& notification = static_pointer_cast<Notification>(object);
@@ -138,9 +144,9 @@ void Service::RefreshNotificationsCache(void)
 /**
  * @threadsafety Always.
  */
-set<Notification::Ptr> Service::GetNotifications(void) const
+std::set<Notification::Ptr> Service::GetNotifications(void) const
 {
-       set<Notification::Ptr> notifications;
+       std::set<Notification::Ptr> notifications;
 
        {
                boost::mutex::scoped_lock lock(m_NotificationMutex);
@@ -187,7 +193,7 @@ static void CopyNotificationAttributes(TDict notificationDesc, const ConfigItemB
 void Service::UpdateSlaveNotifications(void)
 {
        Dictionary::Ptr oldNotifications;
-       vector<Dictionary::Ptr> notificationDescsList;
+       std::vector<Dictionary::Ptr> notificationDescsList;
        ConfigItem::Ptr item;
 
        item = ConfigItem::GetObject("Service", GetName());
@@ -222,7 +228,7 @@ void Service::UpdateSlaveNotifications(void)
                String nfcname;
                Value nfcdesc;
                BOOST_FOREACH(boost::tie(nfcname, nfcdesc), notificationDescs) {
-                       stringstream namebuf;
+                       std::ostringstream namebuf;
                        namebuf << GetName() << "-" << nfcname;
                        String name = namebuf.str();
 
@@ -235,7 +241,7 @@ void Service::UpdateSlaveNotifications(void)
                        CopyNotificationAttributes(this, builder);
 
                        if (!nfcdesc.IsObjectType<Dictionary>())
-                               BOOST_THROW_EXCEPTION(invalid_argument("Notification description must be a dictionary."));
+                               BOOST_THROW_EXCEPTION(std::invalid_argument("Notification description must be a dictionary."));
 
                        Dictionary::Ptr notification = nfcdesc;
 
index a7a545a63fee20ddc0ead7a30a43621ecaa2a61e..28ef74b52b44db7d06a0e600d0824c21e2814f1f 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "icinga/service.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -371,9 +376,9 @@ void Service::OnAttributeChanged(const String& name)
 /**
  * @threadsafety Always.
  */
-set<Host::Ptr> Service::GetParentHosts(void) const
+std::set<Host::Ptr> Service::GetParentHosts(void) const
 {
-       set<Host::Ptr> parents;
+       std::set<Host::Ptr> parents;
 
        Host::Ptr host = GetHost();
 
@@ -402,9 +407,9 @@ set<Host::Ptr> Service::GetParentHosts(void) const
 /**
  * @threadsafety Always.
  */
-set<Service::Ptr> Service::GetParentServices(void) const
+std::set<Service::Ptr> Service::GetParentServices(void) const
 {
-       set<Service::Ptr> parents;
+       std::set<Service::Ptr> parents;
 
        Host::Ptr host = GetHost();
        Array::Ptr dependencies = GetServiceDependencies();
@@ -475,7 +480,7 @@ Dictionary::Ptr Service::CalculateDynamicMacros(const Dictionary::Ptr& crOverrid
 
 Dictionary::Ptr Service::CalculateAllMacros(const Dictionary::Ptr& crOverride) const
 {
-       vector<Dictionary::Ptr> macroDicts;
+       std::vector<Dictionary::Ptr> macroDicts;
        macroDicts.push_back(GetMacros());
 
        Host::Ptr host = GetHost();
index 9ee7a60edc5914f73d5dbd4a100ee8801e0017db..e41717f2feb5dc5cc6b3188f6078cc5bf62c1ec0 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef SERVICE_H
 #define SERVICE_H
 
+#include "base/dynamictype.h"
+#include <boost/signals2.hpp>
+
 namespace icinga
 {
 
@@ -98,8 +101,8 @@ public:
        Dictionary::Ptr CalculateDynamicMacros(const Dictionary::Ptr& crOverride = Dictionary::Ptr()) const;
        Dictionary::Ptr CalculateAllMacros(const Dictionary::Ptr& crOverride = Dictionary::Ptr()) const;
 
-       set<Host::Ptr> GetParentHosts(void) const;
-       set<Service::Ptr> GetParentServices(void) const;
+       std::set<Host::Ptr> GetParentHosts(void) const;
+       std::set<Service::Ptr> GetParentServices(void) const;
 
        bool IsReachable(void) const;
 
@@ -179,8 +182,8 @@ public:
        static StateType StateTypeFromString(const String& state);
        static String StateTypeToString(StateType state);
 
-       static signals2::signal<void (const Service::Ptr&)> OnCheckerChanged;
-       static signals2::signal<void (const Service::Ptr&)> OnNextCheckChanged;
+       static boost::signals2::signal<void (const Service::Ptr&)> OnCheckerChanged;
+       static boost::signals2::signal<void (const Service::Ptr&)> OnNextCheckChanged;
 
        /* Downtimes */
        static int GetNextDowntimeID(void);
@@ -236,7 +239,7 @@ public:
        void RequestNotifications(NotificationType type, const Dictionary::Ptr& cr);
        void SendNotifications(NotificationType type, const Dictionary::Ptr& cr);
 
-       set<Notification::Ptr> GetNotifications(void) const;
+       std::set<Notification::Ptr> GetNotifications(void) const;
 
        static void InvalidateNotificationsCache(void);
 
@@ -296,8 +299,8 @@ private:
        static int m_NextDowntimeID;
 
        static boost::mutex m_DowntimeMutex;
-       static map<int, String> m_LegacyDowntimesCache;
-       static map<String, Service::WeakPtr> m_DowntimesCache;
+       static std::map<int, String> m_LegacyDowntimesCache;
+       static std::map<String, Service::WeakPtr> m_DowntimesCache;
        static bool m_DowntimesCacheNeedsUpdate;
        static Timer::Ptr m_DowntimesCacheTimer;
        static Timer::Ptr m_DowntimesExpireTimer;
@@ -314,8 +317,8 @@ private:
        static int m_NextCommentID;
 
        static boost::mutex m_CommentMutex;
-       static map<int, String> m_LegacyCommentsCache;
-       static map<String, Service::WeakPtr> m_CommentsCache;
+       static std::map<int, String> m_LegacyCommentsCache;
+       static std::map<String, Service::WeakPtr> m_CommentsCache;
        static bool m_CommentsCacheNeedsUpdate;
        static Timer::Ptr m_CommentsCacheTimer;
        static Timer::Ptr m_CommentsExpireTimer;
@@ -333,7 +336,7 @@ private:
        Attribute<double> m_NotificationInterval;
 
        static boost::mutex m_NotificationMutex;
-       static map<String, set<Notification::WeakPtr> > m_NotificationsCache;
+       static std::map<String, std::set<Notification::WeakPtr> > m_NotificationsCache;
        static bool m_NotificationsCacheNeedsUpdate;
        static Timer::Ptr m_NotificationsCacheTimer;
 
index a6f457749c909d2882bd7bc43a3d335292617fcc..036c5431d644ca2ee4ccb7f7aafbb6cd55b0c7c1 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "icinga/servicegroup.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
 boost::mutex ServiceGroup::m_Mutex;
-map<String, vector<Service::WeakPtr> > ServiceGroup::m_MembersCache;
+std::map<String, std::vector<Service::WeakPtr> > ServiceGroup::m_MembersCache;
 bool ServiceGroup::m_MembersCacheNeedsUpdate = false;
 Timer::Ptr ServiceGroup::m_MembersCacheTimer;
 
@@ -86,7 +92,7 @@ ServiceGroup::Ptr ServiceGroup::GetByName(const String& name)
        DynamicObject::Ptr configObject = DynamicObject::GetObject("ServiceGroup", name);
 
        if (!configObject)
-               BOOST_THROW_EXCEPTION(invalid_argument("ServiceGroup '" + name + "' does not exist."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("ServiceGroup '" + name + "' does not exist."));
 
        return dynamic_pointer_cast<ServiceGroup>(configObject);
 }
@@ -94,9 +100,9 @@ ServiceGroup::Ptr ServiceGroup::GetByName(const String& name)
 /**
  * @threadsafety Always.
  */
-set<Service::Ptr> ServiceGroup::GetMembers(void) const
+std::set<Service::Ptr> ServiceGroup::GetMembers(void) const
 {
-       set<Service::Ptr> services;
+       std::set<Service::Ptr> services;
 
        {
                boost::mutex::scoped_lock lock(m_Mutex);
@@ -148,9 +154,9 @@ void ServiceGroup::RefreshMembersCache(void)
                m_MembersCacheNeedsUpdate = false;
        }
 
-       Logger::Write(LogDebug, "icinga", "Updating ServiceGroup members cache.");
+       Log(LogDebug, "icinga", "Updating ServiceGroup members cache.");
 
-       map<String, vector<Service::WeakPtr> > newMembersCache;
+       std::map<String, std::vector<Service::WeakPtr> > newMembersCache;
 
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
                const Service::Ptr& service = static_pointer_cast<Service>(object);
index fccb6ca718fc77e2913512b4fdb6d0dac047896d..5801c1d9b244f056ec8db5f2861cbb09211fa5c4 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef SERVICEGROUP_H
 #define SERVICEGROUP_H
 
+#include "base/dynamictype.h"
+
 namespace icinga
 {
 
@@ -43,7 +45,7 @@ public:
        String GetNotesUrl(void) const;
        String GetActionUrl(void) const;
 
-       set<Service::Ptr> GetMembers(void) const;
+       std::set<Service::Ptr> GetMembers(void) const;
 
        static void InvalidateMembersCache(void);
 
@@ -56,7 +58,7 @@ private:
        Attribute<String> m_ActionUrl;
 
        static boost::mutex m_Mutex;
-       static map<String, vector<Service::WeakPtr> > m_MembersCache;
+       static std::map<String, std::vector<Service::WeakPtr> > m_MembersCache;
        static bool m_MembersCacheNeedsUpdate;
        static Timer::Ptr m_MembersCacheTimer;
 
index 66093a45126bd74fc4b2ecf712b295dfd456dfc8..80e5f138520c6f5bb15b3c29c32b77028474eafe 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "base/dynamictype.h"
+#include "base/scriptfunction.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -191,14 +197,14 @@ void TimePeriod::UpdateRegion(double begin, double end)
 
        TimePeriod::Ptr self = GetSelf();
 
-       vector<Value> arguments;
+       std::vector<Value> arguments;
        arguments.push_back(self);
        arguments.push_back(begin);
        arguments.push_back(end);
        ScriptTask::Ptr task = MakeMethodTask("update", arguments);
 
        if (!task) {
-               Logger::Write(LogWarning, "icinga", "TimePeriod object '" + GetName() + "' doesn't have an 'update' method.");
+               Log(LogWarning, "icinga", "TimePeriod object '" + GetName() + "' doesn't have an 'update' method.");
 
                return;
        }
@@ -280,10 +286,10 @@ void TimePeriod::UpdateTimerHandler(void)
        }
 }
 
-void TimePeriod::EmptyTimePeriodUpdate(const ScriptTask::Ptr& task, const vector<Value>& arguments)
+void TimePeriod::EmptyTimePeriodUpdate(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
 {
        if (arguments.size() < 3)
-               BOOST_THROW_EXCEPTION(runtime_error("Expected 3 arguments."));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Expected 3 arguments."));
 
 //     TimePeriod::Ptr tp = arguments[0];
 //     double begin = arguments[1];
@@ -293,10 +299,10 @@ void TimePeriod::EmptyTimePeriodUpdate(const ScriptTask::Ptr& task, const vector
        task->FinishResult(segments);
 }
 
-void TimePeriod::EvenMinutesTimePeriodUpdate(const ScriptTask::Ptr& task, const vector<Value>& arguments)
+void TimePeriod::EvenMinutesTimePeriodUpdate(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
 {
        if (arguments.size() < 3)
-               BOOST_THROW_EXCEPTION(runtime_error("Expected 3 arguments."));
+               BOOST_THROW_EXCEPTION(std::runtime_error("Expected 3 arguments."));
 
        TimePeriod::Ptr tp = arguments[0];
        double begin = arguments[1];
index 5beb1a0240b395497a70feb6a98ddc01e35261af..98a07d93b052197bd5c85397513f8c60cb969fd2 100644 (file)
@@ -45,8 +45,8 @@ public:
        bool IsInside(double ts) const;
        double FindNextTransition(double begin);
 
-       static void EmptyTimePeriodUpdate(const ScriptTask::Ptr& task, const vector<Value>& arguments);
-       static void EvenMinutesTimePeriodUpdate(const ScriptTask::Ptr& task, const vector<Value>& arguments);
+       static void EmptyTimePeriodUpdate(const ScriptTask::Ptr& task, const std::vector<Value>& arguments);
+       static void EvenMinutesTimePeriodUpdate(const ScriptTask::Ptr& task, const std::vector<Value>& arguments);
 
 private:
        Attribute<double> m_ValidBegin;
index 46d4507f7c960042e91caa004f86344cd6bb67a0..b90ed9d00429b04fb32c60d57f6e6c83d8601337 100644 (file)
@@ -18,6 +18,8 @@
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "base/dynamictype.h"
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 
index 8c6004b7caa26bcec7c96547657ac985c49ee440..396206585dc2dcdca7e22b679242adc9e5d15a04 100644 (file)
  ******************************************************************************/
 
 #include "i2-icinga.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
 boost::mutex UserGroup::m_Mutex;
-map<String, vector<User::WeakPtr> > UserGroup::m_MembersCache;
+std::map<String, std::vector<User::WeakPtr> > UserGroup::m_MembersCache;
 bool UserGroup::m_MembersCacheNeedsUpdate = false;
 Timer::Ptr UserGroup::m_MembersCacheTimer;
 
@@ -68,7 +73,7 @@ UserGroup::Ptr UserGroup::GetByName(const String& name)
        DynamicObject::Ptr configObject = DynamicObject::GetObject("UserGroup", name);
 
        if (!configObject)
-               BOOST_THROW_EXCEPTION(invalid_argument("UserGroup '" + name + "' does not exist."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("UserGroup '" + name + "' does not exist."));
 
        return dynamic_pointer_cast<UserGroup>(configObject);
 }
@@ -76,9 +81,9 @@ UserGroup::Ptr UserGroup::GetByName(const String& name)
 /**
  * @threadsafety Always.
  */
-set<User::Ptr> UserGroup::GetMembers(void) const
+std::set<User::Ptr> UserGroup::GetMembers(void) const
 {
-       set<User::Ptr> users;
+       std::set<User::Ptr> users;
 
        {
                boost::mutex::scoped_lock lock(m_Mutex);
@@ -130,9 +135,9 @@ void UserGroup::RefreshMembersCache(void)
                m_MembersCacheNeedsUpdate = false;
        }
 
-       Logger::Write(LogDebug, "icinga", "Updating UserGroup members cache.");
+       Log(LogDebug, "icinga", "Updating UserGroup members cache.");
 
-       map<String, vector<User::WeakPtr> > newMembersCache;
+       std::map<String, std::vector<User::WeakPtr> > newMembersCache;
 
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("User")) {
                const User::Ptr& user = static_pointer_cast<User>(object);
index 39912ee005108d7fa7e947bcf64711e42827c821..3ac92bb812d91390fc3ec1e3f24df60806bebb3a 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef USERGROUP_H
 #define USERGROUP_H
 
+#include "base/dynamicobject.h"
+
 namespace icinga
 {
 
@@ -41,7 +43,7 @@ public:
 
        String GetDisplayName(void) const;
 
-       set<User::Ptr> GetMembers(void) const;
+       std::set<User::Ptr> GetMembers(void) const;
 
        static void InvalidateMembersCache(void);
 
@@ -52,7 +54,7 @@ private:
        Attribute<String> m_DisplayName;
 
        static boost::mutex m_Mutex;
-       static map<String, vector<User::WeakPtr> > m_MembersCache;
+       static std::map<String, std::vector<User::WeakPtr> > m_MembersCache;
        static bool m_MembersCacheNeedsUpdate;
        static Timer::Ptr m_MembersCacheTimer;
 
index d314d69683ed340f3fe038ab4c5b6d16f0805778..eda99c6354400e3d56f99f7cb51f3c9ccb9b2c4e 100644 (file)
@@ -15,10 +15,7 @@ libpython_la_CPPFLAGS = \
        -DI2_PYTHON_BUILD \
        $(BOOST_CPPFLAGS) \
        @PYTHON_CSPEC@ \
-       -I${top_srcdir}/lib/base \
-       -I${top_srcdir}/lib/config \
-       -I${top_srcdir}/lib/remoting \
-       -I${top_srcdir}
+       -I${top_srcdir}/lib
 
 libpython_la_LDFLAGS = \
        $(BOOST_LDFLAGS) \
index 4f53ab03821c6a15d669512966269363d47b7551..674d6280cbd993d6317628de2abb86ace32785a0 100644 (file)
@@ -27,8 +27,7 @@ libremoting_la_SOURCES = \
 libremoting_la_CPPFLAGS = \
        -DI2_REMOTING_BUILD \
        $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/lib/base \
-       -I${top_srcdir}/lib/config
+       -I${top_srcdir}/lib
 
 libremoting_la_LDFLAGS = \
        $(BOOST_LDFLAGS) \
index 2df0a63df25cce4c214dc9fc171ee086acfbc9c1..e7bf0561573e973bfc06a1cd5af51a7772ea0d7a 100644 (file)
  ******************************************************************************/
 
 #include "i2-remoting.h"
+#include "base/application.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 
 REGISTER_TYPE(Endpoint);
 
-signals2::signal<void (const Endpoint::Ptr&)> Endpoint::OnConnected;
-signals2::signal<void (const Endpoint::Ptr&)> Endpoint::OnDisconnected;
+boost::signals2::signal<void (const Endpoint::Ptr&)> Endpoint::OnConnected;
+boost::signals2::signal<void (const Endpoint::Ptr&)> Endpoint::OnDisconnected;
 
 /**
  * Constructor for the Endpoint class.
@@ -203,13 +208,13 @@ void Endpoint::RegisterTopicHandler(const String& topic, const boost::function<E
 {
        ObjectLock olock(this);
 
-       map<String, shared_ptr<signals2::signal<Endpoint::Callback> > >::iterator it;
+       std::map<String, shared_ptr<boost::signals2::signal<Endpoint::Callback> > >::iterator it;
        it = m_TopicHandlers.find(topic);
 
-       shared_ptr<signals2::signal<Endpoint::Callback> > sig;
+       shared_ptr<boost::signals2::signal<Endpoint::Callback> > sig;
 
        if (it == m_TopicHandlers.end()) {
-               sig = boost::make_shared<signals2::signal<Endpoint::Callback> >();
+               sig = boost::make_shared<boost::signals2::signal<Endpoint::Callback> >();
                m_TopicHandlers.insert(make_pair(topic, sig));
        } else {
                sig = it->second;
@@ -228,7 +233,7 @@ void Endpoint::UnregisterTopicHandler(const String&, const boost::function<Endpo
        //m_TopicHandlers[method] -= callback;
        //UnregisterSubscription(method);
 
-       BOOST_THROW_EXCEPTION(runtime_error("Not implemented."));
+       BOOST_THROW_EXCEPTION(std::runtime_error("Not implemented."));
 }
 
 void Endpoint::ProcessRequest(const Endpoint::Ptr& sender, const RequestMessage& request)
@@ -245,7 +250,7 @@ void Endpoint::ProcessRequest(const Endpoint::Ptr& sender, const RequestMessage&
                if (!request.GetMethod(&method))
                        return;
 
-               map<String, shared_ptr<signals2::signal<Endpoint::Callback> > >::iterator it;
+               std::map<String, shared_ptr<boost::signals2::signal<Endpoint::Callback> > >::iterator it;
                it = m_TopicHandlers.find(method);
 
                if (it == m_TopicHandlers.end())
@@ -302,10 +307,10 @@ void Endpoint::ClientClosedHandler(void)
                stringstream message;
                message << "Error occured for JSON-RPC socket: Message=" << diagnostic_information(ex);
 
-               Logger::Write(LogWarning, "jsonrpc", message.str());
+               Log(LogWarning, "jsonrpc", message.str());
        }*/
 
-       Logger::Write(LogWarning, "jsonrpc", "Lost connection to endpoint: identity=" + GetName());
+       Log(LogWarning, "jsonrpc", "Lost connection to endpoint: identity=" + GetName());
 
        {
                ObjectLock olock(this);
index b92cdf11f9b7c5948ee051145e7f4965be983cf9..e60c8f5dc0c0407b56376145bc2e30fadfe94b98 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef ENDPOINT_H
 #define ENDPOINT_H
 
+#include "base/dynamicobject.h"
+#include <boost/signals2.hpp>
+
 namespace icinga
 {
 
@@ -69,8 +72,8 @@ public:
 
        static Endpoint::Ptr MakeEndpoint(const String& name, bool replicated, bool local = true);
 
-       static signals2::signal<void (const Endpoint::Ptr&)> OnConnected;
-       static signals2::signal<void (const Endpoint::Ptr&)> OnDisconnected;
+       static boost::signals2::signal<void (const Endpoint::Ptr&)> OnConnected;
+       static boost::signals2::signal<void (const Endpoint::Ptr&)> OnDisconnected;
 
 private:
        Attribute<bool> m_Local;
@@ -85,7 +88,7 @@ private:
        bool m_SentWelcome; /**< Have we sent a welcome message to this
                                 endpoint? */
 
-       map<String, shared_ptr<signals2::signal<Callback> > > m_TopicHandlers;
+       std::map<String, shared_ptr<boost::signals2::signal<Callback> > > m_TopicHandlers;
 
        void NewMessageHandler(const MessagePart& message);
        void ClientClosedHandler(void);
index 9739999bd0878bd025b2cde4c25a39cc00c09145..a0e2b27dce19edca61858803ccdcd04f70f66d65 100644 (file)
  ******************************************************************************/
 
 #include "i2-remoting.h"
+#include "base/dynamictype.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include "base/convert.h"
 #include <boost/tuple/tuple.hpp>
+#include <boost/foreach.hpp>
 
 using namespace icinga;
 
@@ -115,11 +120,11 @@ void EndpointManager::AddListener(const String& service)
        shared_ptr<SSL_CTX> sslContext = m_SSLContext;
 
        if (!sslContext)
-               BOOST_THROW_EXCEPTION(logic_error("SSL context is required for AddListener()"));
+               BOOST_THROW_EXCEPTION(std::logic_error("SSL context is required for AddListener()"));
 
-       stringstream s;
+       std::ostringstream s;
        s << "Adding new listener: port " << service;
-       Logger::Write(LogInformation, "icinga", s.str());
+       Log(LogInformation, "icinga", s.str());
 
        TcpSocket::Ptr server = boost::make_shared<TcpSocket>();
 
@@ -144,7 +149,7 @@ void EndpointManager::AddConnection(const String& node, const String& service) {
        shared_ptr<SSL_CTX> sslContext = m_SSLContext;
 
        if (!sslContext)
-               BOOST_THROW_EXCEPTION(logic_error("SSL context is required for AddConnection()"));
+               BOOST_THROW_EXCEPTION(std::logic_error("SSL context is required for AddConnection()"));
 
        TcpSocket::Ptr client = boost::make_shared<TcpSocket>();
        client->Connect(node, service);
@@ -183,7 +188,7 @@ void EndpointManager::ClientConnectedHandler(const Stream::Ptr& client, const St
        shared_ptr<X509> cert = tlsStream->GetPeerCertificate();
        String identity = Utility::GetCertificateCN(cert);
 
-       Logger::Write(LogInformation, "icinga", "New client connection at " + peerAddress + " for identity '" + identity + "'");
+       Log(LogInformation, "icinga", "New client connection at " + peerAddress + " for identity '" + identity + "'");
 
        Endpoint::Ptr endpoint = Endpoint::GetByName(identity);
 
@@ -246,9 +251,9 @@ void EndpointManager::SendAnycastMessage(const Endpoint::Ptr& sender,
 {
        String method;
        if (!message.GetMethod(&method))
-               BOOST_THROW_EXCEPTION(invalid_argument("Message is missing the 'method' property."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Message is missing the 'method' property."));
 
-       vector<Endpoint::Ptr> candidates;
+       std::vector<Endpoint::Ptr> candidates;
 
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Endpoint")) {
                Endpoint::Ptr endpoint = dynamic_pointer_cast<Endpoint>(object);
@@ -290,11 +295,11 @@ void EndpointManager::SendMulticastMessage(const Endpoint::Ptr& sender,
 {
        String id;
        if (message.GetID(&id))
-               BOOST_THROW_EXCEPTION(invalid_argument("Multicast requests must not have an ID."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Multicast requests must not have an ID."));
 
        String method;
        if (!message.GetMethod(&method))
-               BOOST_THROW_EXCEPTION(invalid_argument("Message is missing the 'method' property."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Message is missing the 'method' property."));
 
        BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Endpoint")) {
                Endpoint::Ptr recipient = dynamic_pointer_cast<Endpoint>(object);
@@ -316,10 +321,7 @@ void EndpointManager::SendAPIMessage(const Endpoint::Ptr& sender, const Endpoint
 
        m_NextMessageID++;
 
-       stringstream idstream;
-       idstream << m_NextMessageID;
-
-       String id = idstream.str();
+       String id = Convert::ToString(m_NextMessageID);
        message.SetID(id);
 
        PendingRequest pr;
@@ -335,8 +337,8 @@ void EndpointManager::SendAPIMessage(const Endpoint::Ptr& sender, const Endpoint
                SendUnicastMessage(sender, recipient, message);
 }
 
-bool EndpointManager::RequestTimeoutLessComparer(const pair<String, PendingRequest>& a,
-    const pair<String, PendingRequest>& b)
+bool EndpointManager::RequestTimeoutLessComparer(const std::pair<String, PendingRequest>& a,
+    const std::pair<String, PendingRequest>& b)
 {
        return a.second.Timeout < b.second.Timeout;
 }
@@ -383,7 +385,7 @@ void EndpointManager::ReconnectTimerHandler(void)
                service = endpoint->GetService();
 
                if (node.IsEmpty() || service.IsEmpty()) {
-                       Logger::Write(LogWarning, "icinga", "Can't reconnect "
+                       Log(LogWarning, "icinga", "Can't reconnect "
                            "to endpoint '" + endpoint->GetName() + "': No "
                            "node/service information.");
                        continue;
@@ -397,7 +399,7 @@ void EndpointManager::RequestTimerHandler(void)
 {
        ObjectLock olock(this);
 
-       map<String, PendingRequest>::iterator it;
+       std::map<String, PendingRequest>::iterator it;
        for (it = m_Requests.begin(); it != m_Requests.end(); ++it) {
                if (it->second.HasTimedOut()) {
                        it->second.Callback(Endpoint::Ptr(), it->second.Request,
@@ -417,9 +419,9 @@ void EndpointManager::ProcessResponseMessage(const Endpoint::Ptr& sender,
 
        String id;
        if (!message.GetID(&id))
-               BOOST_THROW_EXCEPTION(invalid_argument("Response message must have a message ID."));
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Response message must have a message ID."));
 
-       map<String, PendingRequest>::iterator it;
+       std::map<String, PendingRequest>::iterator it;
        it = m_Requests.find(id);
 
        if (it == m_Requests.end())
index 95e7087be4da30acafc744de5d203a30c6dc1a7c..e180a983b389ae8ee5d6f26f5eb896cda5206644 100644 (file)
 #ifndef ENDPOINTMANAGER_H
 #define ENDPOINTMANAGER_H
 
+#include "base/tcpsocket.h"
+#include "base/tlsstream.h"
+#include <boost/signals2.hpp>
+
 namespace icinga
 {
 
@@ -60,7 +64,7 @@ public:
 
        void ProcessResponseMessage(const Endpoint::Ptr& sender, const ResponseMessage& message);
 
-       signals2::signal<void (const Endpoint::Ptr&)> OnNewEndpoint;
+       boost::signals2::signal<void (const Endpoint::Ptr&)> OnNewEndpoint;
 
 private:
        String m_Identity;
@@ -72,8 +76,8 @@ private:
 
        Timer::Ptr m_ReconnectTimer;
 
-       set<TcpSocket::Ptr> m_Servers;
-       set<TlsStream::Ptr> m_PendingClients;
+       std::set<TcpSocket::Ptr> m_Servers;
+       std::set<TlsStream::Ptr> m_PendingClients;
 
        /**
         * Information about a pending API request.
@@ -93,10 +97,10 @@ private:
        };
 
        long m_NextMessageID;
-       map<String, PendingRequest> m_Requests;
+       std::map<String, PendingRequest> m_Requests;
        Timer::Ptr m_RequestTimer;
 
-       static bool RequestTimeoutLessComparer(const pair<String, PendingRequest>& a, const pair<String, PendingRequest>& b);
+       static bool RequestTimeoutLessComparer(const std::pair<String, PendingRequest>& a, const std::pair<String, PendingRequest>& b);
        void RequestTimerHandler(void);
 
        void SubscriptionTimerHandler(void);
index cb18bf81eea2e1651662bac7d0ea3b3fe5f6025f..47c4ade2a7a97bb9b97019a18893cbbacc78874d 100644 (file)
@@ -27,8 +27,8 @@
  * supports endpoint-based communication using messages.
  */
 
-#include <i2-base.h>
-#include <i2-config.h>
+#include "base/i2-base.h"
+#include "config/i2-config.h"
 
 #ifdef I2_REMOTING_BUILD
 #      define I2_REMOTING_API I2_EXPORT
index 6e60abb183083c5a76149f57f59970a8a8ad88b4..b7ac5d7276171f98d10fb286685d36b46467a4f4 100644 (file)
  ******************************************************************************/
 
 #include "i2-remoting.h"
+#include "base/netstring.h"
+#include "base/objectlock.h"
+#include "base/logger_fwd.h"
+#include <boost/exception/diagnostic_information.hpp>
 
 using namespace icinga;
 
@@ -61,16 +65,16 @@ void JsonRpcConnection::ProcessData(void)
                        Value value = Value::Deserialize(jsonString);
 
                        if (!value.IsObjectType<Dictionary>()) {
-                               BOOST_THROW_EXCEPTION(invalid_argument("JSON-RPC"
+                               BOOST_THROW_EXCEPTION(std::invalid_argument("JSON-RPC"
                                    " message must be a dictionary."));
                        }
 
                        MessagePart mp(value);
                        OnNewMessage(GetSelf(), mp);
-               } catch (const exception& ex) {
-                       Logger::Write(LogCritical, "remoting", "Exception"
+               } catch (const std::exception& ex) {
+                       Log(LogCritical, "remoting", "Exception"
                            " while processing message from JSON-RPC client: " +
-                           diagnostic_information(ex));
+                           boost::diagnostic_information(ex));
                }
        }
 }
index 592a2b01dddd448d02d1bf30c7c7f12d0b9503a2..daeec311d0407c9064a07e43a5c9433e8321e562 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef JSONRPCCONNECTION_H
 #define JSONRPCCONNECTION_H
 
+#include "base/connection.h"
+#include <boost/signals2.hpp>
+
 namespace icinga
 {
 
@@ -38,7 +41,7 @@ public:
 
        void SendMessage(const MessagePart& message);
 
-       signals2::signal<void (const JsonRpcConnection::Ptr&, const MessagePart&)> OnNewMessage;
+       boost::signals2::signal<void (const JsonRpcConnection::Ptr&, const MessagePart&)> OnNewMessage;
 
 protected:
        virtual void ProcessData(void);
index b459b9dcde0b478e8e27936d9c8270e471ec1434..4da41ebc4a3015b964a0221d473cf7f71e981e05 100644 (file)
@@ -18,6 +18,7 @@
  ******************************************************************************/
 
 #include "i2-remoting.h"
+#include <boost/smart_ptr/make_shared.hpp>
 
 using namespace icinga;
 
index 1e1e00c2d4863fc74ac333c5f95aa22628b1686b..f6a229353d6644ab2371630e026b215d52f545ca 100644 (file)
@@ -49,7 +49,7 @@ int main(int argc, char **argv)
 
        fprintf(outfp, "/* This file has been automatically generated\n"
            "   from the input file \"%s\". */\n\n", argv[1]);
-       fputs("#include \"i2-config.h\"\n\nstatic const char g_ConfigFragment[] = {\n", outfp);
+       fputs("#include \"config/configcompiler.h\"\n\nstatic const char g_ConfigFragment[] = {\n", outfp);
        fputc('\t', outfp);
 
        cols = 0;