aflibChain.h

00001 /*
00002  * Copyright: (C) 1999-2001 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@tns.net
00019  *
00020  */
00021 
00022 
00023 #ifndef _AFLIBCHAIN_H
00024 #define _AFLIBCHAIN_H
00025 
00026 #ifdef HAVE_CONFIG_H
00027 #include <config.h>
00028 #endif
00029 
00030 #include <list>
00031 #include <map>
00032 #include <functional>
00033 #include "aflib.h"
00034 using std::list;
00035 using std::map;
00036 using std::less;
00037 
00056 class aflibAudio;
00057 class aflibChainNode;
00058 
00059 
00060 class aflibChain {
00061 
00062 public:
00063 
00064    virtual
00065    ~aflibChain();
00066 
00067    const map<int, aflibAudio *, less<int> >&
00068    getParents() const;
00069 
00070    int
00071    addParent(aflibAudio& parent);
00072 
00073    void
00074    removeParent(int parent_id);
00075 
00076    void
00077    removeParent(aflibAudio& parent);
00078 
00079    bool
00080    getNodeProcessed() const;
00081  
00082    void
00083    setNodeProcessed(bool node);
00084 
00085    void
00086    dumpChain(bool check_env = TRUE);
00087 
00088 protected:
00089 
00090    aflibChain();
00091    aflibChain(aflibAudio& parent);
00092 
00093    void
00094    replaceParent(
00095       aflibAudio& old_p,
00096       aflibAudio& new_p);
00097 
00098    // These are callback functions that derived classes can over ride to be
00099    // notified when a parent is destroyed or added. An Audio Editor object
00100    // for instance may have many inputs and if one is destroyed then it needs to
00101    // be notified so that it can rebuild its lists.
00102    virtual void
00103    parentWasDestroyed(int parent_id);
00104 
00105    virtual void
00106    parentWasAdded(int parent_id);
00107 
00108 private:
00109 
00110    aflibChain(aflibChain& op);
00111 
00112    const aflibChain&
00113    operator=(const aflibChain& op);
00114 
00115    void
00116    insertIntoChain(
00117       aflibAudio& parent,
00118       aflibAudio& child);
00119 
00120    void
00121    insertIntoChain(
00122       aflibAudio& child);
00123 
00124    void
00125    removeFromChain(
00126       aflibAudio& child);
00127 
00128 
00129 static list<aflibChainNode *>  _total_list;  
00130 aflibChainNode *   _this_node;
00131 bool               _processing_constructor;
00132 
00133 };
00134 
00135 
00136 #endif
00137 
00138 

Generated on Tue Jan 16 12:42:55 2007 for Open Source Audio Library Project by  doxygen 1.4.6