mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
53 lines
1 KiB
C++
53 lines
1 KiB
C++
/* Common entry point for all villas command line tools.
|
|
*
|
|
* Author: Steffen Vogel <post@steffenvogel.de>
|
|
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <villas/colors.hpp>
|
|
#include <villas/config.hpp>
|
|
#include <villas/exceptions.hpp>
|
|
#include <villas/log.hpp>
|
|
#include <villas/utils.hpp>
|
|
|
|
namespace villas {
|
|
|
|
class Tool {
|
|
|
|
protected:
|
|
Logger logger;
|
|
|
|
int argc;
|
|
char **argv;
|
|
|
|
std::string name;
|
|
|
|
static Tool *current_tool;
|
|
|
|
static void staticHandler(int signal, siginfo_t *sinfo, void *ctx);
|
|
|
|
virtual void handler(int, siginfo_t *, void *) {}
|
|
|
|
std::list<int> handlerSignals;
|
|
|
|
static void printCopyright();
|
|
|
|
static void printVersion();
|
|
|
|
public:
|
|
Tool(int ac, char *av[], const std::string &name,
|
|
const std::list<int> &sigs = {});
|
|
|
|
virtual int main() { return 0; }
|
|
|
|
virtual void usage() {}
|
|
|
|
virtual void parse() {}
|
|
|
|
virtual int run();
|
|
};
|
|
|
|
} // namespace villas
|