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
56
57
58
59
60
61
62
63
64
65
#![allow(unused_attributes)]
use std::io::{Read, Write};
#[allow(unused_imports)]
use crate::{
encoding::*,
basic_types::*,
node_id::NodeId,
string::UAString,
service_types::RelativePath,
};
#[derive(Debug, Clone, PartialEq)]
pub struct AttributeOperand {
pub node_id: NodeId,
pub alias: UAString,
pub browse_path: RelativePath,
pub attribute_id: u32,
pub index_range: UAString,
}
impl BinaryEncoder<AttributeOperand> for AttributeOperand {
fn byte_len(&self) -> usize {
let mut size = 0;
size += self.node_id.byte_len();
size += self.alias.byte_len();
size += self.browse_path.byte_len();
size += self.attribute_id.byte_len();
size += self.index_range.byte_len();
size
}
#[allow(unused_variables)]
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize> {
let mut size = 0;
size += self.node_id.encode(stream)?;
size += self.alias.encode(stream)?;
size += self.browse_path.encode(stream)?;
size += self.attribute_id.encode(stream)?;
size += self.index_range.encode(stream)?;
Ok(size)
}
#[allow(unused_variables)]
fn decode<S: Read>(stream: &mut S, decoding_options: &DecodingOptions) -> EncodingResult<Self> {
let node_id = NodeId::decode(stream, decoding_options)?;
let alias = UAString::decode(stream, decoding_options)?;
let browse_path = RelativePath::decode(stream, decoding_options)?;
let attribute_id = u32::decode(stream, decoding_options)?;
let index_range = UAString::decode(stream, decoding_options)?;
Ok(AttributeOperand {
node_id,
alias,
browse_path,
attribute_id,
index_range,
})
}
}