00001 /* 00002 * Copyright: (C) 1999-2000 Bruce W. Forsberg 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Bruce Forsberg forsberg@adnc.com 00019 * 00020 */ 00021 00022 00023 #ifndef _AFLIBCHAIN_H 00024 #define _AFLIBCHAIN_H 00025 00026 #include <list> 00027 #include <map> 00028 #include "aflib.h" 00029 00048 class aflibAudio; 00049 class aflibChainNode; 00050 00051 00052 class aflibChain { 00053 00054 public: 00055 00056 virtual 00057 ~aflibChain(); 00058 00059 const map<int, aflibAudio *, less<int> >& 00060 getParents() const; 00061 00062 int 00063 addParent(aflibAudio& parent); 00064 00065 void 00066 removeParent(int parent_id); 00067 00068 void 00069 removeParent(aflibAudio& parent); 00070 00071 bool 00072 getNodeProcessed() const; 00073 00074 void 00075 setNodeProcessed(bool node); 00076 00077 void 00078 dumpChain(bool check_env = TRUE); 00079 00080 protected: 00081 00082 aflibChain(); 00083 aflibChain(aflibAudio& parent); 00084 00085 void 00086 replaceParent( 00087 aflibAudio& old_p, 00088 aflibAudio& new_p); 00089 00090 // These are callback functions that derived classes can over ride to be 00091 // notified when a parent is destroyed or added. An Audio Editor object 00092 // for instance may have many inputs and if one is destroyed then it needs to 00093 // be notified so that it can rebuild its lists. 00094 virtual void 00095 parentWasDestroyed(int parent_id); 00096 00097 virtual void 00098 parentWasAdded(int parent_id); 00099 00100 private: 00101 00102 aflibChain(aflibChain& op); 00103 00104 const aflibChain& 00105 operator=(const aflibChain& op); 00106 00107 void 00108 insertIntoChain( 00109 aflibAudio& parent, 00110 aflibAudio& child); 00111 00112 void 00113 insertIntoChain( 00114 aflibAudio& child); 00115 00116 void 00117 removeFromChain( 00118 aflibAudio& child); 00119 00120 00121 static list<aflibChainNode *> _total_list; 00122 aflibChainNode * _this_node; 00123 bool _processing_constructor; 00124 00125 }; 00126 00127 00128 #endif 00129 00130