asio C++ library

PrevUpHomeNext

random_access_file

Typedef for the typical usage of a random-access file.

typedef basic_random_access_file random_access_file;
Types

Name

Description

rebind_executor

Rebinds the file type to another executor.

executor_type

The type of the executor associated with the object.

flags

A bitmask type (C++ Std [lib.bitmask.types]).

native_handle_type

The native representation of a file.

seek_basis

Basis for seeking in a file.

Member Functions

Name

Description

assign

Assign an existing native file to the file.

async_read_some_at

Start an asynchronous read at the specified offset.

async_write_some_at

Start an asynchronous write at the specified offset.

basic_random_access_file [constructor]

Construct a basic_random_access_file without opening it.

Construct and open a basic_random_access_file.

Construct a basic_random_access_file on an existing native file.

Move-construct a basic_random_access_file from another.

Move-construct a basic_random_access_file from a file of another executor type.

cancel

Cancel all asynchronous operations associated with the file.

close

Close the file.

get_executor

Get the executor associated with the object.

is_open

Determine whether the file is open.

native_handle

Get the native file representation.

open

Open the file using the specified path.

operator=

Move-assign a basic_random_access_file from another.

Move-assign a basic_random_access_file from a file of another executor type.

read_some_at

Read some data from the handle at the specified offset.

release

Release ownership of the underlying native file.

resize

Alter the size of the file.

size

Get the size of the file.

sync_all

Synchronise the file to disk.

sync_data

Synchronise the file data to disk.

write_some_at

Write some data to the handle at the specified offset.

~basic_random_access_file [destructor]

Destroys the file.

Data Members

Name

Description

append [static]

Open the file in append mode.

create [static]

Create the file if it does not exist.

exclusive [static]

Ensure a new file is created. Must be combined with create.

read_only [static]

Open the file for reading.

read_write [static]

Open the file for reading and writing.

truncate [static]

Open the file with any existing contents truncated.

write_only [static]

Open the file for writing.

The basic_random_access_file class template provides asynchronous and blocking random-access file functionality.

Thread Safety

Distinct objects: Safe.

Shared objects: Unsafe.

Synchronous read_some_at and write_some_at 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 open or close, are not thread safe.

Requirements

Header: asio/random_access_file.hpp

Convenience header: asio.hpp


PrevUpHomeNext