IMP
2.1.0
The Integrative Modeling Platform
IMP Mainpage
All IMP Modules
Related Pages
Modules
Namespaces
Classes
Files
Examples
Indexes
File List
File Members
writer_macros.h
Go to the documentation of this file.
1
/**
2
* \file IMP/display/writer_macros.h
3
* \brief macros for display classes
4
*
5
* Copyright 2007-2013 IMP Inventors. All rights reserved.
6
*/
7
8
#ifndef IMPDISPLAY_WRITER_MACROS_H
9
#define IMPDISPLAY_WRITER_MACROS_H
10
#include "
Writer.h
"
11
12
//! Define information for an TextWriter object
13
/** This macro declares the methods do_open, do_close, add_geometry
14
and show, and defines the destructor and get_version_info.
15
*/
16
#define IMP_TEXT_WRITER(Name) \
17
Name(base::TextOutput of) : TextWriter(of) { do_open(); } \
18
Name(std::string name) : TextWriter(name) { \
19
if (name.find("%1%") == std::string::npos) { \
20
TextWriter::open(); \
21
} \
22
} \
23
Name(const char* name) : TextWriter(std::string(name)) { \
24
if (std::string(name).find("%1%") == std::string::npos) { \
25
TextWriter::open(); \
26
} \
27
} \
28
IMP_OBJECT_METHODS(Name); \
29
\
30
protected: \
31
virtual void do_destroy() IMP_OVERRIDE { do_close(); } \
32
virtual void do_open(); \
33
virtual void do_close()
34
35
#define IMP_WRITER(Name) \
36
IMP_OBJECT_METHODS(Name); \
37
\
38
protected: \
39
virtual void do_destroy() IMP_OVERRIDE { do_close(); } \
40
virtual void do_open(); \
41
virtual void do_close()
42
43
#if !defined(IMP_DOXYGEN) && !defined(SWIG)
44
#define IMP_REGISTER_WRITER(Name, suffix) \
45
namespace { \
46
internal::WriterFactoryRegistrar Name##registrar( \
47
suffix, new internal::WriterFactoryHelper<Name>()); \
48
}
49
#endif
50
51
#endif
/* IMPDISPLAY_WRITER_MACROS_H */
Writer.h
Base class for writing geometry to a file.