0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PollEvent.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 3
9  * of the License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
26 
27 #include <Common/Compat.h>
28 
29 #include "PollEvent.h"
30 
31 #include <string>
32 
33 using namespace Hypertable;
34 using namespace std;
35 
36 string PollEvent::to_string(int events) {
37  string str;
38  string or_str;
39 
40  if (events & PollEvent::READ) {
41  str.append("READ");
42  or_str = string("|");
43  }
44 
45  if (events & PollEvent::PRI) {
46  str += or_str + "PRI";
47  or_str = string("|");
48  }
49 
50  if (events & PollEvent::WRITE) {
51  str += or_str + "WRITE";
52  or_str = string("|");
53  }
54 
55  if (events & PollEvent::ERROR) {
56  str += or_str + "ERROR";
57  or_str = string("|");
58  }
59 
60  if (events & PollEvent::HUP) {
61  str += or_str + "HUP";
62  or_str = string("|");
63  }
64 
65  if (events & PollEvent::REMOVE) {
66  str += or_str + "REMOVE";
67  or_str = string("|");
68  }
69 
70  if (events & PollEvent::RDHUP) {
71  str += or_str + "RDHUP";
72  or_str = string("|");
73  }
74 
75  return str;
76 }
Error condition
Definition: PollEvent.h:48
Po::typed_value< String > * str(String *v=0)
Definition: Properties.h:166
STL namespace.
Data available to read.
Definition: PollEvent.h:42
std::string to_string(int events)
Returns a string representation of polling events.
Definition: PollEvent.cc:36
Stream socket peer closed connection.
Definition: PollEvent.h:53
Urgent data available to read.
Definition: PollEvent.h:44
Compatibility Macros for C/C++.
Declarations for PollEvent.
Hypertable definitions
Writing can be performed without blocking.
Definition: PollEvent.h:46