I'm still looking for answers to my previous question (Getting all the Telescopes and Cameras), but perhaps this is related to things not working.

This may be related to my relative unfamiliarity to C++, but I am finding that instances of BaseDevice seems function as both an object and as a pointer to an object.

I am using Xcode on macOS for development and find that both these pieces of code compile just fine:

void IndiClient::newDevice(INDI::BaseDevice baseDevice)
{         
   IDLog("New Device: %s\n", baseDevice.getDeviceName());
   auto interface = baseDevice.getDriverInterface();
   if (interface & BaseDevice::TELESCOPE_INTERFACE)
   {
       IDLog("New Telescope: %s\n", baseDevice.getDeviceName());
   }
}

and
void IndiClient::newDevice(INDI::BaseDevice baseDevice)
{         
   IDLog("New Device: %s\n", baseDevice->getDeviceName());
   auto interface = baseDevice->getDriverInterface();
   if (interface & BaseDevice::TELESCOPE_INTERFACE)
   {
       IDLog("New Telescope: %s\n", baseDevice->getDeviceName());
   }
}

In the first case I'm referencing baseDevice as if it were an object and in the second case I'm using pointer dereferencing. They both compile without errors and both work. What's going on here??

Is this somehow related to the d-pointer pattern that INDI is using? Or is it some glitch in Xcode and maybe I need to have some setting different so this compiles poperlt?

Thanks for you looking at this.
Bill

Read More...