[seiscomp, scanloc] Install, add .gitignore

This commit is contained in:
2025-10-09 15:07:02 +02:00
commit 20f5301bb1
2848 changed files with 1315858 additions and 0 deletions

View File

@ -0,0 +1,17 @@
#ifndef SC_MPLUGIN_API_H
#define SC_MPLUGIN_API_H
#if defined(WIN32) && (defined(SC_MPLUGIN_SHARED) || defined(SC_ALL_SHARED))
# if defined(SC_MPLUGIN_EXPORTS)
# define SC_MPLUGIN_API __declspec(dllexport)
# define SC_MPLUGIN_TEMPLATE_EXPORT
# else
# define SC_MPLUGIN_API __declspec(dllimport)
# define SC_MPLUGIN_TEMPLATE_EXPORT extern
# endif
#else
# define SC_MPLUGIN_API
# define SC_MPLUGIN_TEMPLATE_EXPORT
#endif
#endif

View File

@ -0,0 +1,75 @@
/***************************************************************************
* Copyright (C) GFZ Potsdam *
* All rights reserved. *
* *
* GNU Affero General Public License Usage *
* This file may be used under the terms of the GNU Affero *
* Public License version 3.0 as published by the Free Software Foundation *
* and appearing in the file LICENSE included in the packaging of this *
* file. Please review the following information to ensure the GNU Affero *
* Public License version 3.0 requirements will be met: *
* https://www.gnu.org/licenses/agpl-3.0.html. *
***************************************************************************/
#ifndef SEISCOMP_APPLICATIONS_MONITOROUTPLUGININTERFACE_H__
#define SEISCOMP_APPLICATIONS_MONITOROUTPLUGININTERFACE_H__
#include <string>
#include <seiscomp/core/baseobject.h>
#include <seiscomp/core/interfacefactory.h>
#include <seiscomp/config/config.h>
#include <seiscomp/plugins/monitor/api.h>
#include <seiscomp/plugins/monitor/types.h>
namespace Seiscomp {
namespace Applications {
DEFINE_SMARTPOINTER(MonitorOutPluginInterface);
class SC_MPLUGIN_API MonitorOutPluginInterface : public Seiscomp::Core::BaseObject {
DECLARE_SC_CLASS(MonitorOutPluginInterface);
// ----------------------------------------------------------------------
// X'struction
// ----------------------------------------------------------------------
public:
MonitorOutPluginInterface(const std::string& name);
virtual ~MonitorOutPluginInterface() {}
// ----------------------------------------------------------------------
// Public interface
// ----------------------------------------------------------------------
public:
virtual bool initOut(const Config::Config &cfg) = 0;
virtual bool deinitOut() = 0;
virtual bool print(const ClientTable& table) = 0;
virtual bool refreshOut() = 0;
virtual bool clearOut() = 0;
const std::string& name() const;
static MonitorOutPluginInterface* Create(const std::string& service);
// ----------------------------------------------------------------------
// Private data members
// ---------------------------------------------------------------------
private:
std::string _name;
};
DEFINE_INTERFACE_FACTORY(MonitorOutPluginInterface);
#define REGISTER_MONITOR_OUT_PLUGIN_INTERFACE(Class, Service) \
Seiscomp::Core::Generic::InterfaceFactory<Seiscomp::Applications::MonitorOutPluginInterface, Class> __##Class##InterfaceFactory__(Service)
} // namespace Applications
} // namespace Seiscomp
#endif

View File

@ -0,0 +1,116 @@
/***************************************************************************
* Copyright (C) GFZ Potsdam *
* All rights reserved. *
* *
* GNU Affero General Public License Usage *
* This file may be used under the terms of the GNU Affero *
* Public License version 3.0 as published by the Free Software Foundation *
* and appearing in the file LICENSE included in the packaging of this *
* file. Please review the following information to ensure the GNU Affero *
* Public License version 3.0 requirements will be met: *
* https://www.gnu.org/licenses/agpl-3.0.html. *
***************************************************************************/
#ifndef SEISCOMP_APPLICATIONS_MONITORPLUGININTERFACE_H__
#define SEISCOMP_APPLICATIONS_MONITORPLUGININTERFACE_H__
#include <map>
#include <vector>
#include <string>
#include <seiscomp/core/baseobject.h>
#include <seiscomp/core/interfacefactory.h>
#include <seiscomp/config/config.h>
#include <seiscomp/plugins/monitor/api.h>
#include <seiscomp/plugins/monitor/types.h>
namespace Seiscomp {
namespace Applications {
SC_MPLUGIN_API bool findName(ClientInfoData clientData, std::string name);
DEFINE_SMARTPOINTER(MonitorPluginInterface);
class MFilterParser;
class MFilterInterface;
class SC_MPLUGIN_API MonitorPluginInterface : public Seiscomp::Core::BaseObject {
DECLARE_SC_CLASS(MonitorPluginInterface);
// ----------------------------------------------------------------------
// X'struction
// ----------------------------------------------------------------------
public:
MonitorPluginInterface(const std::string& name);
virtual ~MonitorPluginInterface();
// ----------------------------------------------------------------------
// Public interface
// ----------------------------------------------------------------------
public:
static MonitorPluginInterface *Create(const std::string &service);
virtual bool init(const Config::Config &cfg);
virtual void process(const ClientTable &clientTable) = 0;
bool initFilter(const Config::Config &cfg);
bool operational() const;
bool isFilteringEnabled() const;
void setOperational(bool val);
const std::string &filterString() const;
const ClientTable *filter(const ClientTable& clientTable);
const ClientTable *filterMean(const ClientTable& clientTable);
void setFilterMeanInterval(double interval);
const ClientTable *match() const;
const std::string &name() const;
// ----------------------------------------------------------------------
// Private interface
// ----------------------------------------------------------------------
private:
template <Client::Status::ETag tag>
void sumData(ClientInfoData &lhs, const ClientInfoData &rhs);
template <Client::Status::ETag tag>
void calculateMean(ClientInfoData &lhs, size_t count);
// ----------------------------------------------------------------------
// Private members
// ----------------------------------------------------------------------
private:
Core::TimeSpan _filterMeanInterval;
Core::Time _filterMeanTimeMark;
ClientTable _filterMeanClientTable;
std::map<std::string, size_t> _filterMeanMessageCount;
ClientTable _match;
std::string _name;
bool _operational;
bool _isFilteringEnabled;
std::string _filterStr;
MFilterParser *_mFilterParser;
MFilterInterface *_filter;
};
DEFINE_INTERFACE_FACTORY(MonitorPluginInterface);
#define REGISTER_MONITOR_PLUGIN_INTERFACE(Class, Service) \
Seiscomp::Core::Generic::InterfaceFactory<Seiscomp::Applications::MonitorPluginInterface, Class> __##Class##InterfaceFactory__(Service)
} // namespace Applications
} // namespace Seiscomp
#endif

View File

@ -0,0 +1,73 @@
/***************************************************************************
* Copyright (C) GFZ Potsdam *
* All rights reserved. *
* *
* GNU Affero General Public License Usage *
* This file may be used under the terms of the GNU Affero *
* Public License version 3.0 as published by the Free Software Foundation *
* and appearing in the file LICENSE included in the packaging of this *
* file. Please review the following information to ensure the GNU Affero *
* Public License version 3.0 requirements will be met: *
* https://www.gnu.org/licenses/agpl-3.0.html. *
***************************************************************************/
#ifndef SEISCOMP_APPLICATIONS_TYPES_H__
#define SEISCOMP_APPLICATIONS_TYPES_H__
#include <map>
#include <list>
#include <seiscomp/messaging/status.h>
namespace Seiscomp {
namespace Applications {
typedef std::map<Client::Status::Tag, std::string> ClientInfoData;
struct ClientTableEntry {
ClientTableEntry(const ClientInfoData &data)
: info(data), processed(false), printed(false) {}
ClientTableEntry(const Client::Status &status)
: processed(false), printed(false) {
*this = status;
}
ClientTableEntry &operator=(const ClientInfoData &data) {
if ( info != data ) {
info = data;
processed = false;
printed = false;
}
return *this;
}
ClientTableEntry &operator=(const Client::Status &status) {
ClientInfoData data;
for ( int i = 0; i < Client::Status::ETagQuantity; ++i ) {
Client::Status::Tag tag;
if ( !status.values[i].empty() ) {
tag.fromInt(i);
data[tag] = status.values[i];
}
}
return *this = data;
}
operator ClientInfoData &() { return info; }
operator const ClientInfoData &() const { return info; }
ClientInfoData info; //! The client information
bool processed; //! Has this entry already been seen by a plugin?
bool printed; //! Has this entry already been seen by an output
//! plugin?
};
typedef std::list<ClientTableEntry> ClientTable;
} // namespace Applications
} // namespace Seiscomp
#endif