Commit e420e305 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Adaptiong new portals API change and finished adding doxy comments for include header files

parent 3415c82b
......@@ -36,6 +36,7 @@ public:
//! Redefined method to remove reference
/**
* Releases object to the pool if no reference available anymore
* @return Number of remaining refs
*/
virtual int RemoveReference() const;
......@@ -80,13 +81,14 @@ private:
class VACORE_API IVAPoolObjectFactory
{
public:
//! Destructor
inline virtual ~IVAPoolObjectFactory() {};
//! Factory method (abstract)
/**
* Interface method to create a new pool object
*
* \return Pointer to the new pool object
* @return Pointer to the new pool object
*/
virtual CVAPoolObject* CreatePoolObject() = 0;
};
......@@ -103,12 +105,12 @@ public:
/**
* Creates new pool object using the standard constructor of the template object
*
* \return Pointer to the new pool object
* @return Pointer to the new pool object
*/
inline virtual CVAPoolObject* CreatePoolObject()
{
return new T;
}
};
};
#endif // IW_VA_POOL_OBJECT
......@@ -25,26 +25,41 @@
* functionality that keeps track of every reference
* an object may have.
*/
class VACORE_API IVAReferenceableObject {
class VACORE_API IVAReferenceableObject
{
public:
// Destruktor
virtual ~IVAReferenceableObject() {};
//! Destructor
virtual inline ~IVAReferenceableObject() {};
// Gibt zurck ob das Objekt referenziert wird (Anzahl Referenzen >= 1)
virtual bool HasReferences() const=0;
// Gibt die Anzahl der Referenzen zurck
virtual int GetNumReferences() const=0;
//! Returns true if there are references for this objects
/**
* @return True, of at least one reference is set
*/
virtual bool HasReferences() const = 0;
// Setzt die Anzahl der Referenzen auf 0
// REMOVE:
virtual void ResetReferences()=0;
//! Number of references getter
/**
* @return Number of references
*/
virtual int GetNumReferences() const = 0;
// Referenz hinzufgen (Referenzzhler inkrementieren)
virtual int AddReference() const=0;
//! Reset references
/**
* Unclean reference reset, do not use if not explicitly required.
*/
virtual void ResetReferences() = 0;
// Referenz entfernen (Referenzzhler dekrementieren)
virtual int RemoveReference() const=0;
//! Adds reference
/**
* @return Updated number of references
*/
virtual int AddReference() const = 0;
//! Removes reference
/**
* @return Updated number of references
*/
virtual int RemoveReference() const = 0;
};
......@@ -55,34 +70,47 @@ public:
* an object may have. The reference functionality is
* implemented using atomic reference counter.
*/
class VACORE_API CVAReferenceableObject :IVAReferenceableObject {
class VACORE_API CVAReferenceableObject :IVAReferenceableObject
{
public:
// Standardkonstruktor (Objekt hat keine Referenzen nach der Erzeugung)
//! Default constructor (zero references)
CVAReferenceableObject();
// Destruktor
//! Destructor
virtual ~CVAReferenceableObject();
// Gibt zurck ob das Objekt referenziert wird (Anzahl Referenzen >= 1)
//! Returns true if there are references for this objects
/**
* @return True, of at least one reference is set
*/
bool HasReferences() const;
// Gibt die Anzahl der Referenzen zurck
//! Number of references getter
/**
* @return Number of references
*/
int GetNumReferences() const;
// Setzt die Anzahl der Referenzen auf 0
// REMOVE:
//! Reset references
/**
* Unclean reference reset, do not use if not explicitly required.
*/
virtual void ResetReferences();
// Referenz hinzufgen (Referenzzhler inkrementieren)
// (Rckgabe: Wert des Referenzzhlers nach Inkrementierung)
//! Adds reference
/**
* @return Updated number of references
*/
virtual int AddReference() const;
// Referenz entfernen (Referenzzhler dekrementieren)
// (Rckgabe: Wert des Referenzzhlers nach Dekrementierung)
//! Removes reference
/**
* @return Updated number of references
*/
virtual int RemoveReference() const;
private:
mutable volatile int m_iRefCount;
mutable volatile int m_iRefCount; //!< Internal reference counter
};
//! Referenceable pointer type
......@@ -91,82 +119,116 @@ private:
* reference counting. The template class has to be a subclass
* of #CVAReferenceableObject.
*/
template <class T>
class VACORE_API CVARefPtr {
template< class T >
class VACORE_API CVARefPtr
{
public:
//! Standard constructor (No reference, nullptr pointer)
CVARefPtr() : m_ptr(nullptr) {}
//! Default constructor (No reference, nullptr pointer)
inline CVARefPtr()
: m_ptr( nullptr )
{
};
//! Initialisation constructor, sets reference to the passed object pointer
CVARefPtr(T* ptr) {
/**
* @param[in] ptr Object pointer
*/
inline CVARefPtr( T* ptr )
{
*this = ptr;
}
};
//! Copy constructor, sets an autonomouse reference for the copy
CVARefPtr(const CVARefPtr& ref) {
/**
* @param[in] ref Object to copy from
*/
inline CVARefPtr( const CVARefPtr& ref )
{
*this = ref;
}
};
//! Destructor removing reference of target objects, if present
~CVARefPtr() {
if (m_ptr) m_ptr->RemoveReference();
}
inline ~CVARefPtr()
{
if( m_ptr )
m_ptr->RemoveReference();
};
//! Remove reference
/**
* \note Uses assertion in debug mode that reference counter is greater then 0
* @note Uses assertion in debug mode that reference counter is greater then 0
*/
void Clear() {
if (m_ptr) m_ptr->RemoveReference();
inline void Clear()
{
if( m_ptr )
m_ptr->RemoveReference();
m_ptr = nullptr;
};
//! Assignment, creates an autonomous reference count
CVARefPtr& operator=(const CVARefPtr& rhs) {
/**
* @param[in] rhs Right hand side reference pointer object
* @return Reference to object that has been assigned values
*/
inline CVARefPtr& operator=( const CVARefPtr& rhs )
{
// Remove currrent reference
if (m_ptr) m_ptr->RemoveReference();
if( m_ptr )
m_ptr->RemoveReference();
// Create new reference (note: first reference, then assignement)
if (rhs.m_ptr) rhs.m_ptr->AddReference();
if( rhs.m_ptr )
rhs.m_ptr->AddReference();
m_ptr = rhs.m_ptr;
return *this;
}
};
//! Assignment, creates an autonomous reference count
CVARefPtr& operator=(T* ptr) {
/**
* @param[in] ptr Right hand side reference pointer object
* @return Reference to object that has been assigned values
*/
inline CVARefPtr& operator=( T* ptr )
{
// Remove currrent reference
if (m_ptr) m_ptr->RemoveReference();
if( m_ptr )
m_ptr->RemoveReference();
// Create new reference (note: first reference, then assignement)
if (ptr) ptr->AddReference();
if( ptr )
ptr->AddReference();
m_ptr = ptr;
return *this;
}
};
//! Cast assignment to pointer type
operator T*() const {
inline operator T*( ) const
{
return m_ptr;
}
};
//! Dereferenciation
T& operator*() const {
inline T& operator*( ) const
{
assert( m_ptr );
if (!m_ptr) VA_EXCEPT1("Attempt to dereference nullpointer");
if( !m_ptr )
VA_EXCEPT1( "Attempt to dereference nullpointer" );
return m_ptr;
}
};
//! Member dereferenciation
T* operator->() const {
inline T* operator->( ) const
{
assert( m_ptr );
if (!m_ptr) VA_EXCEPT1("Attempt to dereference nullpointer");
if( !m_ptr )
VA_EXCEPT1( "Attempt to dereference nullpointer" );
return m_ptr;
}
};
private:
T* m_ptr; //!< References object pointer
};
#endif // IW_VACORE_REFERENCEABLE_OBJECT
......@@ -33,10 +33,17 @@ protected:
private:
//! Forbidden for everyone: copy constructor
inline IVAUncopyable( const IVAUncopyable& ) {};
/**
* @param[in] oObj Uncopyable object
*/
inline IVAUncopyable( const IVAUncopyable& oObj ) {};
//! Forbidden for everyone: assignment operator
IVAUncopyable& operator=( const IVAUncopyable& );
/**
* @param[in] oObj Unassignable object
* @return Uncopyable object
*/
IVAUncopyable& operator=( const IVAUncopyable& pObj );
};
#endif // IW_VACORE_UNCOPYABLE
\ No newline at end of file
#endif // IW_VACORE_UNCOPYABLE
......@@ -66,7 +66,9 @@ public:
// @todo refactor.
virtual void UpdateGlobalAuralizationMode( int iGlobalAuralisationMode ) = 0;
virtual inline int GetAuralizationMode() { return IVAInterface::VA_AURAMODE_ALL; };
virtual inline int GetAuralizationMode() const { return IVAInterface::VA_AURAMODE_ALL; };
virtual inline void SetAuralizationMode( const int ) {};
virtual inline void SetParameters( const CVAStruct& ) {};
virtual inline CVAStruct GetParameters( const CVAStruct& ) const { return CVAStruct(); };
......
......@@ -3502,7 +3502,7 @@ bool CVACoreImpl::GetSoundPortalEnabled( const int iPortalID ) const
VA_RETHROW;
}
CVAStruct CVACoreImpl::GetSoundPortalParameters( const int iID ) const
CVAStruct CVACoreImpl::GetSoundPortalParameters( const int iID, const CVAStruct& oArgs ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
}
......
......@@ -247,7 +247,7 @@ public:
int GetSoundPortalSoundReceiver( const int iSoundPortalID ) const;
void SetSoundPortalSoundSource( const int iSoundPortalID, const int iSoundSourceID );
int GetSoundPortalSoundSource( const int iSoundPortalID ) const;
CVAStruct GetSoundPortalParameters( const int iID ) const;
CVAStruct GetSoundPortalParameters( const int iID, const CVAStruct& oArgs ) const;
void SetSoundPortalParameters( const int iID, const CVAStruct& oParams );
void SetSoundPortalPosition( const int iSoundPortalID, const VAVec3& vPos );
VAVec3 GetSoundPortalPosition( const int iSoundPortalID ) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment