diff --git a/src/OpenFOAM/memory/autoPtr/autoPtr.H b/src/OpenFOAM/memory/autoPtr/autoPtr.H index 5f4afc765acc85403d4c7a512bb44333ad631686..2ade60924a28c5dc9e1d8389a3c7a34f6118220f 100644 --- a/src/OpenFOAM/memory/autoPtr/autoPtr.H +++ b/src/OpenFOAM/memory/autoPtr/autoPtr.H @@ -96,7 +96,7 @@ public: // pointer inline void reset(T* = 0); - //- Delete object and set pointer to NULL, if the pointer is valid. + //- Delete object (if the pointer is valid) and set pointer to NULL. inline void clear(); @@ -108,9 +108,7 @@ public: //- Return const reference to the object data inline const T& operator()() const; - // inline T& operator*(); - // inline const T& operator*() const; - + //- Const cast to the underlying type reference inline operator const T&() const; //- Return object pointer @@ -119,7 +117,7 @@ public: //- Return const object pointer inline const T* operator->() const; - //- Take over object pointer from parameter + //- Take over the object pointer from parameter inline void operator=(const autoPtr<T>&); }; diff --git a/src/OpenFOAM/memory/autoPtr/autoPtrI.H b/src/OpenFOAM/memory/autoPtr/autoPtrI.H index 1a6fce01f78a6babbced8b77a9c6acd3fe09c396..ead0d6264095806d0a2d682e3be95cf85204daef 100644 --- a/src/OpenFOAM/memory/autoPtr/autoPtrI.H +++ b/src/OpenFOAM/memory/autoPtr/autoPtrI.H @@ -80,7 +80,7 @@ inline void Foam::autoPtr<T>::set(T* p) { if (ptr_) { - FatalErrorIn("void autoPtr<T>::set(T*)") + FatalErrorIn("void Foam::autoPtr<T>::set(T*)") << "object already allocated" << abort(FatalError); } @@ -115,7 +115,7 @@ inline T& Foam::autoPtr<T>::operator()() { if (!ptr_) { - FatalErrorIn("T& autoPtr<T>::operator()()") + FatalErrorIn("T& Foam::autoPtr<T>::operator()()") << "object is not allocated" << abort(FatalError); } @@ -129,7 +129,7 @@ inline const T& Foam::autoPtr<T>::operator()() const { if (!ptr_) { - FatalErrorIn("const T& autoPtr<T>::operator()() const") + FatalErrorIn("const T& Foam::autoPtr<T>::operator()() const") << "object is not allocated" << abort(FatalError); } @@ -138,22 +138,6 @@ inline const T& Foam::autoPtr<T>::operator()() const } -/* -template<class T> -inline T& Foam::autoPtr<T>::operator*() -{ - return operator()(); -} - - -template<class T> -inline const T& Foam::autoPtr<T>::operator*() const -{ - return operator()(); -} -*/ - - template<class T> inline Foam::autoPtr<T>::operator const T&() const { @@ -166,7 +150,7 @@ inline T* Foam::autoPtr<T>::operator->() { if (!ptr_) { - FatalErrorIn("autoPtr<T>::operator->()") + FatalErrorIn("Foam::autoPtr<T>::operator->()") << "object is not allocated" << abort(FatalError); } diff --git a/src/OpenFOAM/memory/tmp/refCount.H b/src/OpenFOAM/memory/refCount/refCount.H similarity index 98% rename from src/OpenFOAM/memory/tmp/refCount.H rename to src/OpenFOAM/memory/refCount/refCount.H index 9974ff0cb14e153b0ced516a2f0b56d56fcf58e4..c3b59142116ce26810fba1c658ed708712bb83de 100644 --- a/src/OpenFOAM/memory/tmp/refCount.H +++ b/src/OpenFOAM/memory/refCount/refCount.H @@ -25,7 +25,7 @@ Class Foam::refCount Description - Reference counter for tmp\<field\>. + Reference counter for various OpenFOAM components. \*---------------------------------------------------------------------------*/ diff --git a/src/OpenFOAM/memory/tmp/tmp.H b/src/OpenFOAM/memory/tmp/tmp.H index 90fa6f5684dd523226527d53e2de1162eca9d20e..f1a9f81fae01e1f3b21fa06159647f11ae889beb 100644 --- a/src/OpenFOAM/memory/tmp/tmp.H +++ b/src/OpenFOAM/memory/tmp/tmp.H @@ -62,7 +62,7 @@ class tmp //- Pointer to temporary object mutable T* ptr_; - // Const reference to constant object + //- Const reference to constant object const T& ref_; diff --git a/src/OpenFOAM/memory/tmp/tmpI.H b/src/OpenFOAM/memory/tmp/tmpI.H index 144977f72729c19e2d624eae56c2ef73c08b41ef..18c41ae6465fdafd8d1a97276323fe364f2d9b7d 100644 --- a/src/OpenFOAM/memory/tmp/tmpI.H +++ b/src/OpenFOAM/memory/tmp/tmpI.H @@ -60,7 +60,7 @@ inline Foam::tmp<T>::tmp(const tmp<T>& t) } else { - FatalErrorIn("tmp<T>::tmp(const tmp<T>&)") + FatalErrorIn("Foam::tmp<T>::tmp(const tmp<T>&)") << "attempted copy of a deallocated temporary" << abort(FatalError); } @@ -116,7 +116,7 @@ inline T* Foam::tmp<T>::ptr() const { if (!ptr_) { - FatalErrorIn("tmp<T>::ptr() const") + FatalErrorIn("Foam::tmp<T>::ptr() const") << "temporary deallocated" << abort(FatalError); } @@ -155,7 +155,7 @@ inline T& Foam::tmp<T>::operator()() { if (!ptr_) { - FatalErrorIn("T& tmp<T>::operator()()") + FatalErrorIn("T& Foam::tmp<T>::operator()()") << "temporary deallocated" << abort(FatalError); } @@ -184,7 +184,7 @@ inline const T& Foam::tmp<T>::operator()() const { if (!ptr_) { - FatalErrorIn("const T& tmp<T>::operator()() const") + FatalErrorIn("const T& Foam::tmp<T>::operator()() const") << "temporary deallocated" << abort(FatalError); } @@ -212,7 +212,7 @@ inline T* Foam::tmp<T>::operator->() { if (!ptr_) { - FatalErrorIn("tmp<T>::operator->()") + FatalErrorIn("Foam::tmp<T>::operator->()") << "temporary deallocated" << abort(FatalError); } @@ -260,14 +260,14 @@ inline void Foam::tmp<T>::operator=(const tmp<T>& t) } else { - FatalErrorIn("tmp<T>::operator=(const tmp<T>& t)") + FatalErrorIn("Foam::tmp<T>::operator=(const tmp<T>&)") << "attempted copy of a deallocated temporary" << abort(FatalError); } } else { - FatalErrorIn("tmp<T>::operator=(const tmp<T>& t)") + FatalErrorIn("Foam::tmp<T>::operator=(const tmp<T>&)") << "attempted to assign to a const reference to constant object" << abort(FatalError); }