mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
graphviz: workaround nameclash
This commit is contained in:
parent
9c2c99696e
commit
ef7b2f7f91
23 changed files with 110 additions and 111 deletions
|
@ -34,7 +34,7 @@
|
|||
#include <villas/exceptions.hpp>
|
||||
|
||||
/* Forward declarations */
|
||||
struct path;
|
||||
struct vpath;
|
||||
struct node;
|
||||
struct sample;
|
||||
|
||||
|
@ -67,7 +67,7 @@ protected:
|
|||
int priority; /**< A priority to change the order of execution within one type of hook. */
|
||||
int enabled; /**< Is this hook active? */
|
||||
|
||||
struct path *path;
|
||||
struct vpath *path;
|
||||
struct node *node;
|
||||
|
||||
vlist signals;
|
||||
|
@ -75,7 +75,7 @@ protected:
|
|||
json_t *cfg; /**< A JSON object containing the configuration of the hook. */
|
||||
|
||||
public:
|
||||
Hook(struct path *p, struct node *n, int fl, int prio, bool en = true);
|
||||
Hook(struct vpath *p, struct node *n, int fl, int prio, bool en = true);
|
||||
virtual ~Hook();
|
||||
|
||||
virtual void parse(json_t *c);
|
||||
|
@ -189,7 +189,7 @@ public:
|
|||
priority(prio)
|
||||
{ }
|
||||
|
||||
virtual Hook *make(struct path *p, struct node *n) = 0;
|
||||
virtual Hook *make(struct vpath *p, struct node *n) = 0;
|
||||
|
||||
int getFlags()
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ class HookPlugin : public HookFactory {
|
|||
public:
|
||||
using HookFactory::HookFactory;
|
||||
|
||||
virtual Hook *make(struct path *p, struct node *n)
|
||||
virtual Hook *make(struct vpath *p, struct node *n)
|
||||
{
|
||||
return new T(p, n, flags, priority);
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
/* Forward declarations */
|
||||
struct vlist;
|
||||
struct sample;
|
||||
struct path;
|
||||
struct vpath;
|
||||
struct node;
|
||||
|
||||
int hook_list_init(struct vlist *hs);
|
||||
|
@ -57,13 +57,13 @@ int hook_list_destroy(struct vlist *hs);
|
|||
* hooks = [ "print" ]
|
||||
* }
|
||||
*/
|
||||
void hook_list_parse(struct vlist *hs, json_t *cfg, int mask, struct path *p, struct node *n);
|
||||
void hook_list_parse(struct vlist *hs, json_t *cfg, int mask, struct vpath *p, struct node *n);
|
||||
|
||||
void hook_list_prepare(struct vlist *hs, struct vlist *sigs, int mask, struct path *p, struct node *n);
|
||||
void hook_list_prepare(struct vlist *hs, struct vlist *sigs, int mask, struct vpath *p, struct node *n);
|
||||
|
||||
int hook_list_prepare_signals(struct vlist *hs, struct vlist *signals);
|
||||
|
||||
int hook_list_add(struct vlist *hs, int mask, struct path *p, struct node *n);
|
||||
int hook_list_add(struct vlist *hs, int mask, struct vpath *p, struct node *n);
|
||||
|
||||
int hook_list_process(struct vlist *hs, struct sample *smps[], unsigned cnt);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
|||
timespec last;
|
||||
|
||||
public:
|
||||
LimitRateHook(struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
LimitRateHook(struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
LimitHook(p, n, fl, prio, en),
|
||||
mode(LIMIT_RATE_LOCAL)
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ enum class PathMode {
|
|||
};
|
||||
|
||||
/** The datastructure for a path. */
|
||||
struct path {
|
||||
struct vpath {
|
||||
enum State state; /**< Path state. */
|
||||
|
||||
enum PathMode mode; /**< Determines when this path is triggered. */
|
||||
|
@ -68,8 +68,8 @@ struct path {
|
|||
struct sample *last_sample;
|
||||
int last_sequence;
|
||||
|
||||
struct vlist sources; /**< List of all incoming nodes (struct path_source). */
|
||||
struct vlist destinations; /**< List of all outgoing nodes (struct path_destination). */
|
||||
struct vlist sources; /**< List of all incoming nodes (struct vpath_source). */
|
||||
struct vlist destinations; /**< List of all outgoing nodes (struct vpath_destination). */
|
||||
struct vlist mappings; /**< List of all input mappings (struct mapping_entry). */
|
||||
struct vlist hooks; /**< List of processing hooks (struct hook). */
|
||||
struct vlist signals; /**< List of signals which this path creates (struct signal). */
|
||||
|
@ -96,12 +96,12 @@ struct path {
|
|||
};
|
||||
|
||||
/** Initialize internal data structures. */
|
||||
int path_init(struct path *p);
|
||||
int path_init(struct vpath *p);
|
||||
|
||||
int path_prepare(struct path *p);
|
||||
int path_prepare(struct vpath *p);
|
||||
|
||||
/** Check if path configuration is proper. */
|
||||
int path_check(struct path *p);
|
||||
int path_check(struct vpath *p);
|
||||
|
||||
/** Start a path.
|
||||
*
|
||||
|
@ -111,7 +111,7 @@ int path_check(struct path *p);
|
|||
* @retval 0 Success. Everything went well.
|
||||
* @retval <0 Error. Something went wrong.
|
||||
*/
|
||||
int path_start(struct path *p);
|
||||
int path_start(struct vpath *p);
|
||||
|
||||
/** Stop a path.
|
||||
*
|
||||
|
@ -119,19 +119,19 @@ int path_start(struct path *p);
|
|||
* @retval 0 Success. Everything went well.
|
||||
* @retval <0 Error. Something went wrong.
|
||||
*/
|
||||
int path_stop(struct path *p);
|
||||
int path_stop(struct vpath *p);
|
||||
|
||||
/** Destroy path by freeing dynamically allocated memory.
|
||||
*
|
||||
* @param i A pointer to the path structure.
|
||||
*/
|
||||
int path_destroy(struct path *p);
|
||||
int path_destroy(struct vpath *p);
|
||||
|
||||
/** Show some basic statistics for a path.
|
||||
*
|
||||
* @param p A pointer to the path structure.
|
||||
*/
|
||||
void path_print_stats(struct path *p);
|
||||
void path_print_stats(struct vpath *p);
|
||||
|
||||
/** Fills the provided buffer with a string representation of the path.
|
||||
*
|
||||
|
@ -140,13 +140,13 @@ void path_print_stats(struct path *p);
|
|||
* @param p A pointer to the path structure.
|
||||
* @return A pointer to a string containing a textual representation of the path.
|
||||
*/
|
||||
const char * path_name(struct path *p);
|
||||
const char * path_name(struct vpath *p);
|
||||
|
||||
/** Reverse a path */
|
||||
int path_reverse(struct path *p, struct path *r);
|
||||
int path_reverse(struct vpath *p, struct vpath *r);
|
||||
|
||||
/** Check if node is used as source or destination of a path. */
|
||||
int path_uses_node(struct path *p, struct node *n);
|
||||
int path_uses_node(struct vpath *p, struct node *n);
|
||||
|
||||
/** Parse a single path and add it to the global configuration.
|
||||
*
|
||||
|
@ -156,14 +156,14 @@ int path_uses_node(struct path *p, struct node *n);
|
|||
* @retval 0 Success. Everything went well.
|
||||
* @retval <0 Error. Something went wrong.
|
||||
*/
|
||||
int path_parse(struct path *p, json_t *cfg, struct vlist *nodes);
|
||||
int path_parse(struct vpath *p, json_t *cfg, struct vlist *nodes);
|
||||
|
||||
bool path_is_simple(const struct path *p);
|
||||
bool path_is_simple(const struct vpath *p);
|
||||
|
||||
bool path_is_enabled(const struct path *p);
|
||||
bool path_is_enabled(const struct vpath *p);
|
||||
|
||||
bool path_is_reversed(const struct path *p);
|
||||
bool path_is_reversed(const struct vpath *p);
|
||||
|
||||
struct vlist * path_get_signals(struct path *p);
|
||||
struct vlist * path_get_signals(struct vpath *p);
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -32,21 +32,21 @@
|
|||
#include <villas/queue.h>
|
||||
|
||||
/* Forward declarations */
|
||||
struct path;
|
||||
struct vpath;
|
||||
struct sample;
|
||||
|
||||
struct path_destination {
|
||||
struct vpath_destination {
|
||||
struct node *node;
|
||||
|
||||
struct queue queue;
|
||||
};
|
||||
|
||||
int path_destination_init(struct path_destination *pd, int queuelen);
|
||||
int path_destination_init(struct vpath_destination *pd, int queuelen);
|
||||
|
||||
int path_destination_destroy(struct path_destination *pd);
|
||||
int path_destination_destroy(struct vpath_destination *pd);
|
||||
|
||||
void path_destination_enqueue(struct path *p, struct sample *smps[], unsigned cnt);
|
||||
void path_destination_enqueue(struct vpath *p, struct sample *smps[], unsigned cnt);
|
||||
|
||||
void path_destination_write(struct path_destination *pd, struct path *p);
|
||||
void path_destination_write(struct vpath_destination *pd, struct vpath *p);
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -33,10 +33,10 @@
|
|||
#include <villas/list.h>
|
||||
|
||||
/* Forward declarations */
|
||||
struct path;
|
||||
struct vpath;
|
||||
struct sample;
|
||||
|
||||
struct path_source {
|
||||
struct vpath_source {
|
||||
struct node *node;
|
||||
|
||||
bool masked;
|
||||
|
@ -45,10 +45,10 @@ struct path_source {
|
|||
struct vlist mappings; /**< List of mappings (struct mapping_entry). */
|
||||
};
|
||||
|
||||
int path_source_init(struct path_source *ps);
|
||||
int path_source_init(struct vpath_source *ps);
|
||||
|
||||
int path_source_destroy(struct path_source *ps);
|
||||
int path_source_destroy(struct vpath_source *ps);
|
||||
|
||||
int path_source_read(struct path_source *ps, struct path *p, int i);
|
||||
int path_source_read(struct vpath_source *ps, struct vpath *p, int i);
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
struct vlist *paths = session->getSuperNode()->getPaths();
|
||||
|
||||
for (size_t i = 0; i < vlist_length(paths); i++) {
|
||||
struct path *p = (struct path *) vlist_at(paths, i);
|
||||
struct vpath *p = (struct vpath *) vlist_at(paths, i);
|
||||
|
||||
json_t *json_path = json_pack("{ s: i }",
|
||||
"state", p->state
|
||||
|
|
|
@ -38,7 +38,7 @@ const char *hook_reasons[] = {
|
|||
using namespace villas;
|
||||
using namespace villas::node;
|
||||
|
||||
Hook::Hook(struct path *p, struct node *n, int fl, int prio, bool en) :
|
||||
Hook::Hook(struct vpath *p, struct node *n, int fl, int prio, bool en) :
|
||||
state(State::INITIALIZED),
|
||||
flags(fl),
|
||||
priority(prio),
|
||||
|
|
|
@ -58,7 +58,7 @@ int hook_list_destroy(vlist *hs)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void hook_list_parse(vlist *hs, json_t *cfg, int mask, struct path *o, struct node *n)
|
||||
void hook_list_parse(vlist *hs, json_t *cfg, int mask, struct vpath *o, struct node *n)
|
||||
{
|
||||
if (!json_is_array(cfg))
|
||||
throw ConfigError(cfg, "node-config-hook", "Hooks must be configured as a list of hook objects");
|
||||
|
@ -100,7 +100,7 @@ static int hook_is_enabled(const Hook *h)
|
|||
return h->isEnabled() ? 0 : -1;
|
||||
}
|
||||
|
||||
void hook_list_prepare(vlist *hs, vlist *sigs, int m, struct path *p, struct node *n)
|
||||
void hook_list_prepare(vlist *hs, vlist *sigs, int m, struct vpath *p, struct node *n)
|
||||
{
|
||||
assert(hs->state == State::INITIALIZED);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ protected:
|
|||
vlist signal_names;
|
||||
|
||||
public:
|
||||
AverageHook(struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
AverageHook(struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
Hook(p, n, fl, prio, en)
|
||||
{
|
||||
int ret;
|
||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
|||
char *new_unit;
|
||||
|
||||
public:
|
||||
CastHook(struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
CastHook(struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
Hook(p, n, fl, prio, en),
|
||||
signal_index(-1),
|
||||
signal_name(nullptr),
|
||||
|
|
|
@ -116,7 +116,7 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
DPHook(struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
DPHook(struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
Hook(p, n, fl, prio, en),
|
||||
inverse(0)
|
||||
{ }
|
||||
|
|
|
@ -58,7 +58,7 @@ protected:
|
|||
timespec startTime;
|
||||
|
||||
public:
|
||||
GateHook(struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
GateHook(struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
Hook(p, n, fl, prio, en),
|
||||
mode(Mode::RISING_EDGE),
|
||||
threshold(0.5),
|
||||
|
|
|
@ -50,7 +50,7 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
JitterCalcHook(struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
JitterCalcHook(struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
Hook(p, n, fl, prio, en)
|
||||
{
|
||||
size_t sz = GPS_NTP_DELAY_WIN_SIZE;
|
||||
|
|
|
@ -46,7 +46,7 @@ protected:
|
|||
timespec realTime;
|
||||
|
||||
public:
|
||||
PpsTsHook(struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
PpsTsHook(struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
Hook(p, n, fl, prio, en),
|
||||
lastValue(0),
|
||||
thresh(1.5),
|
||||
|
|
|
@ -45,7 +45,7 @@ protected:
|
|||
char *uri;
|
||||
|
||||
public:
|
||||
PrintHook(struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
PrintHook(struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
Hook(p, n, fl, prio, en),
|
||||
prefix(nullptr),
|
||||
uri(nullptr)
|
||||
|
|
|
@ -42,7 +42,7 @@ protected:
|
|||
double offset;
|
||||
|
||||
public:
|
||||
ScaleHook(struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
ScaleHook(struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
Hook(p, n, fl, prio, en),
|
||||
scale(1),
|
||||
offset(0)
|
||||
|
|
|
@ -43,7 +43,7 @@ protected:
|
|||
} mode;
|
||||
|
||||
public:
|
||||
ShiftTimestampHook(struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
ShiftTimestampHook(struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
Hook(p, n, fl, prio, en),
|
||||
mode(SHIFT_ORIGIN)
|
||||
{ }
|
||||
|
|
|
@ -45,7 +45,7 @@ protected:
|
|||
StatsHook *parent;
|
||||
|
||||
public:
|
||||
StatsWriteHook(StatsHook *pa, struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
StatsWriteHook(StatsHook *pa, struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
Hook(p, n, fl, prio, en),
|
||||
parent(pa)
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ protected:
|
|||
StatsHook *parent;
|
||||
|
||||
public:
|
||||
StatsReadHook(StatsHook *pa, struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
StatsReadHook(StatsHook *pa, struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
Hook(p, n, fl, prio, en),
|
||||
parent(pa)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
StatsHook(struct path *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
StatsHook(struct vpath *p, struct node *n, int fl, int prio, bool en = true) :
|
||||
Hook(p, n, fl, prio, en),
|
||||
format(Stats::Format::HUMAN),
|
||||
verbose(0),
|
||||
|
|
74
lib/path.cpp
74
lib/path.cpp
|
@ -51,8 +51,8 @@ using namespace villas::utils;
|
|||
static void * path_run_single(void *arg)
|
||||
{
|
||||
int ret;
|
||||
struct path *p = (struct path *) arg;
|
||||
struct path_source *ps = (struct path_source *) vlist_at(&p->sources, 0);
|
||||
struct vpath *p = (struct vpath *) arg;
|
||||
struct vpath_source *ps = (struct vpath_source *) vlist_at(&p->sources, 0);
|
||||
|
||||
while (p->state == State::STARTED) {
|
||||
pthread_testcancel();
|
||||
|
@ -62,7 +62,7 @@ static void * path_run_single(void *arg)
|
|||
continue;
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = (struct path_destination *) vlist_at(&p->destinations, i);
|
||||
struct vpath_destination *pd = (struct vpath_destination *) vlist_at(&p->destinations, i);
|
||||
|
||||
path_destination_write(pd, p);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ static void * path_run_single(void *arg)
|
|||
static void * path_run_poll(void *arg)
|
||||
{
|
||||
int ret;
|
||||
struct path *p = (struct path *) arg;
|
||||
struct vpath *p = (struct vpath *) arg;
|
||||
|
||||
while (p->state == State::STARTED) {
|
||||
ret = poll(p->reader.pfds, p->reader.nfds, -1);
|
||||
|
@ -85,7 +85,7 @@ static void * path_run_poll(void *arg)
|
|||
p->logger->debug("Path {} returned from poll(2)", path_name(p));
|
||||
|
||||
for (int i = 0; i < p->reader.nfds; i++) {
|
||||
struct path_source *ps = (struct path_source *) vlist_at(&p->sources, i);
|
||||
struct vpath_source *ps = (struct vpath_source *) vlist_at(&p->sources, i);
|
||||
|
||||
if (p->reader.pfds[i].revents & POLLIN) {
|
||||
/* Timeout: re-enqueue the last sample */
|
||||
|
@ -103,7 +103,7 @@ static void * path_run_poll(void *arg)
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = (struct path_destination *) vlist_at(&p->destinations, i);
|
||||
struct vpath_destination *pd = (struct vpath_destination *) vlist_at(&p->destinations, i);
|
||||
|
||||
path_destination_write(pd, p);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ static void * path_run_poll(void *arg)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
int path_init(struct path *p)
|
||||
int path_init(struct vpath *p)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -165,7 +165,7 @@ int path_init(struct path *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int path_prepare_poll(struct path *p)
|
||||
static int path_prepare_poll(struct vpath *p)
|
||||
{
|
||||
int fds[16], ret, n = 0, m;
|
||||
|
||||
|
@ -176,7 +176,7 @@ static int path_prepare_poll(struct path *p)
|
|||
p->reader.nfds = 0;
|
||||
|
||||
for (unsigned i = 0; i < vlist_length(&p->sources); i++) {
|
||||
struct path_source *ps = (struct path_source *) vlist_at(&p->sources, i);
|
||||
struct vpath_source *ps = (struct vpath_source *) vlist_at(&p->sources, i);
|
||||
|
||||
m = node_poll_fds(ps->node, fds);
|
||||
if (m < 0)
|
||||
|
@ -217,7 +217,7 @@ static int path_prepare_poll(struct path *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int path_prepare(struct path *p)
|
||||
int path_prepare(struct vpath *p)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -228,7 +228,7 @@ int path_prepare(struct path *p)
|
|||
unsigned pool_size = MAX(1UL, vlist_length(&p->destinations)) * p->queuelen;
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = (struct path_destination *) vlist_at(&p->destinations, i);
|
||||
struct vpath_destination *pd = (struct vpath_destination *) vlist_at(&p->destinations, i);
|
||||
|
||||
if (node_type(pd->node)->pool_size > pool_size)
|
||||
pool_size = node_type(pd->node)->pool_size;
|
||||
|
@ -247,7 +247,7 @@ int path_prepare(struct path *p)
|
|||
return ret;
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&p->sources); i++) {
|
||||
struct path_source *ps = (struct path_source *) vlist_at(&p->sources, i);
|
||||
struct vpath_source *ps = (struct vpath_source *) vlist_at(&p->sources, i);
|
||||
|
||||
ret = path_source_init(ps);
|
||||
if (ret)
|
||||
|
@ -309,7 +309,7 @@ int path_prepare(struct path *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int path_parse(struct path *p, json_t *cfg, struct vlist *nodes)
|
||||
int path_parse(struct vpath *p, json_t *cfg, struct vlist *nodes)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -370,11 +370,11 @@ int path_parse(struct path *p, json_t *cfg, struct vlist *nodes)
|
|||
|
||||
for (size_t i = 0; i < vlist_length(&p->mappings); i++) {
|
||||
struct mapping_entry *me = (struct mapping_entry *) vlist_at(&p->mappings, i);
|
||||
struct path_source *ps = nullptr;
|
||||
struct vpath_source *ps = nullptr;
|
||||
|
||||
/* Check if there is already a path_source for this source */
|
||||
for (size_t j = 0; j < vlist_length(&p->sources); j++) {
|
||||
struct path_source *pt = (struct path_source *) vlist_at(&p->sources, j);
|
||||
struct vpath_source *pt = (struct vpath_source *) vlist_at(&p->sources, j);
|
||||
|
||||
if (pt->node == me->node) {
|
||||
ps = pt;
|
||||
|
@ -384,7 +384,7 @@ int path_parse(struct path *p, json_t *cfg, struct vlist *nodes)
|
|||
|
||||
/* Create new path_source of not existing */
|
||||
if (!ps) {
|
||||
ps = new struct path_source;
|
||||
ps = new struct vpath_source;
|
||||
|
||||
ps->node = me->node;
|
||||
ps->masked = false;
|
||||
|
@ -407,7 +407,7 @@ int path_parse(struct path *p, json_t *cfg, struct vlist *nodes)
|
|||
for (size_t i = 0; i < vlist_length(&destinations); i++) {
|
||||
struct node *n = (struct node *) vlist_at(&destinations, i);
|
||||
|
||||
auto *pd = new struct path_destination;
|
||||
auto *pd = new struct vpath_destination;
|
||||
|
||||
pd->node = n;
|
||||
|
||||
|
@ -431,7 +431,7 @@ int path_parse(struct path *p, json_t *cfg, struct vlist *nodes)
|
|||
json_array_foreach(json_mask, i, json_entry) {
|
||||
const char *name;
|
||||
struct node *node;
|
||||
struct path_source *ps = nullptr;
|
||||
struct vpath_source *ps = nullptr;
|
||||
|
||||
name = json_string_value(json_entry);
|
||||
if (!name) {
|
||||
|
@ -447,7 +447,7 @@ int path_parse(struct path *p, json_t *cfg, struct vlist *nodes)
|
|||
|
||||
/* Search correspondending path_source to node */
|
||||
for (size_t i = 0; i < vlist_length(&p->sources); i++) {
|
||||
struct path_source *pt = (struct path_source *) vlist_at(&p->sources, i);
|
||||
struct vpath_source *pt = (struct vpath_source *) vlist_at(&p->sources, i);
|
||||
|
||||
if (pt->node == node) {
|
||||
ps = pt;
|
||||
|
@ -466,7 +466,7 @@ int path_parse(struct path *p, json_t *cfg, struct vlist *nodes)
|
|||
/* Enable all by default */
|
||||
else {
|
||||
for (size_t i = 0; i < vlist_length(&p->sources); i++) {
|
||||
struct path_source *ps = (struct path_source *) vlist_at(&p->sources, i);
|
||||
struct vpath_source *ps = (struct vpath_source *) vlist_at(&p->sources, i);
|
||||
|
||||
ps->masked = true;
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ int path_parse(struct path *p, json_t *cfg, struct vlist *nodes)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int path_check(struct path *p)
|
||||
int path_check(struct vpath *p)
|
||||
{
|
||||
assert(p->state != State::DESTROYED);
|
||||
|
||||
|
@ -511,7 +511,7 @@ int path_check(struct path *p)
|
|||
if (p->rate <= 0) {
|
||||
/* Check that all path sources provide a file descriptor for polling */
|
||||
for (size_t i = 0; i < vlist_length(&p->sources); i++) {
|
||||
struct path_source *ps = (struct path_source *) vlist_at(&p->sources, i);
|
||||
struct vpath_source *ps = (struct vpath_source *) vlist_at(&p->sources, i);
|
||||
|
||||
if (!node_type(ps->node)->poll_fds) {
|
||||
p->logger->error("Node {} can not be used in polling mode with path {}", node_name(ps->node), path_name(p));
|
||||
|
@ -535,7 +535,7 @@ int path_check(struct path *p)
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&p->sources); i++) {
|
||||
struct path_source *ps = (struct path_source *) vlist_at(&p->sources, i);
|
||||
struct vpath_source *ps = (struct vpath_source *) vlist_at(&p->sources, i);
|
||||
|
||||
if (!node_type(ps->node)->read) {
|
||||
p->logger->error("Node {} is not supported as a source for path {}", node_name(ps->node), path_name(p));
|
||||
|
@ -544,7 +544,7 @@ int path_check(struct path *p)
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = (struct path_destination *) vlist_at(&p->destinations, i);
|
||||
struct vpath_destination *pd = (struct vpath_destination *) vlist_at(&p->destinations, i);
|
||||
|
||||
if (!node_type(pd->node)->write) {
|
||||
p->logger->error("Destiation node {} is not supported as a sink for path ", node_name(pd->node), path_name(p));
|
||||
|
@ -562,7 +562,7 @@ int path_check(struct path *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int path_start(struct path *p)
|
||||
int path_start(struct vpath *p)
|
||||
{
|
||||
int ret;
|
||||
const char *mode;
|
||||
|
@ -647,7 +647,7 @@ int path_start(struct path *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int path_stop(struct path *p)
|
||||
int path_stop(struct vpath *p)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -682,7 +682,7 @@ int path_stop(struct path *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int path_destroy(struct path *p)
|
||||
int path_destroy(struct vpath *p)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -735,13 +735,13 @@ int path_destroy(struct path *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
const char * path_name(struct path *p)
|
||||
const char * path_name(struct vpath *p)
|
||||
{
|
||||
if (!p->_name) {
|
||||
strcatf(&p->_name, "[");
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&p->sources); i++) {
|
||||
struct path_source *ps = (struct path_source *) vlist_at(&p->sources, i);
|
||||
struct vpath_source *ps = (struct vpath_source *) vlist_at(&p->sources, i);
|
||||
|
||||
strcatf(&p->_name, " %s", node_name_short(ps->node));
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ const char * path_name(struct path *p)
|
|||
strcatf(&p->_name, " ] " CLR_MAG("=>") " [");
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = (struct path_destination *) vlist_at(&p->destinations, i);
|
||||
struct vpath_destination *pd = (struct vpath_destination *) vlist_at(&p->destinations, i);
|
||||
|
||||
strcatf(&p->_name, " %s", node_name_short(pd->node));
|
||||
}
|
||||
|
@ -760,17 +760,17 @@ const char * path_name(struct path *p)
|
|||
return p->_name;
|
||||
}
|
||||
|
||||
int path_uses_node(struct path *p, struct node *n)
|
||||
int path_uses_node(struct vpath *p, struct node *n)
|
||||
{
|
||||
for (size_t i = 0; i < vlist_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = (struct path_destination *) vlist_at(&p->destinations, i);
|
||||
struct vpath_destination *pd = (struct vpath_destination *) vlist_at(&p->destinations, i);
|
||||
|
||||
if (pd->node == n)
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&p->sources); i++) {
|
||||
struct path_source *ps = (struct path_source *) vlist_at(&p->sources, i);
|
||||
struct vpath_source *ps = (struct vpath_source *) vlist_at(&p->sources, i);
|
||||
|
||||
if (ps->node == n)
|
||||
return 0;
|
||||
|
@ -779,7 +779,7 @@ int path_uses_node(struct path *p, struct node *n)
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool path_is_simple(const struct path *p)
|
||||
bool path_is_simple(const struct vpath *p)
|
||||
{
|
||||
int ret;
|
||||
const char *in = nullptr, *out = nullptr;
|
||||
|
@ -800,17 +800,17 @@ bool path_is_simple(const struct path *p)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool path_is_enabled(const struct path *p)
|
||||
bool path_is_enabled(const struct vpath *p)
|
||||
{
|
||||
return p->enabled;
|
||||
}
|
||||
|
||||
bool path_is_reversed(const struct path *p)
|
||||
bool path_is_reversed(const struct vpath *p)
|
||||
{
|
||||
return p->reverse;
|
||||
}
|
||||
|
||||
struct vlist * path_get_signals(struct path *p)
|
||||
struct vlist * path_get_signals(struct vpath *p)
|
||||
{
|
||||
return &p->signals;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <villas/path.h>
|
||||
#include <villas/path_destination.h>
|
||||
|
||||
int path_destination_init(struct path_destination *pd, int queuelen)
|
||||
int path_destination_init(struct vpath_destination *pd, int queuelen)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -38,7 +38,7 @@ int path_destination_init(struct path_destination *pd, int queuelen)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int path_destination_destroy(struct path_destination *pd)
|
||||
int path_destination_destroy(struct vpath_destination *pd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -49,7 +49,7 @@ int path_destination_destroy(struct path_destination *pd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void path_destination_enqueue(struct path *p, struct sample *smps[], unsigned cnt)
|
||||
void path_destination_enqueue(struct vpath *p, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
unsigned enqueued, cloned;
|
||||
|
||||
|
@ -60,7 +60,7 @@ void path_destination_enqueue(struct path *p, struct sample *smps[], unsigned cn
|
|||
p->logger->warn("Pool underrun in path {}", path_name(p));
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = (struct path_destination *) vlist_at(&p->destinations, i);
|
||||
struct vpath_destination *pd = (struct vpath_destination *) vlist_at(&p->destinations, i);
|
||||
|
||||
enqueued = queue_push_many(&pd->queue, (void **) clones, cloned);
|
||||
if (enqueued != cnt)
|
||||
|
@ -75,7 +75,7 @@ void path_destination_enqueue(struct path *p, struct sample *smps[], unsigned cn
|
|||
sample_decref_many(clones, cloned);
|
||||
}
|
||||
|
||||
void path_destination_write(struct path_destination *pd, struct path *p)
|
||||
void path_destination_write(struct vpath_destination *pd, struct vpath *p)
|
||||
{
|
||||
int cnt = pd->node->out.vectorize;
|
||||
int sent;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <villas/path_destination.h>
|
||||
#include <villas/path_source.h>
|
||||
|
||||
int path_source_init(struct path_source *ps)
|
||||
int path_source_init(struct vpath_source *ps)
|
||||
{
|
||||
int ret;
|
||||
int pool_size = MAX(DEFAULT_QUEUE_LENGTH, ps->node->in.vectorize);
|
||||
|
@ -44,7 +44,7 @@ int path_source_init(struct path_source *ps)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int path_source_destroy(struct path_source *ps)
|
||||
int path_source_destroy(struct vpath_source *ps)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -59,7 +59,7 @@ int path_source_destroy(struct path_source *ps)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int path_source_read(struct path_source *ps, struct path *p, int i)
|
||||
int path_source_read(struct vpath_source *ps, struct vpath *p, int i)
|
||||
{
|
||||
int ret, recv, tomux, allocated, cnt, toenqueue, enqueued = 0;
|
||||
unsigned release;
|
||||
|
|
|
@ -187,7 +187,7 @@ void SuperNode::parse(json_t *cfg)
|
|||
size_t i;
|
||||
json_t *json_path;
|
||||
json_array_foreach(json_paths, i, json_path) {
|
||||
parse: path *p = new path;
|
||||
parse: auto *p = new vpath;
|
||||
|
||||
ret = path_init(p);
|
||||
if (ret)
|
||||
|
@ -241,7 +241,7 @@ void SuperNode::check()
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&paths); i++) {
|
||||
auto *p = (struct path *) vlist_at(&paths, i);
|
||||
auto *p = (struct vpath *) vlist_at(&paths, i);
|
||||
|
||||
ret = path_check(p);
|
||||
if (ret)
|
||||
|
@ -300,7 +300,7 @@ void SuperNode::startPaths()
|
|||
int ret;
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&paths); i++) {
|
||||
auto *p = (struct path *) vlist_at(&paths, i);
|
||||
auto *p = (struct vpath *) vlist_at(&paths, i);
|
||||
|
||||
if (!path_is_enabled(p))
|
||||
continue;
|
||||
|
@ -338,7 +338,7 @@ void SuperNode::preparePaths()
|
|||
int ret;
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&paths); i++) {
|
||||
auto *p = (struct path *) vlist_at(&paths, i);
|
||||
auto *p = (struct vpath *) vlist_at(&paths, i);
|
||||
|
||||
if (!path_is_enabled(p))
|
||||
continue;
|
||||
|
@ -400,7 +400,7 @@ void SuperNode::stopPaths()
|
|||
int ret;
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&paths); i++) {
|
||||
auto *p = (struct path *) vlist_at(&paths, i);
|
||||
auto *p = (struct vpath *) vlist_at(&paths, i);
|
||||
|
||||
ret = path_stop(p);
|
||||
if (ret)
|
||||
|
@ -502,7 +502,7 @@ int SuperNode::periodic()
|
|||
int started = 0;
|
||||
|
||||
for (size_t i = 0; i < vlist_length(&paths); i++) {
|
||||
auto *p = (struct path *) vlist_at(&paths, i);
|
||||
auto *p = (struct vpath *) vlist_at(&paths, i);
|
||||
|
||||
if (p->state == State::STARTED) {
|
||||
started++;
|
||||
|
@ -539,12 +539,11 @@ graph_t * SuperNode::getGraph()
|
|||
/* Create a simple digraph */
|
||||
Agraph_t *g;
|
||||
Agnode_t *n, *m;
|
||||
Agedge_t *e;
|
||||
|
||||
g = agopen("g", Agdirected, 0);
|
||||
n = agnode(g, "n", 1);
|
||||
m = agnode(g, "m", 1);
|
||||
e = agedge(g, n, m, 0, 1);
|
||||
g = agopen((char *) "g", Agdirected, 0);
|
||||
n = agnode(g, (char *) "n", 1);
|
||||
m = agnode(g, (char *) "m", 1);
|
||||
agedge(g, n, m, 0, 1);
|
||||
|
||||
return g;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue