#ifndef __GNET_GFRIENDLIST_RPCDATA
#define __GNET_GFRIENDLIST_RPCDATA

#include "rpcdefs.h"

#include "ggroupinfo"
#include "gfriendinfo"

namespace GNET
{
	class GFriendList : public GNET::Rpc::Data
	{
	public:
		GGroupInfoVector groups;
		GFriendInfoVector friends;

	public:
		GFriendList ()
		{
		}

		GFriendList(const GFriendList &rhs)
			: groups(rhs.groups),friends(rhs.friends) { }

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

		Rpc::Data& operator = (const Rpc::Data &rhs)
		{
			const GFriendList *r = dynamic_cast<const GFriendList *>(&rhs);
			if (r && r != this)
			{
				groups = r->groups;
				friends = r->friends;
			}
			return *this;
		}

		GFriendList& operator = (const GFriendList &rhs)
		{
			const GFriendList *r = &rhs;
			if (r && r != this)
			{
				groups = r->groups;
				friends = r->friends;
			}
			return *this;
		}

		OctetsStream& marshal(OctetsStream & os) const
		{
			os << groups;
			os << friends;
			return os;
		}

		const OctetsStream& unmarshal(const OctetsStream &os)
		{
			os >> groups;
			os >> friends;
			return os;
		}

	};
};
#endif
