IMP logo
IMP Reference Guide  2.11.1
The Integrative Modeling Platform
EMReaderWriter.h
Go to the documentation of this file.
1 /**
2  * \file IMP/em/EMReaderWriter.h
3  * \brief Classes to read or write density files in EM format.
4  *
5  * Copyright 2007-2019 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPEM_EM_READER_WRITER_H
10 #define IMPEM_EM_READER_WRITER_H
11 
12 #include <IMP/em/em_config.h>
13 #include "MapReaderWriter.h"
14 #include "DensityHeader.h"
15 #include "internal/EMHeader.h"
16 #include "def.h"
17 
18 IMPEM_BEGIN_NAMESPACE
19 /** Reader/writer for EM. */
20 class IMPEMEXPORT EMReaderWriter : public MapReaderWriter {
21  public:
22 #if !defined(DOXYGEN) && !defined(SWIG)
23  //! Reads a density file in EM format and stores the information
24  /**
25  \param[in] filename name of the file to read
26  \param[in] data pointer to the data
27  \param[in] header DensityHeader() to store the header information
28  \exception IOException in case that the filename was not found
29  */
30  void read(const char *filename, float **data, DensityHeader &header);
31  //! Writes a density file in EM format with the header information
32  /**
33  \param[in] filename name of the file to read
34  \param[in] data pointer to the data
35  \param[in] header DensityHeader() with the header information
36  */
37  void write(const char *filename, const float *data,
38  const DensityHeader &header);
39 #endif
40  protected:
41  //! Reads the header
42  //! Reads the data
43  /**
44  \param file ifstream of the file to read
45  \param header internal::EMHeader to store the header information
46  */
47  void read_header(std::ifstream &file, internal::EMHeader &header);
48  //! Reads the data
49  /**
50  \param file ifstream of the file to read
51  \param data pointer to store the data
52  \param header internal::EMHeader to store the header information
53  \exception IOException if the data allocation had failed
54  \exception IOException is the requested data type is not implemented
55  */
56  void read_data(std::ifstream &file, float **data,
57  const internal::EMHeader &header);
58  //! Writes the header
59  /**
60  \param[in] s
61  \param[in] header internal::EMHeader with the header information
62  \exception IOException if the writing operation had failed.
63  */
64  void write_header(std::ostream &s, const internal::EMHeader &header);
65 
67 };
68 
69 IMPEM_END_NAMESPACE
70 
71 #endif /* IMPEM_EM_READER_WRITER_H */
The base class to handle reading and writing of density maps.
Definitions for EMBED.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Metadata for a density file.
An abstract class for reading a map.