Skip to content

Question about class structure #9

@jordiexvision

Description

@jordiexvision

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions