MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SetLogLevelOrd.hpp
1 /*
2  Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #ifndef SET_LOGLEVEL_ORD_HPP
19 #define SET_LOGLEVEL_ORD_HPP
20 
21 #include <LogLevel.hpp>
22 #include "EventSubscribeReq.hpp"
23 #include "SignalData.hpp"
24 
32  friend class MgmtSrvr; /* XXX can probably be removed */
33  friend class MgmApiSession;
34  friend class CommandInterpreter;
35 
39  friend class Cmvmi;
40 
41  friend class NodeLogLevel;
42 
43 private:
44  STATIC_CONST( SignalLength = 1 + LogLevel::LOGLEVEL_CATEGORIES );
45 
46  Uint32 noOfEntries;
47  Uint32 theData[LogLevel::LOGLEVEL_CATEGORIES];
48 
49  void clear();
50 
54  void setLogLevel(LogLevel::EventCategory ec, int level = 7);
55 
56  SetLogLevelOrd& assign (const LogLevel& ll){
57  noOfEntries = LogLevel::LOGLEVEL_CATEGORIES;
58  for(Uint32 i = 0; i<noOfEntries; i++){
59  theData[i] = (i << 16) | ll.getLogLevel((LogLevel::EventCategory)i);
60  }
61  return * this;
62  }
63 
64  SetLogLevelOrd& assign (const EventSubscribeReq& ll){
65  noOfEntries = ll.noOfEntries;
66  for(Uint32 i = 0; i<noOfEntries; i++){
67  theData[i] = ll.theData[i];
68  }
69  return * this;
70  }
71 };
72 
73 inline
74 void
75 SetLogLevelOrd::clear(){
76  noOfEntries = 0;
77 }
78 
79 inline
80 void
81 SetLogLevelOrd::setLogLevel(LogLevel::EventCategory ec, int level){
82  theData[noOfEntries] = (ec << 16) | level;
83  noOfEntries++;
84 }
85 
86 #endif