VAObject.h 2.08 KB
Newer Older
Jonas Stienen's avatar
Jonas Stienen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
/*
 *
 *    VVV        VVV A
 *     VVV      VVV AAA        Virtual Acoustics
 *      VVV    VVV   AAA       Real-time auralisation for virtual reality    
 *       VVV  VVV     AAA
 *        VVVVVV       AAA     (c) Copyright Institut fr Technische Akustik (ITA)
 *         VVVV         AAA        RWTH Aachen (http://www.akustik.rwth-aachen.de)
 *
 *  ---------------------------------------------------------------------------------
 *
 *    File:				CVAObject.h   
 *
 *    Purpose:			Base class for objects with identity and message interface
 *
 *    Autor(en):		Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de)
 *
 *  ---------------------------------------------------------------------------------
 */
  
// $Id: 
#ifndef __VABASE_OBJECT_H__
#define __VABASE_OBJECT_H__

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

// Forward declarations
class VABASE_API CVAStruct;
//class VABASE_API CVAObjectRegistry;

//! Base class for objects with identity and message interface
/**
 * 
 */
class VABASE_API CVAObject {
public:
	//! Default constructor
	CVAObject();

	//! Initialization constructors
	CVAObject(const char* pszName);
	CVAObject(const std::string& sName);

	//! 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?
	virtual int CallObject(const CVAStruct& oArgs, CVAStruct& oReturn);

protected:
	// Important: An object may not change its name after it is registered
	void SetObjectName(const std::string& sName);

private:
	int m_iObjectID;
	std::string m_sObjectName;

	// Note: This may only be called from an object registry
	void SetObjectID(int iID);

	friend class CVAObjectRegistry;
};

#endif // __VABASE_OBJECT_H__