Bsoft  2.1.0
Bernard's software package
file_util.h
Go to the documentation of this file.
1 
9 #include "Bstring.h"
10 #include <fstream>
11 
12 #ifndef _filetype_
13 
20 enum FileType {
21  Unknown_FileType = 0, // Indeterminate
22  Image = 1, // Image file
23  Micrograph = 2, // Micrograph parameter file
24  Molecule = 3, // Molecular coordinate file
25  Model = 4, // Model parameter file
26  MgRelion = 11 // Relion micrograph
27 } ;
28 #define _filetype_
29 #endif
30 
31 // Function prototypes
32 int fread_large(unsigned char* aptr, size_t pagesize, size_t offset, ifstream* fimg);
33 Bstring find_file(Bstring filename, Bstring path, int flag=0);
34 string find_file(string filename, string path, int flag=0);
35 FileType file_type(const char* filename);
36 FileType file_type(Bstring& filename);
37 int detect_and_fix_carriage_return(const char* filename);
38 
fread_large
int fread_large(unsigned char *aptr, size_t pagesize, size_t offset, ifstream *fimg)
Reads blocks of memeory no larger than 1Gb.
Definition: file_util.cpp:347
Bstring
Definition: Bstring.h:29
Molecule
@ Molecule
Definition: file_util.h:24
Micrograph
@ Micrograph
Definition: file_util.h:23
detect_and_fix_carriage_return
int detect_and_fix_carriage_return(const char *filename)
Detects carriage returns in text files and converts them to new-lines.
Definition: file_util.cpp:377
FileType
FileType
File type enumeration.
Definition: file_util.h:20
Bstring.h
Header file for the string class.
Image
@ Image
Definition: file_util.h:22
MgRelion
@ MgRelion
Definition: file_util.h:26
find_file
Bstring find_file(Bstring filename, Bstring path, int flag=0)
Searches for a file within or without the given path.
Definition: file_util.cpp:54
Model
@ Model
Definition: file_util.h:25
Unknown_FileType
@ Unknown_FileType
Definition: file_util.h:21
file_type
FileType file_type(const char *filename)
Checks the file type using the extension and contents.
Definition: file_util.cpp:178