libassa
3.5.1
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
assa
FdSet.h
Go to the documentation of this file.
1
// -*- c++ -*-
2
//------------------------------------------------------------------------------
3
// FdSet.h
4
//------------------------------------------------------------------------------
5
// Copyright (C) 1997-2002 Vladislav Grinchenko
6
//
7
// This library is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU Library General Public
9
// License as published by the Free Software Foundation; either
10
// version 2 of the License, or (at your option) any later version.
11
//------------------------------------------------------------------------------
12
#ifndef FDSET_H
13
#define FDSET_H
14
17
#include <string.h>
18
#include <sys/time.h>
/* select(3) */
19
20
#if defined(Linux)
/* select(3) */
21
# include <sys/types.h>
22
# include <unistd.h>
23
#endif
24
25
#include <algorithm>
26
#include <string>
27
#include <sstream>
28
#include <iostream>
29
#include <list>
30
31
#include "
assa/Logger.h
"
32
33
namespace
ASSA {
34
51
class
FdSet
:
public
fd_set
52
{
53
public
:
56
FdSet
();
57
62
bool
setFd
(
handler_t
fd_);
63
68
bool
clear
(
handler_t
fd_);
69
74
bool
isSet
(
handler_t
fd_);
75
78
void
sync
();
79
82
void
reset
();
83
84
88
int
maxInSet
();
89
93
int
numSet
();
94
101
void
dump
();
102
105
std::string
dump_c_str
();
106
107
private
:
108
109
#if !defined (WIN32)
110
typedef
std::list<u_int>::iterator
ActiveFDs_Iter
;
111
112
std::list<u_int>
m_actfds
;
113
#endif
114
};
115
116
//------------------------------------------------------------------------------
117
// Member Functions
118
//------------------------------------------------------------------------------
119
inline
FdSet::FdSet
() {
reset
(); }
120
inline
void
FdSet::dump
() {
DL
((
REACT
,
"%s\n"
,
dump_c_str
().c_str ())); }
121
122
inline
bool
FdSet::isSet
(
handler_t
fd_) {
return
FD_ISSET (fd_,
this
); }
123
124
inline
int
125
FdSet::
126
numSet
()
127
{
128
#if defined (WIN32)
129
return
this->fd_count;
130
#else
/* UNIX */
131
return
m_actfds
.size ();
132
#endif
133
}
134
135
136
}
// end namespace ASSA
137
138
#endif
/* FDSET_H */
Generated on Wed Jun 13 2012 09:34:05 for libassa by
1.8.1