fixed compilation errors on octomap >=1.8 introduced by previous commit for octomap < 1.8

This commit is contained in:
matlabbe
2018-02-09 11:02:01 -05:00
parent c2d0628da1
commit 1c8c233ebf
2 changed files with 32 additions and 11 deletions

View File

@@ -66,19 +66,11 @@ public:
const octomap::point3d & getPointRef() const {return pointRef_;}
// following methods defined for octomap < 1.8 compatibility
inline RtabmapColorOcTreeNode* getChild(unsigned int i) {
return static_cast<RtabmapColorOcTreeNode*> (OcTreeNode::getChild(i));
}
inline const RtabmapColorOcTreeNode* getChild(unsigned int i) const {
return static_cast<const RtabmapColorOcTreeNode*> (OcTreeNode::getChild(i));
}
RtabmapColorOcTreeNode* getChild(unsigned int i);
const RtabmapColorOcTreeNode* getChild(unsigned int i) const;
bool pruneNode();
void expandNode();
bool createChild(unsigned int i) {
if (children == NULL) allocChildren();
children[i] = new RtabmapColorOcTreeNode();
return true;
}
bool createChild(unsigned int i);
private:
int nodeRefId_;

View File

@@ -40,6 +40,23 @@ namespace rtabmap {
// RtabmapColorOcTree
//////////////////////////////////////
RtabmapColorOcTreeNode* RtabmapColorOcTreeNode::getChild(unsigned int i) {
#ifdef OCTOMAP_PRE_18
return static_cast<RtabmapColorOcTreeNode*> (OcTreeNode::getChild(i));
#else
UFATAL("This function should not be used with octomap >= 1.8");
return 0;
#endif
}
const RtabmapColorOcTreeNode* RtabmapColorOcTreeNode::getChild(unsigned int i) const {
#ifdef OCTOMAP_PRE_18
return static_cast<const RtabmapColorOcTreeNode*> (OcTreeNode::getChild(i));
#else
UFATAL("This function should not be used with octomap >= 1.8");
return 0;
#endif
}
//octomap <1.8
bool RtabmapColorOcTreeNode::pruneNode() {
#ifdef OCTOMAP_PRE_18
@@ -75,6 +92,18 @@ void RtabmapColorOcTreeNode::expandNode() {
#endif
}
//octomap <1.8
bool RtabmapColorOcTreeNode::createChild(unsigned int i) {
#ifdef OCTOMAP_PRE_18
if (children == NULL) allocChildren();
children[i] = new RtabmapColorOcTreeNode();
return true;
#else
UFATAL("This function should not be used with octomap >= 1.8");
return false;
#endif
}
RtabmapColorOcTree::RtabmapColorOcTree(double resolution)
: OccupancyOcTreeBase<RtabmapColorOcTreeNode>(resolution) {
RtabmapColorOcTreeMemberInit.ensureLinking();