1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use crate::address_space::{base::Base, node::Node};
#[derive(Debug)]
pub struct Method {
base: Base,
}
node_impl!(Method);
impl Method {
pub fn new(node_id: &NodeId, browse_name: &str, display_name: &str, description: &str, is_abstract: bool, executable: bool, user_executable: bool) -> Method {
let attributes = vec![
(AttributeId::IsAbstract, Variant::Boolean(is_abstract)),
(AttributeId::Executable, Variant::Boolean(executable)),
(AttributeId::UserExecutable, Variant::Boolean(user_executable)),
];
Method {
base: Base::new(NodeClass::Method, node_id, browse_name, display_name, description, attributes),
}
}
pub fn is_abstract(&self) -> bool {
find_attribute_value_mandatory!(&self.base, IsAbstract, Boolean)
}
pub fn executable(&self) -> bool {
find_attribute_value_mandatory!(&self.base, Executable, Boolean)
}
pub fn user_executable(&self) -> bool {
if self.executable() {
find_attribute_value_mandatory!(&self.base, UserExecutable, Boolean)
} else {
false
}
}
}