Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members

MModule.h

00001 /*
00002 
00003     This file is part of la Marmite.
00004     Copyright (C) 2005 Nicolas Falquet.
00005 
00006     La Marmite is free software ; you can redistribute it and/or
00007     modify it under the terms of the GNU General Public License as
00008     published by the Free Software Foundation ; either version 2 of
00009     the License, or (at your option) any later version.
00010 
00011     La Marmite is distributed in the hope that it will be useful, but
00012     WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with la Marmite ; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019     02111-1307  USA
00020 
00021 */
00022 
00023 #ifndef M_MODULE_H
00024 #define M_MODULE_H
00025 
00026 using namespace std;
00027 
00028 #include <qobject.h>
00029 #include <string>
00030 
00031 class MPort;
00032 #include "MAudioInputPort.h"
00033 #include "MAudioOutputPort.h"
00034 #include "MControlInputPort.h"
00035 #include "MControlOutputPort.h"
00036 
00046 class MModule /* abstract */ : public QObject
00047 {
00048 
00049   Q_OBJECT
00050 
00051 public :
00052 
00053   // destructor
00054 
00055   virtual ~ MModule ( ) { }
00056 
00057   // functions
00058 
00062   virtual string Name ( ) const;
00063 
00067   virtual bool IsActive ( ) const;
00068 
00075   virtual MAudioInputPort * ModuleAudioInput ( const unsigned int n ) const = 0;
00076 
00083   virtual MAudioOutputPort * ModuleAudioOutput ( const unsigned int n ) const = 0;
00084 
00092   virtual MControlInputPort * ModuleControlInput ( const unsigned int n ) const = 0;
00093 
00101   virtual MControlOutputPort * ModuleControlOutput ( const unsigned int n ) const = 0;
00102 
00107   virtual unsigned int NumberOfAudioInputs ( ) const = 0;
00108 
00113   virtual unsigned int NumberOfAudioOutputs ( ) const = 0;
00114 
00119   virtual unsigned int NumberOfControlInputs ( ) const = 0;
00120 
00125   virtual unsigned int NumberOfControlOutputs ( ) const = 0;
00126 
00133   virtual MPort * GetPortByName ( const string & name ) const;
00134 
00141   virtual bool IsMine ( MPort * port ) const;
00142 
00143 public slots :
00144 
00145   // methods
00146 
00156   virtual void Activate ( ) = 0;
00157 
00167   virtual void Deactivate ( ) = 0;
00168 
00179   virtual void Run ( const unsigned int n ) = 0;
00180 
00181 protected :
00182 
00183   // attributes
00184 
00186   string _name;
00187 
00189   bool _active;
00190 
00191   // protected constructor
00192 
00199   MModule ( const string & name = "module", QObject * parent = 0 )
00200     : QObject ( parent ), _name ( name ), _active ( false )
00201   {
00202     setName ( _name.c_str ( ) );
00203   }
00204 
00205 };
00206 
00207 #endif // M_MODULE_H

Generated on Mon Jan 31 12:43:30 2005 for la Marmite by Doxygen 1.4.1