-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Longer term solutions to DataContainer data type issue needed. #1193
Milestone
Comments
@KrisThielemans sorry not sure I understand your last suggestion:
|
Something like this is probably better than what I had originally suggested as it needs only a template class, not 2 of them template <typename DataType>
class DataContainerWithDataType: public DataContainer
{
public:
...
virtual DataType sum() const = 0;
virtual void sum(void * ptr) const override
{
const DataType ret = this->sum();
*static_cast<DataType *>(ptr) = ret;
}
class STIRDataContainer : public DataContainerWithDataType<float>
{
private:
typedef DataContainerWithDataType<float> base_type;
public:
// make sure we get the generic version as well
using base_type::sum;
virtual float sum() const override;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some
DataContainer
methods compute a value that is complex for Gadgetron containers and real for other containers, and so, the variable that would store such a value cannot be explicitly declared in this abstract base class. Currently, this issue is quick-fixed by passing avoid*
to these methods that is cast tofloat*
orcomplex_float_t*
in the respective methods of the derived classes.Possible longer term fixes:
void *
. Easy, but probably unexpected.std::any
(and if needed with a virtual functionstd::any DataContainer::get_zero_data_element()
or so). More complicated and not very elegant.DataContainer
if possible.The text was updated successfully, but these errors were encountered: