Minor fixes in LifxLightBulb driver (not fully tested yet)
[iot2.git] / iotjava / iotruntime / cpp / IoTAddress.hpp
1 #ifndef _IOTADDRESS_HPP__
2 #define _IOTADDRESS_HPP__
3 #include <iostream>
4
5 using namespace std;
6
7
8 // IoTAddress class for iotruntime
9 // Implemented based on IoTAddress.java that is used to wrap address
10 //
11 // @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
12 // @version     1.0
13 // @since       2017-01-09
14
15 class IoTAddress
16 {
17         public:
18
19                 // Constructor
20                 IoTAddress(string _sAddress) {
21
22                         inetAddress = _sAddress;
23                 }
24
25
26                 // Constructor
27                 IoTAddress() {
28                 }
29
30
31                 ~IoTAddress() {
32                 }
33
34
35                 string getAddress() {
36
37                         return inetAddress;
38                 }
39
40
41                 string getURL(string strURLComplete) {
42
43                         return "http://" + inetAddress + strURLComplete;
44                 }
45
46
47                 // Custom hasher for IoTAddress / IoTDeviceAddress iterator
48                 size_t hash(IoTAddress const& devAddress) const {
49
50                         std::hash<std::string> hashVal;
51                         return hashVal(inetAddress);
52                 }
53
54
55         // IoTAddress class properties
56         protected:
57                 string inetAddress;
58 };
59 #endif