ModelTransformer.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Sonic Visualiser
00005     An audio file viewer and annotation editor.
00006     Centre for Digital Music, Queen Mary, University of London.
00007     This file copyright 2006 Chris Cannam.
00008    
00009     This program is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU General Public License as
00011     published by the Free Software Foundation; either version 2 of the
00012     License, or (at your option) any later version.  See the file
00013     COPYING included with this distribution for more information.
00014 */
00015 
00016 #ifndef _TRANSFORMER_H_
00017 #define _TRANSFORMER_H_
00018 
00019 #include "base/Thread.h"
00020 
00021 #include "data/model/Model.h"
00022 
00023 #include "Transform.h"
00024 
00038 class ModelTransformer : public Thread
00039 {
00040 public:
00041     virtual ~ModelTransformer();
00042 
00043     class Input {
00044     public:
00045         Input(Model *m) : m_model(m), m_channel(-1) { }
00046         Input(Model *m, int c) : m_model(m), m_channel(c) { }
00047 
00048         Model *getModel() const { return m_model; }
00049         void setModel(Model *m) { m_model = m; }
00050 
00051         int getChannel() const { return m_channel; }
00052         void setChannel(int c) { m_channel = c; }
00053 
00054     protected:
00055         Model *m_model;
00056         int m_channel;
00057     };
00058 
00066     void abandon() { m_abandoned = true; }
00067 
00071     Model *getInputModel()  { return m_input.getModel(); }
00072 
00076     int getInputChannel() { return m_input.getChannel(); }
00077 
00083     Model *getOutputModel() { return m_output; }
00084 
00090     Model *detachOutputModel() { m_detached = true; return m_output; }
00091 
00098     QString getMessage() const { return m_message; }
00099 
00100 protected:
00101     ModelTransformer(Input input, const Transform &transform);
00102 
00103     Transform m_transform;
00104     Input m_input; // I don't own the model in this
00105     Model *m_output; // I own this, unless...
00106     bool m_detached; // ... this is true.
00107     bool m_abandoned;
00108     QString m_message;
00109 };
00110 
00111 #endif

Generated on Wed Feb 20 15:45:26 2008 for SonicVisualiser by  doxygen 1.5.1