/**
 * \file Module.h
 * \date 17.02.2002
 *
 * Interface for the Module class
 */

#ifndef COMMON_MODULE_H
#define COMMON_MODULE_H

#include "Common/Interfaces/Interface.h"
#include "Common/Protocol/CharString.h"

/// Constants for initialization of modules
//@{
#define INIT_OK 0
#define INIT_ERR 1
//@}

/**
 * \class Module
 * \author Marek Lehuta
 * \brief Basic module framework
 *
 * Every module in the system is derived from Module
 */

class Module
{
public:
// Construction and destruction
	Module(const char* pStrId, const char* pStrName, const char* pStrVer)
		: m_strId(pStrId), m_strName(pStrName), m_strVer(pStrVer) {}
	Module(const CharString& strId, const CharString& strName,
		const CharString& strVer) : m_strId(strId), m_strName(strName),
		m_strVer(strVer) {}
	virtual ~Module() {}

// Interface implementation
	virtual int Init(int argc, char** argv, int iTask = -1) { return INIT_OK; }
	virtual void Run(int iTask = -1) {}

	virtual Interface* GetInterface(int iTask = -1) const { return NULL; }

	CharString GetId() const { return m_strId; }
	CharString GetName() const { return m_strName; }
	CharString GetVer() const { return m_strVer; }

protected:

private:
	CharString m_strId;
	CharString m_strName;
	CharString m_strVer;

};

#endif // COMMON_MODULE_H
