[go: up one dir, main page]

File: Pipe.3cc

package info (click to toggle)
libcommoncpp2 1.0.13-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,740 kB
  • ctags: 2,860
  • sloc: cpp: 18,857; sh: 8,451; ansic: 1,546; makefile: 299; xml: 5
file content (214 lines) | stat: -rw-r--r-- 5,844 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
.TH "Pipe" 3 "19 Jul 2003" "CommonC++" \" -*- nroff -*-
.ad l
.nh
.SH NAME
Pipe \- The Pipe uses system kernel buffering to hold data being passed either between two execution contexts within the same process, or between different processes. kernel buffering between processes and/or threads. 
.SH SYNOPSIS
.br
.PP
\fC#include <file.h>\fP
.PP
.SS "Public Methods"

.in +1c
.ti -1c
.RI "bool \fBoperator!\fP ()"
.br
.RI "\fIUsed to see if the pipe has any open entities.\fP"
.ti -1c
.RI "int \fBreceive\fP (void *addr)"
.br
.RI "\fIPerform an object atomic transfer of data from a pipe.\fP"
.ti -1c
.RI "int \fBsend\fP (void *addr)"
.br
.RI "\fIPerform an object atomic transfer of data to a pipe.\fP"
.ti -1c
.RI "bool \fBisValid\fP (void)"
.br
.RI "\fIVerify this object is 'valid'.\fP"
.in -1c
.SS "Protected Methods"

.in +1c
.ti -1c
.RI "int \fBgetSize\fP (void)"
.br
.RI "\fIGet the object size for atomic operations.\fP"
.ti -1c
.RI "void \fBendSender\fP (void)"
.br
.RI "\fISender is often used for implementing a fork()'d message port between processes.\fP"
.ti -1c
.RI "void \fBendReceiver\fP (void)"
.br
.RI "\fIReceiver is often used for implementing a fork()'d message port between processes.\fP"
.ti -1c
.RI "\fBPipe\fP (int \fBsize\fP=512, int count=1)"
.br
.RI "\fICreate a kernel pipe descriptor set using pipe().\fP"
.ti -1c
.RI "virtual \fB~Pipe\fP ()"
.br
.RI "\fIDestroy the pipe and kernel descriptor resources.\fP"
.ti -1c
.RI "\fBPipe\fP (const Pipe &orig)"
.br
.RI "\fICreate a pipe as a duplicate of an existing pipe.\fP"
.ti -1c
.RI "Pipe & \fBoperator=\fP (const Pipe &orig)"
.br
.ti -1c
.RI "void \fBsender\fP (void)"
.br
.ti -1c
.RI "void \fBreceiver\fP (void)"
.br
.ti -1c
.RI "int \fBread\fP (void *buf, int len)"
.br
.ti -1c
.RI "int \fBwrite\fP (void *buf, int len)"
.br
.in -1c
.SS "Protected Attributes"

.in +1c
.ti -1c
.RI "int \fBfd\fP [2]"
.br
.ti -1c
.RI "int \fBobjcount\fP"
.br
.ti -1c
.RI "int \fBobjsize\fP"
.br
.in -1c
.SH "DETAILED DESCRIPTION"
.PP 
The Pipe uses system kernel buffering to hold data being passed either between two execution contexts within the same process, or between different processes. kernel buffering between processes and/or threads.
.PP
Unlike thread's '\fBBuffer\fP', Pipe uses system descriptors and kernel memory. Under Posix, the size of the pipe and associated kernel memory is always a fixed constant as defined by _PC_PIPE_BUF. The Common C++ 'pipe' class primarily deals with 'atomic' transfers of fixed sized objects through pipes. Pipes may pass data arbitrarily and can also be used through the 'pipestream' class.
.PP
The 'Pipe' class is not meant to be a true 'public' class, but as a builder class for deriving other classes.
.PP
\fBAuthor: \fP
.in +1c
David Sugar <dyfet@ostel.com> 
.PP
.SH "CONSTRUCTOR & DESTRUCTOR DOCUMENTATION"
.PP 
.SS "Pipe::Pipe (int size = 512, int count = 1)\fC [protected]\fP"
.PP
Create a kernel pipe descriptor set using pipe().
.PP
On systems which allow the pipe kernel buffer to be defined, a size for aligned atomic transfers can be set, as well as the number of atomic objects the kernel will buffer. On Posix systems, these options are ignored.
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIsize\fP\fP
objsize of atomic objects to send. 
.TP
\fB\fIcount\fP\fP
count of atomic objects to kernel buffer. 
.SS "virtual Pipe::~Pipe ()\fC [protected, virtual]\fP"
.PP
Destroy the pipe and kernel descriptor resources.
.PP
.SS "Pipe::Pipe (const Pipe & orig)\fC [protected]\fP"
.PP
Create a pipe as a duplicate of an existing pipe.
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIorig\fP\fP
pipe to duplicate. 
.SH "MEMBER FUNCTION DOCUMENTATION"
.PP 
.SS "void Pipe::endReceiver (void)\fC [inline, protected]\fP"
.PP
Receiver is often used for implementing a fork()'d message port between processes.
.PP
By stopping the receiver, the current pipe can then only be used for sending, and the receiver is presumed to be in the other half of a fork()'d process.
.PP
\fBSee also: \fP
.in +1c
\fBendSender\fP 
.SS "void Pipe::endSender (void)\fC [inline, protected]\fP"
.PP
Sender is often used for implementing a fork()'d message port between processes.
.PP
By stopping the sender, the current pipe can then only be used for receiving, and the sender is presumed to be in the other half of a fork()'d process.
.PP
\fBSee also: \fP
.in +1c
\fBendReceiver\fP 
.SS "int Pipe::getSize (void)\fC [inline, protected]\fP"
.PP
Get the object size for atomic operations.
.PP
\fBReturns: \fP
.in +1c
size of atomic operations. 
.SS "bool Pipe::isValid (void)"
.PP
Verify this object is 'valid'.
.PP
\fBReturns: \fP
.in +1c
true if valid. 
.SS "bool Pipe::operator! ()"
.PP
Used to see if the pipe has any open entities.
.PP
.SS "Pipe& Pipe::operator= (const Pipe & orig)\fC [protected]\fP"
.PP
.SS "int Pipe::read (void * buf, int len)\fC [inline, protected]\fP"
.PP
.SS "int Pipe::receive (void * addr)\fC [inline]\fP"
.PP
Perform an object atomic transfer of data from a pipe.
.PP
\fBReturns: \fP
.in +1c
number of bytes actually read if successful. 
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIaddr\fP\fP
pointer to store read data. 
.SS "void Pipe::receiver (void)\fC [inline, protected]\fP"
.PP
.SS "int Pipe::send (void * addr)\fC [inline]\fP"
.PP
Perform an object atomic transfer of data to a pipe.
.PP
\fBReturns: \fP
.in +1c
number of bytes written if successful. 
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIaddr\fP\fP
pointer to write data from. 
.SS "void Pipe::sender (void)\fC [inline, protected]\fP"
.PP
.SS "int Pipe::write (void * buf, int len)\fC [inline, protected]\fP"
.PP
.SH "MEMBER DATA DOCUMENTATION"
.PP 
.SS "int Pipe::fd[2]\fC [protected]\fP"
.PP
.SS "int Pipe::objcount\fC [protected]\fP"
.PP
.SS "int Pipe::objsize\fC [protected]\fP"
.PP


.SH "AUTHOR"
.PP 
Generated automatically by Doxygen for CommonC++ from the source code.