Ticket #11408 (assigned)

Opened 6 years ago

Last modified 5 years ago

Const correctness for Workspaces

Reported by: Owen Arnold Owned by: Owen Arnold
Priority: major Milestone: Backlog
Component: Framework Keywords:
Cc: Blocked By:
Blocking: Tester:

Description

I cannot do this inside the execute method of my algorithm.

 boost::shared_ptr<const T> prop = this->getProperty("InputWorkspace");

I can only do this

 boost::shared_ptr<T> prop = this->getProperty("InputWorkspace");

This is bad because If I have an InputWorkspace as Kernel::Direction.In (not Direction.InOut) I do not, and should not be given the ability to modify that Workspace.

The problem is in IPropertyManager TypedValue.

It should just be a case of introducing this to get things working.

 /// explicit specialization for boost::shared_const_ptr
    template <typename T> operator boost::shared_ptr<const T>() {
      return pm.getValue<boost::shared_ptr<T>>(prop);
    }

Change History

comment:1 Changed 6 years ago by Owen Arnold

  • Owner set to Owen Arnold
  • Status changed from new to assigned

comment:2 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 12247

Note: See TracTickets for help on using tickets.