[#BloombergLP-bdlsb-FixedMemInput]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlsb.adoc[bdlsb]::FixedMemInput
:relfileprefix: ../../
:mrdocs:

This class, like `bdlsb&colon;&colon;FixedMemInStreamBuf`, implements the input functionality of the `basic&lowbar;streambuf` interface, using client&hyphen;supplied `char &ast;` memory&period; It has an interface identical to `bdlsb&colon;&colon;FixedMemInStreamBuf` but does _not_ inherit from `bsl&colon;&colon;streambuf`&period; This implementation is advantageous for performance reasons, as the overhead of the initialization and virtual function calls of a `bsl&colon;&colon;streambuf` can be undesirable&period; It is especially designed for streaming a very small amount of information from a fixed&hyphen;length buffer using a `bslx&lowbar;genericinstream` when the number of characters read from the input is guaranteed not to exceed the length of the buffer&period; Note that this class is not designed to be derived from&period;

== Synopsis

Declared in `&lt;bdlsb&lowbar;fixedmeminput&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class FixedMemInput;
----

== Type Aliases

[cols="1"]
|===
| Name
| xref:BloombergLP/bdlsb/FixedMemInput/char_type.adoc[`char&lowbar;type`] 
| xref:BloombergLP/bdlsb/FixedMemInput/int_type.adoc[`int&lowbar;type`] 
| xref:BloombergLP/bdlsb/FixedMemInput/off_type.adoc[`off&lowbar;type`] 
| xref:BloombergLP/bdlsb/FixedMemInput/pos_type.adoc[`pos&lowbar;type`] 
| xref:BloombergLP/bdlsb/FixedMemInput/traits_type.adoc[`traits&lowbar;type`] 
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlsb/FixedMemInput/2constructor.adoc[`FixedMemInput`]         [.small]#[constructor]#
| Create a `FixedMemInput` using the specified `buffer` of the specified `length`&period; The position indicator is set to the beginning of the `buffer`&period; The behavior is undefined unless `buffer !&equals; 0 &amp;&amp; length &gt; 0` or `length &equals;&equals; 0`&period; Note that `buffer` is held but not owned&period;
| xref:BloombergLP/bdlsb/FixedMemInput/capacity.adoc[`capacity`] 
| Return the size for the buffer held by this buffer, in bytes, supplied at construction&period;
| xref:BloombergLP/bdlsb/FixedMemInput/data.adoc[`data`] 
| Return the address of the non&hyphen;modifiable character buffer held by this stream buffer&period;
| xref:BloombergLP/bdlsb/FixedMemInput/in_avail.adoc[`in&lowbar;avail`] 
| Return the number of characters available from the current read position in this stream buffer&period;
| xref:BloombergLP/bdlsb/FixedMemInput/length.adoc[`length`] 
| Return the number of characters that can be successfully read from this stream buffer before reading `traits&lowbar;type&colon;&colon;eof()` &hyphen;&hyphen; i&period;e&period;, the number of characters between the current read position and the end of this buffer&period;
| xref:BloombergLP/bdlsb/FixedMemInput/pubseekoff.adoc[`pubseekoff`] 
| Set the position indicator to the relative specified `offset` from the base position indicated by the specified `way` and return the resulting absolute position on success or pos&lowbar;type(&hyphen;1) on failure&period; Optionally specify `which` area of the stream buffer&period; The seek operation will fail if `which` does not include the flag `bsl&colon;&colon;ios&lowbar;base&colon;&colon;in` or if the resulting absolute position is less than zero or greater than the value returned by `length`&period;
| xref:BloombergLP/bdlsb/FixedMemInput/pubseekpos.adoc[`pubseekpos`] 
| Set the position indicator to the specified `position` and return the resulting absolute position on success or pos&lowbar;type(&hyphen;1) on failure&period; Optionally specify `which` area of the stream buffer&period; The `seekpos` operation will fail if `which` does not include the flag `bsl&colon;&colon;ios&lowbar;base&colon;&colon;in` or if position is less then zero or greater than the value returned by `length`&period;
| xref:BloombergLP/bdlsb/FixedMemInput/pubsetbuf.adoc[`pubsetbuf`] 
| Reinitialize this stream buffer to use the specified character `buffer` having the specified `length`&period; Return a pointer providing modifiable access to this stream buffer&period; The behaviour is undefined unless `buffer !&equals; 0 &amp;&amp; length &gt; 0` or `length &equals;&equals; 0`&period; Upon reinitialization for use of the new buffer, the position indicator is set to the beginning of the `buffer`&period; Note that `buffer` is held but not owned&period;
| xref:BloombergLP/bdlsb/FixedMemInput/sbumpc.adoc[`sbumpc`] 
| Return the character at the current read position from this buffer, or `traits&lowbar;type&colon;&colon;eof()` if the end of the buffer is reached and advance read position indicator&period;
| xref:BloombergLP/bdlsb/FixedMemInput/sgetc.adoc[`sgetc`] 
| Return the character at the current read position from this buffer, or `traits&lowbar;type&colon;&colon;eof()` if the end of the buffer is reached&period;
| xref:BloombergLP/bdlsb/FixedMemInput/sgetn.adoc[`sgetn`] 
| Read the specified `length` characters to the specified `destination`&period; Return the number of characters successfully read from this buffer, which is either equal to the `length` parameter or equal to the distance from the current read position to the end of the input buffer, whichever is smaller, and move the read cursor position by this amount&period; The behavior is undefined unless &apos;0 &lt;&equals; length&apos;&period;
| xref:BloombergLP/bdlsb/FixedMemInput/snextc.adoc[`snextc`] 
| Advance the current read position and return the character at the resulting position from this buffer, or `traits&lowbar;type&colon;&colon;eof()` if the end of the buffer is reached&period;
| xref:BloombergLP/bdlsb/FixedMemInput/sputbackc.adoc[`sputbackc`] 
| Move the current read position back one character if the current read position is not at the beginning of the buffer and the previous position contains the specified character `c`, and return that character&period; Otherwise, return `traits&lowbar;type&colon;&colon;eof()` and do not move the current read position&period;
| xref:BloombergLP/bdlsb/FixedMemInput/sungetc.adoc[`sungetc`] 
| Move the current read position back one character if the current read position is not at the beginning of the buffer, and return the character at the resulting current read position from this buffer&period; Return `traits&lowbar;type&colon;&colon;eof()` otherwise&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
