source: pkg/main/libbonobo/trunk/doc/api/xml/bonobo-stream-client.xml @ 479

Revision 479, 14.9 KB checked in by alanbach-guest, 6 years ago (diff)

Libbonobo 2.18.0 updates

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