#ifndef __GNET_DBSTOCKTRANSACTIONARG_RPCDATA
#define __GNET_DBSTOCKTRANSACTIONARG_RPCDATA

#include "rpcdefs.h"

#include "gmailsyncdata"

namespace GNET
{
	class DBStockTransactionArg : public GNET::Rpc::Data
	{
	public:
		int userid;
		int roleid;
		char withdraw;
		int cash;
		int money;
		GMailSyncData syncdata;

	public:
		DBStockTransactionArg (int l_userid = 0,int l_roleid = 0,char l_withdraw = 0
			,int l_cash = 0,int l_money = 0,const GMailSyncData& l_syncdata = GMailSyncData())
			: userid(l_userid),roleid(l_roleid),withdraw(l_withdraw)
			,cash(l_cash),money(l_money),syncdata(l_syncdata)
		{
		}

		DBStockTransactionArg(const DBStockTransactionArg &rhs)
			: userid(rhs.userid),roleid(rhs.roleid),withdraw(rhs.withdraw),
			cash(rhs.cash),money(rhs.money),syncdata(rhs.syncdata) { }

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

		Rpc::Data& operator = (const Rpc::Data &rhs)
		{
			const DBStockTransactionArg *r = dynamic_cast<const DBStockTransactionArg *>(&rhs);
			if (r && r != this)
			{
				userid = r->userid;
				roleid = r->roleid;
				withdraw = r->withdraw;
				cash = r->cash;
				money = r->money;
				syncdata = r->syncdata;
			}
			return *this;
		}

		DBStockTransactionArg& operator = (const DBStockTransactionArg &rhs)
		{
			const DBStockTransactionArg *r = &rhs;
			if (r && r != this)
			{
				userid = r->userid;
				roleid = r->roleid;
				withdraw = r->withdraw;
				cash = r->cash;
				money = r->money;
				syncdata = r->syncdata;
			}
			return *this;
		}

		OctetsStream& marshal(OctetsStream & os) const
		{
			os << userid;
			os << roleid;
			os << withdraw;
			os << cash;
			os << money;
			os << syncdata;
			return os;
		}

		const OctetsStream& unmarshal(const OctetsStream &os)
		{
			os >> userid;
			os >> roleid;
			os >> withdraw;
			os >> cash;
			os >> money;
			os >> syncdata;
			return os;
		}

	};
};
#endif
