/*  $Id: slot.cpp,v 1.1 2004/01/28 01:17:37 mbn Exp $
**
**  ClanLib Game SDK
**  Copyright (C) 2003  The ClanLib Team
**  For a total list of contributers see the file CREDITS.
**
**  This library is free software; you can redistribute it and/or
**  modify it under the terms of the GNU Lesser General Public
**  License as published by the Free Software Foundation; either
**  version 2.1 of the License, or (at your option) any later version.
**
**  This library is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
**  Lesser General Public License for more details.
**
**  You should have received a copy of the GNU Lesser General Public
**  License along with this library; if not, write to the Free Software
**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
**
*/

#include "API/Signals/slot.h"
#include "API/Signals/slot_generic.h"

/////////////////////////////////////////////////////////////////////////////
// CL_Slot construction:

CL_Slot::CL_Slot() : impl(0)
{
}

CL_Slot::CL_Slot(const CL_Slot &copy) : impl(copy.impl)
{
	if (impl != 0) impl->add_slot_ref();
}

CL_Slot::~CL_Slot()
{
	if (impl != 0) impl->release_slot_ref();
}

/////////////////////////////////////////////////////////////////////////////
// CL_Slot attributes:

int CL_Slot::get_slot_ref() const
{
	if (impl) return impl->get_slot_ref();
	else return 0;
}

int CL_Slot::get_signal_ref() const
{
	if (impl) return impl->get_signal_ref();
	else return 0;
}

bool CL_Slot::is_persistent() const
{
	return impl->is_persistent();
}

/////////////////////////////////////////////////////////////////////////////
// CL_Slot operations:

void CL_Slot::operator =(const CL_Slot &copy)
{
	if (impl) impl->release_slot_ref();
	impl = copy.impl;
	if (impl) impl->add_slot_ref();
}

void CL_Slot::set_persistent(bool flag)
{
	if (impl) impl->set_persistent(flag);
}

/////////////////////////////////////////////////////////////////////////////
// CL_Slot implementation:

CL_Slot::CL_Slot(CL_Slot_Generic *impl) : impl(impl)
{
	if (impl != 0) impl->add_slot_ref();
}
