Click here to Skip to main content
15,887,434 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am writting a wrapper in C++/CLI for a SDK of a 3D sensor. The question is in the last release the SDK has many changes, including a two listeners. Is my first time with C++/CLI and I do not know how to wrap the listener. I see other sites that explain this, but I do not understand very well what are the doing.

The listener is like this:
C++
class DecoderListener
{
public:
    virtual ~DecoderListener() {};
    virtual Status onCloudDecoded(int /lastFrameDecodedNumber/, int /lastFrameDecodedLen/, long long /lastFrameDecodedTimeStamp/,
            float * /positions/, float * /normals/, unsigned char * /colors/)
    {
        return NotImplemented;
    };


    virtual Status onMapDecoded(int /*depthMapNumber*/, long long /*timeStamp*/, unsigned char const* /*pImage*/, int /*dataSize*/, int /*dataW*/, int /*dataH*/)
    {
        return NotImplemented;
    };

    virtual Status onDepthMapWithColorDecoded(int /*depthMapNumber*/, long long /*timeStamp*/, unsigned char const* /*pDMImage*/, int /*DMDataSize*/, int /*DMdataW*/, int /*DMdataH*/, unsigned char const* /*pcolorImage*/, int /*colorDataSize*/, int /*colorDataW*/, int /*colorDataH*/)
    {
        return NotImplemented;
    };
};
Posted

1 solution

Imagine these Listeners as callbacks. And callbacks are somehow function pointers. It is a really powerful feature of C.

Here is some a tutorial about function pointers.

Tip: always initialize them to NULL, check it before calling and reset them to NULL when your done. This avoids strange bugs!!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900