I’m writing an ofxMachineVision addon. Let’s say it could be similar to ofxXimea.
Then I’m writing a grabber to draw frames and GUI to accessing all features of my new device. Problem is that Grabbers only access Device::Base classes. If I have many Device functions I want to access from my Grabber but I don’t want to write all those virtual functions on the Device::Base class... would you always do something like:
(in myGrabber class)
auto derivedDevice = static_pointer_cast<Device::MyDevice>(this->getDevice());
derivedDevice->setParameter(value);
It seems that you wrote Grabber::Simple to be compatible with many devices.
What if a device has many specific features and you want to use a GUI draw all of them?
I would prefer not to have the need of specifying all those functions in 4 different classes. For example setExposure() is defined in Grabber::Simple, Grabber::Base, Device::Base and Device::VideoInput.
Is there a way to reduce the amount of code for that goal? I was thinking of defining a feature implementation only once in a class then binding that feature to another class in the same way you are doing addFeature(FeatureType).
Thank you for this great addon. Its an excellent way of learning, specially C++11!
I’m writing an ofxMachineVision addon. Let’s say it could be similar to ofxXimea.
Then I’m writing a grabber to draw frames and GUI to accessing all features of my new device. Problem is that
Grabbersonly accessDevice::Baseclasses. If I have many Device functions I want to access from my Grabber but I don’t want to write all those virtual functions on theDevice::Baseclass... would you always do something like:It seems that you wrote Grabber::Simple to be compatible with many devices.
What if a device has many specific features and you want to use a GUI draw all of them?
I would prefer not to have the need of specifying all those functions in 4 different classes. For example
setExposure()is defined inGrabber::Simple,Grabber::Base,Device::BaseandDevice::VideoInput.Is there a way to reduce the amount of code for that goal? I was thinking of defining a feature implementation only once in a class then binding that feature to another class in the same way you are doing
addFeature(FeatureType).Thank you for this great addon. Its an excellent way of learning, specially C++11!