9 #ifndef RMF_DECORATOR_BOND_H
10 #define RMF_DECORATOR_BOND_H
12 #include <RMF/config.h>
19 #include <RMF/internal/paths.h>
21 #include <boost/lexical_cast.hpp>
35 :
Decorator(nh), bonded_0_(bonded_0), bonded_1_(bonded_1) {}
40 return get_node().get_file().
get_node(
41 NodeID(get_node().get_value(bonded_0_)));
43 RMF_DECORATOR_CATCH();
47 return get_node().get_file().
get_node(
48 NodeID(get_node().get_frame_value(bonded_0_)));
50 RMF_DECORATOR_CATCH();
54 return get_node().get_file().
get_node(
55 NodeID(get_node().get_static_value(bonded_0_)));
57 RMF_DECORATOR_CATCH();
62 return get_node().get_file().
get_node(
63 NodeID(get_node().get_value(bonded_1_)));
65 RMF_DECORATOR_CATCH();
69 return get_node().get_file().
get_node(
70 NodeID(get_node().get_frame_value(bonded_1_)));
72 RMF_DECORATOR_CATCH();
76 return get_node().get_file().
get_node(
77 NodeID(get_node().get_static_value(bonded_1_)));
79 RMF_DECORATOR_CATCH();
82 static std::string get_decorator_type_name() {
return "BondConst"; }
83 RMF_SHOWABLE(
BondConst,
"Bond: " << get_node());
94 void set_bonded_0(
Int v) {
98 RMF_DECORATOR_CATCH();
100 void set_frame_bonded_0(
Int v) {
104 RMF_DECORATOR_CATCH();
106 void set_static_bonded_0(
Int v) {
110 RMF_DECORATOR_CATCH();
113 void set_bonded_1(
Int v) {
117 RMF_DECORATOR_CATCH();
119 void set_frame_bonded_1(
Int v) {
123 RMF_DECORATOR_CATCH();
125 void set_static_bonded_1(
Int v) {
129 RMF_DECORATOR_CATCH();
135 return get_node().get_file().
get_node(
136 NodeID(get_node().get_value(bonded_0_)));
138 RMF_DECORATOR_CATCH();
142 return get_node().get_file().
get_node(
143 NodeID(get_node().get_frame_value(bonded_0_)));
145 RMF_DECORATOR_CATCH();
149 return get_node().get_file().
get_node(
150 NodeID(get_node().get_static_value(bonded_0_)));
152 RMF_DECORATOR_CATCH();
157 return get_node().get_file().
get_node(
158 NodeID(get_node().get_value(bonded_1_)));
160 RMF_DECORATOR_CATCH();
164 return get_node().get_file().
get_node(
165 NodeID(get_node().get_frame_value(bonded_1_)));
167 RMF_DECORATOR_CATCH();
171 return get_node().get_file().
get_node(
172 NodeID(get_node().get_static_value(bonded_1_)));
174 RMF_DECORATOR_CATCH();
181 RMF_DECORATOR_CATCH();
187 RMF_DECORATOR_CATCH();
193 RMF_DECORATOR_CATCH();
200 RMF_DECORATOR_CATCH();
206 RMF_DECORATOR_CATCH();
212 RMF_DECORATOR_CATCH();
215 static std::string get_decorator_type_name() {
return "Bond"; }
227 : cat_(fh.get_category(
"physics")),
228 bonded_0_(fh.
get_key<IntTag>(cat_,
"bonded 0")),
229 bonded_1_(fh.
get_key<IntTag>(cat_,
"bonded 1")) {}
231 : cat_(fh.get_category(
"physics")),
232 bonded_0_(fh.
get_key<IntTag>(cat_,
"bonded 0")),
233 bonded_1_(fh.
get_key<IntTag>(cat_,
"bonded 1")) {}
236 RMF_USAGE_CHECK((nh.get_type() ==
RMF::BOND),
237 std::string(
"Bad node type. Got \"") +
238 boost::lexical_cast<std::string>(nh.get_type()) +
239 "\" in decorator type Bond");
240 return BondConst(nh, bonded_0_, bonded_1_);
244 RMF_USAGE_CHECK((nh.get_type() ==
RMF::BOND),
245 std::string(
"Bad node type. Got \"") +
246 boost::lexical_cast<std::string>(nh.get_type()) +
247 "\" in decorator type Bond");
248 return Bond(nh, bonded_0_, bonded_1_);
254 !nh.get_value(bonded_0_).get_is_null();
258 !nh.get_static_value(bonded_0_).get_is_null() &&
259 !nh.get_static_value(bonded_1_).get_is_null();
261 RMF_SHOWABLE(BondFactory,
"BondFactory");
264 struct BondConstFactory :
public BondFactory {
265 BondConstFactory(FileConstHandle fh) : BondFactory(fh) {}
266 BondConstFactory(FileHandle fh) : BondFactory(fh) {}
Mostly empty base classes for decorators and factories.
A handle for a particular node in the hierarchy.
The base class for decorators.
NodeType get_type() const
get the type of this node
A handle for a particular node in a read-only hierarchy.
A handle for a read-only RMF file.
void set_value(ID< Tag > k, typename Tag::ArgumentType v) const
A handle for an RMF file.
The base class for Factories.
Declaration for RMF::FileHandle.
Declaration of NodeHandle.
bool get_is(NodeConstHandle nh) const
void set_static_value(ID< Tag > k, typename Tag::ArgumentType v) const
set the value of the attribute k for all frames.
ID< Tag > get_key(Category category, std::string name) const
Various general useful macros for IMP.
const NodeType BOND
A link between two atoms.
NodeHandle get_node(NodeID id) const
Return a NodeHandle from a NodeID.
void set_frame_value(ID< Tag > k, typename Tag::ArgumentType v) const
set the value of the attribute k for this node on the current frame.