EMAN2
Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes
EMAN::Df3IO Class Reference

#include <df3io.h>

Inheritance diagram for EMAN::Df3IO:
Inheritance graph
[legend]
Collaboration diagram for EMAN::Df3IO:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Df3IO (const string &filename, IOMode rw_mode=READ_ONLY)
 ~Df3IO ()

Static Public Member Functions

static bool is_valid (const void *first_block, off_t file_size=0)

Public Attributes

 DEFINE_IMAGEIO_FUNC

Private Attributes

unsigned short nx
unsigned short ny
unsigned short nz
string filename
IOMode rw_mode
FILE * df3file
bool initialized
bool is_new_file

Detailed Description

Definition at line 58 of file df3io.h.


Constructor & Destructor Documentation

Df3IO::Df3IO ( const string &  filename,
IOMode  rw_mode = READ_ONLY 
) [explicit]

Definition at line 44 of file df3io.cpp.

:       filename(df3_filename), rw_mode(rw), df3file(0),
        initialized(false), is_new_file(false)
{
}
Df3IO::~Df3IO ( )

Definition at line 50 of file df3io.cpp.

References df3file.

{
        if (df3file) {
                fclose(df3file);
                df3file = 0;
        }
}

Member Function Documentation

bool Df3IO::is_valid ( const void *  first_block,
off_t  file_size = 0 
) [static]

Definition at line 263 of file df3io.cpp.

References ENTERFUNC, EXITFUNC, EMAN::ByteOrder::is_data_big_endian(), nx, ny, and nz.

Referenced by EMAN::EMUtil::get_image_type().

{
        ENTERFUNC;

        if (!first_block) {
                return false;
        }

        const unsigned short *data = static_cast < const unsigned short *>(first_block);
        unsigned short nx = data[0];
        unsigned short ny = data[1];
        unsigned short nz = data[2];

        if(ByteOrder::is_data_big_endian(&nx) && ByteOrder::is_data_big_endian(&ny) && ByteOrder::is_data_big_endian(&nz)) {
                return true;
        }

        EXITFUNC;
        return false;
}

Member Data Documentation

Definition at line 64 of file df3io.h.

FILE* EMAN::Df3IO::df3file [private]

Definition at line 70 of file df3io.h.

Referenced by ~Df3IO().

string EMAN::Df3IO::filename [private]

Definition at line 68 of file df3io.h.

bool EMAN::Df3IO::initialized [private]

Definition at line 71 of file df3io.h.

bool EMAN::Df3IO::is_new_file [private]

Definition at line 72 of file df3io.h.

unsigned short EMAN::Df3IO::nx [private]

Definition at line 67 of file df3io.h.

Referenced by is_valid().

unsigned short EMAN::Df3IO::ny [private]

Definition at line 67 of file df3io.h.

Referenced by is_valid().

unsigned short EMAN::Df3IO::nz [private]

Definition at line 67 of file df3io.h.

Referenced by is_valid().

Definition at line 69 of file df3io.h.


The documentation for this class was generated from the following files: