#ifndef _MESSAGECLASS_H_
#define _MESSAGECLASS_H_

#include "../tobject.h"

#include <vector>
#include <string>

using namespace std;

class VarInst;

/* 
 * This file holds base messages for modular system.
 *
 * NOTE: "message" can be any subclass of TObject class.
 */

/**
 * \brief Message send by shell whenever value of variable is altered.
 * 
 * \date 01-29-2006
 *
 * \author Ondrej Svejdar
 *
 * \todo 
 *
 * \bug 
 *
 */
class MesgVarChange:public TObject
{
public:
	static const char* type;
	const char* getType() const;

	/// pointer to changed variable
	const VarInst* variable;

	/**
	 * \brie ctor
	 * \param variable changed variable
	 */
	inline MesgVarChange(const VarInst* variable):
		variable(variable)
	{
	}
};

/**
 * \brief Message send by shell whenever command is run on module.
 * 
 * \date 01-29-2006
 *
 * \author Ondrej Svejdar
 *
 * \todo 
 *
 * \bug 
 *
 */
class MesgCommand:public TObject
{
public:
	static const char* type;
	const char* getType() const;

	typedef vector<string> t_params;
private:
	string name;
	t_params params;
public:
	/**
	 * \brief ctor
	 * \param name name of command 
	 * \param params parameters (empty vector if there aren't any)
	 * \return 
	 */
	MesgCommand(const string& name,vector<string> params):name(name)
	{
		for(vector<string>::const_iterator it=params.begin();it!=params.end();it++)
			this->params.push_back(*it);
	}	

	/**
	 * \brief return command name
	 * \return command name
	 */
	inline const string& getName() const
	{
		return name;
	}


	/**
	 * \brief return parameters count
	 * \return parameters count
	 */
	inline int getParamsCount() const
	{
		return (int)params.size();
	}
	
	
	/**
	 * \brief return parameter at index 
	 * \param index index
	 * \return parameter name
	 */
	inline const string& getParam(int index) const
	{
		return params[index];
	}
};

/**
 * \brief Message send to modules when ending application.
 * 
 * \date 01-29-2006
 *
 * \author Ondrej Svejdar
 *
 * \todo 
 *
 * \bug 
 *
 */
class MesgApplicationExit:public TObject
{
public:
    static const char* type;
	const char* getType() const;

	inline MesgApplicationExit() {}
};

#endif/*_MESSAGECLASS_H_*/
