VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
17 {
18  public:
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
36 {
37  FD_ZERO(&myRead0);
38  FD_ZERO(&myWrite0);
39  myRead = myRead0;
40  myWrite = myWrite0;
41  myMaxFD = -1;
42 }
43 
44 inline int
46 {
47  myRead = myRead0;
48  myWrite = myWrite0;
49  return DtSelect(myMaxFD+1, &myRead, &myWrite, NULL, timeout);
50 }
51 
52 inline void
54 {
55  FD_SET((unsigned int) fd, &myRead0);
56  myMaxFD = DtMax(myMaxFD, fd);
57 }
58 
59 inline void
61 {
62  FD_CLR((unsigned int) fd, &myRead0);
64 }
65 
66 inline int
68 {
69  return ((int)(FD_ISSET((unsigned int) fd, &myRead)));
70 }
71 
72 inline void
74 {
75  FD_SET((unsigned int) fd, &myWrite0);
76  myMaxFD = DtMax(myMaxFD, fd);
77 }
78 
79 inline void
81  FD_ZERO(&myWrite0);
82 }
83 
84 #ifdef DtUSE_UTILITIES_NAMESPACE
85 }
86 #endif
87 
void addRead(int fd)
Definition: vlSelectParamW.h:53
int canRead(int fd)
Definition: vlSelectParamW.h:67
int select(DtTime timeout)
Definition: vlSelectParamW.h:45
T DtMax(T x, T y)
Returns what ever is greater, x or y of type T.
Definition: vlUtil.h:143
fd_set myWrite0
Definition: vlSelectParamW.h:31
void addWrite(int fd)
Definition: vlSelectParamW.h:73
void delRead(int fd)
Definition: vlSelectParamW.h:60
int DtSelect(int n, fd_set *i, fd_set *o, fd_set *e, DtTime t)
DtSelectParamWithWrite()
Definition: vlSelectParamW.h:35
void clearWrite()
Definition: vlSelectParamW.h:80
int myMaxFD
Definition: vlSelectParamW.h:29
Definition: vlSelectParamW.h:16
fd_set myRead0
Definition: vlSelectParamW.h:30

Document ID: Generated on Tue Aug 10 00:12:31 EDT 2021 from SVN revision 232765
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)