Search code examples
c++abstract-classinteloverridingperceptual-sdk

C++ Override Syntax


I'm working with Intel's PCSDK, there's a part I don't syntactically understand from a sample where the constructor of an abstract class is overridden. Specifically, this line:

GesturePipeline (void):UtilPipeline(),m_render(L"Gesture Viewer") {
EnableGesture();
}

What does the comma between UtilPipeline() and m_render mean? Here's the entire code for context:

#include "util_pipeline.h"
#include "gesture_render.h"
#include "pxcgesture.h"
class GesturePipeline: public UtilPipeline {
public:
GesturePipeline (void):UtilPipeline(),m_render(L"Gesture Viewer") {
EnableGesture();
}
virtual void PXCAPI OnGesture(PXCGesture::Gesture *data) {
if (data->active) m_gdata = (*data);
}
virtual void PXCAPI OnAlert(PXCGesture::Alert *data) {
switch (data->label) {
case PXCGesture::Alert::LABEL_FOV_TOP:
wprintf_s(L"******** Alert: Hand touches the TOP boundary!\n");
break;
case PXCGesture::Alert::LABEL_FOV_BOTTOM:
wprintf_s(L"******** Alert: Hand touches the BOTTOM boundary!\n");
break;
case PXCGesture::Alert::LABEL_FOV_LEFT:
wprintf_s(L"******** Alert: Hand touches the LEFT boundary!\n");
break;
case PXCGesture::Alert::LABEL_FOV_RIGHT:
wprintf_s(L"******** Alert: Hand touches the RIGHT boundary!\n");
break;
}
}
virtual bool OnNewFrame(void) {
return m_render.RenderFrame(QueryImage(PXCImage::IMAGE_TYPE_DEPTH),
QueryGesture(), &m_gdata);
}
protected:
GestureRender m_render;
PXCGesture::Gesture m_gdata;
};

Solution

  • It's an initializer list which initializes the base class and a member variable:

    GesturePipeline (void) // constructor signature
      : UtilPipeline(), // initialize base class
        m_render(L"Gesture Viewer") // initialize member m_render from GesturePipeline
    {
        EnableGesture();
    }