This file is indexed.

/usr/include/visp/vpRequest.h is in libvisp-dev 2.9.0-3+b2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/****************************************************************************
 *
 * $Id: vpRequest.h 4574 2014-01-09 08:48:51Z fspindle $
 *
 * This file is part of the ViSP software.
 * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
 * 
 * This software is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * ("GPL") version 2 as published by the Free Software Foundation.
 * See the file LICENSE.txt at the root directory of this source
 * distribution for additional information about the GNU GPL.
 *
 * For using ViSP with software that can not be combined with the GNU
 * GPL, please contact INRIA about acquiring a ViSP Professional 
 * Edition License.
 *
 * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
 * 
 * This software was developed at:
 * INRIA Rennes - Bretagne Atlantique
 * Campus Universitaire de Beaulieu
 * 35042 Rennes Cedex
 * France
 * http://www.irisa.fr/lagadic
 *
 * If you have questions regarding the use of this file, please contact
 * INRIA at visp@inria.fr
 * 
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * Description:
 * Network Request.
 *
 * Authors:
 * Aurelien Yol
 *
 *****************************************************************************/

#ifndef vpRequest_H
#define vpRequest_H

#include <visp/vpConfig.h>
#include <visp/vpDebug.h>
#include <visp/vpException.h>
#include <visp/vpImageException.h>

#include <string.h>
#include <vector>

/*!
  \class vpRequest
  
  \ingroup Network

  \brief This the request that will transit on the network

  Exemple request decoding an image on a specific form.
  First parameter : Height of the image.
  Second parameter : Width of the image.
  Thirs parameter : Bitmap of the image (not compress).
  
  Here is the header of the vpRequestImage class.
  
  \code
#ifndef vpRequestImage_H
#define vpRequestImage_H

#include <visp/vpImage.h>
#include <visp/vpRequest.h>

class vpRequestImage : public vpRequest
{
private:
  vpImage<unsigned char> *I;
  
public:
  vpRequestImage();
  vpRequestImage(vpImage<unsigned char> *);
  ~vpRequestImage();
  
  virtual void encode();
  virtual void decode();
};

#endif
  \endcode
  
  Here is the definition of the vpRequestImage class.
  
  \code
#include <vpRequestImage.h>

vpRequestImage::vpRequestImage(){
  request_id = "image";
}

vpRequestImage::vpRequestImage(vpImage<unsigned char> *Im){
  request_id = "image";
  I = Im;
}

vpRequestImage::~vpRequestImage(){}

void vpRequestImage::encode(){
  clear(); 
  
  unsigned int h = I->getHeight();
  unsigned int w = I->getWidth();     

  addParameterObject(&h);
  addParameterObject(&w);
  addParameterObject(I->bitmap,h*w*sizeof(unsigned char));
}
  
void vpRequestImage::decode(){
  if(listOfParams.size() == 3){
    unsigned int w, h;
    memcpy((void*)&h, (void*)listOfParams[0].c_str(), sizeof(unsigned int));
    memcpy((void*)&w, (void*)listOfParams[1].c_str(), sizeof(unsigned int));
    
    I->resize(h,w);
    memcpy((void*)I->bitmap,(void*)listOfParams[2].c_str(),w*h*sizeof(unsigned char));
  }
}
  \endcode
  
  \sa vpClient
  \sa vpServer
  \sa vpNetwork
*/
class VISP_EXPORT vpRequest
{
protected:
  std::string               request_id;
  std::vector<std::string>  listOfParams;
  
public:
                vpRequest();
  virtual       ~vpRequest();
  
  void          addParameter(char *params);
  void          addParameter(std::string &params);
  void          addParameter(std::vector<std::string> &listOfparams);
  template<typename T>
  void          addParameterObject(T * params, const int &sizeOfObject = sizeof(T));
  
  /*!
    Decode the parameters of the request (Funtion that has to be redifined).
    
    \sa vpRequest::encode()
  */
  virtual void  decode() = 0;
  
  /*!
    Clear the parameters of the request.
  */
  void          clear(){ listOfParams.clear(); }
  
  /*!
    Encode the parameters of the request (Funtion that has to be redifined).
    
    \sa vpRequest::decode()
  */
  virtual void  encode() = 0;
  
  /*!
    Accessor on the parameters.
    
    \return Parameter at the index i.
  */  
  inline std::string&        operator[](const unsigned int &i)   { return listOfParams[i];}

  /*!
    Accessor on the parameters (const).
    
    \return Parameter at the index i (const).
  */ 
  inline const  std::string& operator[](const unsigned int &i) const { return listOfParams[i];}
  
  /*!
    Get the ID of the request.
    
    \sa vpRequest::setId()
    
    \return ID of the request.
  */
  std::string   getId(){ return request_id; }
  
  /*!
    Change the ID of the request.
    
    \sa vpRequest::getId()
    
    \param id : new ID.
  */
  void          setId(const char *id){ request_id = id; }
  
  /*!
    Get the number of parameters.
    
    \return Number of parameters.
  */
  unsigned int  size(){ return (unsigned int)listOfParams.size(); }
};


//######## Definition of Template Functions ########
//#                                                #
//##################################################


/*!
  Add an object as parameter of the request.
  
  \warning Only simple object can be sent unless you know its size. 
  Sending object containing pointers, virtual methods, etc, won't probably work.
  Unless the size is well defined...
  
  \sa vpRequest::addParameter()

  \param params : Object to add.
  \param sizeOfObject : Size of the object.
*/
template<typename T>
void vpRequest::addParameterObject(T * params, const int &sizeOfObject)
{
  if(sizeOfObject != 0){
    char *tempS = new char [sizeOfObject];
    memcpy((void*)tempS, (void*)params, sizeOfObject);
    std::string returnVal(tempS, sizeOfObject);
  
    listOfParams.push_back(returnVal);

    delete [] tempS;
  }
}

#endif