Dirk Reiners wrote:
>     Hi Carsten,
> 
> Carsten Neumann wrote:
>> How about renaming these to get/setGenericValue() ?
>> IMHO this solves more than the overload problem I encounter, it also
>> indicates that this is not the most efficient interface to use. At the
>> same time this becomes a little faster, as MaxType can be a "smaller" type:
>>
>> IntegralProperties: UInt64 -> UInt32
>> VectorProperties:   Vec4ld -> Vec4d
>>   
> I don't like that very much, as the main idea was that users could 
> access any kind of GeoProp with any type of data and get sensible 
> results. If they used the stored type, it would be fast, if not, it 
> wouldn't, but it would still work. This was one of the  common 
> confusions in 1, and the source of the dreaded "Why can't I add a 
> Color4f to a Color4f property?" question.

For "arbitrary" type access there are still member template access
functions in GeoVectorProperty:

template <class ExternalType>
ExternalType getValue (const UInt32 index) const

that make use of getGenericValue (and carry the cost of the virtual call
and two conversion -- to MaxType and then to ExternalType)

and in TypedGeoVectorProperty:

template <class ExternalType>
ExternalType getValue (const UInt32 index)

that access the data directly (these only cost a conversion if
ExternalType is different from StoredType).

Sorry, I probably should have provided this information up front.
Actually, now that I'm writing this, set/getGenericValue probably
could/should be protected.


> What I can see as a compromise would be to rename the stored type ones 
> to get/setStoredValue and have the generic one be the default. That one 
> not using the Stored one will be slow, but it will work.
>
> Comments?

This unfortunately gives the more efficient interface a longer name.

        Carsten

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core

Reply via email to