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 
00035 class Selector {
00036   public:
00038     Selector() {
00039         reset();
00040     }
00041 
00043     QPID_COMMON_EXTERN Selector(const Options&);
00044 
00046     Selector(Level l, const std::string& s=std::string()) {
00047         reset();
00048         enable(l,s);
00049     }
00050 
00051     Selector(const std::string& enableStr) {
00052         reset();
00053         enable(enableStr);
00054     }
00055 
00060     void enable(Level level, const std::string& substring=std::string()) {
00061         substrings[level].push_back(substring);
00062     }
00063 
00067     void enable(Level level, Category category) {
00068         catFlags[level][category] = true;
00069     }
00070 
00072     QPID_COMMON_EXTERN void enable(const std::string& enableStr);
00073 
00075     QPID_COMMON_EXTERN bool isEnabled(Level level, const char* function);
00076     QPID_COMMON_EXTERN bool isEnabled(Level level, const char* function, Category category);
00077 
00079     QPID_COMMON_EXTERN void reset() {
00080         for (int lt = 0; lt < LevelTraits::COUNT; ++lt)
00081             for (int ct = 0; ct < CategoryTraits::COUNT; ++ct)
00082                 catFlags[lt][ct] = false;
00083     }
00084 
00085   private:
00086     std::vector<std::string> substrings[LevelTraits::COUNT];
00087     bool catFlags[LevelTraits::COUNT][CategoryTraits::COUNT];
00088 };
00089 
00090 
00091 }} // namespace qpid::log
00092 
00093 
00094 #endif  

Qpid C++ API Reference
Generated on Mon Dec 10 2012 for Qpid C++ Client API by doxygen 1.7.5