544 lines
19 KiB
HTML
544 lines
19 KiB
HTML
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
|
<title>random_access_file</title>
|
||
|
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||
|
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||
|
<link rel="home" href="../../index.html" title="Asio">
|
||
|
<link rel="up" href="../reference.html" title="Reference">
|
||
|
<link rel="prev" href="query_result/type.html" title="query_result::type">
|
||
|
<link rel="next" href="read.html" title="read">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
</head>
|
||
|
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||
|
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||
|
<hr>
|
||
|
<div class="spirit-nav">
|
||
|
<a accesskey="p" href="query_result/type.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="read.html"><img src="../../next.png" alt="Next"></a>
|
||
|
</div>
|
||
|
<div class="section">
|
||
|
<div class="titlepage"><div><div><h3 class="title">
|
||
|
<a name="asio.reference.random_access_file"></a><a class="link" href="random_access_file.html" title="random_access_file">random_access_file</a>
|
||
|
</h3></div></div></div>
|
||
|
<p>
|
||
|
<a class="indexterm" name="asio.indexterm.random_access_file"></a>
|
||
|
</p>
|
||
|
<p>
|
||
|
Typedef for the typical usage of a random-access file.
|
||
|
</p>
|
||
|
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">basic_random_access_file</span> <span class="identifier">random_access_file</span><span class="special">;</span>
|
||
|
</pre>
|
||
|
<h5>
|
||
|
<a name="asio.reference.random_access_file.h0"></a>
|
||
|
<span><a name="asio.reference.random_access_file.types"></a></span><a class="link" href="random_access_file.html#asio.reference.random_access_file.types">Types</a>
|
||
|
</h5>
|
||
|
<div class="informaltable"><table class="table">
|
||
|
<colgroup>
|
||
|
<col>
|
||
|
<col>
|
||
|
</colgroup>
|
||
|
<thead><tr>
|
||
|
<th>
|
||
|
<p>
|
||
|
Name
|
||
|
</p>
|
||
|
</th>
|
||
|
<th>
|
||
|
<p>
|
||
|
Description
|
||
|
</p>
|
||
|
</th>
|
||
|
</tr></thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file__rebind_executor.html" title="basic_random_access_file::rebind_executor"><span class="bold"><strong>rebind_executor</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Rebinds the file type to another executor.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/executor_type.html" title="basic_random_access_file::executor_type"><span class="bold"><strong>executor_type</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
The type of the executor associated with the object.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/flags.html" title="basic_random_access_file::flags"><span class="bold"><strong>flags</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
A bitmask type (C++ Std [lib.bitmask.types]).
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/native_handle_type.html" title="basic_random_access_file::native_handle_type"><span class="bold"><strong>native_handle_type</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
The native representation of a file.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/seek_basis.html" title="basic_random_access_file::seek_basis"><span class="bold"><strong>seek_basis</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Basis for seeking in a file.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table></div>
|
||
|
<h5>
|
||
|
<a name="asio.reference.random_access_file.h1"></a>
|
||
|
<span><a name="asio.reference.random_access_file.member_functions"></a></span><a class="link" href="random_access_file.html#asio.reference.random_access_file.member_functions">Member
|
||
|
Functions</a>
|
||
|
</h5>
|
||
|
<div class="informaltable"><table class="table">
|
||
|
<colgroup>
|
||
|
<col>
|
||
|
<col>
|
||
|
</colgroup>
|
||
|
<thead><tr>
|
||
|
<th>
|
||
|
<p>
|
||
|
Name
|
||
|
</p>
|
||
|
</th>
|
||
|
<th>
|
||
|
<p>
|
||
|
Description
|
||
|
</p>
|
||
|
</th>
|
||
|
</tr></thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/assign.html" title="basic_random_access_file::assign"><span class="bold"><strong>assign</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Assign an existing native file to the file.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/async_read_some_at.html" title="basic_random_access_file::async_read_some_at"><span class="bold"><strong>async_read_some_at</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Start an asynchronous read at the specified offset.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/async_write_some_at.html" title="basic_random_access_file::async_write_some_at"><span class="bold"><strong>async_write_some_at</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Start an asynchronous write at the specified offset.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/basic_random_access_file.html" title="basic_random_access_file::basic_random_access_file"><span class="bold"><strong>basic_random_access_file</strong></span></a> <span class="silver">[constructor]</span>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Construct a basic_random_access_file without opening it. <br>
|
||
|
<span class="silver"> —</span><br> Construct and open a basic_random_access_file. <br> <span class="silver"> —</span><br>
|
||
|
Construct a basic_random_access_file on an existing native file.
|
||
|
<br> <span class="silver"> —</span><br> Move-construct a basic_random_access_file from another.
|
||
|
<br> <span class="silver"> —</span><br> Move-construct a basic_random_access_file from a
|
||
|
file of another executor type.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/cancel.html" title="basic_random_access_file::cancel"><span class="bold"><strong>cancel</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Cancel all asynchronous operations associated with the file.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/close.html" title="basic_random_access_file::close"><span class="bold"><strong>close</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Close the file.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/get_executor.html" title="basic_random_access_file::get_executor"><span class="bold"><strong>get_executor</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Get the executor associated with the object.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/is_open.html" title="basic_random_access_file::is_open"><span class="bold"><strong>is_open</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Determine whether the file is open.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/native_handle.html" title="basic_random_access_file::native_handle"><span class="bold"><strong>native_handle</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Get the native file representation.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/open.html" title="basic_random_access_file::open"><span class="bold"><strong>open</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Open the file using the specified path.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/operator_eq_.html" title="basic_random_access_file::operator="><span class="bold"><strong>operator=</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Move-assign a basic_random_access_file from another. <br> <span class="silver"> —</span><br>
|
||
|
Move-assign a basic_random_access_file from a file of another executor
|
||
|
type.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/read_some_at.html" title="basic_random_access_file::read_some_at"><span class="bold"><strong>read_some_at</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Read some data from the handle at the specified offset.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/release.html" title="basic_random_access_file::release"><span class="bold"><strong>release</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Release ownership of the underlying native file.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/resize.html" title="basic_random_access_file::resize"><span class="bold"><strong>resize</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Alter the size of the file.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/size.html" title="basic_random_access_file::size"><span class="bold"><strong>size</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Get the size of the file.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/sync_all.html" title="basic_random_access_file::sync_all"><span class="bold"><strong>sync_all</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Synchronise the file to disk.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/sync_data.html" title="basic_random_access_file::sync_data"><span class="bold"><strong>sync_data</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Synchronise the file data to disk.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/write_some_at.html" title="basic_random_access_file::write_some_at"><span class="bold"><strong>write_some_at</strong></span></a>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Write some data to the handle at the specified offset.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/_basic_random_access_file.html" title="basic_random_access_file::~basic_random_access_file"><span class="bold"><strong>~basic_random_access_file</strong></span></a> <span class="silver">[destructor]</span>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Destroys the file.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table></div>
|
||
|
<h5>
|
||
|
<a name="asio.reference.random_access_file.h2"></a>
|
||
|
<span><a name="asio.reference.random_access_file.data_members"></a></span><a class="link" href="random_access_file.html#asio.reference.random_access_file.data_members">Data
|
||
|
Members</a>
|
||
|
</h5>
|
||
|
<div class="informaltable"><table class="table">
|
||
|
<colgroup>
|
||
|
<col>
|
||
|
<col>
|
||
|
</colgroup>
|
||
|
<thead><tr>
|
||
|
<th>
|
||
|
<p>
|
||
|
Name
|
||
|
</p>
|
||
|
</th>
|
||
|
<th>
|
||
|
<p>
|
||
|
Description
|
||
|
</p>
|
||
|
</th>
|
||
|
</tr></thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/append.html" title="basic_random_access_file::append"><span class="bold"><strong>append</strong></span></a> <span class="silver">[static]</span>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Open the file in append mode.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/create.html" title="basic_random_access_file::create"><span class="bold"><strong>create</strong></span></a> <span class="silver">[static]</span>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Create the file if it does not exist.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/exclusive.html" title="basic_random_access_file::exclusive"><span class="bold"><strong>exclusive</strong></span></a> <span class="silver">[static]</span>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Ensure a new file is created. Must be combined with create.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/read_only.html" title="basic_random_access_file::read_only"><span class="bold"><strong>read_only</strong></span></a> <span class="silver">[static]</span>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Open the file for reading.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/read_write.html" title="basic_random_access_file::read_write"><span class="bold"><strong>read_write</strong></span></a> <span class="silver">[static]</span>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Open the file for reading and writing.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/sync_all_on_write.html" title="basic_random_access_file::sync_all_on_write"><span class="bold"><strong>sync_all_on_write</strong></span></a> <span class="silver">[static]</span>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Open the file so that write operations automatically synchronise
|
||
|
the file data and metadata to disk.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/truncate.html" title="basic_random_access_file::truncate"><span class="bold"><strong>truncate</strong></span></a> <span class="silver">[static]</span>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Open the file with any existing contents truncated.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<a class="link" href="basic_random_access_file/write_only.html" title="basic_random_access_file::write_only"><span class="bold"><strong>write_only</strong></span></a> <span class="silver">[static]</span>
|
||
|
</p>
|
||
|
</td>
|
||
|
<td>
|
||
|
<p>
|
||
|
Open the file for writing.
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table></div>
|
||
|
<p>
|
||
|
The <a class="link" href="basic_random_access_file.html" title="basic_random_access_file"><code class="computeroutput"><span class="identifier">basic_random_access_file</span></code></a> class template
|
||
|
provides asynchronous and blocking random-access file functionality.
|
||
|
</p>
|
||
|
<h5>
|
||
|
<a name="asio.reference.random_access_file.h3"></a>
|
||
|
<span><a name="asio.reference.random_access_file.thread_safety"></a></span><a class="link" href="random_access_file.html#asio.reference.random_access_file.thread_safety">Thread
|
||
|
Safety</a>
|
||
|
</h5>
|
||
|
<p>
|
||
|
<span class="emphasis"><em>Distinct</em></span> <span class="emphasis"><em>objects:</em></span> Safe.
|
||
|
</p>
|
||
|
<p>
|
||
|
<span class="emphasis"><em>Shared</em></span> <span class="emphasis"><em>objects:</em></span> Unsafe.
|
||
|
</p>
|
||
|
<p>
|
||
|
Synchronous <code class="computeroutput"><span class="identifier">read_some_at</span></code>
|
||
|
and <code class="computeroutput"><span class="identifier">write_some_at</span></code> operations
|
||
|
are thread safe with respect to each other, if the underlying operating system
|
||
|
calls are also thread safe. This means that it is permitted to perform concurrent
|
||
|
calls to these synchronous operations on a single file object. Other synchronous
|
||
|
operations, such as <code class="computeroutput"><span class="identifier">open</span></code>
|
||
|
or <code class="computeroutput"><span class="identifier">close</span></code>, are not thread
|
||
|
safe.
|
||
|
</p>
|
||
|
<h5>
|
||
|
<a name="asio.reference.random_access_file.h4"></a>
|
||
|
<span><a name="asio.reference.random_access_file.requirements"></a></span><a class="link" href="random_access_file.html#asio.reference.random_access_file.requirements">Requirements</a>
|
||
|
</h5>
|
||
|
<p>
|
||
|
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/random_access_file.hpp</code>
|
||
|
</p>
|
||
|
<p>
|
||
|
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||
|
</p>
|
||
|
</div>
|
||
|
<div class="copyright-footer">Copyright © 2003-2023 Christopher M. Kohlhoff<p>
|
||
|
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" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||
|
</p>
|
||
|
</div>
|
||
|
<hr>
|
||
|
<div class="spirit-nav">
|
||
|
<a accesskey="p" href="query_result/type.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="read.html"><img src="../../next.png" alt="Next"></a>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|