#ifndef __GNET_USERARG_RPCDATA
#define __GNET_USERARG_RPCDATA

#include "rpcdefs.h"


namespace GNET
{
	class UserArg : public GNET::Rpc::Data
	{
	public:
		unsigned int id;
		int login_time;
		int login_ip;

	public:
		UserArg (unsigned int l_id = 0,int l_login_time = 0,int l_login_ip = 0)
			: id(l_id),login_time(l_login_time),login_ip(l_login_ip)
		{
		}

		UserArg(const UserArg &rhs)
			: id(rhs.id),login_time(rhs.login_time),login_ip(rhs.login_ip) { }

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

		Rpc::Data& operator = (const Rpc::Data &rhs)
		{
			const UserArg *r = dynamic_cast<const UserArg *>(&rhs);
			if (r && r != this)
			{
				id = r->id;
				login_time = r->login_time;
				login_ip = r->login_ip;
			}
			return *this;
		}

		UserArg& operator = (const UserArg &rhs)
		{
			const UserArg *r = &rhs;
			if (r && r != this)
			{
				id = r->id;
				login_time = r->login_time;
				login_ip = r->login_ip;
			}
			return *this;
		}

		OctetsStream& marshal(OctetsStream & os) const
		{
			os << id;
			os << login_time;
			os << login_ip;
			return os;
		}

		const OctetsStream& unmarshal(const OctetsStream &os)
		{
			os >> id;
			os >> login_time;
			os >> login_ip;
			return os;
		}

	};
};
#endif
