/Users/bernard/b20/bsoft/include/file_util.h(3)

NAME
/Users/bernard/b20/bsoft/include/file_util.h - Header file for file checking functions.

SYNOPSIS

#include 'Bstring.h'
#include <fstream>

  Macros
#define _filetype_

  Enumerations
enum FileType { Unknown_FileType = 0, Image = 1, Micrograph = 2, Molecule = 3, Model = 4, MgRelion = 11 }
File type enumeration.

  Functions
int fread_large (unsigned char *aptr, size_t pagesize, size_t offset, ifstream *fimg)
Reads blocks of memeory no larger than 1Gb.
Bstring find_file (Bstring filename, Bstring path, int flag=0)
Searches for a file within or without the given path.
string find_file (string filename, string path, int flag=0)
FileType file_type (const char *filename)
Checks the file type using the extension and contents.
FileType file_type (Bstring &filename)
int detect_and_fix_carriage_return (const char *filename)
Detects carriage returns in text files and converts them to new-lines.

Detailed Description

Header file for file checking functions.

Author:
    Bernard Heymann

Date:
    Created: 20010601

    Modified: 20180330

Definition in file file_util.h.

Macro Definition Documentation

  #define _filetype_

Definition at line 28 of file file_util.h.

Enumeration Type Documentation

  enum FileType

File type enumeration. The types are mostly based on Bsoft objects. Additional types enumerated above 10 are for other packages.

Enumerator

Unknown_FileType

Image

Micrograph

Molecule

Model

MgRelion

Definition at line 20 of file file_util.h.

Function Documentation

  int detect_and_fix_carriage_return (const char * filename)

Detects carriage returns in text files and converts them to new-lines.

Parameters:
    *filename file name.

Returns:
    int 0, <0 if error.

    The first line is read and if any carriage returns are found, the whole
    file is scanned and carriage returns converted to new-lines.

Definition at line 377 of file file_util.cpp.

  FileType file_type (const char * filename)

Checks the file type using the extension and contents.

Parameters:
    *filename file name.

Returns:
    FileType enumerated file type.

    The file extension is the main determinant of the file type.
    File formats with multiple types (such as the STAR and PDB formats)
    are distinguished based on content.

Definition at line 178 of file file_util.cpp.

  FileType file_type (Bstring & filename)

Definition at line 184 of file file_util.cpp.

  Bstring find_file (Bstring filename, Bstring path, int flag)

Searches for a file within or without the given path.

Parameters:
    filename file name to search for.
    path path to search in.
    flag if not found: bit 1 = warn; bit 2 = delete file name.

Returns:
    Bstring found file, empty if not found and delete_flag set.

    The input filename is first tested for access.
    If not found, the filename without its original path is tested.
    If not found, the filename with the given path is tested.
    If not found, an error is reported and the original filename returned
    unless the delete flag is set.

Definition at line 54 of file file_util.cpp.

  string find_file (string filename, string path, int flag = 0)

Definition at line 111 of file file_util.cpp.

  int fread_large (unsigned char * aptr, size_t pagesize, size_t offset, ifstream * fimg)

Reads blocks of memeory no larger than 1Gb.

Parameters:
    *aptr pointer to pre-allocated memory.
    pagesize size of pre-allocated memory.
    offset offset in file.
    *fimg file pointer.

Returns:
    int 0, <0 if error.

    Each block is packed in sequence into the pre-allocated memory provided.

Definition at line 347 of file file_util.cpp.

Author

Generated automatically by Doxygen for Bsoft from the source code.