2011-06-18 03:34:27 +02:00
|
|
|
/*
|
|
|
|
|
OutputSlot - capability to transfer data to a physical output
|
|
|
|
|
|
|
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2011, Hermann Vosseler <Ichthyostega@web.de>
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
This program 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 General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
|
|
* *****************************************************/
|
|
|
|
|
|
|
|
|
|
|
2011-11-05 16:51:24 +01:00
|
|
|
#include "lib/error.hpp"
|
2011-06-18 03:34:27 +02:00
|
|
|
#include "proc/play/output-slot.hpp"
|
2011-11-06 02:37:22 +01:00
|
|
|
#include "proc/play/output-slot-connection.hpp"
|
2011-06-18 03:34:27 +02:00
|
|
|
|
2011-11-05 16:51:24 +01:00
|
|
|
#include <boost/noncopyable.hpp>
|
|
|
|
|
#include <vector>
|
2011-06-18 03:34:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace proc {
|
|
|
|
|
namespace play {
|
|
|
|
|
|
2011-11-05 16:51:24 +01:00
|
|
|
using std::vector;
|
|
|
|
|
|
|
|
|
|
namespace error = lumiera::error;
|
|
|
|
|
|
2011-06-18 03:34:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace { // hidden local details of the service implementation....
|
|
|
|
|
|
|
|
|
|
} // (End) hidden service impl details
|
|
|
|
|
|
|
|
|
|
|
2011-11-05 16:51:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-18 03:34:27 +02:00
|
|
|
|
|
|
|
|
OutputSlot::~OutputSlot() { } // emit VTables here....
|
|
|
|
|
|
2011-11-05 16:51:24 +01:00
|
|
|
OutputSlot::Allocation::~Allocation() { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-18 03:34:27 +02:00
|
|
|
|
|
|
|
|
|
2011-06-25 17:44:28 +02:00
|
|
|
/** whether this output slot is occupied
|
|
|
|
|
* @return true if currently unconnected and
|
|
|
|
|
* able to connect and handle output data
|
|
|
|
|
*/
|
|
|
|
|
bool
|
|
|
|
|
OutputSlot::isFree() const
|
|
|
|
|
{
|
2011-11-05 16:51:24 +01:00
|
|
|
return ! this->state_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** */
|
|
|
|
|
OutputSlot::Allocation&
|
|
|
|
|
OutputSlot::allocate()
|
|
|
|
|
{
|
|
|
|
|
if (!isFree())
|
|
|
|
|
throw error::Logic ("Attempt to open/allocate an OutputSlot already in use.");
|
|
|
|
|
|
|
|
|
|
UNIMPLEMENTED ("internal interface to determine the number of channel-connections");
|
|
|
|
|
|
2011-11-06 02:37:22 +01:00
|
|
|
state_.reset (this->buildState());
|
2011-11-05 16:51:24 +01:00
|
|
|
return *state_;
|
2011-06-25 17:44:28 +02:00
|
|
|
}
|
2011-06-18 03:34:27 +02:00
|
|
|
|
|
|
|
|
|
2011-11-06 02:37:22 +01:00
|
|
|
void
|
|
|
|
|
OutputSlot::disconnect()
|
|
|
|
|
{
|
|
|
|
|
if (!isFree())
|
|
|
|
|
state_.reset(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-18 03:34:27 +02:00
|
|
|
|
|
|
|
|
}} // namespace proc::play
|