SpectMorph

lib/smmorphoperator.hh

00001 /*
00002  * Copyright (C) 2011 Stefan Westerfeld
00003  *
00004  * This library is free software; you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License as published by the
00006  * Free Software Foundation; either version 3 of the License, or (at your
00007  * option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
00012  * for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef SPECTMORPH_MORPH_OPERATOR_HH
00019 #define SPECTMORPH_MORPH_OPERATOR_HH
00020 
00021 #include "smoutfile.hh"
00022 #include "sminfile.hh"
00023 
00024 namespace SpectMorph
00025 {
00026 
00027 class MorphOperatorView;
00028 class MorphPlan;
00029 
00030 class MorphOperator
00031 {
00032 protected:
00033   MorphPlan  *m_morph_plan;
00034   std::string m_name;
00035   std::string m_id;
00036 
00037   void write_operator (OutFile& file, const std::string& name, MorphOperator *op);
00038 
00039 public:
00040   enum OutputType {
00041     OUTPUT_NONE,
00042     OUTPUT_AUDIO,
00043     OUTPUT_CONTROL
00044   };
00045   MorphOperator (MorphPlan *morph_plan);
00046   virtual ~MorphOperator();
00047 
00048   virtual const char *type() = 0;
00049   virtual bool save (OutFile& out_file) = 0;
00050   virtual bool load (InFile& in_file) = 0;
00051   virtual void post_load();
00052   virtual OutputType output_type() = 0;
00053 
00054   MorphPlan *morph_plan();
00055 
00056   std::string type_name();
00057 
00058   std::string name();
00059   void set_name (const std::string& name);
00060 
00061   bool can_rename (const std::string& name);
00062 
00063   std::string id();
00064   void set_id (const std::string& id);
00065 
00066   static MorphOperator *create (const std::string& type, MorphPlan *plan);
00067 };
00068 
00069 }
00070 
00071 #endif
 All Classes Functions Variables Enumerations Enumerator