Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • VTK VTK
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 733
    • Issues 733
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 203
    • Merge requests 203
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTK
  • VTKVTK
  • Issues
  • #18170

Closed
Open
Created Apr 09, 2021 by Ben Boeckel@ben.boeckelOwner

ObjectFactory needs an RAII way to enable/disable overrides

The API currently is very anemic here. There's a way to turn on and off all overrides of a given class. There's no way to (ergonomically) query and restore the state either. One would need to iterate over the registered object factories, remember the state, flip the desired states, make the object in question, then finally restore the state.

This is:

  • finicky
  • error-prone
  • not at all thread-aware (e.g., new factories could come in, other threads do this machination too, etc.)

There should be a way to scope an object that does this. Something like:

vtkFactoryable* base = nullptr;

{
  vtkFactoryModifier modifer("vtkFactoryable");
  // modifier.DisableAllOverloads();
  modifier.DisableOverload("vtkFactoryWeDontWantHere");
  base = vtkFactoryable::New();

  // `modifer` goes out of scope and restores the state
}

Cc: @brad.king @ken-martin @utkarsh.ayachit

Assignee
Assign to
Time tracking