Files
hayodea 8836ab470b Wire comparator CLI, marionette threading model, and final load order.
Initialize SmoThreadingModelDesc from marionette before body startup, load
comparator libs before stimbuff via -c/--comparator-lib, and drop the hardcoded
libcomparatorCore.so load path.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 21:17:52 -04:00

68 lines
1.5 KiB
C++

#ifndef OPTS_H
#define OPTS_H
#include <vector>
#include <string>
#include <getopt.h>
#include <stdexcept>
#include <exception>
// Define a class to hold the options and parse arguments
class OptionParser
{
public:
OptionParser() : verbose(false), printUsage(false), traceCallables(false)
{}
~OptionParser() = default;
void parseArguments(int argc, char *argv[], char **envp);
std::string stringifyOptions(void) const;
std::string getUsage() const;
static OptionParser &getOptions(void)
{
static OptionParser options;
return options;
}
public:
class Exception : public std::exception
{
public:
explicit Exception(std::string message_);
~Exception() override = default;
const char* what() const noexcept override;
protected:
std::string message;
};
std::string argv0;
std::vector<std::string> senseApiLibPath;
std::vector<std::string> senseApiLibs;
std::vector<std::string> comparatorLibs;
std::string dapSpecs;
std::vector<std::string> dapSpecFiles;
bool verbose, printUsage, traceCallables;
static struct option longOptions[];
};
class OptionsParserError
: public OptionParser::Exception
{
public:
OptionsParserError(
const std::string& errorMessage, const OptionParser& parser);
};
class JustPrintUsageNoError
: public OptionParser::Exception
{
public:
explicit JustPrintUsageNoError(const OptionParser& parser);
};
#endif // OPTS_H