RMF
Toggle main menu visibility
Label.h
Go to the documentation of this file.
1
/**
2
* \file RMF/Label.h
3
* \brief Declaration of RMF::Label.
4
*
5
* Copyright 2007-2022 IMP Inventors. All rights reserved.
6
*
7
*/
8
9
#ifndef RMF_LABEL_H
10
#define RMF_LABEL_H
11
12
#include "RMF/config.h"
13
#include "
NodeHandle.h
"
14
15
RMF_ENABLE_WARNINGS
16
namespace
RMF
{
17
18
//! A decorator-like class to mark certain nodes (e.g. molecule boundaries)
19
/** Labels mark a node of the hierarchy as having a property, but, unlike
20
Decorator nodes, don't have any other associated data.
21
*/
22
class
Label {
23
IntKey
k_;
24
std::string name_;
25
26
protected
:
27
template
<
class
FH>
28
Label(FH fh, std::string category, std::string name)
29
: name_(name) {
30
Category
cat = fh.get_category(category);
31
k_ = fh.template get_key<IntTag>(cat, name);
32
}
33
34
public
:
35
Label() {}
36
bool
get_is(
NodeConstHandle
nh)
const
{
return
nh.get_has_value(k_); }
37
void
set_is(
NodeHandle
nh)
const
{ nh.
set_value
(k_, 1); }
38
RMF_SHOWABLE(Label, name_);
39
};
40
41
}
/* namespace RMF */
42
43
RMF_DISABLE_WARNINGS
44
45
#endif
/* RMF_LABEL_H */
NodeHandle.h
Declaration of NodeHandle.
RMF::NodeConstHandle
A handle for a particular node in a read-only hierarchy.
Definition
NodeConstHandle.h:86
RMF::NodeHandle
A handle for a particular node in the hierarchy.
Definition
NodeHandle.h:60
RMF::NodeHandle::set_value
void set_value(ID< Tag > k, typename Tag::ArgumentType v) const
Definition
NodeHandle.h:115
RMF
The namespace for all functionality in the library.
Definition
BufferConstHandle.h:21
RMF::Category
ID< CategoryTag > Category
Definition
ID.h:110
RMF::IntKey
ID< IntTag > IntKey
Definition
keys.h:41