yocto_files.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_files.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindFiles(), the high-level API for Files 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_FILES_H
42 #define YOCTO_FILES_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (generated code: YFiles definitions)
50 class YFiles; // forward declaration
51 
52 typedef void (*YFilesValueCallback)(YFiles *func, const string& functionValue);
53 #define Y_FILESCOUNT_INVALID (YAPI_INVALID_UINT)
54 #define Y_FREESPACE_INVALID (YAPI_INVALID_UINT)
55 //--- (end of generated code: YFiles definitions)
56 
57 
58 //--- (generated code: YFileRecord definitions)
59 //--- (end of generated code: YFileRecord definitions)
60 
61 
62 //--- (generated code: YFileRecord declaration)
69 #ifdef __BORLANDC__
70 #pragma option push -w-8022
71 #endif
72 //--- (end of generated code: YFileRecord declaration)
73  //--- (generated code: YFileRecord attributes)
74  // Attributes (function value cache)
75  string _name;
76  int _size;
77  int _crc;
78  //--- (end of generated code: YFileRecord attributes)
79  //--- (generated code: YFileRecord constructor)
80 
81  //--- (end of generated code: YFileRecord constructor)
82  //--- (generated code: YFileRecord initialization)
83  //--- (end of generated code: YFileRecord initialization)
84 
85 public:
86  YFileRecord(const string& json);
87  //--- (generated code: YFileRecord accessors declaration)
88 
89 
90  virtual string get_name(void);
91 
92  virtual int get_size(void);
93 
94  virtual int get_crc(void);
95 
96 #ifdef __BORLANDC__
97 #pragma option pop
98 #endif
99  //--- (end of generated code: YFileRecord accessors declaration)
100 };
101 
102 
103 
104 
105 
106 //--- (generated code: YFiles declaration)
116 #ifdef __BORLANDC__
117 #pragma option push -w-8022
118 #endif
119 //--- (end of generated code: YFiles declaration)
120  //--- (generated code: YFiles attributes)
121  // Attributes (function value cache)
125 
126  friend YFiles *yFindFiles(const string& func);
127  friend YFiles *yFirstFiles(void);
128 
129  // Function-specific method for parsing of JSON output and caching result
130  virtual int _parseAttr(YJSONObject* json_val);
131 
132  // Constructor is protected, use yFindFiles factory function to instantiate
133  YFiles(const string& func);
134  //--- (end of generated code: YFiles attributes)
135 
136  //--- (generated code: YFiles initialization)
137  //--- (end of generated code: YFiles initialization)
138 
139 public:
140  ~YFiles();
141  //--- (generated code: YFiles accessors declaration)
142 
143  static const int FILESCOUNT_INVALID = YAPI_INVALID_UINT;
144  static const int FREESPACE_INVALID = YAPI_INVALID_UINT;
145 
153  int get_filesCount(void);
154 
155  inline int filesCount(void)
156  { return this->get_filesCount(); }
157 
165  int get_freeSpace(void);
166 
167  inline int freeSpace(void)
168  { return this->get_freeSpace(); }
169 
197  static YFiles* FindFiles(string func);
198 
210  virtual int registerValueCallback(YFilesValueCallback callback);
212 
213  virtual int _invokeValueCallback(string value);
214 
215  virtual string sendCommand(string command);
216 
225  virtual int format_fs(void);
226 
240  virtual vector<YFileRecord> get_list(string pattern);
241 
251  virtual bool fileExist(string filename);
252 
262  virtual string download(string pathname);
263 
275  virtual int upload(string pathname,string content);
276 
291  virtual int remove(string pathname);
292 
293 
294  inline static YFiles* Find(string func)
295  { return YFiles::FindFiles(func); }
296 
304  YFiles *nextFiles(void);
305  inline YFiles *next(void)
306  { return this->nextFiles();}
307 
317  static YFiles* FirstFiles(void);
318  inline static YFiles* First(void)
319  { return YFiles::FirstFiles();}
320 #ifdef __BORLANDC__
321 #pragma option pop
322 #endif
323  //--- (end of generated code: YFiles accessors declaration)
324 };
325 
326 //--- (generated code: YFiles functions declaration)
327 
355 inline YFiles* yFindFiles(const string& func)
356 { return YFiles::FindFiles(func);}
366 inline YFiles* yFirstFiles(void)
367 { return YFiles::FirstFiles();}
368 
369 //--- (end of generated code: YFiles functions declaration)
370 
371 #endif
static YFiles * First(void)
Definition: yocto_files.h:318
int freeSpace(void)
Definition: yocto_files.h:167
int filesCount(void)
Definition: yocto_files.h:155
YFiles * next(void)
Definition: yocto_files.h:305
void(* YFilesValueCallback)(YFiles *func, const string &functionValue)
Definition: yocto_files.h:52
int _freeSpace
Definition: yocto_files.h:123
#define YAPI_INVALID_UINT
Definition: yocto_api.h:71
string _name
Definition: yocto_files.h:75
int _filesCount
Definition: yocto_files.h:122
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
static YFiles * FindFiles(string func)
ROSLIB_DECL std::string command(const std::string &cmd)
static int upload(const char *hubserial, const char *subpath, const char *filename, u8 *data, u32 data_len, char *errmsg)
Definition: yprog.c:1631
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
YFiles * yFirstFiles(void)
Definition: yocto_files.h:366
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
static YFiles * Find(string func)
Definition: yocto_files.h:294
YFiles * yFindFiles(const string &func)
Definition: yocto_files.h:355
static YFiles * FirstFiles(void)
YFilesValueCallback _valueCallbackFiles
Definition: yocto_files.h:124
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563


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