home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
develop.d97d4ead1f,2024/11/21
The Integrative Modeling Platform
IMP Manual
Reference Guide
Tutorial Index
Modules
Classes
Examples
include
IMP
display
version 20241121.develop.d97d4ead1f
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-2022 IMP Inventors. All rights reserved.
6
*/
7
8
#ifndef IMPDISPLAY_WRITER_MACROS_H
9
#define IMPDISPLAY_WRITER_MACROS_H
10
#include "
Writer.h
"
11
#include <memory>
12
13
//! Define information for an TextWriter object
14
/** This macro declares the methods do_open, do_close, add_geometry
15
and show, and defines the destructor and get_version_info.
16
*/
17
#define IMP_TEXT_WRITER(Name) \
18
Name(TextOutput of) : TextWriter(of) { do_open(); } \
19
Name(std::string name) : TextWriter(name) { \
20
if (name.find("%1%") == std::string::npos) { \
21
TextWriter::open(); \
22
} \
23
} \
24
Name(const char* name) : TextWriter(std::string(name)) { \
25
if (std::string(name).find("%1%") == std::string::npos) { \
26
TextWriter::open(); \
27
} \
28
} \
29
IMP_OBJECT_METHODS(Name); \
30
\
31
protected: \
32
virtual void do_destroy() override { do_close(); } \
33
virtual void do_open() override; \
34
virtual void do_close() override
35
36
#define IMP_WRITER(Name) \
37
IMP_OBJECT_METHODS(Name); \
38
\
39
protected: \
40
virtual void do_destroy() override { do_close(); } \
41
virtual void do_open(); \
42
virtual void do_close()
43
44
#if !defined(IMP_DOXYGEN) && !defined(SWIG)
45
#define IMP_REGISTER_WRITER(Name, suffix) \
46
namespace { \
47
internal::WriterFactoryRegistrar Name##registrar( \
48
suffix, std::make_shared<internal::WriterFactoryHelper<Name> >()); \
49
}
50
#endif
51
52
#endif
/* IMPDISPLAY_WRITER_MACROS_H */
Writer.h
Base class for writing geometry to a file.