YARP
Yet Another Robot Platform
zfpPortmonitor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #ifndef YARP_ZFP_CARRIER_ZFPPORTMONITOR_H
10 #define YARP_ZFP_CARRIER_ZFPPORTMONITOR_H
11 
12 #include <yarp/os/Bottle.h>
13 #include <yarp/os/Things.h>
14 #include <yarp/sig/Image.h>
15 #include <yarp/os/MonitorObject.h>
16 
17 
19 {
20 public:
21  bool create(const yarp::os::Property& options) override;
22  void destroy() override;
23 
24  bool setparam(const yarp::os::Property& params) override;
25  bool getparam(yarp::os::Property& params) override;
26 
27  bool accept(yarp::os::Things& thing) override;
28  yarp::os::Things& update(yarp::os::Things& thing) override;
29 protected:
30  int compress(float* array, float* &compressed, int &zfpsize, int nx, int ny, float tolerance);
31  int decompress(float* array, float* &decompressed, int zfpsize, int nx, int ny, float tolerance);
32  void resizeF(float* &array, int newSize);
33  void resizeV(void* &array, int newSize);
34 private:
36  yarp::os::Bottle data;
38  bool shouldCompress;
39  void *buffer;
40  float *compressed;
41  float *decompressed;
42  int sizeToAllocate;
43  int sizeToAllocateB;
44 };
45 
46 #endif
bool setparam(const yarp::os::Property &params) override
This will be called when the portmonitor carrier parameters are set via Yarp admin port.
int decompress(float *array, float *&decompressed, int zfpsize, int nx, int ny, float tolerance)
int compress(float *array, float *&compressed, int &zfpsize, int nx, int ny, float tolerance)
bool getparam(yarp::os::Property &params) override
This will be called when the portmonitor carrier parameters are requested via Yarp admin port.
void resizeV(void *&array, int newSize)
void resizeF(float *&array, int newSize)
bool accept(yarp::os::Things &thing) override
This will be called when the data reach the portmonitor object.
void destroy() override
This will be called when the portmonitor object destroyes.
yarp::os::Things & update(yarp::os::Things &thing) override
After data get accpeted in the accept() callback, an instance of that is given to the update function...
bool create(const yarp::os::Property &options) override
This will be called when the dll is properly loaded by the portmonitor carrier.
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:76
A class for storing options and configuration information.
Definition: Property.h:37
Base class for generic things.
Definition: Things.h:22