Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

/root/src/subsynth/syn/Core/Terminal.cpp

Go to the documentation of this file.
00001 
00002 /****************** <SYN heading BEGIN do not edit this line> *****************
00003  *
00004  * subsynth - modular audio synthesizer
00005  * subsynth is (C) Copyright 2001-2002 by Kevin Meinert
00006  *
00007  * Original Author: Kevin Meinert
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Library General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Library General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Library General Public
00020  * License along with this library; if not, write to the
00021  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00022  * Boston, MA 02111-1307, USA.
00023  *
00024  * -----------------------------------------------------------------
00025  * File:          $RCSfile: Terminal.cpp,v $
00026  * Date modified: $Date: 2002/04/05 16:28:27 $
00027  * Version:       $Revision: 1.12 $
00028  * -----------------------------------------------------------------
00029  *
00030  ****************** <SYN heading END do not edit this line> ******************/
00031 #include <string>
00032 #include <syn/Core/Module.h>
00033 #include <syn/Core/Connection.h>
00034 #include <syn/Core/Terminal.h> // my header.
00035 
00036 namespace syn
00037 {
00038    Terminal::Terminal( Module& module, const std::string& name ) 
00039          : mModule( module ), mName( name ), mDisconnect( new Connection )
00040    {
00041       mConnection = mDisconnect;
00042       mDisconnect->queue().setHighMark( 0 );
00043       mDisconnect->queue().setLowMark( 0 );
00044       mDisconnect->queue().setDone( true );
00045    }
00046    
00047    Terminal::~Terminal() 
00048    { 
00049       mName = "deleted"; 
00050    }
00051 
00052    bool Terminal::done()
00053    {
00054       return mConnection->queue().done();
00055    }   
00056 
00057    void  Terminal::setDone( bool d )
00058    {
00059       if (this->isConnected())
00060          mConnection->queue().setDone( d );
00061    }   
00062    
00063    /* the name of this instance of terminal */
00064    const std::string& Terminal::name() const 
00065    { 
00066       return mName; 
00067    }
00068    
00069    void Terminal::setName( const std::string& name ) 
00070    { 
00071       mName = name; 
00072    }
00073 
00076    void Terminal::disconnect() { mConnection = mDisconnect; }
00077 
00079    bool Terminal::isConnected() const { return bool(mConnection.get() != mDisconnect.get()); }
00080 
00081    void Terminal::setConnection( ConnectionPtr conn )
00082    {
00083       mConnection = conn;
00084    }   
00085    
00090    void Terminal::connect( TerminalPtr inptr, TerminalPtr outptr  )
00091    {
00092       ConnectionPtr conn = ConnectionPtr( new Connection );
00093       inptr->setConnection( conn );
00094       outptr->setConnection( conn );
00095       conn->connect( inptr, outptr );
00096    }
00097 
00099    Connection& Terminal::connection()
00100    {
00101       assert( mConnection.get() != NULL );
00102       return (*mConnection.get());
00103    }   
00104 
00105 } // end of namespace.

Generated at Mon Apr 15 09:26:07 2002 for subsynth by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001