A lot of doxy style comments

parent 059bf547
......@@ -18,25 +18,31 @@
//! Global synchronization token for event handler operations
/**
* This singleton class realizes a global synchronization token
* that can be used to realize mutual exclusive operations regarding
* event handlers, like attaching/detaching event handlers to
* event handler registrys and destruction of event handlers.
*/
* This singleton class realizes a global synchronization token
* that can be used to realize mutual exclusive operations regarding
* event handlers, like attaching/detaching event handlers to
* event handler registrys and destruction of event handlers.
*/
class VABASE_API IVAEventHandlerGlobalLock
{
public:
//! Returns the singleton instance
/**
* @return Global lock for event handling
*/
static IVAEventHandlerGlobalLock& GetInstance();
// Lock (blocking wait, no try)
//! Lock (blocking wait, no try)
virtual void Lock() const = 0;
// Unlock
//! Unlock
virtual void Unlock() const = 0;
protected:
//! Protected default constructor
inline IVAEventHandlerGlobalLock() {};
//! Protected destructor
virtual inline ~IVAEventHandlerGlobalLock() {};
};
......
......@@ -20,10 +20,9 @@
//! Base class for exceptions
/**
* This is the exception base class for all VA software components.
* Exceptions are defined by an error code and an error message.
*/
* This is the exception base class for all VA software components.
* Exceptions are defined by an error code and an error message.
*/
class VABASE_API CVAException
{
public:
......@@ -45,23 +44,36 @@ public:
CVAException();
//! Initialization constructor
CVAException( int iErrorCode, const std::string& sErrorMessage = "" );
/**
* @param[in] iErrorCode Error code
* @param[in] sErrorMessage Error text
*/
CVAException( const int iErrorCode, const std::string& sErrorMessage = "" );
//! Destructor
virtual ~CVAException();
//! Returns the error code
/**
* @return Error code, one of ErrorCode
*/
int GetErrorCode() const;
//! Returns the error message
/**
* @return Error text message
*/
std::string GetErrorMessage() const;
//! Return a string representation of the exception
/**
* @return Formatted text of exception
*/
std::string ToString() const;
protected:
int m_iErrorCode;
std::string m_sErrorMessage;
int m_iErrorCode; //!< Error code, one of ErrorCode
std::string m_sErrorMessage; //!< Error text message
};
//! Macro for throwing exceptions
......@@ -71,6 +83,11 @@ protected:
#define VA_EXCEPT_NOT_IMPLEMENTED { throw CVAException( (CVAException::NOT_IMPLEMENTED) , "Not implemented" ); }
//! STL stream output operator
/**
* @param[in] os Outstream object
* @param[in] ex VA exception
* @return Outstream object including exception text
*/
VABASE_API std::ostream& operator<<( std::ostream& os, const CVAException& ex );
#endif // IW_VABASE_EXCEPTION
This diff is collapsed.
......@@ -29,38 +29,64 @@ public:
//! Default constructor
CVAObject();
//! Initialization constructors
//! Initialization constructor
/**
* @param[in] pszName Character type name initialization
*/
CVAObject( const char* pszName );
//! Initialization constructor
/**
* @param[in] sName String type name initialization
*/
CVAObject( const std::string& sName );
//! Destructor
virtual ~CVAObject();
//! Returns the ID of the object
/**
* @return Object identifier integer
*/
int GetObjectID() const;
//! Returns the name of the object
/**
* @return Object name
*/
std::string GetObjectName() const;
//! Returns information on the object
/**
* @return Object info
*/
virtual CVAObjectInfo GetObjectInfo() const;
//! Call the object with a message and capture return message
/**
*
* @param[in] oArgs Object call arguments as CVAStruct
* @return Object call return value as CVAStruct
*/
virtual CVAStruct CallObject( const CVAStruct& oArgs ) = 0;
protected:
// Important: An object may not change its name after it is registered
/**
* @param[in] sName Name of new object
* @note This may only be called from an object registry
*/
void SetObjectName( const std::string& sName );
private:
int m_iObjectID;
std::string m_sObjectName;
int m_iObjectID; //!< Object identifier
std::string m_sObjectName; //!< Object name (should not be changed during runtime)
// Note: This may only be called from an object registry
void SetObjectID( const int iID );
//! Object identifier (integer) setter
/**
* @param[in] iID Object identifier number
* @note This may only be called from an object registry
*/
void SetObjectID( const int iID );
friend class CVAObjectRegistry;
};
......
......@@ -22,12 +22,13 @@
#include <string>
#include <vector>
// Forwards
class CVAObject;
//! Registry class for objects
/**
*
*/
* Handles VA object registration. Objects will be callable via object / module interface.
*/
class VABASE_API CVAObjectRegistry
{
public:
......@@ -37,66 +38,84 @@ public:
//! Destructor
~CVAObjectRegistry();
//! Clear up. Deregisters all modules.
//! Clear objects. Deregisters all modules.
void Clear();
//! Registers an object with the registry and returns its ID
/**
* @param[in] pObject Object pointer
* @return Object identifier
*/
int RegisterObject( CVAObject* pObject );
//! Deregisters an object from the registry
/**
* @param[in] pObject Object pointer
*/
void UnregisterObject( CVAObject* pObject );
//! Query the IDs of all objects
void GetObjectIDs( std::vector< int >& viIDs ) const;
//! Query information on all objects
/**
* @param[in] viInfos Object infos
*/
void GetObjectInfos( std::vector< CVAObjectInfo >& viInfos ) const;
//! Finds an object by its ID
/**
* \return Pointer to the object, NULL if not found
*/
* @param[in] iID Object identifier
* @return Pointer to the object, NULL if not found
*/
CVAObject* FindObjectByID( const int iID ) const;
//! Finds the object with the given name
/**
* \return Pointer to the object, NULL if not found
* \note Object names are case-sensitive
*/
* @param[in] sName Object name
* @return Pointer to the object, NULL if not found
* @note Object names are case-sensitive
*/
CVAObject* FindObjectByName( const std::string& sName ) const;
//! Returns an object by its ID
/**
* \return Pointer to the object
* \note Throws an exception "invalid object ID" in case the object does not exist
*/
* @param[in] iID Object identifier
* @return Pointer to the object
* @note Throws an exception "invalid object ID" in case the object does not exist
*/
CVAObject* GetObjectByID( const int iID ) const;
//! Returns the object with the given name
/**
* \return Pointer to the object, if existing,
* \note Throws an exception "unknown object" in case the object does not exist
* \note Object names are case-sensitive
*/
* @param[in] sName Object name
* @return Pointer to the object, if existing,
* @note Throws an exception "unknown object" in case the object does not exist
* @note Object names are case-sensitive
*/
CVAObject* GetObjectByName( const std::string& sName ) const;
//! Calls an object determined by its ID
/**
* \returns Throws an "invalid object ID" exception, if the object does not exist
*/
* @param[in] iID Object identifier
* @param[in] oArgs Object call arguments
* @returns Throws an "invalid object ID" exception, if the object does not exist
*/
CVAStruct CallObjectByID( const int iID, const CVAStruct& oArgs ) const;
//! Calls an object determined by its name
/**
* \returns Throws an "unknown object" exception, if the object does not exist
* @param[in] sName Object name
* @param[in] oArgs Object call arguments
* @returns Throws an "unknown object" exception, if the object does not exist
*/
CVAStruct CallObjectByName( const std::string& sName, const CVAStruct& oArgs ) const;
private:
std::vector< CVAObject* > m_vpObjects; // Object table (O(1) lookups!)
std::map< std::string, CVAObject* > m_mpObjects; // Fast name search structure (O(log N) queries!)
size_t m_nObjects; // Number of registered objects
int m_iIDLast; // ID counter
std::vector< CVAObject* > m_vpObjects; //!< Object table (O(1) lookups!)
std::map< std::string, CVAObject* > m_mpObjects; //!< Fast name search structure (O(log N) queries!)
size_t m_nObjects; //!< Number of registered objects
int m_iIDLast; //!< ID counter
friend class CVAObject;
};
......
......@@ -31,18 +31,39 @@
class VABASE_API CVASampleBuffer
{
public:
//! Constructor with empty samples
CVASampleBuffer();
//! Constructor for given number of samples
/**
* @param[in] iNumSamples Number of samples
* @param[in] bZeroInit Will init all samples to zero if true (default)
*/
CVASampleBuffer( const int iNumSamples, const bool bZeroInit = true );
CVASampleBuffer( const CVASampleBuffer& );
//! Copy constructor
/**
* @param[in] oCopyFrom Copy data from this sample buffer
*/
CVASampleBuffer( const CVASampleBuffer& oCopyFrom );
virtual ~CVASampleBuffer();
//! Number of samples, zero if buffer is uninitialized
/**
* @return Number of samples
*/
int GetNumSamples() const;
//! Pointer to first sample of buffer in memory
/**
* @return Data pointer as float
*/
float* GetData();
//! Pointer to first sample of buffer in memory
/**
* @return Read-only data pointer as float
*/
const float* GetDataReadOnly() const;
//! Sets all samples to zero
......@@ -50,7 +71,12 @@ public:
std::vector< float > vfSamples; //!< Vector of audio samples, 32-bit floating point precision
CVASampleBuffer& operator=( const CVASampleBuffer& );
//! Assignment operator
/**
* @param[in] oOther Other sample buffer
* @return Sample buffer with assigned data from other sample buffer
*/
CVASampleBuffer& operator=( const CVASampleBuffer& oOther );
};
#endif // IW_VABASE_SAMPLES
This diff is collapsed.
......@@ -17,18 +17,22 @@
#include <VABaseDefinitions.h>
#include <string>
//! Version info data class
/**
* Diese Datenklasse beschreibt Versionsinformationen ber den VA-Kern
*/
* Class describing version info of VA components
*/
class VABASE_API CVAVersionInfo
{
public:
std::string sVersion; // Version als Zeichenkette (z.B. "1.02")
std::string sDate; // Datum der Erstellung bzw. Verffentlichung
std::string sFlags; // Liste der Eigenschaften (flags) (z.B. "Debug", "SSE2")
std::string sComments; // Zustzliche Kommentate (z.B. "Special Pentium-H build");
std::string sVersion; //!< Version as string (e.g. "1.02")
std::string sDate; //!< Date of creation / publiching date
std::string sFlags; //!< List of properties (flags) (e.g. "debug", "SSE2")
std::string sComments; //!< Additional comments
//! Als Zeichenkette zurckgeben
/**
* @return Version info as formatted string
*/
std::string ToString() const;
};
......
......@@ -16,10 +16,15 @@
#include <sstream>
CVAException::CVAException()
: m_iErrorCode(UNSPECIFIED) {}
: m_iErrorCode( UNSPECIFIED )
{
}
CVAException::CVAException(int iErrorCode, const std::string& sErrorMessage)
: m_iErrorCode(iErrorCode), m_sErrorMessage(sErrorMessage) {}
CVAException::CVAException( const int iErrorCode, const std::string& sErrorMessage )
: m_iErrorCode( iErrorCode )
, m_sErrorMessage( sErrorMessage )
{
}
CVAException::~CVAException() {}
......@@ -29,49 +34,50 @@ std::string CVAException::GetErrorMessage() const { return m_sErrorMessage; }
std::string CVAException::ToString() const {
std::stringstream ss;
switch (m_iErrorCode) {
switch( m_iErrorCode ) {
case MODAL_ERROR:
if (m_iErrorCode != 0)
if( m_iErrorCode != 0 )
ss << "Modal error: " << m_sErrorMessage << " (error code " << m_iErrorCode << ")";
else
ss << "Modal error: " << m_sErrorMessage;
break;
case NETWORK_ERROR:
if (m_iErrorCode != 0)
if( m_iErrorCode != 0 )
ss << "Network error: " << m_sErrorMessage << " (error code " << m_iErrorCode << ")";
else
ss << "Network error: " << m_sErrorMessage;
break;
case PROTOCOL_ERROR:
if (m_iErrorCode != 0)
if( m_iErrorCode != 0 )
ss << "Network protocol error: " << m_sErrorMessage << " (error code " << m_iErrorCode << ")";
else
ss << "Network protocol error: " << m_sErrorMessage;
break;
// Alle anderen bekannten Fehler
// Alle anderen bekannten Fehler
case NOT_IMPLEMENTED:
case INVALID_PARAMETER:
case INVALID_ID:
case RESOURCE_IN_USE:
case FILE_NOT_FOUND:
if (m_iErrorCode != 0)
if( m_iErrorCode != 0 )
ss << m_sErrorMessage << " (error code " << m_iErrorCode << ")";
else
ss << m_sErrorMessage;
break;
default:
if (m_sErrorMessage.empty()) {
if (m_iErrorCode != 0)
if( m_sErrorMessage.empty() ) {
if( m_iErrorCode != 0 )
ss << "An unspecified error occured (error code " << m_iErrorCode << ")";
else
ss << "An unspecified error occured";
} else {
if (m_iErrorCode != 0)
}
else {
if( m_iErrorCode != 0 )
ss << m_sErrorMessage << " (error code " << m_iErrorCode << ")";
else
ss << m_sErrorMessage;
......@@ -82,6 +88,6 @@ std::string CVAException::ToString() const {
return ss.str();
}
std::ostream& operator<<(std::ostream& os, const CVAException& ex) {
std::ostream& operator<<( std::ostream& os, const CVAException& ex ) {
return os << ex.ToString();
}
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