📄 algorithmdata.h
字号:
// file: $isip/class/mmedia/AlgorithmData/AlgorithmData.h// version: $Id: AlgorithmData.h,v 1.3 2002/06/24 23:21:16 picone Exp $//// make sure definitions are only made once//#ifndef ISIP_ALGORITHM_DATA#define ISIP_ALGORITHM_DATA// isip include files//#ifndef ISIP_VECTOR_FLOAT#include <VectorFloat.h>#endif#ifndef ISIP_VECTOR_DOUBLE#include <VectorDouble.h>#endif#ifndef ISIP_VECTOR_COMPLEX_FLOAT#include <VectorComplexFloat.h>#endif#ifndef ISIP_MATRIX_FLOAT#include <MatrixFloat.h>#endif#ifndef ISIP_MATRIX_COMPLEX_FLOAT#include <MatrixComplexFloat.h>#endif#ifndef ISIP_VECTOR_COMPLEX_DOUBLE#include <VectorComplexDouble.h>#endif#ifndef ISIP_MATRIX_DOUBLE#include <MatrixDouble.h>#endif#ifndef ISIP_MATRIX_COMPLEX_DOUBLE#include <MatrixComplexDouble.h>#endif#ifndef ISIP_VECTOR#include <Vector.h>#endif#ifndef ISIP_DEBUG_LEVEL#include <DebugLevel.h>#endif// AlgorithmData: a class that defines an interface contract for the// data passed to all Algorithms. This is the lowest-level class for// mmedia library and the algo library and is used to encapsulate the// different data formats one can pass to FrontEnd.//class AlgorithmData { //--------------------------------------------------------------------------- // // public constants // //---------------------------------------------------------------------------public: // define the class name // static const String CLASS_NAME; //---------------------------------------- // // other important constants // //---------------------------------------- // define the enumeration for data type // enum DATA_TYPE { NONE = 0, VECTOR_FLOAT, VECTOR_COMPLEX_FLOAT, MATRIX_FLOAT, MATRIX_COMPLEX_FLOAT, VECTOR_DOUBLE, VECTOR_COMPLEX_DOUBLE, MATRIX_DOUBLE, MATRIX_COMPLEX_DOUBLE, COMBINATION, DEF_DTYPE = NONE }; // define the enumeration for coefficient type: // note that we only list those types that are stand-alone data types // with well-defined meanings in terms of signal processing. a class // such as Calculus, that operates on generic types of data, is not // listed. a class such as Cepstrum is not listed also because Cepstrum // can be treated as a SIGNAL from a coefficient-type perspective. // in general, the types listed here are those types for which customized // Features exist (for example computing the spectrum from linear // prediction coefficients requires a data-specific Feature). // enum COEF_TYPE { GENERIC = 0, PROPAGATE, SIGNAL, SPECTRUM, CORRELATION, COVARIANCE, ENERGY, FILTER, LOG_AREA_RATIO, PREDICTION, REFLECTION, DEF_CTYPE = GENERIC }; // define static NameMap objects // static const NameMap DTYPE_MAP; static const NameMap CTYPE_MAP; //---------------------------------------- // // i/o related constants // //---------------------------------------- static const String DEF_PARAM; //---------------------------------------- // // default values and arguments // //---------------------------------------- //---------------------------------------- // // error codes // //---------------------------------------- static const long ERR = 50300; static const long ERR_TYPE = 50301; //--------------------------------------------------------------------------- // // protected data // //---------------------------------------------------------------------------protected: // define the type of the data (vector, matrix, etc.) // DATA_TYPE data_type_d; // define the type of coefficient // COEF_TYPE coef_type_d; // a pointer to the data itself // void* data_d; // define a debug level // static DebugLevel debug_level_d; // define the 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); // method: setDebug // boolean setDebug(Integral::DEBUG level) { return debug_level_d.assign(level); } // other debug methods // boolean debug(const unichar* message) const; // method: destructor // ~AlgorithmData() { if (data_d != (void*)NULL) { setDataType(NONE); } } // method: default constructor // AlgorithmData(DATA_TYPE arg = DEF_DTYPE) { data_type_d = NONE; coef_type_d = DEF_CTYPE; data_d = (void*)NULL; if (arg != NONE) { setDataType(arg); } } // method: copy constructor // AlgorithmData(const AlgorithmData& arg) { data_type_d = NONE; coef_type_d = DEF_CTYPE; data_d = (void*)NULL; assign(arg); } // assign methods // boolean assign(const AlgorithmData& input_a); // method: operator= // AlgorithmData& operator= (const AlgorithmData& copy_node) { assign(copy_node); return *this; } // i/o methods // // method: sofSize // long sofSize() const { return (long)Error::handle(name(), L"sofSize", Error::NOT_IMPLEM, __FILE__, __LINE__); } // method: read // boolean read(Sof& sof, long tag, const String cname = CLASS_NAME) { return Error::handle(name(), L"read", Error::NOT_IMPLEM, __FILE__, __LINE__); } // method: write // boolean write(Sof& sof, long tag, const String cname = CLASS_NAME) const { return Error::handle(name(), L"write", Error::NOT_IMPLEM, __FILE__, __LINE__); } // method: readData // boolean readData(Sof& sof, const String pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false) { return Error::handle(name(), L"readData", Error::NOT_IMPLEM, __FILE__, __LINE__); } // method: writeData // boolean writeData(Sof& sof, const String pname = DEF_PARAM) const { return Error::handle(name(), L"writeData", Error::NOT_IMPLEM, __FILE__, __LINE__); } // equality methods // boolean eq(const AlgorithmData& arg) const; // 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 // //--------------------------------------------------------------------------- // set methods
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -