📄 algorithmcontainer.h
字号:
// file: $isip/class/algo/AlgorithmContainer/AlgorithmContainer.h// version: $Id: AlgorithmContainer.h,v 1.7 2002/06/29 18:05:01 picone Exp $//// make sure definitions are only made once//#ifndef ISIP_ALGORITHM_CONTAINER#define ISIP_ALGORITHM_CONTAINER// isip include files//#ifndef ISIP_ALGORITHM_BASE#include <AlgorithmBase.h>#endif#ifndef ISIP_LONG#include <Long.h>#endif#ifndef ISIP_STRING#include <String.h>#endif#ifndef ISIP_MEMORY_MANAGER#include <MemoryManager.h>#endif// forward class definitions//class AlgorithmData;// AlgorithmContainer: a class used as a placeholder for subgraphs. this// class allows container objects to be specified in a recipe// (via transform_builder) and to be read by isip_transform.//class AlgorithmContainer : public AlgorithmBase { //--------------------------------------------------------------------------- // // public constants // //---------------------------------------------------------------------------public: // define the class name // static const String CLASS_NAME; //---------------------------------------- // // other important constants // //---------------------------------------- // define the algorithm choices // enum ALGORITHM { SUB_PROCESS = 0, DEF_ALGORITHM = SUB_PROCESS }; // define the implementation choices // enum IMPLEMENTATION { EXPAND = 0, DEF_IMPLEMENTATION = EXPAND }; // define static NameMap objects // static const NameMap ALGO_MAP; static const NameMap IMPL_MAP; //---------------------------------------- // // i/o related constants // //---------------------------------------- static const String DEF_PARAM; static const String PARAM_ALGORITHM; static const String PARAM_IMPLEMENTATION; static const String PARAM_GRAPH_TAG; static const String PARAM_VARIABLE; //---------------------------------------- // // default values and arguments // //---------------------------------------- // default value for the class data // static const long DEF_GRAPH_TAG = -1; //---------------------------------------- // // error codes // //---------------------------------------- static const long ERR = 73200; //--------------------------------------------------------------------------- // // protected data // //---------------------------------------------------------------------------protected: // algorithm name // ALGORITHM algorithm_d; // implementation name // IMPLEMENTATION implementation_d; // the variable name and type // Long graph_tag_d; // the container variable name // String variable_d; // memory manager // static MemoryManager mgr_d; //--------------------------------------------------------------------------- // // required public methods // //---------------------------------------------------------------------------public: // method: name // static const String& name() { return CLASS_NAME; } // other static methods // static boolean diagnose(Integral::DEBUG debug_level); // debug methods: // setDebug method is inherited from the base class // boolean debug(const unichar* msg) const; // method: destructor // ~AlgorithmContainer() {} // method: constructor // AlgorithmContainer(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, long graph_tag = DEF_GRAPH_TAG) { algorithm_d = algorithm; implementation_d = implementation; graph_tag_d = graph_tag; } // method: copy constructor // AlgorithmContainer(const AlgorithmContainer& arg) { assign(arg); } // method: assign // boolean assign(const AlgorithmContainer& arg); // method: operator= // AlgorithmContainer& operator= (const AlgorithmContainer& arg) { assign(arg); return *this; } // i/o methods // long sofSize() const; boolean read(Sof& sof, long tag, const String& name = CLASS_NAME); boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const; boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false); boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const; // method: eq // boolean eq(const AlgorithmContainer& arg) const { return ((algorithm_d == arg.algorithm_d) && (implementation_d == arg.implementation_d) && (graph_tag_d == arg.graph_tag_d) && (variable_d.eq(arg.variable_d))); } // method: new // static void* operator new(size_t size) { return mgr_d.get(); } // method: new[] // static void* operator new[](size_t size) { return mgr_d.getBlock(size); } // method: delete // static void operator delete(void* ptr) { mgr_d.release(ptr); } // method: delete[] // static void operator delete[](void* ptr) { mgr_d.releaseBlock(ptr); } // method: setGrowSize // static boolean setGrowSize(long grow_size) { return mgr_d.setGrow(grow_size); } // other memory management methods // boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE); //--------------------------------------------------------------------------- // // class-specific public methods: // set methods // //--------------------------------------------------------------------------- // method: setAlgorithm // boolean setAlgorithm(ALGORITHM algorithm) { algorithm_d = algorithm; is_valid_d = false; return true; } // method: setImplementation // boolean setImplementation(IMPLEMENTATION implementation) { implementation_d = implementation; is_valid_d = false; return true; } // method: setVariable // boolean setVariable(const String& arg) { return variable_d.assign(arg); } // method: setGraphTag // boolean setGraphTag(long arg) { return graph_tag_d.assign(arg); } // method: set // boolean set(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, long graph_tag = DEF_GRAPH_TAG) { algorithm_d = algorithm; implementation_d = implementation; graph_tag_d = graph_tag; is_valid_d = false; return true; } //--------------------------------------------------------------------------- // // class-specific public methods: // get methods // //--------------------------------------------------------------------------- // method: getAlgorithm // ALGORITHM getAlgorithm() const { return algorithm_d; } // method: getImplementation // IMPLEMENTATION getImplementation() const { return implementation_d; } // method: getVariable // const String& getVariable() const { return variable_d; } // method: getGraphTag // const long getGraphTag() const { return graph_tag_d; } // method: get // boolean get(ALGORITHM& algorithm, IMPLEMENTATION& implementation, long& graph_tag) const { algorithm = algorithm_d; implementation = implementation_d; graph_tag = graph_tag_d; return true; } //--------------------------------------------------------------------------- // // class-specific public methods: // AlgorithmBase interface contract methods // //--------------------------------------------------------------------------- // assign method // boolean assign(const AlgorithmBase& arg); // equality method // boolean eq(const AlgorithmBase& arg) const; // method: className // const String& className() const { return CLASS_NAME; } // method: apply // boolean apply(Vector<AlgorithmData>& output, const Vector< CircularBuffer<AlgorithmData> >& input) { return false; } // parser methods // boolean setParser(SofParser* parser); //--------------------------------------------------------------------------- // // private methods // //---------------------------------------------------------------------------private:};// end of include file// #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -