Commit 679628af authored by Jan Möbius's avatar Jan Möbius
Browse files

Tobias: SplatCloud update



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14995 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c31dd85e
...@@ -354,42 +354,18 @@ public: ...@@ -354,42 +354,18 @@ public:
* *
* \note Be careful, this method is *not* in O(1). * \note Be careful, this method is *not* in O(1).
* *
* @param[in] _handle A handle of the desired property.
* Do *not* use handle-strings inbetween '<' and '>'. These are reserved for predefined properties.
* @param[out] _property A pointer to the new property.
* If the property is already present, the pointer is set to the old property and no new property is created or added.
* Otherwise the pointer is set to the newly created property.
* If the creation fails, the pointer is set to 0 and no new property is added.
* @return For convenience the validity of _property is returned (i.e. _property != 0).
*/
///@{
template <typename T> inline bool requestSplatProperty( const PropertyHandleT<T> &_handle ) { SplatPropertyT<T> *temp; return requestSplatProperty( _handle, temp ); }
template <typename T> inline bool requestCloudProperty( const PropertyHandleT<T> &_handle ) { CloudPropertyT<T> *temp; return requestCloudProperty( _handle, temp ); }
template <typename T> bool requestSplatProperty( const PropertyHandleT<T> &_handle, SplatPropertyT<T> *(&_property) ); // no separate methods for const pointers
template <typename T> bool requestCloudProperty( const PropertyHandleT<T> &_handle, CloudPropertyT<T> *(&_property) ); // because methods are not const anyway
///@}
///@}
//----------------
/** @name Request and set splat-properties. */
///@{
/** \brief Request and set a cloud-property.
*
* This is equivalent to the single parameter version of the requestCloudProperty() method but sets the property's data for convenience.
* Notice that the data is set (overwritten) either if the property is already present or not.
*
* \note Be careful, this method is *not* in O(1).
*
* @param[in] _handle A handle of the desired property. * @param[in] _handle A handle of the desired property.
* Do *not* use handle-strings inbetween '<' and '>'. These are reserved for predefined properties. * Do *not* use handle-strings inbetween '<' and '>'. These are reserved for predefined properties.
* @param[in] _data The new data value. * @return If the property is already present, a pointer to the old property is returned and no new property is created or added.
* @return For convenience the validity of _property is returned (i.e. _property != 0). * Otherwise a pointer to the newly created property is returned.
* If the creation fails, 0 is returned and no new property is added.
*/ */
template <typename T> inline bool requestCloudProperty( const PropertyHandleT<T> &_handle, const T &_data ) ///@{
{ CloudPropertyT<T> *prop; if( requestCloudProperty( _handle, prop ) ) { prop->data() = _data; return true; } return false; } template <typename T> SplatPropertyT<T> *requestSplatProperty( const PropertyHandleT<T> &_handle );
template <typename T> CloudPropertyT<T> *requestCloudProperty( const PropertyHandleT<T> &_handle );
template <typename T> inline SplatPropertyT<T> *requestSplatProperty( const BasePropertyHandle &_handle ) { return requestSplatProperty( PropertyHandleT<T>( _handle ) ); }
template <typename T> inline CloudPropertyT<T> *requestCloudProperty( const BasePropertyHandle &_handle ) { return requestCloudProperty( PropertyHandleT<T>( _handle ) ); }
///@}
///@} ///@}
...@@ -404,18 +380,16 @@ public: ...@@ -404,18 +380,16 @@ public:
* *
* \note Be careful, this method is *not* in O(1). * \note Be careful, this method is *not* in O(1).
* *
* @param[in] _handle A handle of the property to remove. * @param[in] _handle A handle of the property to remove.
* Do *not* use handle-strings inbetween '<' and '>'. These are reserved for predefined properties. * Do *not* use handle-strings inbetween '<' and '>'. These are reserved for predefined properties.
* @param[out] _property A pointer to the old property. * @return If the property is present and will *not* be removed, a pointer to the old property is returned.
* If the property is present and will *not* be removed, the pointer is set to the old property. * Otherwise 0 is returned.
* Otherwise the pointer is set to 0.
* @return For convenience the validity of _property is returned (i.e. _property != 0).
*/ */
///@{ ///@{
template <typename T> inline bool releaseSplatProperty( const PropertyHandleT<T> &_handle ) { SplatPropertyT<T> *temp; return releaseSplatProperty( _handle, temp ); } template <typename T> SplatPropertyT<T> *releaseSplatProperty( const PropertyHandleT<T> &_handle );
template <typename T> inline bool releaseCloudProperty( const PropertyHandleT<T> &_handle ) { CloudPropertyT<T> *temp; return releaseCloudProperty( _handle, temp ); } template <typename T> CloudPropertyT<T> *releaseCloudProperty( const PropertyHandleT<T> &_handle );
template <typename T> bool releaseSplatProperty( const PropertyHandleT<T> &_handle, SplatPropertyT<T> *(&_property) ); template <typename T> inline SplatPropertyT<T> *releaseSplatProperty( const BasePropertyHandle &_handle ) { return releaseSplatProperty( PropertyHandleT<T>( _handle ) ); }
template <typename T> bool releaseCloudProperty( const PropertyHandleT<T> &_handle, CloudPropertyT<T> *(&_property) ); template <typename T> inline CloudPropertyT<T> *releaseCloudProperty( const BasePropertyHandle &_handle ) { return releaseCloudProperty( PropertyHandleT<T>( _handle ) ); }
///@} ///@}
///@} ///@}
...@@ -428,20 +402,20 @@ public: ...@@ -428,20 +402,20 @@ public:
/** \brief Get a pointer to a property. /** \brief Get a pointer to a property.
* *
* \note Be careful, this method is *not* in O(1). * \note Be careful, this method is *not* in O(1).
* This is the reason why there is no method returning a pointer directly and no hasSplatProperty() or hasCloudProperty() method.
* If you want to check for existence, use the dual parameter version of the getSplatProperty() or getCloudProperty() method once
* and then check for _property != 0 multiple times if needed.
* *
* @param[in] _handle A handle of the desired property. * @param[in] _handle A handle of the desired property.
* @param[out] _property A pointer to the property. * return If the property is present, a pointer to the property is returned.
* If the property is present, the pointer is set to the property. * Otherwise 0 is returned.
* Otherwise the pointer is set to 0.
*/ */
///@{ ///@{
template <typename T> void getSplatProperty( const PropertyHandleT<T> &_handle, SplatPropertyT<T> *(&_property) ); template <typename T> SplatPropertyT<T> *getSplatProperty( const PropertyHandleT<T> &_handle );
template <typename T> void getSplatProperty( const PropertyHandleT<T> &_handle, const SplatPropertyT<T> *(&_property) ) const; template <typename T> const SplatPropertyT<T> *getSplatProperty( const PropertyHandleT<T> &_handle ) const;
template <typename T> void getCloudProperty( const PropertyHandleT<T> &_handle, CloudPropertyT<T> *(&_property) ); template <typename T> CloudPropertyT<T> *getCloudProperty( const PropertyHandleT<T> &_handle );
template <typename T> void getCloudProperty( const PropertyHandleT<T> &_handle, const CloudPropertyT<T> *(&_property) ) const; template <typename T> const CloudPropertyT<T> *getCloudProperty( const PropertyHandleT<T> &_handle ) const;
template <typename T> inline SplatPropertyT<T> *getSplatProperty( const BasePropertyHandle &_handle ) { return getSplatProperty( PropertyHandleT<T>( _handle ) ); }
template <typename T> inline const SplatPropertyT<T> *getSplatProperty( const BasePropertyHandle &_handle ) const { return getSplatProperty( PropertyHandleT<T>( _handle ) ); }
template <typename T> inline CloudPropertyT<T> *getCloudProperty( const BasePropertyHandle &_handle ) { return getCloudProperty( PropertyHandleT<T>( _handle ) ); }
template <typename T> inline const CloudPropertyT<T> *getCloudProperty( const BasePropertyHandle &_handle ) const { return getCloudProperty( PropertyHandleT<T>( _handle ) ); }
///@} ///@}
///@} ///@}
...@@ -451,19 +425,25 @@ public: ...@@ -451,19 +425,25 @@ public:
/** @name Get property maps. */ /** @name Get property maps. */
///@{ ///@{
/** \brief Get all splat- or cloud-properties. /** \brief Get all splat-properties.
* *
* \note Be careful, std::map's count() method will *not* check for the appropiate type of a property. * \note Be careful, std::map's count() method will *not* check for the appropiate type of a property.
* There is no hasSplatProperty() or hasCloudProperty() method because this would *not* be in O(1). * Instead use something like SplatPropertyT<MyPropType> *myProp = mySplatCloud.getSplatProperty<MyPropType>( "MyPropName" ); once
* Instead call the dual parameter version of the getSplatProperty() or getCloudProperty() method once * and then check for myProp != 0 multiple times if needed.
* and then check for _property != 0 multiple times if needed.
* *
* @return Returns the property map as read-only reference. * @return Returns the property map as read-only reference.
*/ */
///@{
inline const SplatPropertyMap &splatProperties() const { return splatProperties_; } inline const SplatPropertyMap &splatProperties() const { return splatProperties_; }
/** \brief Get all cloud-properties.
*
* \note Be careful, std::map's count() method will *not* check for the appropiate type of a property.
* Instead use something like CloudPropertyT<MyPropType> *myProp = mySplatCloud.getCloudProperty<MyPropType>( "MyPropName" ); once
* and then check for myProp != 0 multiple times if needed.
*
* @return Returns the property map as read-only reference.
*/
inline const CloudPropertyMap &cloudProperties() const { return cloudProperties_; } inline const CloudPropertyMap &cloudProperties() const { return cloudProperties_; }
///@}
///@} ///@}
...@@ -563,15 +543,17 @@ public: ...@@ -563,15 +543,17 @@ public:
* See the requestSplatProperty() or requestCloudProperty() method for more detail. * See the requestSplatProperty() or requestCloudProperty() method for more detail.
* *
* \note Be careful, this method is *not* in O(1). * \note Be careful, this method is *not* in O(1).
*
* @return Returns true if the predefined property is available, otherwise false.
*/ */
///@{ ///@{
inline bool requestPositions() { return requestSplatProperty( POSITIONS_HANDLE, positionsProperty_ ); } inline bool requestPositions() { positionsProperty_ = requestSplatProperty( POSITIONS_HANDLE ); return (positionsProperty_ != 0); }
inline bool requestColors() { return requestSplatProperty( COLORS_HANDLE, colorsProperty_ ); } inline bool requestColors() { colorsProperty_ = requestSplatProperty( COLORS_HANDLE ); return (colorsProperty_ != 0); }
inline bool requestNormals() { return requestSplatProperty( NORMALS_HANDLE, normalsProperty_ ); } inline bool requestNormals() { normalsProperty_ = requestSplatProperty( NORMALS_HANDLE ); return (normalsProperty_ != 0); }
inline bool requestPointsizes() { return requestSplatProperty( POINTSIZES_HANDLE, pointsizesProperty_ ); } inline bool requestPointsizes() { pointsizesProperty_ = requestSplatProperty( POINTSIZES_HANDLE ); return (pointsizesProperty_ != 0); }
inline bool requestIndices() { return requestSplatProperty( INDICES_HANDLE, indicesProperty_ ); } inline bool requestIndices() { indicesProperty_ = requestSplatProperty( INDICES_HANDLE ); return (indicesProperty_ != 0); }
inline bool requestViewlists() { return requestSplatProperty( VIEWLISTS_HANDLE, viewlistsProperty_ ); } inline bool requestViewlists() { viewlistsProperty_ = requestSplatProperty( VIEWLISTS_HANDLE ); return (viewlistsProperty_ != 0); }
inline bool requestSelections() { return requestSplatProperty( SELECTIONS_HANDLE, selectionsProperty_ ); } inline bool requestSelections() { selectionsProperty_ = requestSplatProperty( SELECTIONS_HANDLE ); return (selectionsProperty_ != 0); }
///@} ///@}
///@} ///@}
...@@ -588,13 +570,13 @@ public: ...@@ -588,13 +570,13 @@ public:
* \note Be careful, this method is *not* in O(1). * \note Be careful, this method is *not* in O(1).
*/ */
///@{ ///@{
inline bool releasePositions() { return releaseSplatProperty( POSITIONS_HANDLE, positionsProperty_ ); } inline void releasePositions() { positionsProperty_ = releaseSplatProperty( POSITIONS_HANDLE ); }
inline bool releaseColors() { return releaseSplatProperty( COLORS_HANDLE, colorsProperty_ ); } inline void releaseColors() { colorsProperty_ = releaseSplatProperty( COLORS_HANDLE ); }
inline bool releaseNormals() { return releaseSplatProperty( NORMALS_HANDLE, normalsProperty_ ); } inline void releaseNormals() { normalsProperty_ = releaseSplatProperty( NORMALS_HANDLE ); }
inline bool releasePointsizes() { return releaseSplatProperty( POINTSIZES_HANDLE, pointsizesProperty_ ); } inline void releasePointsizes() { pointsizesProperty_ = releaseSplatProperty( POINTSIZES_HANDLE ); }
inline bool releaseIndices() { return releaseSplatProperty( INDICES_HANDLE, indicesProperty_ ); } inline void releaseIndices() { indicesProperty_ = releaseSplatProperty( INDICES_HANDLE ); }
inline bool releaseViewlists() { return releaseSplatProperty( VIEWLISTS_HANDLE, viewlistsProperty_ ); } inline void releaseViewlists() { viewlistsProperty_ = releaseSplatProperty( VIEWLISTS_HANDLE ); }
inline bool releaseSelections() { return releaseSplatProperty( SELECTIONS_HANDLE, selectionsProperty_ ); } inline void releaseSelections() { selectionsProperty_ = releaseSplatProperty( SELECTIONS_HANDLE ); }
///@} ///@}
///@} ///@}
...@@ -675,13 +657,13 @@ private: ...@@ -675,13 +657,13 @@ private:
/// Get pointers to predefined splat-properties. /// Get pointers to predefined splat-properties.
inline void getPredefinedSplatPropertyPointers() inline void getPredefinedSplatPropertyPointers()
{ {
getSplatProperty( POSITIONS_HANDLE, positionsProperty_ ); positionsProperty_ = getSplatProperty( POSITIONS_HANDLE );
getSplatProperty( COLORS_HANDLE, colorsProperty_ ); colorsProperty_ = getSplatProperty( COLORS_HANDLE );
getSplatProperty( NORMALS_HANDLE, normalsProperty_ ); normalsProperty_ = getSplatProperty( NORMALS_HANDLE );
getSplatProperty( POINTSIZES_HANDLE, pointsizesProperty_ ); pointsizesProperty_ = getSplatProperty( POINTSIZES_HANDLE );
getSplatProperty( INDICES_HANDLE, indicesProperty_ ); indicesProperty_ = getSplatProperty( INDICES_HANDLE );
getSplatProperty( VIEWLISTS_HANDLE, viewlistsProperty_ ); viewlistsProperty_ = getSplatProperty( VIEWLISTS_HANDLE );
getSplatProperty( SELECTIONS_HANDLE, selectionsProperty_ ); selectionsProperty_ = getSplatProperty( SELECTIONS_HANDLE );
} }
/// Get pointers to predefined cloud-properties. /// Get pointers to predefined cloud-properties.
......
...@@ -110,7 +110,7 @@ template <typename T> ...@@ -110,7 +110,7 @@ template <typename T>
template <typename T> template <typename T>
bool SplatCloud::requestSplatProperty( const SplatCloud::PropertyHandleT<T> &_handle, SplatCloud::SplatPropertyT<T> *(&_property) ) SplatCloud::SplatPropertyT<T> *SplatCloud::requestSplatProperty( const SplatCloud::PropertyHandleT<T> &_handle )
{ {
// try to find property map entry // try to find property map entry
SplatPropertyMap::iterator iter = splatProperties_.find( _handle ); SplatPropertyMap::iterator iter = splatProperties_.find( _handle );
...@@ -119,35 +119,32 @@ bool SplatCloud::requestSplatProperty( const SplatCloud::PropertyHandleT<T> &_ha ...@@ -119,35 +119,32 @@ bool SplatCloud::requestSplatProperty( const SplatCloud::PropertyHandleT<T> &_ha
if( iter != splatProperties_.end() ) if( iter != splatProperties_.end() )
{ {
// try to cast // try to cast
_property = dynamic_cast<SplatPropertyT<T> *>( iter->second.property_ ); SplatPropertyT<T> *oldProp = dynamic_cast<SplatPropertyT<T> *>( iter->second.property_ );
// check if cast failed and property in map has different type. if so, return failure (_property is 0) // if found property is of the right type, increase number of requests
if( _property == 0 ) if( oldProp != 0 )
return false; ++iter->second.numRequests_;
// increase number of requests and return success (_property is a valid pointer) // return pointer to old property
++iter->second.numRequests_; return oldProp;
return true;
} }
// create new property // create new property
_property = new SplatPropertyT<T>( _handle, numSplats_ ); SplatPropertyT<T> *newProp = new SplatPropertyT<T>( _handle, numSplats_ );
// if out of memory, abort and return failure (_property is 0) // if creation went wrong, free memory and reset pointer
if( _property == 0 ) if( newProp->data_.size() != numSplats_ )
return false;
// if creation went wrong, free memory and return failure (_property will be set to 0)
if( _property->data_.size() != numSplats_ )
{ {
delete _property; delete newProp;
_property = 0; newProp = 0;
return false;
} }
// insert new property map entry and return success (_property is a valid pointer) // if pointer is valid, insert new property map entry
splatProperties_[ _handle ] = SplatPropertyMapEntry( _property, 1 ); if( newProp != 0 )
return true; splatProperties_[ _handle ] = SplatPropertyMapEntry( newProp, 1 );
// return pointer to new property
return newProp;
} }
...@@ -155,7 +152,7 @@ bool SplatCloud::requestSplatProperty( const SplatCloud::PropertyHandleT<T> &_ha ...@@ -155,7 +152,7 @@ bool SplatCloud::requestSplatProperty( const SplatCloud::PropertyHandleT<T> &_ha
template <typename T> template <typename T>
bool SplatCloud::requestCloudProperty( const SplatCloud::PropertyHandleT<T> &_handle, SplatCloud::CloudPropertyT<T> *(&_property) ) SplatCloud::CloudPropertyT<T> *SplatCloud::requestCloudProperty( const SplatCloud::PropertyHandleT<T> &_handle )
{ {
// try to find property map entry // try to find property map entry
CloudPropertyMap::iterator iter = cloudProperties_.find( _handle ); CloudPropertyMap::iterator iter = cloudProperties_.find( _handle );
...@@ -164,27 +161,25 @@ bool SplatCloud::requestCloudProperty( const SplatCloud::PropertyHandleT<T> &_ha ...@@ -164,27 +161,25 @@ bool SplatCloud::requestCloudProperty( const SplatCloud::PropertyHandleT<T> &_ha
if( iter != cloudProperties_.end() ) if( iter != cloudProperties_.end() )
{ {
// try to cast // try to cast
_property = dynamic_cast<CloudPropertyT<T> *>( iter->second.property_ ); CloudPropertyT<T> *oldProp = dynamic_cast<CloudPropertyT<T> *>( iter->second.property_ );
// check if cast failed and property in map has different type. if so, return failure (_property is 0) // if found property is of the right type, increase number of requests
if( _property == 0 ) if( oldProp != 0 )
return false; ++iter->second.numRequests_;
// increase number of requests and return success (_property is a valid pointer) // return pointer to old property
++iter->second.numRequests_; return oldProp;
return true;
} }
// create new property // create new property
_property = new CloudPropertyT<T>( _handle ); CloudPropertyT<T> *newProp = new CloudPropertyT<T>( _handle );
// if out of memory, abort and return failure (_property is 0) // if pointer is valid, insert new property map entry
if( _property == 0 ) if( newProp != 0 )
return false; cloudProperties_[ _handle ] = CloudPropertyMapEntry( newProp, 1 );
// insert new property map entry and return success (_property is a valid pointer) // return pointer to new property
cloudProperties_[ _handle ] = CloudPropertyMapEntry( _property, 1 ); return newProp;
return true;
} }
...@@ -192,34 +187,38 @@ bool SplatCloud::requestCloudProperty( const SplatCloud::PropertyHandleT<T> &_ha ...@@ -192,34 +187,38 @@ bool SplatCloud::requestCloudProperty( const SplatCloud::PropertyHandleT<T> &_ha
template <typename T> template <typename T>
bool SplatCloud::releaseSplatProperty( const SplatCloud::PropertyHandleT<T> &_handle, SplatCloud::SplatPropertyT<T> *(&_property) ) SplatCloud::SplatPropertyT<T> *SplatCloud::releaseSplatProperty( const SplatCloud::PropertyHandleT<T> &_handle )
{ {
// try to find property map entry // try to find property map entry
SplatPropertyMap::iterator iter = splatProperties_.find( _handle ); SplatPropertyMap::iterator iter = splatProperties_.find( _handle );
// set _property to 0 if *not* found or cast fails, otherwise to a valid pointer // if *not* found, abort
_property = (iter == splatProperties_.end()) ? 0 : dynamic_cast<SplatPropertyT<T> *>( iter->second.property_ ); if( iter == splatProperties_.end() )
return 0;
// if a property with the same name but a different type is present, do *not* remove any property
// if *not* a valid pointer, abort and return failure (_property is 0) // try to cast
if( _property == 0 ) SplatPropertyT<T> *prop = dynamic_cast<SplatPropertyT<T> *>( iter->second.property_ );
return false;
// decrease number of request // check if found property is of the right type
--iter->second.numRequests_; if( prop != 0 )
{
// check if property should *not* be removed yet. if so, return success (_property is a valid pointer) // decrease number of request
if( iter->second.numRequests_ != 0 ) --iter->second.numRequests_;
return true;
// check if property should be removed now
// free memory of property and reset pointer if( iter->second.numRequests_ == 0 )
delete _property; {
_property = 0; // free memory of property and reset pointer
delete prop;
prop = 0;
// remove property map entry
splatProperties_.erase( iter );
}
}
// remove property map entry and return false because _property is 0 // return pointer to property
splatProperties_.erase( iter ); return prop;
return false;
} }
...@@ -227,34 +226,38 @@ bool SplatCloud::releaseSplatProperty( const SplatCloud::PropertyHandleT<T> &_ha ...@@ -227,34 +226,38 @@ bool SplatCloud::releaseSplatProperty( const SplatCloud::PropertyHandleT<T> &_ha
template <typename T> template <typename T>
bool SplatCloud::releaseCloudProperty( const SplatCloud::PropertyHandleT<T> &_handle, SplatCloud::CloudPropertyT<T> *(&_property) ) SplatCloud::CloudPropertyT<T> *SplatCloud::releaseCloudProperty( const SplatCloud::PropertyHandleT<T> &_handle )
{ {
// try to find property map entry // try to find property map entry
CloudPropertyMap::iterator iter = cloudProperties_.find( _handle ); CloudPropertyMap::iterator iter = cloudProperties_.find( _handle );
// set _property to 0 if *not* found or cast fails, otherwise to a valid pointer // if *not* found, abort
_property = (iter == cloudProperties_.end()) ? 0 : dynamic_cast<CloudPropertyT<T> *>( iter->second.property_ ); if( iter == cloudProperties_.end() )
return 0;
// if a property with the same name but a different type is present, do *not* remove any property
// if *not* a valid pointer, abort and return failure (_property is 0)
if( _property == 0 )
return false;
// decrease number of request // try to cast
--iter->second.numRequests_; CloudPropertyT<T> *prop = dynamic_cast<CloudPropertyT<T> *>( iter->second.property_ );
// check if property should *not* be removed yet. if so, return success (_property is a valid pointer) // check if found property is of the right type
if( iter->second.numRequests_ != 0 ) if( prop != 0 )
return true; {
// decrease number of request
// free memory of property and reset pointer --iter->second.numRequests_;
delete _property;
_property = 0; // check if property should be removed now
if( iter->second.numRequests_ == 0 )
{
// free memory of property and reset pointer
delete prop;
prop = 0;
// remove property map entry
cloudProperties_.erase( iter );
}
}
// remove property map entry and return false because _property is 0 // return pointer to property
cloudProperties_.erase( iter ); return prop;
return false;
} }
...@@ -262,13 +265,13 @@ bool SplatCloud::releaseCloudProperty( const SplatCloud::PropertyHandleT<T> &_ha ...@@ -262,13 +265,13 @@ bool SplatCloud::releaseCloudProperty( const SplatCloud::PropertyHandleT<T> &_ha
template <typename T> template <typename T>
void SplatCloud::getSplatProperty( const SplatCloud::PropertyHandleT<T> &_handle, SplatCloud::SplatPropertyT<T> *(&_property) ) SplatCloud::SplatPropertyT<T> *SplatCloud::getSplatProperty( const SplatCloud::PropertyHandleT<T> &_handle )
{ {
// try to find property map entry // try to find property map entry
SplatPropertyMap::const_iterator iter = splatProperties_.find( _handle ); SplatPropertyMap::const_iterator iter = splatProperties_.find( _handle );
// set _property to 0 if *not* found or cast fails, otherwise to a valid pointer // if *not* found or cast fails return 0, otherwise return a valid pointer
_property = (iter == splatProperties_.end()) ? 0 : dynamic_cast<SplatPropertyT<T> *>( iter->second.property_ ); return (iter == splatProperties_.end()) ? 0 : dynamic_cast<SplatPropertyT<T> *>( iter->second.property_ );
} }
...@@ -276,13 +279,13 @@ void SplatCloud::getSplatProperty( const SplatCloud::PropertyHandleT<T> &_handle ...@@ -276,13 +279,13 @@ void SplatCloud::getSplatProperty( const SplatCloud::PropertyHandleT<T> &_handle
template <typename T> template <typename T>
void SplatCloud::getSplatProperty( const SplatCloud::PropertyHandleT<T> &_handle, const SplatCloud::SplatPropertyT<T> *(&_property) ) const const SplatCloud::SplatPropertyT<T> *SplatCloud::getSplatProperty( const SplatCloud::PropertyHandleT<T> &_handle ) const
{ {
// try to find property map entry // try to find property map entry
SplatPropertyMap::const_iterator iter = splatProperties_.find( _handle ); SplatPropertyMap::const_iterator iter = splatProperties_.find( _handle );
// set _property to 0 if *not* found or cast fails, otherwise to a valid pointer // if *not* found or cast fails return 0, otherwise return a valid pointer
_property = (iter == splatProperties_.end()) ? 0 : dynamic_cast<const SplatPropertyT<T> *>( iter->second.property_ ); return (iter == splatProperties_.end()) ? 0 : dynamic_cast<const SplatPropertyT<T> *>( iter->second.property_ );
} }
...@@ -290,13 +293,13 @@ void SplatCloud::getSplatProperty( const SplatCloud::PropertyHandleT<T> &_handle ...@@ -290,13 +293,13 @@ void SplatCloud::getSplatProperty( const SplatCloud::PropertyHandleT<T> &_handle
template <typename T> template <typename T>
void SplatCloud::getCloudProperty( const SplatCloud::PropertyHandleT<T> &_handle, SplatCloud::CloudPropertyT<T> *(&_property) ) SplatCloud::CloudPropertyT<T> *SplatCloud::getCloudProperty( const SplatCloud::PropertyHandleT<T> &_handle )
{ {