Libpointing
An open-source cross-platform library to get raw events from pointing devices and master transfer functions.
TransferFunction.h
1 /* -*- mode: c++ -*-
2  *
3  * pointing/transferfunctions/TransferFunction.h --
4  *
5  * Initial software
6  * Authors: Géry Casiez, Nicolas Roussel
7  * Copyright © Inria
8  *
9  * http://libpointing.org/
10  *
11  * This software may be used and distributed according to the terms of
12  * the GNU General Public License version 2 or any later version.
13  *
14  */
15 
16 #ifndef TransferFunction_h
17 #define TransferFunction_h
18 
19 #include <pointing/utils/URI.h>
20 #include <pointing/utils/TimeStamp.h>
21 #include <pointing/input/PointingDevice.h>
22 #include <pointing/output/DisplayDevice.h>
23 
24 #include <string>
25 #include <iostream>
26 #include <list>
27 
28 namespace pointing {
29 
39 
40  protected:
41 
42  TransferFunction(void) {}
43 
52  void normalizeInput(int *dx, int *dy, PointingDevice *input) const;
53 
62  void normalizeOutput(int *dx, int *dy, DisplayDevice *output) const;
63 
64  public:
65 
66  static std::list<std::string> schemes(void) ;
67 
76  static TransferFunction* create(const char* function_uri,
77  PointingDevice* input, DisplayDevice* output) ;
78 
79  static TransferFunction* create(std::string function_uri,
80  PointingDevice* input, DisplayDevice* output) ;
81 
82  static TransferFunction* create(URI &function_uri,
83  PointingDevice* input, DisplayDevice* output) ;
85 
90  virtual void clearState(void) = 0 ;
91 
100  virtual void applyi(int dxMickey, int dyMickey, int *dxPixel, int *dyPixel,
101  TimeStamp::inttime timestamp=TimeStamp::undef) = 0 ;
102 
111  virtual void applyd(int dxMickey, int dyMickey, double *dxPixel, double *dyPixel,
112  TimeStamp::inttime timestamp=TimeStamp::undef) = 0;
113 
120  virtual URI getURI(bool expanded=false) const = 0 ;
121 
125  virtual void setDebugLevel(int /*level*/) {}
126  virtual void debug(std::ostream& /*out*/) const {}
127 
128  virtual ~TransferFunction() {}
129 
130  } ;
131 
132 }
133 
134 #endif
static TransferFunction * create(const char *function_uri, PointingDevice *input, DisplayDevice *output)
Static method to instantiate an object of a sub-class.
Definition: TransferFunction.cpp:89
virtual void setDebugLevel(int)
Sets the level of information for debugging purposes (default = 0).
Definition: TransferFunction.h:125
virtual void applyd(int dxMickey, int dyMickey, double *dxPixel, double *dyPixel, TimeStamp::inttime timestamp=TimeStamp::undef)=0
apply The main method of the class which applies the transfer function.
virtual void applyi(int dxMickey, int dyMickey, int *dxPixel, int *dyPixel, TimeStamp::inttime timestamp=TimeStamp::undef)=0
apply The main method of the class which applies the transfer function.
The TransferFunction class is an abstract class that creates an object of its concrete subclasses...
Definition: TransferFunction.h:38
Definition: DummyPointingDevice.cpp:23
The PointingDevice class is used to represent Pointing Devices connected to the computer or pseudo-de...
Definition: PointingDevice.h:35
DisplayDevice class is used to represent the displays connected to the computer.
Definition: DisplayDevice.h:31
void normalizeInput(int *dx, int *dy, PointingDevice *input) const
normalizeInput Normalizes input to a transfer function with respect to the given PointingDevice. For example, to prevent fast movements of the cursor for high resolution mice. dx and dy are changed according to the input->getResolution()
Definition: TransferFunction.cpp:96
virtual void clearState(void)=0
Method which clears the current state of the device to be the default one (without any remainders or ...
virtual URI getURI(bool expanded=false) const =0
getURI The method constructs URI corresponding to the type and parameters of the transfer function...
void normalizeOutput(int *dx, int *dy, DisplayDevice *output) const
normalizeOutput Normalizes output of a transfer function with respect to the given DisplayDevice...
Definition: TransferFunction.cpp:106