Skip to content

Mark non-const and non-modifying member functions as const #3836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace OpenNIFrameSource
const PointCloudPtr
snap ();
bool
isActive ();
isActive () const;
void
onKeyboardEvent (const pcl::visualization::KeyboardEvent & event);

Expand Down
2 changes: 1 addition & 1 deletion apps/3d_rec_framework/src/tools/openni_frame_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace OpenNIFrameSource
}

bool
OpenNIFrameSource::isActive ()
OpenNIFrameSource::isActive () const
{
return active_;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/include/pcl/apps/face_detection/openni_frame_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace OpenNIFrameSource
const PointCloudPtr
snap ();
bool
isActive ();
isActive () const;
void
onKeyboardEvent (const pcl::visualization::KeyboardEvent & event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class CloudTransformTool : public ToolInterface

/// generate scale matrix
void
getScaleMatrix (int dy, float* matrix);
getScaleMatrix (int dy, float* matrix) const;

/// the transform matrix to be used for updating the coordinates of all
/// the points in the cloud
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TrackBall

private:

void getPointFromScreenPoint(int s_x, int s_y, float &x, float &y, float &z);
void getPointFromScreenPoint(int s_x, int s_y, float &x, float &y, float &z) const;

/// the quaternion representing the current orientation of the trackball
boost::math::quaternion<float> quat_;
Expand Down
2 changes: 1 addition & 1 deletion apps/point_cloud_editor/src/cloudTransformTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ CloudTransformTool::getZTranslateMatrix (int dy, float* matrix)
}

void
CloudTransformTool::getScaleMatrix (int dy, float* matrix)
CloudTransformTool::getScaleMatrix (int dy, float* matrix) const
{
setIdentity(matrix);
float scale = dy > 0 ? scale_factor_ : 1.0 / scale_factor_;
Expand Down
2 changes: 1 addition & 1 deletion apps/point_cloud_editor/src/trackball.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ TrackBall::reset()

void
TrackBall::getPointFromScreenPoint(int s_x, int s_y,
float &x, float &y, float &z)
float &x, float &y, float &z) const
{
// See http://www.opengl.org/wiki/Trackball for more info

Expand Down
2 changes: 1 addition & 1 deletion apps/src/face_detection/openni_frame_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace OpenNIFrameSource
grabber_.stop ();
}

bool OpenNIFrameSource::isActive()
bool OpenNIFrameSource::isActive() const
{
return active_;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace pcl

/** Get the number of added vectors */
inline unsigned int
getNoOfSamples () { return no_of_samples_;}
getNoOfSamples () const { return no_of_samples_;}

/** Add a new sample */
inline void
Expand Down
2 changes: 1 addition & 1 deletion cuda/common/include/pcl/cuda/common/point_type_rgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace cuda
inline __host__ __device__ RGB (char _r, char _g, char _b, char _alpha) :
r(_r), g(_g), b(_b), alpha(_alpha) {}

inline __host__ __device__ bool operator == (const RGB &rhs)
inline __host__ __device__ bool operator == (const RGB &rhs) const
{
return (r == rhs.r && g == rhs.g && b == rhs.b && alpha == rhs.alpha);
}
Expand Down
4 changes: 2 additions & 2 deletions gpu/features/include/pcl/gpu/features/features.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace pcl
NormalEstimation();
void compute(Normals& normals);
void setViewPoint(float vpx, float vpy, float vpz);
void getViewPoint(float& vpx, float& vpy, float& vpz);
void getViewPoint(float& vpx, float& vpy, float& vpz) const;

static void computeNormals(const PointCloud& cloud, const NeighborIndices& nn_indices, Normals& normals);
static void flipNormalTowardsViewpoint(const PointCloud& cloud, float vp_x, float vp_y, float vp_z, Normals& normals);
Expand Down Expand Up @@ -223,7 +223,7 @@ namespace pcl
VFHEstimation();

void setViewPoint(float vpx, float vpy, float vpz);
void getViewPoint(float& vpx, float& vpy, float& vpz);
void getViewPoint(float& vpx, float& vpy, float& vpz) const;

void setUseGivenNormal (bool use);
void setNormalToUse (const NormalType& normal);
Expand Down
4 changes: 2 additions & 2 deletions gpu/features/src/features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void pcl::gpu::NormalEstimation::setViewPoint (float vpx, float vpy, float vpz)
vpx_ = vpx; vpy_ = vpy; vpz_ = vpz;
}

void pcl::gpu::NormalEstimation::getViewPoint (float &vpx, float &vpy, float &vpz)
void pcl::gpu::NormalEstimation::getViewPoint (float &vpx, float &vpy, float &vpz) const
{
vpx = vpx_; vpy = vpy_; vpz = vpz_;
}
Expand Down Expand Up @@ -383,7 +383,7 @@ pcl::gpu::VFHEstimation::VFHEstimation()
}

void pcl::gpu::VFHEstimation::setViewPoint(float vpx, float vpy, float vpz) { vpx_ = vpx; vpy_ = vpy; vpz_ = vpz; }
void pcl::gpu::VFHEstimation::getViewPoint(float& vpx, float& vpy, float& vpz) { vpx = vpx_; vpy = vpy_; vpz = vpz_; }
void pcl::gpu::VFHEstimation::getViewPoint(float& vpx, float& vpy, float& vpz) const { vpx = vpx_; vpy = vpy_; vpz = vpz_; }

void pcl::gpu::VFHEstimation::setUseGivenNormal (bool use) { use_given_normal_ = use; }
void pcl::gpu::VFHEstimation::setNormalToUse (const NormalType& normal) { normal_to_use_ = normal; }
Expand Down
2 changes: 1 addition & 1 deletion gpu/kinfu/include/pcl/gpu/kinfu/kinfu.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace pcl
* \param[out] cy principal point y
*/
void
getDepthIntrinsics (float& fx, float& fy, float& cx, float& cy);
getDepthIntrinsics (float& fx, float& fy, float& cx, float& cy) const;


/** \brief Sets initial camera pose relative to volume coordinate space
Expand Down
2 changes: 1 addition & 1 deletion gpu/kinfu/src/kinfu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pcl::gpu::KinfuTracker::setDepthIntrinsics (float fx, float fy, float cx, float

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void
pcl::gpu::KinfuTracker::getDepthIntrinsics (float& fx, float& fy, float& cx, float& cy)
pcl::gpu::KinfuTracker::getDepthIntrinsics (float& fx, float& fy, float& cx, float& cy) const
{
fx = fx_;
fy = fy_;
Expand Down
4 changes: 2 additions & 2 deletions gpu/kinfu/tools/kinfu_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ struct ImageView
}

void
showDepth (const PtrStepSz<const unsigned short>& depth)
showDepth (const PtrStepSz<const unsigned short>& depth) const
{
if (viz_)
viewerDepth_->showShortImage (depth.data, depth.cols, depth.rows, 0, 5000, true, "short_image");
Expand Down Expand Up @@ -582,7 +582,7 @@ struct SceneCloudView
}

void
clearClouds (bool print_message = false)
clearClouds (bool print_message = false) const
{
if (!viz_)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace pcl

/**Write camera pose to file*/
void
writePose(const std::string &filename_pose, const Eigen::Vector3f &teVecs, const Eigen::Matrix<float, 3, 3, Eigen::RowMajor> &erreMats);
writePose(const std::string &filename_pose, const Eigen::Vector3f &teVecs, const Eigen::Matrix<float, 3, 3, Eigen::RowMajor> &erreMats) const;

/**Counter of the number of screenshots taken*/
int screenshot_counter;
Expand Down
2 changes: 1 addition & 1 deletion gpu/kinfu_large_scale/src/screenshot_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace pcl
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void
ScreenshotManager::writePose(const std::string &filename_pose, const Eigen::Vector3f &teVecs, const Eigen::Matrix<float, 3, 3, Eigen::RowMajor> &erreMats)
ScreenshotManager::writePose(const std::string &filename_pose, const Eigen::Vector3f &teVecs, const Eigen::Matrix<float, 3, 3, Eigen::RowMajor> &erreMats) const
{
std::ofstream poseFile;
poseFile.open (filename_pose.c_str());
Expand Down
2 changes: 1 addition & 1 deletion gpu/octree/include/pcl/gpu/octree/octree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace pcl
void build();

/** \brief Returns true if tree has been built */
bool isBuilt();
bool isBuilt() const;

/** \brief Downloads Octree from GPU to search using CPU function. It use useful for single (not-batch) search */
void internalDownload();
Expand Down
2 changes: 1 addition & 1 deletion gpu/octree/src/octree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void pcl::gpu::Octree::build()
built_ = true;
}

bool pcl::gpu::Octree::isBuilt()
bool pcl::gpu::Octree::isBuilt() const
{
return built_;
}
Expand Down
2 changes: 1 addition & 1 deletion gpu/people/include/pcl/gpu/people/face_detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ namespace pcl

/** \brief Get the cuda GPU device id in use **/
int
getDeviceId() {return cuda_dev_id_;}
getDeviceId() const {return cuda_dev_id_;}

private:
bool largest_object_; /** \brief only give back largest object **/
Expand Down
16 changes: 8 additions & 8 deletions gpu/people/src/cuda/nvidia/NCVHaarObjectDetection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,27 +138,27 @@ struct HaarFeatureDescriptor32
return NCV_SUCCESS;
}

__device__ __host__ NcvBool isTilted()
__device__ __host__ NcvBool isTilted() const
{
return (this->desc & HaarFeatureDescriptor32_Interpret_MaskFlagTilted) != 0;
}

__device__ __host__ NcvBool isLeftNodeLeaf()
__device__ __host__ NcvBool isLeftNodeLeaf() const
{
return (this->desc & HaarFeatureDescriptor32_Interpret_MaskFlagLeftNodeLeaf) != 0;
}

__device__ __host__ NcvBool isRightNodeLeaf()
__device__ __host__ NcvBool isRightNodeLeaf() const
{
return (this->desc & HaarFeatureDescriptor32_Interpret_MaskFlagRightNodeLeaf) != 0;
}

__device__ __host__ Ncv32u getNumFeatures()
__device__ __host__ Ncv32u getNumFeatures() const
{
return (this->desc >> HaarFeatureDescriptor32_NumFeatures_Shift) & HaarFeatureDescriptor32_CreateCheck_MaxNumFeatures;
}

__device__ __host__ Ncv32u getFeaturesOffset()
__device__ __host__ Ncv32u getFeaturesOffset() const
{
return this->desc & HaarFeatureDescriptor32_CreateCheck_MaxFeatureOffset;
}
Expand All @@ -185,7 +185,7 @@ struct HaarClassifierNodeDescriptor32
return (*(Ncv32f *)&this->_ui1.x);
}

__host__ bool isLeaf() // TODO: check this hack don't know if is correct
__host__ bool isLeaf() const // TODO: check this hack don't know if is correct
{
return ( _ui1.x != 0);
}
Expand Down Expand Up @@ -291,12 +291,12 @@ struct HaarStage64
return *(Ncv32f*)&this->_ui2.x;
}

__host__ __device__ Ncv32u getStartClassifierRootNodeOffset()
__host__ __device__ Ncv32u getStartClassifierRootNodeOffset() const
{
return (this->_ui2.y >> HaarStage64_Interpret_ShiftRootNodeOffset);
}

__host__ __device__ Ncv32u getNumClassifierRootNodes()
__host__ __device__ Ncv32u getNumClassifierRootNodes() const
{
return (this->_ui2.y & HaarStage64_Interpret_MaskRootNodes);
}
Expand Down
2 changes: 1 addition & 1 deletion gpu/people/src/trees.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace pcl
{
Tex2Dfetcher( const std::uint16_t* dmap, int W, int H ) : m_dmap(dmap), m_W(W), m_H(H) {}

inline std::uint16_t operator () ( float uf, float vf )
inline std::uint16_t operator () ( float uf, float vf ) const
{
int u = static_cast<int>(uf);
int v = static_cast<int>(vf);
Expand Down
4 changes: 2 additions & 2 deletions gpu/people/tools/people_pcd_prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class PeoplePCDApp
}

void
writeXMLFile(std::string& filename)
writeXMLFile(std::string& filename) const
{
filebuf fb;
fb.open (filename.c_str(), ios::out);
Expand All @@ -149,7 +149,7 @@ class PeoplePCDApp
}

void
readXMLFile(std::string& filename)
readXMLFile(std::string& filename) const
{
filebuf fb;
fb.open (filename.c_str(), ios::in);
Expand Down
2 changes: 1 addition & 1 deletion gpu/surface/src/convex_hull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pcl::device::FacetStream::FacetStream(std::size_t buffer_size)
}

bool
pcl::device::FacetStream::canSplit()
pcl::device::FacetStream::canSplit() const
{
return facet_count * 3 < verts_inds.cols();
}
Expand Down
2 changes: 1 addition & 1 deletion gpu/surface/src/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace pcl

void compactFacets();

bool canSplit();
bool canSplit() const;
void splitFacets();
private:

Expand Down
4 changes: 2 additions & 2 deletions gpu/utils/include/pcl/gpu/utils/timers_cuda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ namespace pcl
cudaEventDestroy(stop_);
}

void start() { cudaEventRecord(start_, 0); }
void start() const { cudaEventRecord(start_, 0); }
Timer& stop() { cudaEventRecord(stop_, 0); cudaEventSynchronize(stop_); return *this; }

float time()
float time() const
{
float elapsed_time;
cudaEventElapsedTime(&elapsed_time, start_, stop_);
Expand Down
4 changes: 2 additions & 2 deletions io/include/pcl/io/ensenso_grabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ namespace pcl
* @return True if successful, false otherwise
* @warning A device must be opened and not running */
bool
grabSingleCloud (pcl::PointCloud<pcl::PointXYZ> &cloud);
grabSingleCloud (pcl::PointCloud<pcl::PointXYZ> &cloud) const;

/** @brief Set up the Ensenso sensor and API to do 3D extrinsic calibration using the Ensenso 2D patterns
* @param[in] grid_spacing
Expand Down Expand Up @@ -256,7 +256,7 @@ namespace pcl
setExtrinsicCalibration (const double euler_angle,
Eigen::Vector3d &rotation_axis,
const Eigen::Vector3d &translation,
const std::string target = "Hand");
const std::string target = "Hand") const;

/** @brief Update Link node in NxLib tree with an identity matrix
* @param[in] target "Hand" or "Workspace" for example
Expand Down
2 changes: 1 addition & 1 deletion io/include/pcl/io/hdl_grabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ namespace pcl
computeXYZI (pcl::PointXYZI& pointXYZI,
std::uint16_t azimuth,
HDLLaserReturn laserReturn,
HDLLaserCorrection correction);
HDLLaserCorrection correction) const;


private:
Expand Down
2 changes: 1 addition & 1 deletion io/include/pcl/io/openni2/openni2_device_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace pcl
getDevice (const std::string& device_URI);

OpenNI2Device::Ptr
getDeviceByIndex (int index);
getDeviceByIndex (int index) const;

OpenNI2Device::Ptr
getFileDevice (const std::string& path);
Expand Down
4 changes: 2 additions & 2 deletions io/src/ensenso_grabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ pcl::EnsensoGrabber::configureCapture (const bool auto_exposure,

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::EnsensoGrabber::grabSingleCloud (pcl::PointCloud<pcl::PointXYZ> &cloud)
pcl::EnsensoGrabber::grabSingleCloud (pcl::PointCloud<pcl::PointXYZ> &cloud) const
{
if (!device_open_)
return (false);
Expand Down Expand Up @@ -575,7 +575,7 @@ bool
pcl::EnsensoGrabber::setExtrinsicCalibration (const double euler_angle,
Eigen::Vector3d &rotation_axis,
const Eigen::Vector3d &translation,
const std::string target)
const std::string target) const
{
if (!device_open_)
return (false);
Expand Down
2 changes: 1 addition & 1 deletion io/src/hdl_grabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ void
pcl::HDLGrabber::computeXYZI (pcl::PointXYZI& point,
std::uint16_t azimuth,
HDLLaserReturn laserReturn,
HDLLaserCorrection correction)
HDLLaserCorrection correction) const
{
double cos_azimuth, sin_azimuth;

Expand Down
Loading