[Smtk-developers] Resource and ResourceComponent Types

David Thompson david.thompson at kitware.com
Wed Aug 16 09:18:25 EDT 2017


> I’ve started modifying the existing Resource class and have a question as to how SMTK should return the Resource’s Type (model, mesh, attribute, etc..) - The class currently uses an enum which is fast and does enforce uniformity  but will require new types of resources to modify the base class to add new enum (like VTK) .  We also could just return a string which would be more flexible but is a bit slower to compare.

At the resource level, strings seem to make a lot more sense because it doesn't feel like we've finished the list of resource types yet (candidates might be: simulation, job, view, workflow template).

> The same question pertains to the type of ResourceComponents.

Can we use dynamic casting of the parent resource or some other formalism to avoid the string comparison at the component level? That way things in tight loops would be fast but we would still be flexible. I worry that if we start with an enum and then add cases all the pre-existing switch statements would add fragility; people seem to deal with strings a little more defensively than enums.

	David


More information about the Smtk-developers mailing list