yocto_current.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_current.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindCurrent(), the high-level API for Current functions
6  *
7  * - - - - - - - - - License information: - - - - - - - - -
8  *
9  * Copyright (C) 2011 and beyond by Yoctopuce Sarl, Switzerland.
10  *
11  * Yoctopuce Sarl (hereafter Licensor) grants to you a perpetual
12  * non-exclusive license to use, modify, copy and integrate this
13  * file into your software for the sole purpose of interfacing
14  * with Yoctopuce products.
15  *
16  * You may reproduce and distribute copies of this file in
17  * source or object form, as long as the sole purpose of this
18  * code is to interface with Yoctopuce products. You must retain
19  * this notice in the distributed source file.
20  *
21  * You should refer to Yoctopuce General Terms and Conditions
22  * for additional information regarding your rights and
23  * obligations.
24  *
25  * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED 'AS IS' WITHOUT
26  * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
27  * WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS
28  * FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO
29  * EVENT SHALL LICENSOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
30  * INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
31  * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR
32  * SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT
33  * LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR
34  * CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON THE
35  * BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF
36  * WARRANTY, OR OTHERWISE.
37  *
38  *********************************************************************/
39 
40 
41 #ifndef YOCTO_CURRENT_H
42 #define YOCTO_CURRENT_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YCurrent return codes)
50 //--- (end of YCurrent return codes)
51 //--- (YCurrent definitions)
52 class YCurrent; // forward declaration
53 
54 typedef void (*YCurrentValueCallback)(YCurrent *func, const string& functionValue);
55 class YMeasure; // forward declaration
56 typedef void (*YCurrentTimedReportCallback)(YCurrent *func, YMeasure measure);
57 #ifndef _Y_ENABLED_ENUM
58 #define _Y_ENABLED_ENUM
59 typedef enum {
64 #endif
65 //--- (end of YCurrent definitions)
66 
67 //--- (YCurrent declaration)
76 #ifdef __BORLANDC__
77 #pragma option push -w-8022
78 #endif
79 //--- (end of YCurrent declaration)
80 protected:
81  //--- (YCurrent attributes)
82  // Attributes (function value cache)
86 
87  friend YCurrent *yFindCurrent(const string& func);
88  friend YCurrent *yFirstCurrent(void);
89 
90  // Function-specific method for parsing of JSON output and caching result
91  virtual int _parseAttr(YJSONObject* json_val);
92 
93  // Constructor is protected, use yFindCurrent factory function to instantiate
94  YCurrent(const string& func);
95  //--- (end of YCurrent attributes)
96 
97 public:
98  ~YCurrent();
99  //--- (YCurrent accessors declaration)
100 
101  static const Y_ENABLED_enum ENABLED_FALSE = Y_ENABLED_FALSE;
102  static const Y_ENABLED_enum ENABLED_TRUE = Y_ENABLED_TRUE;
103  static const Y_ENABLED_enum ENABLED_INVALID = Y_ENABLED_INVALID;
104 
105  Y_ENABLED_enum get_enabled(void);
106 
107  inline Y_ENABLED_enum enabled(void)
108  { return this->get_enabled(); }
109 
110  int set_enabled(Y_ENABLED_enum newval);
111  inline int setEnabled(Y_ENABLED_enum newval)
112  { return this->set_enabled(newval); }
113 
141  static YCurrent* FindCurrent(string func);
142 
154  virtual int registerValueCallback(YCurrentValueCallback callback);
156 
157  virtual int _invokeValueCallback(string value);
158 
172 
173  virtual int _invokeTimedReportCallback(YMeasure value);
174 
175 
176  inline static YCurrent* Find(string func)
177  { return YCurrent::FindCurrent(func); }
178 
186  YCurrent *nextCurrent(void);
187  inline YCurrent *next(void)
188  { return this->nextCurrent();}
189 
199  static YCurrent* FirstCurrent(void);
200  inline static YCurrent* First(void)
201  { return YCurrent::FirstCurrent();}
202 #ifdef __BORLANDC__
203 #pragma option pop
204 #endif
205  //--- (end of YCurrent accessors declaration)
206 };
207 
208 //--- (YCurrent functions declaration)
209 
237 inline YCurrent* yFindCurrent(const string& func)
238 { return YCurrent::FindCurrent(func);}
248 inline YCurrent* yFirstCurrent(void)
249 { return YCurrent::FirstCurrent();}
250 
251 //--- (end of YCurrent functions declaration)
252 
253 #endif
Y_ENABLED_enum enabled(void)
static YCurrent * FirstCurrent(void)
Y_ENABLED_enum
Definition: yocto_current.h:59
static YCurrent * First(void)
YCurrentTimedReportCallback _timedReportCallbackCurrent
Definition: yocto_current.h:85
int setEnabled(Y_ENABLED_enum newval)
YCurrent * next(void)
void(* YCurrentValueCallback)(YCurrent *func, const string &functionValue)
Definition: yocto_current.h:54
virtual int registerTimedReportCallback(YSensorTimedReportCallback callback)
Definition: yocto_api.cpp:7923
virtual int _invokeTimedReportCallback(YMeasure value)
Definition: yocto_api.cpp:7936
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:7645
YCurrent * yFirstCurrent(void)
YCurrent * yFindCurrent(const string &func)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:7015
virtual int registerValueCallback(YSensorValueCallback callback)
Definition: yocto_api.cpp:7626
Y_ENABLED_enum _enabled
Definition: yocto_current.h:83
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
YCurrentValueCallback _valueCallbackCurrent
Definition: yocto_current.h:84
void(* YCurrentTimedReportCallback)(YCurrent *func, YMeasure measure)
Definition: yocto_current.h:56
static YCurrent * FindCurrent(string func)
static YCurrent * Find(string func)


yoctopuce_altimeter
Author(s): Anja Sheppard
autogenerated on Mon Jun 10 2019 15:49:11