[Insight-developers] itkSetMacro with STL types

Luis Ibanez luis.ibanez at kitware.com
Thu Apr 14 18:56:13 EDT 2011


Dave,

One example of use is in the ImageIO classes, where
std::vectors are used as carriers for things like IORegions,
that are arrays for which we don't know their size at
compilation time.

On retrospective, we could have equally well used the
itk::Array in those cases...


    Luis


------------------------------------------
On Thu, Apr 14, 2011 at 6:30 PM, David Cole <david.cole at kitware.com> wrote:
> I'm fairly certain we avoid STL types in public set/get method
> signatures for a handful of reasons.
>
> The two that come immediately to mind are:
> 1) compilation speed (avoiding including the stl headers in other
> headers is a good thing)
> 2) wrapping languages
>
> Maybe both of these are, at this point, merely historical footnotes,
> ... but first, before solving "the problem", I'd see if I couldn't
> rather avoid it in the first place.
>
> Where do you need a vector or a set that's in the public API of ITK?
>
>
> On Thu, Apr 14, 2011 at 6:23 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>> David,
>>
>> Two options come to mind:
>>
>> A) Create a variant of itkSetMacro that doesn't call
>>     the DebugMacro
>>
>> or
>>
>> B)  Create a trait that indicates whether the Type has the
>>      stream << operator overloaded, and depending on that
>>      trait condition the print statement inside of the DebugMacro.
>>
>>
>> There are probably other and smarter options out there...    :-)
>>
>>
>>     Luis
>>
>> --------------------------------------------------
>> On Thu, Apr 14, 2011 at 3:32 PM, David Doria <daviddoria at gmail.com> wrote:
>>> On Thu, Apr 14, 2011 at 3:29 PM, Bill Lorensen <bill.lorensen at gmail.com>
>>> wrote:
>>>>
>>>> You would need to implement <<  for set<int>
>>>
>>> Sure, that'll fix it, but it seems like you should be able to use the
>>> SetMacro even for types which cannot be output. Could a few << operators for
>>> set, vector, etc be included somewhere to at least catch these common cases?
>>>
>>> David
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://kitware.com/products/protraining.html
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>
>>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
>


More information about the Insight-developers mailing list