source: pkg/main/libbonobo/branches/upstream/current/doc/api/xml/bonobo-stream-client.xml @ 310

Revision 310, 14.6 KB checked in by alanbach-guest, 6 years ago (diff)

[svn-inject] Installing original source of libbonobo

Line 
1<refentry id="libbonobo-bonobo-stream-client">
2<refmeta>
3<refentrytitle role="top_of_page">bonobo-stream-client</refentrytitle>
4<manvolnum>3</manvolnum>
5<refmiscinfo>LIBBONOBO Library</refmiscinfo>
6</refmeta>
7
8<refnamediv>
9<refname>bonobo-stream-client</refname>
10<refpurpose>Simplified client wrapper functions for the Stream interface</refpurpose>
11<!--[<xref linkend="desc" endterm="desc.title"/>]-->
12</refnamediv>
13
14<refsynopsisdiv role="synopsis">
15<title role="synopsis.title">Synopsis</title>
16
17<synopsis>
18
19
20
21<link linkend="void">void</link>        <link linkend="bonobo-stream-client-write">bonobo_stream_client_write</link>      (const <link linkend="Bonobo-Stream">Bonobo_Stream</link> stream,
22                                             const <link linkend="void">void</link> *buffer,
23                                             const <link linkend="size-t">size_t</link> size,
24                                             <link linkend="CORBA-Environment">CORBA_Environment</link> *ev);
25<link linkend="guint8">guint8</link>*     <link linkend="bonobo-stream-client-read">bonobo_stream_client_read</link>       (const <link linkend="Bonobo-Stream">Bonobo_Stream</link> stream,
26                                             const <link linkend="size-t">size_t</link> size,
27                                             <link linkend="CORBA-long">CORBA_long</link> *length_read,
28                                             <link linkend="CORBA-Environment">CORBA_Environment</link> *ev);
29<link linkend="void">void</link>        <link linkend="bonobo-stream-client-write-string">bonobo_stream_client_write_string</link>
30                                            (const <link linkend="Bonobo-Stream">Bonobo_Stream</link> stream,
31                                             const <link linkend="char">char</link> *str,
32                                             const <link linkend="gboolean">gboolean</link> terminate,
33                                             <link linkend="CORBA-Environment">CORBA_Environment</link> *ev);
34<link linkend="void">void</link>        <link linkend="bonobo-stream-client-printf">bonobo_stream_client_printf</link>     (const <link linkend="Bonobo-Stream">Bonobo_Stream</link> stream,
35                                             const <link linkend="gboolean">gboolean</link> terminate,
36                                             <link linkend="CORBA-Environment">CORBA_Environment</link> *ev,
37                                             const <link linkend="char">char</link> *fmt,
38                                             ...);
39<link linkend="CORBA-long">CORBA_long</link>  <link linkend="bonobo-stream-client-read-string">bonobo_stream_client_read_string</link>
40                                            (const <link linkend="Bonobo-Stream">Bonobo_Stream</link> stream,
41                                             <link linkend="char">char</link> **str,
42                                             <link linkend="CORBA-Environment">CORBA_Environment</link> *ev);
43<link linkend="CORBA-long">CORBA_long</link>  <link linkend="bonobo-stream-client-get-length">bonobo_stream_client_get_length</link> (const <link linkend="Bonobo-Stream">Bonobo_Stream</link> stream,
44                                             <link linkend="CORBA-Environment">CORBA_Environment</link> *ev);
45</synopsis>
46</refsynopsisdiv>
47
48
49
50
51
52
53
54
55
56<refsect1 role="desc">
57<title role="desc.title">Description</title>
58<para>
59These interfaces are designed to make the stream interface
60slightly easier to use from client code. This is done 2 ways,
61first by make the exception environments optiional, and secondly
62by providing slightly nicer semantics.
63</para>
64
65<para>
66  <example>
67     <title>Writing some simple data to a stream</title>
68     <programlisting>
69bonobo_stream_client_printf (stream, TRUE, ev, "Hello World: <link linkend="d"><literal>d</literal></link>", 5);
70     </programlisting>
71  </example>
72  It is well worth using the bonobo_stream_client_write function
73for any potentialy large writes, since this blocks the data into
74sensible chunks. This is important, otherwise a single transfer is
75attempted that will cause hassles in the CORBA stubs. [ NB. ORBit
76tries to alloca a huge chunk of memory and SEGVs ].
77</para>
78</refsect1>
79
80<refsect1 role="details">
81<title role="details.title">Details</title>
82<refsect2>
83<title><anchor id="bonobo-stream-client-write" role="function"/>bonobo_stream_client_write ()</title>
84<indexterm><primary>bonobo_stream_client_write</primary></indexterm><programlisting><link linkend="void">void</link>        bonobo_stream_client_write      (const <link linkend="Bonobo-Stream">Bonobo_Stream</link> stream,
85                                             const <link linkend="void">void</link> *buffer,
86                                             const <link linkend="size-t">size_t</link> size,
87                                             <link linkend="CORBA-Environment">CORBA_Environment</link> *ev);</programlisting>
88<para>
89This is a helper routine to write <parameter>size</parameter> bytes from <parameter>buffer</parameter> to the
90<parameter>stream</parameter>.  It will continue to write bytes until a fatal error
91occurs. It works around serious problems in ORBit's handling of
92sequences, and makes for nicer, saner protocol usage for
93transfering huge chunks of data.</para>
94<para>
95
96</para><variablelist role="params">
97<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
98<listitem><simpara> A CORBA Object reference to a Bonobo_Stream
99</simpara></listitem></varlistentry>
100<varlistentry><term><parameter>buffer</parameter>&nbsp;:</term>
101<listitem><simpara> the buffer to write
102</simpara></listitem></varlistentry>
103<varlistentry><term><parameter>size</parameter>&nbsp;:</term>
104<listitem><simpara> number of bytes to write
105</simpara></listitem></varlistentry>
106<varlistentry><term><parameter>ev</parameter>&nbsp;:</term>
107<listitem><simpara> a CORBA environment to return status information.
108</simpara></listitem></varlistentry>
109</variablelist></refsect2>
110<refsect2>
111<title><anchor id="bonobo-stream-client-read" role="function"/>bonobo_stream_client_read ()</title>
112<indexterm><primary>bonobo_stream_client_read</primary></indexterm><programlisting><link linkend="guint8">guint8</link>*     bonobo_stream_client_read       (const <link linkend="Bonobo-Stream">Bonobo_Stream</link> stream,
113                                             const <link linkend="size-t">size_t</link> size,
114                                             <link linkend="CORBA-long">CORBA_long</link> *length_read,
115                                             <link linkend="CORBA-Environment">CORBA_Environment</link> *ev);</programlisting>
116<para>
117This is a helper routine to read <parameter>size</parameter> bytes from the <parameter>stream</parameter> into
118a freshly g_ allocated buffer which is returned. Whilst this
119routine may seem pointless; it reads the stream in small chunks
120avoiding possibly massive alloca's inside ORBit's stub/skel code.</para>
121<para>
122
123</para><variablelist role="params">
124<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
125<listitem><simpara> A CORBA Object reference to a Bonobo_Stream
126</simpara></listitem></varlistentry>
127<varlistentry><term><parameter>size</parameter>&nbsp;:</term>
128<listitem><simpara> number of bytes to read or -1 for whole stream.
129</simpara></listitem></varlistentry>
130<varlistentry><term><parameter>length_read</parameter>&nbsp;:</term>
131<listitem><simpara> if non NULL will be set to the length read
132</simpara></listitem></varlistentry>
133<varlistentry><term><parameter>ev</parameter>&nbsp;:</term>
134<listitem><simpara> a CORBA environment to return status information.
135</simpara></listitem></varlistentry>
136<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>NULL on any sort of failure &amp; 0 size read.
137</simpara></listitem></varlistentry>
138</variablelist></refsect2>
139<refsect2>
140<title><anchor id="bonobo-stream-client-write-string" role="function"/>bonobo_stream_client_write_string ()</title>
141<indexterm><primary>bonobo_stream_client_write_string</primary></indexterm><programlisting><link linkend="void">void</link>        bonobo_stream_client_write_string
142                                            (const <link linkend="Bonobo-Stream">Bonobo_Stream</link> stream,
143                                             const <link linkend="char">char</link> *str,
144                                             const <link linkend="gboolean">gboolean</link> terminate,
145                                             <link linkend="CORBA-Environment">CORBA_Environment</link> *ev);</programlisting>
146<para>
147This is a helper routine to write the string in <parameter>str</parameter> to <parameter>stream</parameter>.
148If <parameter>terminate</parameter> is TRUE, a NULL character will be written out at the
149end of the string.  This function will not return until the entire
150string has been written out, unless an exception is raised.  See
151also <link linkend="bonobo-stream-client-write"><function>bonobo_stream_client_write()</function></link>. Continues writing until finished
152or a fatal exception occurs.</para>
153<para>
154
155</para><variablelist role="params">
156<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
157<listitem><simpara> A CORBA object reference to a <link linkend="Bonobo-Stream"><type>Bonobo_Stream</type></link>.
158</simpara></listitem></varlistentry>
159<varlistentry><term><parameter>str</parameter>&nbsp;:</term>
160<listitem><simpara> A string.
161</simpara></listitem></varlistentry>
162<varlistentry><term><parameter>terminate</parameter>&nbsp;:</term>
163<listitem><simpara> Whether or not to write the \0 at the end of the
164string.
165</simpara></listitem></varlistentry>
166<varlistentry><term><parameter>ev</parameter>&nbsp;:</term>
167<listitem><simpara> A pointer to a <link linkend="CORBA-Environment"><type>CORBA_Environment</type></link>
168</simpara></listitem></varlistentry>
169</variablelist></refsect2>
170<refsect2>
171<title><anchor id="bonobo-stream-client-printf" role="function"/>bonobo_stream_client_printf ()</title>
172<indexterm><primary>bonobo_stream_client_printf</primary></indexterm><programlisting><link linkend="void">void</link>        bonobo_stream_client_printf     (const <link linkend="Bonobo-Stream">Bonobo_Stream</link> stream,
173                                             const <link linkend="gboolean">gboolean</link> terminate,
174                                             <link linkend="CORBA-Environment">CORBA_Environment</link> *ev,
175                                             const <link linkend="char">char</link> *fmt,
176                                             ...);</programlisting>
177<para>
178Processes <parameter>fmt</parameter> and the arguments which follow it to produce a
179string.  Writes this string out to <parameter>stream</parameter>.  This function will not
180return until the entire string is written out, unless an exception
181is raised.  See also <link linkend="bonobo-stream-client-write-string"><function>bonobo_stream_client_write_string()</function></link> and
182<link linkend="bonobo-stream-client-write"><function>bonobo_stream_client_write()</function></link>.</para>
183<para>
184
185</para><variablelist role="params">
186<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
187<listitem><simpara> A CORBA object reference to a <link linkend="Bonobo-Stream"><type>Bonobo_Stream</type></link>.
188</simpara></listitem></varlistentry>
189<varlistentry><term><parameter>terminate</parameter>&nbsp;:</term>
190<listitem><simpara> Whether or not to null-terminate the string when it is
191written out to the stream.
192</simpara></listitem></varlistentry>
193<varlistentry><term><parameter>ev</parameter>&nbsp;:</term>
194<listitem><simpara> A CORBA_Environment pointer.
195</simpara></listitem></varlistentry>
196<varlistentry><term><parameter>fmt</parameter>&nbsp;:</term>
197<listitem><simpara> The printf format string.
198</simpara></listitem></varlistentry>
199<varlistentry><term><parameter>...</parameter>&nbsp;:</term>
200<listitem><simpara> format arguments
201</simpara></listitem></varlistentry>
202</variablelist></refsect2>
203<refsect2>
204<title><anchor id="bonobo-stream-client-read-string" role="function"/>bonobo_stream_client_read_string ()</title>
205<indexterm><primary>bonobo_stream_client_read_string</primary></indexterm><programlisting><link linkend="CORBA-long">CORBA_long</link>  bonobo_stream_client_read_string
206                                            (const <link linkend="Bonobo-Stream">Bonobo_Stream</link> stream,
207                                             <link linkend="char">char</link> **str,
208                                             <link linkend="CORBA-Environment">CORBA_Environment</link> *ev);</programlisting>
209<para>
210Reads a NULL-terminated string from <parameter>stream</parameter> and stores it in a
211newly-allocated string in <parameter>str</parameter>.</para>
212<para>
213
214</para><variablelist role="params">
215<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
216<listitem><simpara> The <link linkend="Bonobo-Stream"><type>Bonobo_Stream</type></link> from which the string will be read.
217</simpara></listitem></varlistentry>
218<varlistentry><term><parameter>str</parameter>&nbsp;:</term>
219<listitem><simpara> The string pointer in which the string will be stored.
220</simpara></listitem></varlistentry>
221<varlistentry><term><parameter>ev</parameter>&nbsp;:</term>
222<listitem><simpara> A pointer to a <link linkend="CORBA-Environment"><type>CORBA_Environment</type></link>.
223</simpara></listitem></varlistentry>
224<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> The number of bytes read, or -1 if an error occurs.
225If an exception occurs, <parameter>ev</parameter> will contain the exception.
226</simpara></listitem></varlistentry>
227</variablelist></refsect2>
228<refsect2>
229<title><anchor id="bonobo-stream-client-get-length" role="function"/>bonobo_stream_client_get_length ()</title>
230<indexterm><primary>bonobo_stream_client_get_length</primary></indexterm><programlisting><link linkend="CORBA-long">CORBA_long</link>  bonobo_stream_client_get_length (const <link linkend="Bonobo-Stream">Bonobo_Stream</link> stream,
231                                             <link linkend="CORBA-Environment">CORBA_Environment</link> *ev);</programlisting>
232<para>
233Does the grunt work to get the length of a stream,
234returns -1 if the length is not available. Returns -1
235on exception.</para>
236<para>
237
238</para><variablelist role="params">
239<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
240<listitem><simpara> The stream.
241</simpara></listitem></varlistentry>
242<varlistentry><term><parameter>ev</parameter>&nbsp;:</term>
243<listitem><simpara> Exception environment
244</simpara></listitem></varlistentry>
245<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> Length or -1
246</simpara></listitem></varlistentry>
247</variablelist></refsect2>
248
249</refsect1>
250
251
252
253<refsect1>
254<title>See Also</title>
255<para>
256<link linkend="BonoboStream"><type>BonoboStream</type></link>
257</para>
258</refsect1>
259
260</refentry>
Note: See TracBrowser for help on using the repository browser.