CPP Device Virtualization API Reference for Oracle Internet of Things Cloud Service Client Software Library. Release 21.1.1.0.0-3. E92477-09
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
NamedValue.hpp
1 /*
2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3  *
4  * This software is dual-licensed to you under the MIT License (MIT) and
5  * the Universal Permissive License (UPL). See the LICENSE file in the root
6  * directory for license terms. You may choose either license, or both.
7  */
8 
9 #include <string>
10 #include <stdexcept>
11 #include "iotcs_virtual_device.h"
12 
13 #pragma once
14 
22 namespace iotdcl {
23  class StorageObject;
24  class NamedValue {
25  public:
31  NamedValue(iotcs_named_value *v) throw (std::invalid_argument);
32  NamedValue(iotcs_named_value v) throw (std::invalid_argument);
33  NamedValue(const NamedValue& v) throw (std::invalid_argument);
34  virtual ~NamedValue();
35 
41  NamedValue* next() const;
42 
47  template <typename T> T getValue() const;
48 
53  const std::string& getName() const;
54  private:
55  enum Type {Int, Number, String, Bool, DateTime, StorageObj, None};
56  void checkType(Type) const;
57  Type type;
58  std::string name;
59  iotcs_named_value value;
60  StorageObject *so;
61  NamedValue* m_next;
62  };
63 };
NamedValue(iotcs_named_value *v)
Construct name-value pair from C Library structure.
const std::string & getName() const
Get the name.
Definition: NamedValue.hpp:24
NamedValue * next() const
Get the next name-value pair in the event.
Definition: StorageObject.hpp:158
T getValue() const
Get the value.