v_sim.Files¶
- Subclasses:
 None
Methods¶
- Inherited:
 - Structs:
 
class  | 
  | 
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Virtual Methods¶
- Inherited:
 
Properties¶
None
Signals¶
- Inherited:
 
Fields¶
- Inherited:
 
Name  | 
Type  | 
Access  | 
Description  | 
|---|---|---|---|
parent  | 
r  | 
Class Details¶
- class v_sim.Files(**kwargs)¶
 - Bases:
 - Abstract:
 No
- Structure:
 
An opaque structure for the scalar field.
- classmethod new()¶
 - Returns:
 a newly created
v_sim.Filesobject.- Return type:
 
Creates a new
v_sim.Filesobject.New in version 3.8.
- atEnd()¶
 - 
Inquires if self is at end of file.
New in version 3.8.
 
- fortran_checkFlag(ncheck, endian)¶
 - Parameters:
 ncheck (
int) – the size to be checked for.endian (
v_sim.FortranEndianId) – the endianness of self.
- Raises:
 - Returns:
 Trueon successful read.- Return type:
 
Read the next Fortran flag and check that it’s content is equal to ncheck.
New in version 3.8.
- fortran_open(filename)¶
 - 
Open filename as a Fortran binary file.
New in version 3.8.
 
- fortran_readCharacter(var, nb, error, endianness, testFlag, store)¶
 - Parameters:
 nb (
int) – the size of the array var ;error (
GLib.Error) – a pointer to an error location ;endianness (
v_sim.FortranEndianId) – reverse or not the order of multi-bytes ;testFlag (
bool) – ifTrue, read start and stop flags and test their values ;store (
bool) – a boolean.
- Returns:
 Trueif everything went right.- Return type:
 
Read an array of characters from a fortran record. The endianness is required to read the Fortran flag. If argument store is
False, then the file is read and consistency checked but no data is stored. In that case, var can be not allocated.
- fortran_readDouble(endianness)¶
 - Parameters:
 endianness (
v_sim.FortranEndianId) – reverse or not the order of multi-bytes ;- Raises:
 - Returns:
 Trueif everything went right.- var:
 a double location.
- Return type:
 
Read one double without reading enclosing flags.
- fortran_readDoubleArray(nb, endianness, testFlag)¶
 - Parameters:
 nb (
int) – the expected size of the array var ;endianness (
v_sim.FortranEndianId) – reverse or not the order of multi-bytes ;testFlag (
bool) – ifTrue, read start and stop flags and test their values ;
- Raises:
 - Returns:
 Trueif everything went right.- var:
 an array location.
- Return type:
 
Read an array of doubles from a fortran record.
- fortran_readFlag(endianness)¶
 - Parameters:
 endianness (
v_sim.FortranEndianId) – reverse or not the order of multi-bytes.- Raises:
 - Returns:
 Trueif everything went right.- nb:
 a location t store the value of the flag ;
- Return type:
 
Read the flag of a record (a 32bits integer).
- fortran_readInteger(endianness)¶
 - Parameters:
 endianness (
v_sim.FortranEndianId) – reverse or not the order of multi-bytes ;- Raises:
 - Returns:
 Trueif everything went right.- var:
 an integer location.
- Return type:
 
Read one integer without reading enclosing flags.
- fortran_readIntegerArray(nb, endianness, testFlag)¶
 - Parameters:
 nb (
int) – the expected size of the array var ;endianness (
v_sim.FortranEndianId) – reverse or not the order of multi-bytes ;testFlag (
bool) – ifTrue, read start and stop flags and test their values ;
- Raises:
 - Returns:
 Trueif everything went right.- var:
 an array location.
- Return type:
 
Read an array of integers from a fortran record.
- fortran_readRealArray(nb, endianness, testFlag)¶
 - Parameters:
 nb (
int) – the expected size of the array var ;endianness (
v_sim.FortranEndianId) – reverse or not the order of multi-bytes ;testFlag (
bool) – ifTrue, read start and stop flags and test their values ;
- Raises:
 - Returns:
 Trueif everything went right.- var:
 an allocated array of float ;
- Return type:
 
Read an array of reals from a fortran record.
- fortran_readString(nb, endianness, testFlag)¶
 - Parameters:
 nb (
int) – the length of the expected string.endianness (
v_sim.FortranEndianId) – the endianness of self.testFlag (
bool) – a boolean.
- Raises:
 - Returns:
 Trueon success.- var:
 a location to store the read string.
- Return type:
 
Read a string from the next Fortran record. This string is allocated with malloc and should be freed after use. The expected string is supposed to employ nb bytes on disk, padded with white spaces. The output string is trimmed from whitespaces though.
New in version 3.8.
- fortran_testEndianness(nb)¶
 - Parameters:
 nb (
int) – the value of the flag to read ;- Returns:
 Trueif everything went right.- endianness:
 a location to store the endianness.
- Return type:
 (
bool, endianness:v_sim.FortranEndianId)
Read a flag and compare the value with nb for little and big endian. It return the value of endianness to be used after. The file is rewind after the call.
- fromMemory(data)¶
 - Parameters:
 data (
str) – some data.
Create a
v_sim.Filesobject from data.New in version 3.8.
- open(filename)¶
 - Parameters:
 filename (
str) – a filename.- Raises:
 - Returns:
 Trueif no error occured when opening the file.- Return type:
 
Open filename for read access. The file can be compressed or not.
New in version 3.8.
- read(buffer, count)¶
 - Parameters:
 - Raises:
 - Returns:
 a IO status.
- Return type:
 
Read count bytes from self and store them into buffer.
New in version 3.8.
- read_line_string()¶
 - Raises:
 - Returns:
 a status.
- buffer:
 an allocated string.
- terminator_pos:
 position of the terminator in buffer.
- Return type:
 (
GLib.IOStatus, buffer:GLib.String, terminator_pos:int)
Read a new line from self and put it into buffer. This works like
GLib.IOChannel.read_line_string() but is transparent for compressed files.New in version 3.8.
- rewind()¶
 - Raises:
 - Returns:
 a status.
- Return type:
 
Transparently rewind self at the beginning for compressed files or not.
New in version 3.8.
- setEncoding(encoding)¶
 - Parameters:
 encoding (
str) – an encoding.
Set-up the encoding of self.
New in version 3.8.