Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
qpid/log/Selector.h
Go to the documentation of this file.
00001 #ifndef SELECTOR_H
00002 #define SELECTOR_H
00003 
00004 /*
00005  *
00006  * Copyright (c) 2006 The Apache Software Foundation
00007  *
00008  * Licensed under the Apache License, Version 2.0 (the "License");
00009  * you may not use this file except in compliance with the License.
00010  * You may obtain a copy of the License at
00011  *
00012  *    http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  * Unless required by applicable law or agreed to in writing, software
00015  * distributed under the License is distributed on an "AS IS" BASIS,
00016  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00017  * See the License for the specific language governing permissions and
00018  * limitations under the License.
00019  *
00020  */
00021 
00022 #include "qpid/log/Statement.h"
00023 #include "qpid/CommonImportExport.h"
00024 #include <vector>
00025 
00026 namespace qpid {
00027 namespace log {
00028 struct Options;
00029 
00034 struct SelectorElement {
00035     QPID_COMMON_EXTERN SelectorElement(const std::string cliEntry);
00036     std::string levelStr;
00037     std::string patternStr;
00038     Level level;
00039     Category category;
00040     bool isDisable;
00041     bool isCategory;
00042     bool isLevelAndAbove;
00043     bool isLevelAndBelow;
00044 };
00045 
00051 class Selector {
00052   public:
00054     QPID_COMMON_EXTERN Selector();
00055 
00057     QPID_COMMON_EXTERN Selector(const Options&);
00058 
00060     QPID_COMMON_EXTERN Selector(Level l, const std::string& s=std::string());
00061 
00063     QPID_COMMON_EXTERN Selector(const std::string& selector);
00064 
00066     QPID_COMMON_EXTERN void enable(const std::string& enableStr);
00067     QPID_COMMON_EXTERN void disable(const std::string& disableStr);
00068 
00073     QPID_COMMON_EXTERN void enable(Level level, const std::string& substring=std::string());
00074     QPID_COMMON_EXTERN void disable(Level level, const std::string& substring=std::string());
00075 
00077     QPID_COMMON_EXTERN bool isEnabled(Level level, const char* function);
00078     QPID_COMMON_EXTERN bool isDisabled(Level level, const char* function);
00079 
00081     QPID_COMMON_EXTERN bool isEnabled(Level level, const char* function, Category category);
00082 
00083   private:
00084     typedef std::vector<std::string> FunctionNameTable [LevelTraits::COUNT];
00085     FunctionNameTable enabledFunctions;   // log function names explicitly enabled
00086     FunctionNameTable disabledFunctions;  // log function names explicitly disabled
00087     bool enableFlags[LevelTraits::COUNT][CategoryTraits::COUNT];
00088     bool disableFlags[LevelTraits::COUNT][CategoryTraits::COUNT];
00089 
00090     bool lookupFuncName(Level level, const char* function, FunctionNameTable& table);
00092     QPID_COMMON_EXTERN void reset();
00093 };
00094 
00095 
00096 }} // namespace qpid::log
00097 
00098 
00099 #endif  

Qpid C++ API Reference
Generated on Fri Aug 23 2013 for Qpid C++ Client API by doxygen 1.7.5