/***************************************************************************
 * trackpossubject.cpp
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2007- the KTabEdit development team <mrgwen@gmail.com>
 ***************************************************************************/

/***************************************************************************
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * See the file COPYING for more information.
 ***************************************************************************/

#include "trackpossubject.h"
#include "util/assert.h"

#include "trackposobserver.h"

TrackPosSubject::TrackPosSubject()
: mObserver()
{
}

TrackPosSubject::~TrackPosSubject()
{
}

void TrackPosSubject::attach(TrackPosObserver* o)
{
	PRECONDITION( o != 0x0 );
	
	mObserver.push_back(o);
}

void TrackPosSubject::detach(TrackPosObserver* o)
{
	PRECONDITION( o != 0x0 );
	
	mObserver.removeAll(o);
}

void TrackPosSubject::notifyPositionUpdated()
{
	for (iterator it = mObserver.begin(); it != mObserver.end(); ++it)
		(*it)->positionUpdated();
}
