iCub-main
VideoTexture.h
Go to the documentation of this file.
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 /*
4 * Copyright (C) 2010 RobotCub Consortium, European Commission FP6 Project IST-004370
5 * Author: Paul Fitzpatrick, Vadim Tikhanoff
6 * email: paulfitz@alum.mit.edu, vadim.tikhanoff@iit.it
7 * website: www.robotcub.org
8 * Permission is granted to copy, distribute, and/or modify this program
9 * under the terms of the GNU General Public License, version 2 or any
10 * later version published by the Free Software Foundation.
11 *
12 * A copy of the license can be found at
13 * http://www.robotcub.org/icub/license/gpl.txt
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
18 * Public License for more details
19 */
20 
21 #ifndef __VIDEO_TEXTURE__
22 #define __VIDEO_TEXTURE__
23 
24 
34 #include <yarp/os/BufferedPort.h>
35 #include <yarp/os/Property.h>
36 #include <yarp/sig/Vector.h>
37 #include <yarp/sig/Image.h>
38 #include <yarp/os/Time.h>
39 
40 #include <vector>
41 #include <string>
42 // std
43 #include <stdio.h>
44 #include <iostream>
45 
46 using namespace std;
47 
48 class TextureInput {
49 private:
50  int textureIndex;
51  double lastData;
52  string moduleName;
53  int t;
54  yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > port;
55  yarp::sig::ImageOf<yarp::sig::PixelRgb> cache, input;
56 public:
58  textureIndex = -1;
59  lastData = -1000;
60  t = 0;
61  }
63  port.close();
64  }
65  void setName( string module );
66  bool open(yarp::os::Searchable& config);
67  void apply(unsigned int *textures);
68 };
69 
70 
71 class VideoTexture {
72 public:
73  std::vector<TextureInput *> inputs;
74 
75  ~VideoTexture();
76 
77  string videoPort;
78  bool add(const char *port, int textureIndex) {
79  yarp::os::Property config;
80  config.put("port",port);
81  config.put("textureIndex",textureIndex);
82  return add(config);
83  }
84 
85  void setName( string module );
86 
87  bool add(yarp::os::Searchable& config);
88 
89  void apply(unsigned int *textures);
90 };
91 
92 
93 #endif
bool add(const char *port, int textureIndex)
Definition: VideoTexture.h:78
STL namespace.
bool apply(cDownloader *down, const FullRegulation &reg)
Q15 add(const Q15 a, const Q15 b)
Definition: strain.cpp:1198
std::vector< TextureInput * > inputs
Definition: VideoTexture.h:73
string videoPort
Definition: VideoTexture.h:77