#ifndef __GNET_USERLOGINARG_RPCDATA
#define __GNET_USERLOGINARG_RPCDATA

#include "rpcdefs.h"


namespace GNET
{
	class UserLoginArg : public GNET::Rpc::Data
	{
	public:
		int userid;
		unsigned int localsid;
		char blkickuser;
		int freecreatime;
		int loginip;
		Octets account;
		Octets iseckey;
		Octets oseckey;

	public:
		UserLoginArg (int l_userid = -1,unsigned int l_localsid = 0,char l_blkickuser = 0
			,int l_freecreatime = 0,int l_loginip = 0,const Octets& l_account = Octets()
			,const Octets& l_iseckey = Octets(),const Octets& l_oseckey = Octets())
			: userid(l_userid),localsid(l_localsid),blkickuser(l_blkickuser)
			,freecreatime(l_freecreatime),loginip(l_loginip),account(l_account)
			,iseckey(l_iseckey),oseckey(l_oseckey)
		{
		}

		UserLoginArg(const UserLoginArg &rhs)
			: userid(rhs.userid),localsid(rhs.localsid),blkickuser(rhs.blkickuser),
			freecreatime(rhs.freecreatime),loginip(rhs.loginip),account(rhs.account),
			iseckey(rhs.iseckey),oseckey(rhs.oseckey) { }

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

		Rpc::Data& operator = (const Rpc::Data &rhs)
		{
			const UserLoginArg *r = dynamic_cast<const UserLoginArg *>(&rhs);
			if (r && r != this)
			{
				userid = r->userid;
				localsid = r->localsid;
				blkickuser = r->blkickuser;
				freecreatime = r->freecreatime;
				loginip = r->loginip;
				account = r->account;
				iseckey = r->iseckey;
				oseckey = r->oseckey;
			}
			return *this;
		}

		UserLoginArg& operator = (const UserLoginArg &rhs)
		{
			const UserLoginArg *r = &rhs;
			if (r && r != this)
			{
				userid = r->userid;
				localsid = r->localsid;
				blkickuser = r->blkickuser;
				freecreatime = r->freecreatime;
				loginip = r->loginip;
				account = r->account;
				iseckey = r->iseckey;
				oseckey = r->oseckey;
			}
			return *this;
		}

		OctetsStream& marshal(OctetsStream & os) const
		{
			os << userid;
			os << localsid;
			os << blkickuser;
			os << freecreatime;
			os << loginip;
			os << account;
			os << iseckey;
			os << oseckey;
			return os;
		}

		const OctetsStream& unmarshal(const OctetsStream &os)
		{
			os >> userid;
			os >> localsid;
			os >> blkickuser;
			os >> freecreatime;
			os >> loginip;
			os >> account;
			os >> iseckey;
			os >> oseckey;
			return os;
		}

	};
};
#endif
