Auto-generated patch by python-black
[integration/test.git] / csit / libraries / IoTDM / client_libs / iot_data_concepts.py
1 """
2  Defines abstract classes which describe fundamental data concepts as
3  abstract classes.
4 """
5
6 #
7 # Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
8 #
9 # This program and the accompanying materials are made available under the
10 # terms of the Eclipse Public License v1.0 which accompanies this distribution,
11 # and is available at http://www.eclipse.org/legal/epl-v10.html
12 #
13
14
15 class IoTData(object):
16     """Data exchanged in IoT communication"""
17
18     def clone(self):
19         """Returns copy of this object"""
20         raise NotImplementedError()
21
22     def _compare(self, data2):
23         """
24         Compares two IoT data instances, return True if they are equal,
25         false otherwise
26         """
27         raise NotImplementedError()
28
29
30 class IoTDataBuilder(object):
31     """Builder class of IoTData objects"""
32
33     def clone(self):
34         """Returns copy of this builder object"""
35         raise NotImplementedError()
36
37     def build(self):
38         """Builds the IoTData object"""
39         raise NotImplementedError()
40
41
42 class IoTDataEncoder(object):
43     """Encodes IoTData object to protocol specific message"""
44
45     def encode(self, iotdm_data):
46         """Returns protocol specific message including encoded IoTData"""
47         raise NotImplementedError()
48
49
50 class IoTDataEncodeError(Exception):
51     """IoTData encoding error"""
52
53     pass
54
55
56 class IoTDataDecoder(object):
57     """Decoded protocol specific message to IoTData"""
58
59     def decode(self, protocol_message):
60         """Returns IoTData  decoded of the protocol specific message"""
61         raise NotImplementedError()
62
63
64 class IoTDataDecodeError(Exception):
65     """Protocol message decoding error"""
66
67     pass