Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:04:37

0001 /*
0002  * Copyright (c) 2014-2024 Key4hep-Project.
0003  *
0004  * This file is part of Key4hep.
0005  * See https://key4hep.github.io/key4hep-doc/ for further info.
0006  *
0007  * Licensed under the Apache License, Version 2.0 (the "License");
0008  * you may not use this file except in compliance with the License.
0009  * You may obtain a copy of the License at
0010  *
0011  *     http://www.apache.org/licenses/LICENSE-2.0
0012  *
0013  * Unless required by applicable law or agreed to in writing, software
0014  * distributed under the License is distributed on an "AS IS" BASIS,
0015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016  * See the License for the specific language governing permissions and
0017  * limitations under the License.
0018  */
0019 #ifndef EXAMPLES_KEEPDROPSWITCH_H
0020 #define EXAMPLES_KEEPDROPSWITCH_H
0021 
0022 #include <map>
0023 #include <string>
0024 #include <vector>
0025 
0026 std::vector<std::string> split(const std::string& s, char delim);
0027 
0028 int wildcmp(const char* wild, const char* string);
0029 
0030 class KeepDropSwitch {
0031 public:
0032   enum Cmd { KEEP, DROP, UNKNOWN };
0033   typedef std::vector<std::string> CommandLines;
0034   KeepDropSwitch() {}
0035   explicit KeepDropSwitch(const CommandLines& cmds) { m_commandlines = cmds; }
0036   bool isOn(const std::string& astring) const;
0037 
0038 private:
0039   bool                                getFlag(const std::string& astring) const;
0040   Cmd                                 extractCommand(const std::string cmdLine) const;
0041   CommandLines                        m_commandlines;
0042   mutable std::map<std::string, bool> m_cache;
0043 };
0044 
0045 #endif