Since AxisCamera is a singleton, you can just call AxisCamera::GetInstance(NULL). It doesn't reconnect. Use the SOURCE
See?
Code:
AxisCamera &AxisCamera::GetInstance(const char *cameraIP)
{
if (NULL == _instance) //_instance is a static variable of type AxisCamera*
{
_instance = new AxisCamera(cameraIP);
_instance->m_videoServer = new PCVideoServer();
}
return *_instance;
}
Just make sure you're not the first one to call GetInstance, otherwise you're screwed. Static initialization order fiasco anyone? Yay intermittent segfaults!
Another way is to just have an inline function:
Code:
static inline AxisCamera& camera() {
static AxisCamera& c = AxisCamera::GetInstance(IP);
return c;
}
Yes it's nice to have encapsulation, but when the camera is a global singleton *anyway*, what's the point?