#ifndef __GNET_RENAMEROLEARG_RPCDATA
#define __GNET_RENAMEROLEARG_RPCDATA

#include "rpcdefs.h"


namespace GNET
{
	class RenameRoleArg : public GNET::Rpc::Data
	{
	public:
		int roleid;
		Octets oldname;
		Octets newname;

	public:
		RenameRoleArg (int l_roleid = -1,const Octets& l_oldname = Octets(0),const Octets& l_newname = Octets(0))
			: roleid(l_roleid),oldname(l_oldname),newname(l_newname)
		{
		}

		RenameRoleArg(const RenameRoleArg &rhs)
			: roleid(rhs.roleid),oldname(rhs.oldname),newname(rhs.newname) { }

		Rpc::Data *Clone() const { return new RenameRoleArg(*this); }

		Rpc::Data& operator = (const Rpc::Data &rhs)
		{
			const RenameRoleArg *r = dynamic_cast<const RenameRoleArg *>(&rhs);
			if (r && r != this)
			{
				roleid = r->roleid;
				oldname = r->oldname;
				newname = r->newname;
			}
			return *this;
		}

		RenameRoleArg& operator = (const RenameRoleArg &rhs)
		{
			const RenameRoleArg *r = &rhs;
			if (r && r != this)
			{
				roleid = r->roleid;
				oldname = r->oldname;
				newname = r->newname;
			}
			return *this;
		}

		OctetsStream& marshal(OctetsStream & os) const
		{
			os << roleid;
			os << oldname;
			os << newname;
			return os;
		}

		const OctetsStream& unmarshal(const OctetsStream &os)
		{
			os >> roleid;
			os >> oldname;
			os >> newname;
			return os;
		}

	};
};
#endif
