Juggler
Juggling algorithms and event processing using gaudi framework
KeepDropSwitch.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-or-later
2 // Copyright (C) 2022 Whitney Armstrong
3 
4 #ifndef EXAMPLES_KEEPDROPSWITCH_H
5 #define EXAMPLES_KEEPDROPSWITCH_H
6 
7 #include <map>
8 #include <string>
9 #include <vector>
10 
11 std::vector<std::string> split(const std::string& s, char delim);
12 
13 int wildcmp(const char* wild, const char* string);
14 
15 /** Data output controller.
16  *
17  * \ingroup base
18  */
20 public:
21  enum Cmd { KEEP, DROP, UNKNOWN };
22  typedef std::vector<std::string> CommandLines;
24  explicit KeepDropSwitch(const CommandLines& cmds) { m_commandlines = cmds; }
25  bool isOn(const std::string& astring) const;
26 
27 private:
28  bool getFlag(const std::string& astring) const;
29  Cmd extractCommand(const std::string cmdLine) const;
30  CommandLines m_commandlines;
31  mutable std::map<std::string, bool> m_cache;
32 };
33 
34 #endif
wildcmp
int wildcmp(const char *wild, const char *string)
Definition: KeepDropSwitch.cpp:10
KeepDropSwitch::KEEP
@ KEEP
Definition: KeepDropSwitch.h:21
KeepDropSwitch::Cmd
Cmd
Definition: KeepDropSwitch.h:21
KeepDropSwitch::isOn
bool isOn(const std::string &astring) const
Definition: KeepDropSwitch.cpp:54
KeepDropSwitch::UNKNOWN
@ UNKNOWN
Definition: KeepDropSwitch.h:21
KeepDropSwitch::DROP
@ DROP
Definition: KeepDropSwitch.h:21
KeepDropSwitch::KeepDropSwitch
KeepDropSwitch(const CommandLines &cmds)
Definition: KeepDropSwitch.h:24
KeepDropSwitch
Definition: KeepDropSwitch.h:19
KeepDropSwitch::KeepDropSwitch
KeepDropSwitch()
Definition: KeepDropSwitch.h:23
KeepDropSwitch::CommandLines
std::vector< std::string > CommandLines
Definition: KeepDropSwitch.h:22
split
std::vector< std::string > split(const std::string &s, char delim)
Definition: KeepDropSwitch.cpp:42