compose.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Class Template chain</TITLE>
  5. <LINK REL="stylesheet" HREF="../../../../boost.css">
  6. <LINK REL="stylesheet" HREF="../theme/iostreams.css">
  7. </HEAD>
  8. <BODY>
  9. <!-- Begin Banner -->
  10. <H1 CLASS="title">Function Template <CODE>compose</CODE></H1>
  11. <HR CLASS="banner">
  12. <!-- End Banner -->
  13. <DL class="page-index">
  14. <DT><A href="#description">Description</A></DT>
  15. <DT><A href="#headers">Headers</A></DT>
  16. <DT><A href="#reference">Reference</A></DT>
  17. </DL>
  18. <HR>
  19. <A NAME="description"></A>
  20. <H2>Description</H2>
  21. <P>
  22. Given a Filter <CODE>f</CODE> and a Device <CODE>d</CODE>, we may construct a device <CODE>c</CODE> whose member functions are implemented by invoking the fundamental i/o operations <A HREF='../functions/read.html'><CODE>read</CODE></A>, <A HREF='../functions/write.html'><CODE>write</CODE></A>, <I>etc.</I> with <CODE>f</CODE> as the first argument and <CODE>d</CODE> as the second. Similarly, if we are given two filters <CODE>f1</CODE> and <CODE>f2</CODE>, we may construct a third filter <CODE>f3</CODE> whose member function templates are implemented by invoking the fundamental i/o operations <A HREF='../functions/read.html'><CODE>read</CODE></A>, <A HREF='../functions/write.html'><CODE>write</CODE></A>, <I>etc.</I>, with first argument equal to <CODE>f1</CODE> and second argument equal to the result of composing <CODE>f2</CODE> with the provided Device.
  23. </P>
  24. <P>
  25. The function template <A HREF='#composite'><CODE>composite</CODE></A> represents a Filter or Device which has been constructed in the above manner. The function template <A HREF='#compose'><CODE>compose</CODE></A> is an <A HREF='http://www.boost.org/more/generic_programming.html#object_generator' TARGET='_top'>object generator</A> which given a pair of components returns an appropriate instance of <CODE>composite</CODE>.
  26. </P>
  27. <P>
  28. The <A HREF='../guide/modes.html'>mode</A> of a <CODE>composite</CODE> is defined to provide a maximal subset of the common functionality of the two components. A <CODE>composite</CODE> is <A HREF='../concepts/closable.html'>Closable</A>, <A HREF='../concepts/flushable.html'>Flushable</A>, <A HREF='../concepts/localizable.html'>Localizable</A> and <A HREF='../concepts/optimally_buffered.html'>OptimallyBuffered</A>.
  29. </P>
  30. <A NAME="headers"></A>
  31. <H2>Headers</H2>
  32. <DL class="page-index">
  33. <DT><A CLASS="header" HREF="../../../../boost/iostreams/compose.hpp"><CODE>&lt;boost/iostreams/compose.hpp&gt;</CODE></A></DT>
  34. </DL>
  35. <A NAME="reference"></A>
  36. <H2>Reference</H2>
  37. <A NAME="synopsis"></A>
  38. <H4>Synopsis</H4>
  39. <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
  40. <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#composite_template_params">Filter</A>, <SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#composite_template_params">FilterOrDevice</A>&gt;
  41. <SPAN CLASS='keyword'>class</SPAN> <A CLASS='documented' HREF='#composite'>composite</A> {
  42. <SPAN CLASS='keyword'>public:</SPAN>
  43. <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='keyword'>typename</SPAN> <A CLASS='documented' HREF='../guide/traits.html#char_type'>char_type_of</A>&lt;Filter&gt;::type char_type;
  44. <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='omitted'>implementation-defined</SPAN> mode;
  45. <A CLASS='documented' HREF='#composite_ctor'>composite</A>(<SPAN CLASS='keyword'>const</SPAN> Filter&amp; first, [<SPAN CLASS='keyword'>const</SPAN>] FilterOrDevice&amp; second);
  46. <SPAN CLASS='comment'>// Filter or Device member functions</SPAN>
  47. };
  48. <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#compose_template_params">Filter</A>, <SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#compose_template_params">FilterOrDevice</A>&gt;
  49. <A CLASS='documented' HREF='#composite'>composite</A>&lt;Filter, FilterOrDevice&gt;
  50. <A CLASS='documented' HREF='#compose'>compose</A>(<SPAN CLASS='keyword'>const</SPAN> Filter&amp; first, [<SPAN CLASS='keyword'>const</SPAN>] FilterOrDevice&amp; second);
  51. } } // End namespace boost::io</PRE>
  52. <A NAME="composite"></A>
  53. <H2>Class Template <CODE>composite</CODE></H2>
  54. <A NAME="composite_template_params"></A>
  55. <H4>Template parameters</H4>
  56. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  57. <TR>
  58. <TR>
  59. <TD VALIGN="top"><I>Filter</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  60. <TD>A model of <A HREF='../concepts/filter.html'>Filter</A></TD>
  61. </TR>
  62. <TR>
  63. <TD VALIGN="top"><I>FilterOrDevice</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  64. <TD>A model of <A HREF='../concepts/filter.html'>Filter</A> or <A HREF='../concepts/device.html'>Device</A></TD>
  65. </TR>
  66. </TABLE>
  67. <A NAME="composite_ctor"></A>
  68. <H4><CODE>composite::composite</CODE></H4>
  69. <PRE CLASS="broken_ie"> composite(<SPAN CLASS='keyword'>const</SPAN> Filter&amp; first, [<SPAN CLASS='keyword'>const</SPAN>] FilterOrDevice&amp; second);</PRE>
  70. <P>
  71. Constructs an instance of <CODE>composite</CODE> based on the given components. If <CODE>FilterOrDevice</CODE> is a stream or stream buffer type, the second parameter is a non-<CODE>const</CODE> reference; otherwise it is a <CODE>const</CODE> reference.
  72. </P>
  73. <A NAME="compose"></A>
  74. <H2>Function Template <CODE>compose</CODE></H2>
  75. <PRE CLASS="broken_ie"> composite(<SPAN CLASS='keyword'>const</SPAN> Filter&amp; first, [<SPAN CLASS='keyword'>const</SPAN>] FilterOrDevice&amp; second);</PRE>
  76. <A NAME="compose_template_params"></A>
  77. <H4>Template parameters</H4>
  78. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  79. <TR>
  80. <TR>
  81. <TD VALIGN="top"><I>Filter</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  82. <TD>A model of <A HREF='../concepts/filter.html'>Filter</A></TD>
  83. </TR>
  84. <TR>
  85. <TD VALIGN="top"><I>FilterOrDevice</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  86. <TD>A model of <A HREF='../concepts/filter.html'>Filter</A> or <A HREF='../concepts/device.html'>Device</A></TD>
  87. </TR>
  88. </TABLE>
  89. <P>
  90. Returns an instance of an appropriate specialization of <CODE>composite</CODE> constructed from the given components. If <CODE>FilterOrDevice</CODE> is a stream or stream buffer type, the second parameter is a non-<CODE>const</CODE> reference; otherwise it is a <CODE>const</CODE> reference.
  91. </P>
  92. <!-- Begin Footer -->
  93. <HR>
  94. <P CLASS="copyright">&copy; Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>&copy; Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan Turkanis</a></P>
  95. <P CLASS="copyright">
  96. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <A HREF="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)
  97. </P>
  98. <!-- End Footer -->
  99. </BODY>