This file is indexed.

/usr/include/sensor_msgs/point_field_conversion.h is in libsensor-msgs-dev 1.12.5-2.

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
/*
 * Software License Agreement (BSD License)
 *
 * Robot Operating System code by the University of Osnabrück
 * Copyright (c) 2015, University of Osnabrück
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *   1. Redistributions of source code must retain the above 
 *      copyright notice, this list of conditions and the following
 *      disclaimer.
 *
 *   2. Redistributions in binary form must reproduce the above 
 *      copyright notice, this list of conditions and the following
 *      disclaimer in the documentation and/or other materials provided
 *      with the distribution.
 *
 *   3. Neither the name of the copyright holder nor the names of its
 *      contributors may be used to endorse or promote products derived
 *      from this software without specific prior written permission.
 *
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *
 *
 * point_field_conversion.h
 *
 * Created on: 16.07.2015
 *  Authors: Sebastian Pütz <spuetz@uni-osnabrueck.de>
 */

#ifndef SENSOR_MSGS_POINT_FIELD_CONVERSION_H
#define SENSOR_MSGS_POINT_FIELD_CONVERSION_H

/** 
  * \brief  This file provides a type to enum mapping for the different
  *         PointField types and methods to read and write in 
  *         a PointCloud2 buffer for the different PointField types.
  * \author Sebastian Pütz
  */
namespace sensor_msgs{
  /*!
   * \Enum to type mapping.
   */
  template<int> struct pointFieldTypeAsType {};
  template<> struct pointFieldTypeAsType<sensor_msgs::PointField::INT8>    { typedef int8_t   type; };
  template<> struct pointFieldTypeAsType<sensor_msgs::PointField::UINT8>   { typedef uint8_t  type; };
  template<> struct pointFieldTypeAsType<sensor_msgs::PointField::INT16>   { typedef int16_t  type; };
  template<> struct pointFieldTypeAsType<sensor_msgs::PointField::UINT16>  { typedef uint16_t type; };
  template<> struct pointFieldTypeAsType<sensor_msgs::PointField::INT32>   { typedef int32_t  type; };
  template<> struct pointFieldTypeAsType<sensor_msgs::PointField::UINT32>  { typedef uint32_t type; };
  template<> struct pointFieldTypeAsType<sensor_msgs::PointField::FLOAT32> { typedef float    type; };
  template<> struct pointFieldTypeAsType<sensor_msgs::PointField::FLOAT64> { typedef double   type; };
  
  /*!
   * \Type to enum mapping.
   */
  template<typename T> struct typeAsPointFieldType {};
  template<> struct typeAsPointFieldType<int8_t>   { static const uint8_t value = sensor_msgs::PointField::INT8;    };
  template<> struct typeAsPointFieldType<uint8_t>  { static const uint8_t value = sensor_msgs::PointField::UINT8;   };
  template<> struct typeAsPointFieldType<int16_t>  { static const uint8_t value = sensor_msgs::PointField::INT16;   };
  template<> struct typeAsPointFieldType<uint16_t> { static const uint8_t value = sensor_msgs::PointField::UINT16;  };
  template<> struct typeAsPointFieldType<int32_t>  { static const uint8_t value = sensor_msgs::PointField::INT32;   };
  template<> struct typeAsPointFieldType<uint32_t> { static const uint8_t value = sensor_msgs::PointField::UINT32;  };
  template<> struct typeAsPointFieldType<float>    { static const uint8_t value = sensor_msgs::PointField::FLOAT32; };
  template<> struct typeAsPointFieldType<double>   { static const uint8_t value = sensor_msgs::PointField::FLOAT64; };
 
  /*!
   * \Converts a value at the given pointer position, interpreted as the datatype
   *  specified by the given template argument point_field_type, to the given
   *  template type T and returns it.
   * \param data_ptr            pointer into the point cloud 2 buffer
   * \tparam point_field_type   sensor_msgs::PointField datatype value
   * \tparam T                  return type
   */
  template<int point_field_type, typename T>
    inline T readPointCloud2BufferValue(const unsigned char* data_ptr){
      typedef typename pointFieldTypeAsType<point_field_type>::type type;
      return static_cast<T>(*(reinterpret_cast<type const *>(data_ptr)));
    }
  
  /*!
   * \Converts a value at the given pointer position interpreted as the datatype
   *  specified by the given datatype parameter to the given template type and returns it.
   * \param data_ptr    pointer into the point cloud 2 buffer
   * \param datatype    sensor_msgs::PointField datatype value
   * \tparam T          return type
   */
  template<typename T>
    inline T readPointCloud2BufferValue(const unsigned char* data_ptr, const unsigned char datatype){
      switch(datatype){
        case sensor_msgs::PointField::INT8:
          return readPointCloud2BufferValue<sensor_msgs::PointField::INT8, T>(data_ptr);
        case sensor_msgs::PointField::UINT8:
          return readPointCloud2BufferValue<sensor_msgs::PointField::UINT8, T>(data_ptr);
        case sensor_msgs::PointField::INT16:
          return readPointCloud2BufferValue<sensor_msgs::PointField::INT16, T>(data_ptr);
        case sensor_msgs::PointField::UINT16:
          return readPointCloud2BufferValue<sensor_msgs::PointField::UINT16, T>(data_ptr);
        case sensor_msgs::PointField::INT32:
          return readPointCloud2BufferValue<sensor_msgs::PointField::INT32, T>(data_ptr);
        case sensor_msgs::PointField::UINT32:
          return readPointCloud2BufferValue<sensor_msgs::PointField::UINT32, T>(data_ptr);
        case sensor_msgs::PointField::FLOAT32:
          return readPointCloud2BufferValue<sensor_msgs::PointField::FLOAT32, T>(data_ptr);
        case sensor_msgs::PointField::FLOAT64:
          return readPointCloud2BufferValue<sensor_msgs::PointField::FLOAT64, T>(data_ptr);
      }
    }

  /*!
   * \Inserts a given value at the given point position interpreted as the datatype
   *  specified by the template argument point_field_type.
   * \param data_ptr            pointer into the point cloud 2 buffer
   * \param value               the value to insert
   * \tparam point_field_type   sensor_msgs::PointField datatype value
   * \tparam T                  type of the value to insert
   */
  template<int point_field_type, typename T>
    inline void writePointCloud2BufferValue(unsigned char* data_ptr, T value){
      typedef typename pointFieldTypeAsType<point_field_type>::type type;
      *(reinterpret_cast<type*>(data_ptr)) = static_cast<type>(value);
    }

  /*!
   * \Inserts a given value at the given point position interpreted as the datatype
   *  specified by the given datatype parameter.
   * \param data_ptr    pointer into the point cloud 2 buffer
   * \param datatype    sensor_msgs::PointField datatype value
   * \param value       the value to insert
   * \tparam T          type of the value to insert
   */
  template<typename T>
    inline void writePointCloud2BufferValue(unsigned char* data_ptr, const unsigned char datatype, T value){
      switch(datatype){
        case sensor_msgs::PointField::INT8:
          writePointCloud2BufferValue<sensor_msgs::PointField::INT8, T>(data_ptr, value);
          break;
        case sensor_msgs::PointField::UINT8:
          writePointCloud2BufferValue<sensor_msgs::PointField::UINT8, T>(data_ptr, value);
          break;
        case sensor_msgs::PointField::INT16:
          writePointCloud2BufferValue<sensor_msgs::PointField::INT16, T>(data_ptr, value);
          break;
        case sensor_msgs::PointField::UINT16:
          writePointCloud2BufferValue<sensor_msgs::PointField::UINT16, T>(data_ptr, value);
          break;
        case sensor_msgs::PointField::INT32:
          writePointCloud2BufferValue<sensor_msgs::PointField::INT32, T>(data_ptr, value);
          break;
        case sensor_msgs::PointField::UINT32:
          writePointCloud2BufferValue<sensor_msgs::PointField::UINT32, T>(data_ptr, value);
          break;
        case sensor_msgs::PointField::FLOAT32:
          writePointCloud2BufferValue<sensor_msgs::PointField::FLOAT32, T>(data_ptr, value);
          break;
        case sensor_msgs::PointField::FLOAT64:
          writePointCloud2BufferValue<sensor_msgs::PointField::FLOAT64, T>(data_ptr, value);
          break;
      }
    }
}

#endif /* point_field_conversion.h */