diff --git a/include/villas/hook.hpp b/include/villas/hook.hpp index c288a0b17..6b60ebf27 100644 --- a/include/villas/hook.hpp +++ b/include/villas/hook.hpp @@ -45,10 +45,12 @@ class Hook { public: enum class Flags { - BUILTIN = (1 << 0), /**< Should we add this hook by default to every path?. */ - PATH = (1 << 1), /**< This hook type is used by paths. */ - NODE_READ = (1 << 2), /**< This hook type is used by nodes. */ - NODE_WRITE = (1 << 3) /**< This hook type is used by nodes. */ + BUILTIN = (1 << 0), /**< Should we add this hook by default to every path?. */ + READ_ONLY = (1 << 1), /**< The does not modify the sample contents */ + + PATH = (1 << 8), /**< This hook type is used by paths. */ + NODE_READ = (1 << 9), /**< This hook type is used by nodes. */ + NODE_WRITE = (1 << 10) /**< This hook type is used by nodes. */ }; enum class Reason { @@ -164,6 +166,11 @@ public: { return enabled; } + + bool isReadOnly() const + { + return flags & HookFlags::READ_ONLY; + } }; class LimitHook : public Hook { diff --git a/lib/hooks/decimate.cpp b/lib/hooks/decimate.cpp index 6607e8c3b..b2a5e4457 100644 --- a/lib/hooks/decimate.cpp +++ b/lib/hooks/decimate.cpp @@ -69,7 +69,7 @@ Hook::Reason DecimateHook::process(sample *smp) /* Register hook */ static char n[] = "decimate"; static char d[] = "Downsamping by integer factor"; -static HookPlugin p; +static HookPlugin p; } /* namespace node */ } /* namespace villas */ diff --git a/lib/hooks/drop.cpp b/lib/hooks/drop.cpp index 4324e19eb..07c39aa02 100644 --- a/lib/hooks/drop.cpp +++ b/lib/hooks/drop.cpp @@ -98,7 +98,7 @@ public: /* Register hook */ static char n[] = "drop"; static char d[] = "Drop messages with reordered sequence numbers"; -static HookPlugin p; +static HookPlugin p; } /* namespace node */ } /* namespace villas */ diff --git a/lib/hooks/dump.cpp b/lib/hooks/dump.cpp index b4a780c6c..8bc2232ed 100644 --- a/lib/hooks/dump.cpp +++ b/lib/hooks/dump.cpp @@ -50,7 +50,7 @@ public: /* Register hook */ static char n[] = "dump"; static char d[] = "Dump data to stdout"; -static HookPlugin p; +static HookPlugin p; } /* namespace node */ } /* namespace villas */ diff --git a/lib/hooks/gate.cpp b/lib/hooks/gate.cpp index 5303f33eb..c8e763470 100644 --- a/lib/hooks/gate.cpp +++ b/lib/hooks/gate.cpp @@ -200,7 +200,7 @@ public: /* Register hook */ static char n[] = "gate"; static char d[] = "Skip samples only if an enable signal is under a specified threshold"; -static HookPlugin p; +static HookPlugin p; } /* namespace node */ } /* namespace villas */ diff --git a/lib/hooks/jitter_calc.cpp b/lib/hooks/jitter_calc.cpp index edf67274f..2f89ae276 100644 --- a/lib/hooks/jitter_calc.cpp +++ b/lib/hooks/jitter_calc.cpp @@ -114,7 +114,7 @@ public: /* Register hook */ static char n[] = "jitter_calc"; static char d[] = "Calc jitter, mean and variance of GPS vs NTP TS"; -static HookPlugin p; +static HookPlugin p; } /* namespace node */ } /* namespace villas */ diff --git a/lib/hooks/limit_rate.cpp b/lib/hooks/limit_rate.cpp index 1a05ec368..a18f04cfd 100644 --- a/lib/hooks/limit_rate.cpp +++ b/lib/hooks/limit_rate.cpp @@ -98,7 +98,7 @@ Hook::Reason LimitRateHook::process(sample *smp) /* Register hook */ static char n[] = "limit_rate"; static char d[] = "Limit sending rate"; -static HookPlugin p; +static HookPlugin p; } /* namespace node */ } /* namespace villas */ diff --git a/lib/hooks/print.cpp b/lib/hooks/print.cpp index c72cf402a..f651e99c5 100644 --- a/lib/hooks/print.cpp +++ b/lib/hooks/print.cpp @@ -138,7 +138,7 @@ public: /* Register hook */ static char n[] = "print"; static char d[] = "Print the message to stdout"; -static HookPlugin p; +static HookPlugin p; } /* namespace node */ } /* namespace villas */ diff --git a/lib/hooks/skip_first.cpp b/lib/hooks/skip_first.cpp index f055514f4..5977ea340 100644 --- a/lib/hooks/skip_first.cpp +++ b/lib/hooks/skip_first.cpp @@ -143,7 +143,7 @@ public: /* Register hook */ static char n[] = "skip_first"; static char d[] = "Skip the first samples"; -static HookPlugin p; +static HookPlugin p; } /* namespace node */ } /* namespace villas */ diff --git a/lib/hooks/stats.cpp b/lib/hooks/stats.cpp index 9d4799ecf..702dda60b 100644 --- a/lib/hooks/stats.cpp +++ b/lib/hooks/stats.cpp @@ -279,7 +279,7 @@ Hook::Reason StatsReadHook::process(sample *smp) /* Register hook */ static char n[] = "stats"; static char d[] = "Collect statistics for the current node"; -static HookPlugin p; +static HookPlugin p; } /* namespace node */ } /* namespace villas */