1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fix whitespaces

This commit is contained in:
Steffen Vogel 2021-06-18 14:28:31 -04:00
parent ac20c63f39
commit d53547934c
5 changed files with 62 additions and 47 deletions

View file

@ -66,37 +66,35 @@ public:
Request(Session *s) :
session(s),
logger(logging.get("api:request")),
method(Session::Method::UNKNOWN),
contentLength(0),
body(nullptr),
factory(nullptr)
{ }
virtual ~Request()
virtual
~Request()
{
if (body)
json_decref(body);
}
virtual void
prepare()
virtual
void prepare()
{ }
virtual Response *
execute() = 0;
virtual
Response * execute() = 0;
virtual void
decode();
virtual
void decode();
const std::string &
getMatch(int idx) const
const std::string & getMatch(int idx) const
{
return matches[idx];
}
std::string
getQueryArg(const std::string &arg)
std::string getQueryArg(const std::string &arg)
{
char buf[1024];
const char *val;
@ -106,8 +104,7 @@ public:
return val ? std::string(val) : std::string();
}
std::string
getHeader(enum lws_token_indexes hdr)
std::string getHeader(enum lws_token_indexes hdr)
{
char buf[1024];
@ -116,6 +113,8 @@ public:
return std::string(buf);
}
virtual
std::string toString();
void setLogger(Logger log)
{ logger = log; }
@ -126,14 +125,14 @@ class RequestFactory : public plugin::Plugin {
public:
using plugin::Plugin::Plugin;
virtual bool
match(const std::string &uri, std::smatch &m) const = 0;
virtual
bool match(const std::string &uri, std::smatch &m) const = 0;
virtual Request *
make(Session *s) = 0;
virtual
Request * make(Session *s) = 0;
static Request *
create(Session *s, const std::string &uri, Session::Method meth, unsigned long ct);
static
Request * create(Session *s, const std::string &uri, Session::Method meth, unsigned long ct);
virtual
std::string

View file

@ -35,9 +35,7 @@ class Format {
protected:
int flags; /**< A set of flags which is automatically used. */
int real_precision; /**< Number of digits used for floatint point numbers */
bool destroy_signals;
Logger logger;
@ -52,7 +50,11 @@ protected:
public:
Format(int fl);
virtual bool isBinaryPayload()
virtual
~Format();
virtual
bool isBinaryPayload()
{ return false; }
struct vlist * getSignals() const
@ -67,13 +69,18 @@ public:
void start(struct vlist *sigs, int fl = (int) SampleFlags::HAS_ALL);
void start(const std::string &dtypes, int fl = (int) SampleFlags::HAS_ALL);
virtual void start()
virtual
void start()
{ }
virtual void parse(json_t *json);
virtual
void parse(json_t *json);
virtual int print(FILE *f, const struct sample * const smps[], unsigned cnt);
virtual int scan(FILE *f, struct sample * const smps[], unsigned cnt);
virtual
int print(FILE *f, const struct sample * const smps[], unsigned cnt);
virtual
int scan(FILE *f, struct sample * const smps[], unsigned cnt);
/** Print \p cnt samples from \p smps into buffer \p buf of length \p len.
*
@ -86,7 +93,8 @@ public:
* @retval >=0 The number of samples from \p smps which have been written into \p buf.
* @retval <0 Something went wrong.
*/
virtual int sprint(char *buf, size_t len, size_t *wbytes, const struct sample * const smps[], unsigned cnt) = 0;
virtual
int sprint(char *buf, size_t len, size_t *wbytes, const struct sample * const smps[], unsigned cnt) = 0;
/** Parse samples from the buffer \p buf with a length of \p len bytes.
*
@ -99,7 +107,8 @@ public:
* @retval >=0 The number of samples which have been parsed from \p buf and written into \p smps.
* @retval <0 Something went wrong.
*/
virtual int sscan(const char *buf, size_t len, size_t *rbytes, struct sample * const smps[], unsigned cnt) = 0;
virtual
int sscan(const char *buf, size_t len, size_t *rbytes, struct sample * const smps[], unsigned cnt) = 0;
/* Wrappers for sending a (un)parsing single samples */
@ -138,7 +147,8 @@ class FormatFactory : public plugin::Plugin {
public:
using plugin::Plugin::Plugin;
virtual Format * make() = 0;
virtual
Format * make() = 0;
static
Format * make(json_t *json);

View file

@ -76,16 +76,21 @@ protected:
public:
Hook(struct vpath *p, struct vnode *n, int fl, int prio, bool en = true);
virtual ~Hook();
virtual void parse(json_t *c);
virtual
~Hook();
virtual
void parse(json_t *c);
void prepare(struct vlist *sigs);
void setLogger(Logger log)
{ logger = log; }
/** Called whenever a hook is started; before threads are created. */
virtual void start()
virtual
void start()
{
assert(state == State::PREPARED);
@ -93,37 +98,43 @@ public:
}
/** Called whenever a hook is stopped; after threads are destoyed. */
virtual void stop()
virtual
void stop()
{
assert(state == State::STARTED);
state = State::STOPPED;
}
virtual void check()
virtual
void check()
{
assert(state == State::PARSED);
state = State::CHECKED;
}
virtual void prepare()
virtual
void prepare()
{ }
/** Called periodically. Period is set by global 'stats' option in the configuration file. */
virtual void periodic()
virtual
void periodic()
{
assert(state == State::STARTED);
}
/** Called whenever a new simulation case is started. This is detected by a sequence no equal to zero. */
virtual void restart()
virtual
void restart()
{
assert(state == State::STARTED);
}
/** Called whenever a sample is processed. */
virtual Reason process(struct sample *smp)
virtual
Reason process(struct sample *smp)
{
return Reason::OK;
};
@ -138,7 +149,8 @@ public:
return flags;
}
virtual struct vlist * getSignals()
virtual
struct vlist * getSignals()
{
return &signals;
}
@ -208,22 +220,18 @@ public:
return h;
}
/// Get plugin name
virtual std::string
getName() const
{ return name; }
/// Get plugin description
virtual std::string
getDescription() const
{ return desc; }
/// Get hook flags
virtual int
getFlags() const
{ return flags; }
/// Get hook priority
virtual int
getPriority() const
{ return prio; }

View file

@ -35,8 +35,7 @@ void Request::decode()
throw BadRequest("Failed to decode request payload");
}
std::string
Request::toString()
std::string Request::toString()
{
return fmt::format("endpoint={}, method={}", factory->getName(), Session::methodToString(method));
}

View file

@ -344,7 +344,6 @@ int signal_generator_read(struct vnode *n, struct sample * const smps[], unsigne
steps = 1;
}
double running = time_delta(&s->started, &ts);
t->flags = (int) SampleFlags::HAS_TS_ORIGIN | (int) SampleFlags::HAS_DATA | (int) SampleFlags::HAS_SEQUENCE;