libassa  3.5.1
MaskSet.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //------------------------------------------------------------------------------
3 // MaskSet.h
4 //------------------------------------------------------------------------------
5 // Copyright (c) 1999 by 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 MASK_SET_H
13 #define MASK_SET_H
14 
15 #include "assa/FdSet.h"
16 
17 namespace ASSA {
18 
24 class MaskSet
25 {
26 public:
29 
32 
35 
36 public:
38  void reset ();
39 
41  void sync ();
42 
44  int max_fd ();
45 
47  void dump ();
48 };
49 
50 inline void
52 sync ()
53 {
54  m_rset.sync ();
55  m_wset.sync ();
56  m_eset.sync ();
57 }
58 
59 
60 inline void
62 reset ()
63 {
64  m_rset.reset ();
65  m_wset.reset ();
66  m_eset.reset ();
67 }
68 
69 inline int
71 max_fd ()
72 {
73  return (std::max (m_rset.maxInSet (),
74  std::max (m_wset.maxInSet (),
75  m_eset.maxInSet ())));
76 }
77 
78 inline void
80 dump ()
81 {
82  DL((REACTTRACE,"+---------------------------\n"));
83  DL((REACTTRACE,"| RD FDs set %s\n", m_rset.dump_c_str ().c_str ()));
84  DL((REACTTRACE,"| WR FDs set %s\n", m_wset.dump_c_str ().c_str ()));
85  DL((REACTTRACE,"| EX FDs set %s\n", m_eset.dump_c_str ().c_str ()));
86  DL((REACTTRACE,"+---------------------------\n"));
87 }
88 
89 } // end namespace ASSA
90 
91 #endif /* MASK_SET_H */
#define DL(X)
A macro for writing debug message to the Logger.
Definition: Logger.h:273
Class FdSet.
Definition: FdSet.h:52
void reset()
Reset every bit in the set (OFF).
Definition: FdSet.cpp:90
void sync()
Sync internals after used by select(3C)
Definition: FdSet.cpp:72
std::string dump_c_str()
Return object state dump as an ASCII string.
Definition: FdSet.cpp:116
int maxInSet()
Find out the highest file descriptor in the set.
Definition: FdSet.cpp:101
FdSet m_rset
Read fds set.
Definition: MaskSet.h:28
void sync()
Resync internals after select() call.
Definition: MaskSet.h:52
FdSet m_eset
Exception fds set.
Definition: MaskSet.h:34
int max_fd()
Return maximum value of the file descriptor in the Set.
Definition: MaskSet.h:71
void reset()
Clear all bits in all sets.
Definition: MaskSet.h:62
void dump()
Write current state of MaskSet object to log file.
Definition: MaskSet.h:80
FdSet m_wset
Write fds set.
Definition: MaskSet.h:31
Definition: Acceptor.h:40
@ REACTTRACE
Extended Reactor/PrioriyQueue messages
Definition: LogMask.h:40