Ticket #6337 (closed: fixed)
Refactor TableWorkspace::addColumn to return a handle to the new column
Reported by: | Russell Taylor | Owned by: | Russell Taylor |
---|---|---|---|
Priority: | minor | Milestone: | Release 2.4 |
Component: | Mantid | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Wenduo Zhou |
Description
In a new algorithm I've been writing, I've found myself continually creating a column and then having to call a separate method to get back the new column. It seems like it would make more sense if the addColumn method just returned a shared pointer to the new column.
Currently, it returns a bool indicating success so we could just return a null pointer for failure and everything should still work (the return value is rarely captured in any case).
Change History
comment:2 Changed 8 years ago by Russell Taylor
Re #6337. Change return type of (I)TableWorkspace::addColumn
...from a success/failure boolean to a shared pointer to the new column. Saves repeatedly having to go and fetch the column separately in an algorithm I'm working on. Any existing places that check the return value (there aren't many) will still work as the pointer will convert to bool.
I kept the return type of the exposed python method unchanged as the Column class is not exposed to python and I didn't see any reason to do so just for this.
Changeset: d112d851e806f1bd5cff299d254150d798952599
comment:3 Changed 8 years ago by Russell Taylor
- Status changed from accepted to verify
- Resolution set to fixed
To test: Just inspect the code and note that the changes are tested. Observe that the places that did rely on the boolean return value (e.g. the addColumns method) still work. Maybe try out the addColumn method manually from python.
comment:4 Changed 8 years ago by Russell Taylor
Re #6337. Change return type of (I)TableWorkspace::addColumn
...from a success/failure boolean to a shared pointer to the new column. Saves repeatedly having to go and fetch the column separately in an algorithm I'm working on. Any existing places that check the return value (there aren't many) will still work as the pointer will convert to bool.
I kept the return type of the exposed python method unchanged as the Column class is not exposed to python and I didn't see any reason to do so just for this.
Changeset: 9ef6a138144a8da4b635fcbcd7da69b8dd225f96