From: Michael Friedrich Date: Mon, 15 May 2017 13:51:39 +0000 (+0200) Subject: Move PerfdataValue() class into base library X-Git-Tag: v2.7.0~67^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=refs%2Fpull%2F5265%2Fhead;p=icinga2 Move PerfdataValue() class into base library This is required for libremote and ApiListener stats in #5133 --- diff --git a/lib/base/CMakeLists.txt b/lib/base/CMakeLists.txt index 420e3204c..b80a7bc2b 100644 --- a/lib/base/CMakeLists.txt +++ b/lib/base/CMakeLists.txt @@ -21,6 +21,7 @@ mkclass_target(datetime.ti datetime.tcpp datetime.thpp) mkclass_target(filelogger.ti filelogger.tcpp filelogger.thpp) mkclass_target(function.ti function.tcpp function.thpp) mkclass_target(logger.ti logger.tcpp logger.thpp) +mkclass_target(perfdatavalue.ti perfdatavalue.tcpp perfdatavalue.thpp) mkclass_target(streamlogger.ti streamlogger.tcpp streamlogger.thpp) mkclass_target(sysloglogger.ti sysloglogger.tcpp sysloglogger.thpp) @@ -33,7 +34,8 @@ set(base_SOURCES json-script.cpp loader.cpp logger.cpp logger.thpp math-script.cpp netstring.cpp networkstream.cpp number.cpp number-script.cpp object.cpp object-script.cpp objecttype.cpp primitivetype.cpp process.cpp ringbuffer.cpp scriptframe.cpp - function.cpp function.thpp function-script.cpp functionwrapper.cpp scriptglobal.cpp + function.cpp function.thpp function-script.cpp functionwrapper.cpp + perfdatavalue.cpp perfdatavalue.thpp scriptglobal.cpp scriptutils.cpp serializer.cpp socket.cpp socketevents.cpp socketevents-epoll.cpp socketevents-poll.cpp stacktrace.cpp statsfunction.cpp stdiostream.cpp stream.cpp streamlogger.cpp streamlogger.thpp string.cpp string-script.cpp sysloglogger.cpp sysloglogger.thpp tcpsocket.cpp udpsocket.cpp threadpool.cpp timer.cpp diff --git a/lib/icinga/perfdatavalue.cpp b/lib/base/perfdatavalue.cpp similarity index 98% rename from lib/icinga/perfdatavalue.cpp rename to lib/base/perfdatavalue.cpp index d350260bf..71d5f4d0a 100644 --- a/lib/icinga/perfdatavalue.cpp +++ b/lib/base/perfdatavalue.cpp @@ -17,8 +17,8 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "icinga/perfdatavalue.hpp" -#include "icinga/perfdatavalue.tcpp" +#include "base/perfdatavalue.hpp" +#include "base/perfdatavalue.tcpp" #include "base/convert.hpp" #include "base/exception.hpp" #include "base/logger.hpp" @@ -67,7 +67,7 @@ PerfdataValue::Ptr PerfdataValue::Parse(const String& perfdata) spq = perfdata.GetLength(); String valueStr = perfdata.SubStr(eqp + 1, spq - eqp - 1); - + size_t pos = valueStr.FindFirstNotOf("+-0123456789.e"); double value = Convert::ToDouble(valueStr.SubStr(0, pos)); diff --git a/lib/icinga/perfdatavalue.hpp b/lib/base/perfdatavalue.hpp similarity index 91% rename from lib/icinga/perfdatavalue.hpp rename to lib/base/perfdatavalue.hpp index 2f91cf7a2..42439f0cc 100644 --- a/lib/icinga/perfdatavalue.hpp +++ b/lib/base/perfdatavalue.hpp @@ -20,13 +20,18 @@ #ifndef PERFDATAVALUE_H #define PERFDATAVALUE_H -#include "icinga/i2-icinga.hpp" -#include "icinga/perfdatavalue.thpp" +#include "base/i2-base.hpp" +#include "base/perfdatavalue.thpp" namespace icinga { -class I2_ICINGA_API PerfdataValue : public ObjectImpl +/** + * A performance data value. + * + * @ingroup base + */ +class I2_BASE_API PerfdataValue : public ObjectImpl { public: DECLARE_OBJECT(PerfdataValue); diff --git a/lib/icinga/perfdatavalue.ti b/lib/base/perfdatavalue.ti similarity index 96% rename from lib/icinga/perfdatavalue.ti rename to lib/base/perfdatavalue.ti index c6c8472ff..e372c9245 100644 --- a/lib/icinga/perfdatavalue.ti +++ b/lib/base/perfdatavalue.ti @@ -17,9 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "icinga/customvarobject.hpp" - -library icinga; +library base; namespace icinga { diff --git a/lib/checker/checkercomponent.cpp b/lib/checker/checkercomponent.cpp index 6e524d9ef..65098d6c3 100644 --- a/lib/checker/checkercomponent.cpp +++ b/lib/checker/checkercomponent.cpp @@ -21,11 +21,11 @@ #include "checker/checkercomponent.tcpp" #include "icinga/icingaapplication.hpp" #include "icinga/cib.hpp" -#include "icinga/perfdatavalue.hpp" #include "remote/apilistener.hpp" #include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/logger.hpp" #include "base/exception.hpp" #include "base/convert.hpp" diff --git a/lib/db_ido/idochecktask.cpp b/lib/db_ido/idochecktask.cpp index c5766038b..707b1ed37 100644 --- a/lib/db_ido/idochecktask.cpp +++ b/lib/db_ido/idochecktask.cpp @@ -21,12 +21,12 @@ #include "icinga/host.hpp" #include "icinga/checkcommand.hpp" #include "icinga/macroprocessor.hpp" -#include "icinga/perfdatavalue.hpp" #include "remote/apilistener.hpp" #include "remote/endpoint.hpp" #include "remote/zone.hpp" #include "base/function.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/configtype.hpp" #include "base/convert.hpp" diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp index 92d7f61a9..b761d2b90 100644 --- a/lib/db_ido_mysql/idomysqlconnection.cpp +++ b/lib/db_ido_mysql/idomysqlconnection.cpp @@ -19,13 +19,13 @@ #include "db_ido_mysql/idomysqlconnection.hpp" #include "db_ido_mysql/idomysqlconnection.tcpp" -#include "icinga/perfdatavalue.hpp" #include "db_ido/dbtype.hpp" #include "db_ido/dbvalue.hpp" #include "base/logger.hpp" #include "base/objectlock.hpp" #include "base/convert.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/application.hpp" #include "base/configtype.hpp" #include "base/exception.hpp" diff --git a/lib/db_ido_pgsql/idopgsqlconnection.cpp b/lib/db_ido_pgsql/idopgsqlconnection.cpp index 28eca8cb3..723767bae 100644 --- a/lib/db_ido_pgsql/idopgsqlconnection.cpp +++ b/lib/db_ido_pgsql/idopgsqlconnection.cpp @@ -21,11 +21,11 @@ #include "db_ido_pgsql/idopgsqlconnection.tcpp" #include "db_ido/dbtype.hpp" #include "db_ido/dbvalue.hpp" -#include "icinga/perfdatavalue.hpp" #include "base/logger.hpp" #include "base/objectlock.hpp" #include "base/convert.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/application.hpp" #include "base/configtype.hpp" #include "base/exception.hpp" diff --git a/lib/icinga/CMakeLists.txt b/lib/icinga/CMakeLists.txt index d2abf4e50..ca98b260b 100644 --- a/lib/icinga/CMakeLists.txt +++ b/lib/icinga/CMakeLists.txt @@ -29,7 +29,6 @@ mkclass_target(icingaapplication.ti icingaapplication.tcpp icingaapplication.thp mkclass_target(customvarobject.ti customvarobject.tcpp customvarobject.thpp) mkclass_target(notificationcommand.ti notificationcommand.tcpp notificationcommand.thpp) mkclass_target(notification.ti notification.tcpp notification.thpp) -mkclass_target(perfdatavalue.ti perfdatavalue.tcpp perfdatavalue.thpp) mkclass_target(scheduleddowntime.ti scheduleddowntime.tcpp scheduleddowntime.thpp) mkclass_target(servicegroup.ti servicegroup.tcpp servicegroup.thpp) mkclass_target(service.ti service.tcpp service.thpp) @@ -47,7 +46,7 @@ set(icinga_SOURCES externalcommandprocessor.cpp host.cpp host.thpp hostgroup.cpp hostgroup.thpp icingaapplication.cpp icingaapplication.thpp icinga-itl.cpp customvarobject.cpp customvarobject.thpp legacytimeperiod.cpp macroprocessor.cpp notificationcommand.cpp notificationcommand.thpp notification.cpp notification.thpp - notification-apply.cpp objectutils.cpp perfdatavalue.cpp perfdatavalue.thpp pluginutility.cpp scheduleddowntime.cpp scheduleddowntime.thpp + notification-apply.cpp objectutils.cpp pluginutility.cpp scheduleddowntime.cpp scheduleddowntime.thpp scheduleddowntime-apply.cpp service-apply.cpp checkable-check.cpp checkable-comment.cpp service.cpp service.thpp servicegroup.cpp servicegroup.thpp checkable-notification.cpp timeperiod.cpp timeperiod.thpp user.cpp user.thpp usergroup.cpp usergroup.thpp diff --git a/lib/icinga/cib.cpp b/lib/icinga/cib.cpp index 50b390ccb..293701937 100644 --- a/lib/icinga/cib.cpp +++ b/lib/icinga/cib.cpp @@ -20,9 +20,9 @@ #include "icinga/cib.hpp" #include "icinga/host.hpp" #include "icinga/service.hpp" -#include "icinga/perfdatavalue.hpp" #include "base/objectlock.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/configtype.hpp" #include "base/statsfunction.hpp" diff --git a/lib/icinga/clusterevents.cpp b/lib/icinga/clusterevents.cpp index 7b13b2415..506971e6a 100644 --- a/lib/icinga/clusterevents.cpp +++ b/lib/icinga/clusterevents.cpp @@ -19,7 +19,6 @@ #include "icinga/clusterevents.hpp" #include "icinga/service.hpp" -#include "icinga/perfdatavalue.hpp" #include "remote/apilistener.hpp" #include "remote/endpoint.hpp" #include "remote/messageorigin.hpp" @@ -29,6 +28,7 @@ #include "base/application.hpp" #include "base/configtype.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/exception.hpp" #include "base/initialize.hpp" #include "base/serializer.hpp" diff --git a/lib/icinga/pluginutility.cpp b/lib/icinga/pluginutility.cpp index 835854703..d59aac845 100644 --- a/lib/icinga/pluginutility.cpp +++ b/lib/icinga/pluginutility.cpp @@ -19,9 +19,9 @@ #include "icinga/pluginutility.hpp" #include "icinga/macroprocessor.hpp" -#include "icinga/perfdatavalue.hpp" #include "base/logger.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/convert.hpp" #include "base/process.hpp" #include "base/objectlock.hpp" diff --git a/lib/livestatus/livestatuslistener.cpp b/lib/livestatus/livestatuslistener.cpp index 9c8f7701f..d5e201409 100644 --- a/lib/livestatus/livestatuslistener.cpp +++ b/lib/livestatus/livestatuslistener.cpp @@ -19,8 +19,8 @@ #include "livestatus/livestatuslistener.hpp" #include "livestatus/livestatuslistener.tcpp" -#include "icinga/perfdatavalue.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/objectlock.hpp" #include "base/configtype.hpp" #include "base/logger.hpp" diff --git a/lib/methods/clusterzonechecktask.cpp b/lib/methods/clusterzonechecktask.cpp index f91c5259c..919e7fbed 100644 --- a/lib/methods/clusterzonechecktask.cpp +++ b/lib/methods/clusterzonechecktask.cpp @@ -20,12 +20,12 @@ #include "methods/clusterzonechecktask.hpp" #include "icinga/checkcommand.hpp" #include "icinga/macroprocessor.hpp" -#include "icinga/perfdatavalue.hpp" #include "remote/apilistener.hpp" #include "remote/endpoint.hpp" #include "remote/zone.hpp" #include "base/function.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" using namespace icinga; diff --git a/lib/methods/icingachecktask.cpp b/lib/methods/icingachecktask.cpp index 7b5c54ec3..7e5898936 100644 --- a/lib/methods/icingachecktask.cpp +++ b/lib/methods/icingachecktask.cpp @@ -21,10 +21,10 @@ #include "icinga/cib.hpp" #include "icinga/service.hpp" #include "icinga/icingaapplication.hpp" -#include "icinga/perfdatavalue.hpp" #include "base/application.hpp" #include "base/objectlock.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/function.hpp" #include "base/configtype.hpp" diff --git a/lib/methods/nullchecktask.cpp b/lib/methods/nullchecktask.cpp index 564f3daf8..09b060c2b 100644 --- a/lib/methods/nullchecktask.cpp +++ b/lib/methods/nullchecktask.cpp @@ -21,9 +21,9 @@ # include #endif /* _WIN32 */ #include "methods/nullchecktask.hpp" -#include "icinga/perfdatavalue.hpp" #include "icinga/icingaapplication.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/convert.hpp" #include "base/function.hpp" #include "base/logger.hpp" diff --git a/lib/methods/randomchecktask.cpp b/lib/methods/randomchecktask.cpp index a0b90ccfe..0d31e795a 100644 --- a/lib/methods/randomchecktask.cpp +++ b/lib/methods/randomchecktask.cpp @@ -21,9 +21,9 @@ # include #endif /* _WIN32 */ #include "methods/randomchecktask.hpp" -#include "icinga/perfdatavalue.hpp" #include "icinga/icingaapplication.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/convert.hpp" #include "base/function.hpp" #include "base/logger.hpp" diff --git a/lib/perfdata/gelfwriter.cpp b/lib/perfdata/gelfwriter.cpp index b8627b81b..afc563c12 100644 --- a/lib/perfdata/gelfwriter.cpp +++ b/lib/perfdata/gelfwriter.cpp @@ -23,12 +23,12 @@ #include "icinga/notification.hpp" #include "icinga/macroprocessor.hpp" #include "icinga/compatutility.hpp" -#include "icinga/perfdatavalue.hpp" #include "base/tcpsocket.hpp" #include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/stream.hpp" #include "base/networkstream.hpp" #include "base/json.hpp" diff --git a/lib/perfdata/graphitewriter.cpp b/lib/perfdata/graphitewriter.cpp index 649e3d2f0..ee59a7363 100644 --- a/lib/perfdata/graphitewriter.cpp +++ b/lib/perfdata/graphitewriter.cpp @@ -23,13 +23,13 @@ #include "icinga/macroprocessor.hpp" #include "icinga/icingaapplication.hpp" #include "icinga/compatutility.hpp" -#include "icinga/perfdatavalue.hpp" #include "base/tcpsocket.hpp" #include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/convert.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/application.hpp" #include "base/stream.hpp" #include "base/networkstream.hpp" diff --git a/lib/perfdata/influxdbwriter.cpp b/lib/perfdata/influxdbwriter.cpp index e1f99e160..bf17bbdb5 100644 --- a/lib/perfdata/influxdbwriter.cpp +++ b/lib/perfdata/influxdbwriter.cpp @@ -25,7 +25,6 @@ #include "icinga/service.hpp" #include "icinga/macroprocessor.hpp" #include "icinga/icingaapplication.hpp" -#include "icinga/perfdatavalue.hpp" #include "icinga/checkcommand.hpp" #include "base/tcpsocket.hpp" #include "base/configtype.hpp" @@ -33,6 +32,7 @@ #include "base/logger.hpp" #include "base/convert.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/stream.hpp" #include "base/json.hpp" #include "base/networkstream.hpp" diff --git a/lib/perfdata/logstashwriter.cpp b/lib/perfdata/logstashwriter.cpp index 9c715298c..dde0bd678 100644 --- a/lib/perfdata/logstashwriter.cpp +++ b/lib/perfdata/logstashwriter.cpp @@ -22,12 +22,12 @@ #include "icinga/service.hpp" #include "icinga/macroprocessor.hpp" #include "icinga/compatutility.hpp" -#include "icinga/perfdatavalue.hpp" #include "icinga/notification.hpp" #include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/stream.hpp" #include "base/networkstream.hpp" #include "base/json.hpp" diff --git a/lib/perfdata/opentsdbwriter.cpp b/lib/perfdata/opentsdbwriter.cpp index 2e2f0fc7d..328c5be7f 100644 --- a/lib/perfdata/opentsdbwriter.cpp +++ b/lib/perfdata/opentsdbwriter.cpp @@ -23,13 +23,13 @@ #include "icinga/macroprocessor.hpp" #include "icinga/icingaapplication.hpp" #include "icinga/compatutility.hpp" -#include "icinga/perfdatavalue.hpp" #include "base/tcpsocket.hpp" #include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/convert.hpp" #include "base/utility.hpp" +#include "base/perfdatavalue.hpp" #include "base/application.hpp" #include "base/stream.hpp" #include "base/networkstream.hpp" diff --git a/test/base-json.cpp b/test/base-json.cpp index b9ba808af..48704f489 100644 --- a/test/base-json.cpp +++ b/test/base-json.cpp @@ -17,7 +17,6 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "icinga/perfdatavalue.hpp" #include "base/dictionary.hpp" #include "base/objectlock.hpp" #include "base/json.hpp" diff --git a/test/base-serialize.cpp b/test/base-serialize.cpp index 09033dae4..4311e1f65 100644 --- a/test/base-serialize.cpp +++ b/test/base-serialize.cpp @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "icinga/perfdatavalue.hpp" +#include "base/perfdatavalue.hpp" #include "base/dictionary.hpp" #include "base/objectlock.hpp" #include "base/serializer.hpp" diff --git a/test/base-type.cpp b/test/base-type.cpp index 065bf4ab0..08cca02df 100644 --- a/test/base-type.cpp +++ b/test/base-type.cpp @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "icinga/perfdatavalue.hpp" +#include "base/perfdatavalue.hpp" #include "base/dictionary.hpp" #include "base/objectlock.hpp" #include "base/application.hpp" diff --git a/test/icinga-perfdata.cpp b/test/icinga-perfdata.cpp index 631ca31cd..2d3d85379 100644 --- a/test/icinga-perfdata.cpp +++ b/test/icinga-perfdata.cpp @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "icinga/perfdatavalue.hpp" +#include "base/perfdatavalue.hpp" #include "icinga/pluginutility.hpp" #include