Struct sdf::file::File [] [src]

pub struct File { /* fields omitted */ }

An .sdf file.

The file is mostly a simple wrapper around an fwifc_file handle, but we do a bit of extra smarts (or dumbs) to help other users.

  • We ensure that we reindex the file only once, regardless of the number of times that reindex has been called.

Methods

impl File
[src]

Opens an .sdf data file.

Examples

use sdf::file::File;
let file = File::open("data/110630_174316.sdf").unwrap();

(Re-)Creates the index file.

The index file is required for navigating the file. This is a blocking operation and may take some time. The index file is placed in the same directory as the data file.

Examples

use sdf::file::File;
let mut file = File::open("data/110630_174316.sdf").unwrap();
file.reindex().unwrap();

Remove this file's index from the filesystem.

Examples

use sdf::file::File;
let mut file = File::open("data/110630_174316.sdf").unwrap();
file.reindex().unwrap();
file.remove_index().unwrap();

Sets the mode timestamp of the start of the sample block.

Examples

use sdf::file::{File, SosblMode};
let mut file = File::open("data/110630_174316.sdf").unwrap();
file.set_sosbl_mode(SosblMode::Relative).unwrap();
file.set_sosbl_mode(SosblMode::Absolute).unwrap();

Gets information about the file.

Examples

use sdf::file::File;
let mut file = File::open("data/110630_174316.sdf").unwrap();
let file_info = file.info();

Gets the calibration info for the file.

We manually copy all of the calibration info into new vectors because we can't really trust the memory behind the fwifc call.

Examples

use sdf::file::{File, CalibrationTableKind, Channel};
let mut file = File::open("data/110630_174316.sdf").unwrap();
let calibration = file.calibration(CalibrationTableKind::Amplitude(Channel::High)).unwrap();

Reads a sample data record from the file.

Panics

Panics if the underlying sdfifc library returns a record with two blocks with the same channel. We assume that this can't happen, and so we panic (rather than returning an error) to indicate that this is a very exceptional case.

Examples

use sdf::file::File;
let mut file = File::open("data/110630_174316.sdf").unwrap();
file.reindex().unwrap();
let record = file.read().unwrap();

Seeks to a record index in the file.

Examples

Seeks to the first record.

use sdf::file::File;
let mut file = File::open("data/110630_174316.sdf").unwrap();
file.reindex().unwrap();
file.seek(1).unwrap();

Seeks to the end of the file.

use std::u32;
use sdf::file::File;
let mut file = File::open("data/110630_174316.sdf").unwrap();
file.reindex().unwrap();
file.seek(u32::MAX).unwrap();

Seeks to an internal timestamp, in seconds.

Examples

use sdf::file::File;
let mut file = File::open("data/110630_174316.sdf").unwrap();
file.reindex().unwrap();
file.seek_time(1.0).unwrap();

Seeks to an external time in seconds.

Either day or week seconds. This requires GPS-synchronized data.

Examples

use sdf::file::File;
let mut file = File::open("data/110630_174316.sdf").unwrap();
file.reindex().unwrap();
file.seek_time_external(1.0).unwrap();

Returns the index of the next record to be read.

Examples

use sdf::file::File;
let mut file = File::open("data/110630_174316.sdf").unwrap();
file.reindex().unwrap();
assert_eq!(1, file.tell().unwrap());
file.read().unwrap();
assert_eq!(2, file.tell().unwrap());

Returns true if this file is indexed.

Examples

use sdf::file::File;
let file = File::open("data/110630_174316.sdf").unwrap();
file.indexed();

Trait Implementations

impl Debug for File
[src]

Formats the value using the given formatter.

impl Drop for File
[src]

A method called when the value goes out of scope. Read more

impl IntoIterator for File
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more