VAObject.h 1.97 KB
Newer Older
Jonas Stienen's avatar
Jonas Stienen committed
1
/*
2
 *  --------------------------------------------------------------------------------------------
Jonas Stienen's avatar
Jonas Stienen committed
3 4
 *
 *    VVV        VVV A
5
 *     VVV      VVV AAA        Virtual Acoustics (VA)
Jonas Stienen's avatar
Jonas Stienen committed
6 7
 *      VVV    VVV   AAA       Real-time auralisation for virtual reality    
 *       VVV  VVV     AAA
8 9
 *        VVVVVV       AAA     (c) Copyright Institute of Technical Acoustics (ITA)
 *         VVVV         AAA        RWTH Aachen University (http://www.akustik.rwth-aachen.de)
Jonas Stienen's avatar
Jonas Stienen committed
10
 *
11
 *  --------------------------------------------------------------------------------------------
Jonas Stienen's avatar
Jonas Stienen committed
12
 */
13

14 15
#ifndef IW_VABASE_OBJECT
#define IW_VABASE_OBJECT
Jonas Stienen's avatar
Jonas Stienen committed
16 17 18 19 20 21

#include <VABaseDefinitions.h>
#include <VAStruct.h>

//! Base class for objects with identity and message interface
/**
22 23 24 25 26
  * In VA, anything can be an object and can be called via the module call interface during runtime.
  * These calls are usually not thread-safe.
  */
class VABASE_API CVAObject
{
Jonas Stienen's avatar
Jonas Stienen committed
27 28 29 30 31
public:
	//! Default constructor
	CVAObject();

	//! Initialization constructors
32 33
	CVAObject( const char* pszName );
	CVAObject( const std::string& sName );
Jonas Stienen's avatar
Jonas Stienen committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

	//! Destructor
	virtual ~CVAObject();

	//! Returns the ID of the object
	int GetObjectID() const;

	//! Returns the name of the object
	std::string GetObjectName() const;

	//! Returns information on the object
	virtual CVAObjectInfo GetObjectInfo() const;

	//! Call the object with a message and capture return message
	/**
	 * \return >0, if the object returned an answer message
	 *         0, if the object did not return an answer message
	 *         -1, if the message could not be handled
	 */
	// TODO: Int als Rckgabe?
54
	virtual int CallObject( const CVAStruct& oArgs, CVAStruct& oReturn );
Jonas Stienen's avatar
Jonas Stienen committed
55 56 57

protected:
	// Important: An object may not change its name after it is registered
58
	void SetObjectName( const std::string& sName );
Jonas Stienen's avatar
Jonas Stienen committed
59 60 61 62 63 64

private:
	int m_iObjectID;
	std::string m_sObjectName;

	// Note: This may only be called from an object registry
65
	void SetObjectID( int iID );
Jonas Stienen's avatar
Jonas Stienen committed
66 67 68 69

	friend class CVAObjectRegistry;
};

70
#endif // IW_VABASE_OBJECT