[Orxonox-commit 2563] r7268 - in code/trunk/src/libraries: core util
rgrieder at orxonox.net
rgrieder at orxonox.net
Mon Aug 30 19:34:07 CEST 2010
Author: rgrieder
Date: 2010-08-30 19:34:07 +0200 (Mon, 30 Aug 2010)
New Revision: 7268
Modified:
code/trunk/src/libraries/core/ClassTreeMask.cc
code/trunk/src/libraries/core/ClassTreeMask.h
code/trunk/src/libraries/core/Iterator.h
code/trunk/src/libraries/core/ObjectListIterator.h
code/trunk/src/libraries/core/SmartPtr.h
code/trunk/src/libraries/core/SubclassIdentifier.h
code/trunk/src/libraries/core/WeakPtr.h
code/trunk/src/libraries/util/MultiType.h
code/trunk/src/libraries/util/mbool.h
Log:
operator=() should not return constant references.
Modified: code/trunk/src/libraries/core/ClassTreeMask.cc
===================================================================
--- code/trunk/src/libraries/core/ClassTreeMask.cc 2010-08-30 16:27:59 UTC (rev 7267)
+++ code/trunk/src/libraries/core/ClassTreeMask.cc 2010-08-30 17:34:07 UTC (rev 7268)
@@ -525,7 +525,7 @@
@param other The other mask
@return A reference to the mask itself
*/
- const ClassTreeMask& ClassTreeMask::operator=(const ClassTreeMask& other)
+ ClassTreeMask& ClassTreeMask::operator=(const ClassTreeMask& other)
{
// Make a copy to avoid troubles with self-assignments (like A = A).
ClassTreeMask temp(other);
@@ -842,7 +842,7 @@
@brief Initializes the iterator from a given ClassTreeMask.
@param mask The mask
*/
- const ClassTreeMaskObjectIterator& ClassTreeMaskObjectIterator::operator=(const ClassTreeMask& mask)
+ ClassTreeMaskObjectIterator& ClassTreeMaskObjectIterator::operator=(const ClassTreeMask& mask)
{
// Clear everything, use a cleaned copy of the mask
this->subclasses_.clear();
Modified: code/trunk/src/libraries/core/ClassTreeMask.h
===================================================================
--- code/trunk/src/libraries/core/ClassTreeMask.h 2010-08-30 16:27:59 UTC (rev 7267)
+++ code/trunk/src/libraries/core/ClassTreeMask.h 2010-08-30 17:34:07 UTC (rev 7268)
@@ -193,7 +193,7 @@
/** @brief End of the ClassTreeMaskObjectIterator. */
inline BaseObject* end() const { return 0; }
- const ClassTreeMask& operator=(const ClassTreeMask& other);
+ ClassTreeMask& operator=(const ClassTreeMask& other);
bool operator==(const ClassTreeMask& other) const;
bool operator!=(const ClassTreeMask& other) const;
@@ -259,7 +259,7 @@
/** @brief Constructor: Initializes the iterator from a given ClassTreeMask. @param mask The mask */
inline ClassTreeMaskObjectIterator(const ClassTreeMask& mask) { (*this) = mask; }
- const ClassTreeMaskObjectIterator& operator=(const ClassTreeMask& mask);
+ ClassTreeMaskObjectIterator& operator=(const ClassTreeMask& mask);
const ClassTreeMaskObjectIterator& operator++();
Modified: code/trunk/src/libraries/core/Iterator.h
===================================================================
--- code/trunk/src/libraries/core/Iterator.h 2010-08-30 16:27:59 UTC (rev 7267)
+++ code/trunk/src/libraries/core/Iterator.h 2010-08-30 17:34:07 UTC (rev 7268)
@@ -123,7 +123,7 @@
@brief Assigns an exported element.
@param exp The exported element
*/
- inline const Iterator<T>& operator=(const ObjectListBase::Export& exp)
+ inline Iterator<T>& operator=(const ObjectListBase::Export& exp)
{
if (this->list_)
this->list_->unregisterIterator(this);
@@ -139,7 +139,7 @@
@brief Assigns the element of another Iterator.
@param other The other Iterator
*/
- inline const Iterator<T>& operator=(const Iterator<T>& other)
+ inline Iterator<T>& operator=(const Iterator<T>& other)
{
if (this->list_)
this->list_->unregisterIterator(this);
@@ -156,7 +156,7 @@
@param element The element
*/
template <class O>
- inline const Iterator<T>& operator=(ObjectListElement<O>* element)
+ inline Iterator<T>& operator=(ObjectListElement<O>* element)
{
if (this->list_)
this->list_->unregisterIterator(this);
@@ -173,7 +173,7 @@
@param other The ObjectListIterator
*/
template <class O>
- inline const Iterator<T>& operator=(const ObjectListIterator<O>& other)
+ inline Iterator<T>& operator=(const ObjectListIterator<O>& other)
{
if (this->list_)
this->list_->unregisterIterator(this);
Modified: code/trunk/src/libraries/core/ObjectListIterator.h
===================================================================
--- code/trunk/src/libraries/core/ObjectListIterator.h 2010-08-30 16:27:59 UTC (rev 7267)
+++ code/trunk/src/libraries/core/ObjectListIterator.h 2010-08-30 17:34:07 UTC (rev 7268)
@@ -100,7 +100,7 @@
@brief Assigns an ObjectListElement.
@param element The ObjectListElement
*/
- inline const ObjectListIterator<T>& operator=(ObjectListElement<T>* element)
+ inline ObjectListIterator<T>& operator=(ObjectListElement<T>* element)
{
this->element_ = element;
return (*this);
@@ -110,7 +110,7 @@
@brief Assigns the element of another ObjectListIterator.
@param element The other ObjectListIterator
*/
- inline const ObjectListIterator<T>& operator=(const ObjectListIterator<T>& other)
+ inline ObjectListIterator<T>& operator=(const ObjectListIterator<T>& other)
{
this->element_ = other.element_;
return (*this);
Modified: code/trunk/src/libraries/core/SmartPtr.h
===================================================================
--- code/trunk/src/libraries/core/SmartPtr.h 2010-08-30 16:27:59 UTC (rev 7267)
+++ code/trunk/src/libraries/core/SmartPtr.h 2010-08-30 17:34:07 UTC (rev 7268)
@@ -35,6 +35,7 @@
#include <cassert>
+#include "Identifier.h"
#include "OrxonoxClass.h"
#include "WeakPtr.h"
@@ -84,33 +85,33 @@
this->base_->decrementReferenceCount();
}
- inline const SmartPtr& operator=(int)
+ inline SmartPtr& operator=(int)
{
SmartPtr(0).swap(*this);
return *this;
}
- inline const SmartPtr& operator=(T* pointer)
+ inline SmartPtr& operator=(T* pointer)
{
SmartPtr(pointer).swap(*this);
return *this;
}
- inline const SmartPtr& operator=(const SmartPtr& other)
+ inline SmartPtr& operator=(const SmartPtr& other)
{
SmartPtr(other).swap(*this);
return *this;
}
template <class O>
- inline const SmartPtr& operator=(const SmartPtr<O>& other)
+ inline SmartPtr& operator=(const SmartPtr<O>& other)
{
SmartPtr(other).swap(*this);
return *this;
}
template <class O>
- inline const SmartPtr& operator=(const WeakPtr<O>& other)
+ inline SmartPtr& operator=(const WeakPtr<O>& other)
{
SmartPtr(other).swap(*this);
return *this;
@@ -193,7 +194,7 @@
template <class T, class U>
SmartPtr<T> dynamic_pointer_cast(const SmartPtr<U>& p)
{
- return dynamic_cast<T*>(p.get());
+ return orxonox_cast<T*>(p.get());
}
}
Modified: code/trunk/src/libraries/core/SubclassIdentifier.h
===================================================================
--- code/trunk/src/libraries/core/SubclassIdentifier.h 2010-08-30 16:27:59 UTC (rev 7267)
+++ code/trunk/src/libraries/core/SubclassIdentifier.h 2010-08-30 17:34:07 UTC (rev 7268)
@@ -90,7 +90,7 @@
@param identifier The Identifier to assign
@return The SubclassIdentifier itself
*/
- const SubclassIdentifier<T>& operator=(Identifier* identifier)
+ SubclassIdentifier<T>& operator=(Identifier* identifier)
{
if (!identifier || !identifier->isA(ClassIdentifier<T>::getIdentifier()))
{
@@ -117,7 +117,7 @@
@param identifier The other SublcassIdentifier
*/
template <class O>
- const SubclassIdentifier<T>& operator=(const SubclassIdentifier<O>& identifier)
+ SubclassIdentifier<T>& operator=(const SubclassIdentifier<O>& identifier)
{
return this->operator=(identifier.getIdentifier());
}
Modified: code/trunk/src/libraries/core/WeakPtr.h
===================================================================
--- code/trunk/src/libraries/core/WeakPtr.h 2010-08-30 16:27:59 UTC (rev 7267)
+++ code/trunk/src/libraries/core/WeakPtr.h 2010-08-30 17:34:07 UTC (rev 7268)
@@ -34,6 +34,7 @@
#include "CorePrereqs.h"
#include <cassert>
+#include "Identifier.h"
#include "OrxonoxClass.h"
#include "Functor.h"
@@ -81,26 +82,26 @@
}
- inline const WeakPtr& operator=(int)
+ inline WeakPtr& operator=(int)
{
WeakPtr(0).swap(*this);
return *this;
}
- inline const WeakPtr& operator=(T* pointer)
+ inline WeakPtr& operator=(T* pointer)
{
WeakPtr(pointer).swap(*this);
return *this;
}
- inline const WeakPtr& operator=(const WeakPtr& other)
+ inline WeakPtr& operator=(const WeakPtr& other)
{
WeakPtr(other).swap(*this);
return *this;
}
template <class O>
- inline const WeakPtr& operator=(const WeakPtr<O>& other)
+ inline WeakPtr& operator=(const WeakPtr<O>& other)
{
WeakPtr(other).swap(*this);
return *this;
@@ -212,7 +213,7 @@
template <class T, class U>
WeakPtr<T> dynamic_pointer_cast(const WeakPtr<U>& p)
{
- return dynamic_cast<T*>(p.get());
+ return orxonox_cast<T*>(p.get());
}
}
Modified: code/trunk/src/libraries/util/MultiType.h
===================================================================
--- code/trunk/src/libraries/util/MultiType.h 2010-08-30 16:27:59 UTC (rev 7267)
+++ code/trunk/src/libraries/util/MultiType.h 2010-08-30 17:34:07 UTC (rev 7268)
@@ -271,10 +271,10 @@
/** @brief Destructor: Deletes the MT_Value. */
inline ~MultiType() { if (this->value_) { delete this->value_; } }
- template <typename V> inline const MultiType& operator=(const V& value) { this->setValue(value); return (*this); } /** @brief Assigns a new value. The value will be converted to the current type of the MultiType. */
- template <typename V> inline const MultiType& operator=(V* value) { this->setValue(value); return (*this); } /** @brief Assigns a pointer. */
- inline const MultiType& operator=(const MultiType& other) { this->setValue(other); return (*this); } /** @brief Assigns the value of the other MultiType and converts it to the current type of the MultiType. */
- inline const MultiType& operator=(MT_Type::Value type) { this->setType(type); return (*this); } /** @brief Resets the value and changes the type. */
+ template <typename V> inline MultiType& operator=(const V& value) { this->setValue(value); return (*this); } /** @brief Assigns a new value. The value will be converted to the current type of the MultiType. */
+ template <typename V> inline MultiType& operator=(V* value) { this->setValue(value); return (*this); } /** @brief Assigns a pointer. */
+ inline MultiType& operator=(const MultiType& other) { this->setValue(other); return (*this); } /** @brief Assigns the value of the other MultiType and converts it to the current type of the MultiType. */
+ inline MultiType& operator=(MT_Type::Value type) { this->setType(type); return (*this); } /** @brief Resets the value and changes the type. */
inline bool setValue(const char& value);
inline bool setValue(const unsigned char& value);
Modified: code/trunk/src/libraries/util/mbool.h
===================================================================
--- code/trunk/src/libraries/util/mbool.h 2010-08-30 16:27:59 UTC (rev 7267)
+++ code/trunk/src/libraries/util/mbool.h 2010-08-30 17:34:07 UTC (rev 7268)
@@ -41,9 +41,9 @@
inline mbool(const mbool& value)
{ this->value_.memory_ = value.value_.memory_; }
- inline const mbool& operator=(bool value)
+ inline mbool& operator=(bool value)
{ if (value != this->value_.bool_) { ++this->value_.memory_; } return (*this); }
- inline const mbool& operator=(const mbool& value)
+ inline mbool& operator=(const mbool& value)
{ this->value_.memory_ = value.value_.memory_; return (*this); }
inline mbool& operator++()
More information about the Orxonox-commit
mailing list