mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Reformat the world
This commit is contained in:
parent
194cb24547
commit
b2f171ec69
714 changed files with 35149 additions and 35203 deletions
|
@ -1,21 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "zeek/Obj.h"
|
||||
#include "zeek/IntrusivePtr.h"
|
||||
#include "zeek/Notifier.h"
|
||||
#include "zeek/Obj.h"
|
||||
#include "zeek/iosource/IOSource.h"
|
||||
#include "zeek/util.h"
|
||||
#include "zeek/IntrusivePtr.h"
|
||||
|
||||
namespace zeek {
|
||||
namespace zeek
|
||||
{
|
||||
|
||||
class ODesc;
|
||||
class Val;
|
||||
|
||||
namespace detail {
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class Frame;
|
||||
class Stmt;
|
||||
|
@ -23,8 +25,8 @@ class Expr;
|
|||
class CallExpr;
|
||||
class ID;
|
||||
|
||||
namespace trigger {
|
||||
|
||||
namespace trigger
|
||||
{
|
||||
|
||||
// Triggers are the heart of "when" statements: expressions that when
|
||||
// they become true execute a body of statements.
|
||||
|
@ -32,16 +34,17 @@ namespace trigger {
|
|||
class TriggerTimer;
|
||||
class TriggerTraversalCallback;
|
||||
|
||||
class Trigger final : public Obj, public notifier::detail::Receiver {
|
||||
class Trigger final : public Obj, public notifier::detail::Receiver
|
||||
{
|
||||
public:
|
||||
// Don't access Trigger objects; they take care of themselves after
|
||||
// instantiation. Note that if the condition is already true, the
|
||||
// statements are executed immediately and the object is deleted
|
||||
// right away.
|
||||
Trigger(const Expr* cond, Stmt* body, Stmt* timeout_stmts, Expr* timeout,
|
||||
Frame* f, bool is_return, const Location* loc);
|
||||
Trigger(const Expr* cond, Stmt* body, Stmt* timeout_stmts, double timeout,
|
||||
Frame* f, bool is_return, const Location* loc);
|
||||
Trigger(const Expr* cond, Stmt* body, Stmt* timeout_stmts, Expr* timeout, Frame* f,
|
||||
bool is_return, const Location* loc);
|
||||
Trigger(const Expr* cond, Stmt* body, Stmt* timeout_stmts, double timeout, Frame* f,
|
||||
bool is_return, const Location* loc);
|
||||
~Trigger() override;
|
||||
|
||||
// Evaluates the condition. If true, executes the body and deletes
|
||||
|
@ -54,15 +57,14 @@ public:
|
|||
void Timeout();
|
||||
|
||||
// Return the timeout interval (negative if none was specified).
|
||||
double TimeoutValue() const
|
||||
{ return timeout_value; }
|
||||
double TimeoutValue() const { return timeout_value; }
|
||||
|
||||
// Called if another entity needs to complete its operations first
|
||||
// in any case before this trigger can proceed.
|
||||
void Hold() { delayed = true; }
|
||||
void Hold() { delayed = true; }
|
||||
|
||||
// Complement of Hold().
|
||||
void Release() { delayed = false; }
|
||||
void Release() { delayed = false; }
|
||||
|
||||
// If we evaluate to true, our return value will be passed on
|
||||
// to the given trigger. Note, automatically calls Hold().
|
||||
|
@ -97,8 +99,8 @@ private:
|
|||
friend class TriggerTraversalCallback;
|
||||
friend class TriggerTimer;
|
||||
|
||||
void Init(const Expr* cond, Stmt* body, Stmt* timeout_stmts, Frame* frame,
|
||||
bool is_return, const Location* location);
|
||||
void Init(const Expr* cond, Stmt* body, Stmt* timeout_stmts, Frame* frame, bool is_return,
|
||||
const Location* location);
|
||||
|
||||
void ReInit(std::vector<IntrusivePtr<Val>> index_expr_results);
|
||||
|
||||
|
@ -121,17 +123,17 @@ private:
|
|||
bool delayed; // true if a function call is currently being delayed
|
||||
bool disabled;
|
||||
|
||||
std::vector<std::pair<Obj *, notifier::detail::Modifiable*>> objs;
|
||||
std::vector<std::pair<Obj*, notifier::detail::Modifiable*>> objs;
|
||||
|
||||
using ValCache = std::map<const CallExpr*, Val*>;
|
||||
ValCache cache;
|
||||
};
|
||||
};
|
||||
|
||||
using TriggerPtr = IntrusivePtr<Trigger>;
|
||||
|
||||
class Manager final : public iosource::IOSource {
|
||||
class Manager final : public iosource::IOSource
|
||||
{
|
||||
public:
|
||||
|
||||
Manager();
|
||||
~Manager();
|
||||
|
||||
|
@ -141,23 +143,23 @@ public:
|
|||
|
||||
void Queue(Trigger* trigger);
|
||||
|
||||
struct Stats {
|
||||
struct Stats
|
||||
{
|
||||
unsigned long total;
|
||||
unsigned long pending;
|
||||
};
|
||||
};
|
||||
|
||||
void GetStats(Stats* stats);
|
||||
|
||||
private:
|
||||
|
||||
using TriggerList = std::list<Trigger*>;
|
||||
TriggerList* pending;
|
||||
unsigned long total_triggers = 0;
|
||||
};
|
||||
|
||||
} // namespace trigger
|
||||
} // namespace trigger
|
||||
|
||||
extern trigger::Manager* trigger_mgr;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace zeek
|
||||
} // namespace detail
|
||||
} // namespace zeek
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue