VR-Link API Documentation for DIS
Home
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
vlutil
vlSelectParamW.h
Go to the documentation of this file.
1
/*********************************************************************
2
** Copyright (c) 1992-2010 VT MAK
3
** All rights reserved.
4
*********************************************************************/
8
#pragma once
9
10
#ifdef DtUSE_UTILITIES_NAMESPACE
11
namespace
DtUSE_UTILITIES_NAMESPACE
12
{
13
#endif
14
15
16
class
DtSelectParamWithWrite
17
{
18
public
:
19
DtSelectParamWithWrite
();
20
21
int
select(
DtTime
timeout);
22
void
addRead(
int
fd);
23
void
delRead(
int
fd);
24
int
canRead(
int
fd);
25
void
addWrite(
int
fd);
26
void
clearWrite();
27
28
protected
:
29
int
myMaxFD
;
30
fd_set
myRead0
, myRead;
31
fd_set
myWrite0
, myWrite;
32
};
33
34
inline
35
DtSelectParamWithWrite::DtSelectParamWithWrite
()
36
{
37
FD_ZERO(&myRead0);
38
FD_ZERO(&myWrite0);
39
myRead = myRead0;
40
myWrite = myWrite0;
41
myMaxFD = -1;
42
}
43
44
inline
int
45
DtSelectParamWithWrite::select
(
DtTime
timeout)
46
{
47
myRead = myRead0;
48
myWrite = myWrite0;
49
return
DtSelect
(myMaxFD+1, &myRead, &myWrite, NULL, timeout);
50
}
51
52
inline
void
53
DtSelectParamWithWrite::addRead
(
int
fd)
54
{
55
FD_SET((
unsigned
int
) fd, &myRead0);
56
myMaxFD =
DtMax
(myMaxFD, fd);
57
}
58
59
inline
void
60
DtSelectParamWithWrite::delRead
(
int
fd)
61
{
62
FD_CLR((
unsigned
int
) fd, &myRead0);
64
}
65
66
inline
int
67
DtSelectParamWithWrite::canRead
(
int
fd)
68
{
69
return
((
int
)(FD_ISSET((
unsigned
int
) fd, &myRead)));
70
}
71
72
inline
void
73
DtSelectParamWithWrite::addWrite
(
int
fd)
74
{
75
FD_SET((
unsigned
int
) fd, &myWrite0);
76
myMaxFD =
DtMax
(myMaxFD, fd);
77
}
78
79
inline
void
80
DtSelectParamWithWrite::clearWrite
() {
81
FD_ZERO(&myWrite0);
82
}
83
84
#ifdef DtUSE_UTILITIES_NAMESPACE
85
}
86
#endif
87
Document ID: Generated on Wed Jan 7 13:31:29 EST 2015 from SVN revision 149162
Copyright © 2005-2014 VT MÄK. All Rights Reserved (
www.mak.com
)