quick start:g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_algo.a #include <Mask.h> Mask(ALGORITHM algorithm = DEF_ALGORITHM); Mask(const Mask& arg); boolean eq(const Mask& arg); boolean setAlgorithm(ALGORITHM algorithm); boolean set(const VectorByte& mask); boolean set(const String& source);
description:VectorFloat data(L"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,32,32,0,32,-32,16"); VectorFloat output; String mask_str(L"0-3, 14-19, 21"); Mask mask(mask_str); mask.compute(output, data);
static const String CLASS_NAME = L"Mask";
enum ALGORITHM { SELECT = 0, REMOVE, DEF_ALGORITHM = SELECT };
enum IMPLEMENTATION { INDEX = 0, DEF_IMPLEMENTATION = INDEX };
static const byte OFF = 0;
static const byte ON = 1;
static const NameMap Mask::ALGO_MAP(L"SELECT, REMOVE");
static const NameMap Mask::IMPL_MAP(L"INDEX");
static const String Mask::DEF_PARAM = L"";
static const String Mask::PARAM_ALGORITHM = L"algorithm";
static const String Mask::PARAM_IMPLEMENTATION = L"implementation";
static const String Mask::PARAM_MASK = L"mask";
static const long ERR = 71200;
ALGORITHM algorithm_d;
IMPLEMENTATION implementation_d;
String source_d;
VectorByte mask_d;
static MemoryManager mgr_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
~Mask();
Mask(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION);
Mask(const Mask& arg);
boolean assign(const Mask& arg);
Mask& operator= (const Mask& arg);
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;
boolean eq(const Mask& arg) const;
static void* operator new(size_t size);
static void* operator new[](size_t size);
static void operator delete(void* ptr);
static void operator delete[](void* ptr);
static boolean setGrowSize(long grow_size);
boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);
Mask(const String& arg);
Mask(const VectorByte& arg);
boolean assign(const String& source);
boolean assign(const VectorByte& mask);
boolean setAlgorithm(ALGORITHM algorithm);
boolean setImplementation(IMPLEMENTATION implementation);
boolean set(const String& source);
boolean set(const VectorByte& source);
boolean convert(String& out, const VectorByte& in);
boolean set(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION);
ALGORITHM getAlgorithm() const;
IMPLEMENTATION getImplementation() const;
const String& getString() const;
const VectorByte& get() const;
boolean get(ALGORITHM& algorithm, IMPLEMENTATION& implementation) const;
boolean compute(VectorFloat& output, const VectorFloat& input, AlgorithmData::COEF_TYPE input_coef_type = AlgorithmData::UNKNOWN, long index = DEF_CHANNEL_INDEX);
boolean compute(VectorComplexFloat& output, const VectorComplexFloat& input, AlgorithmData::COEF_TYPE input_coef_type = AlgorithmData::UNKNOWN, long index = DEF_CHANNEL_INDEX);
boolean assign(const AlgorithmBase& arg);
boolean eq(const AlgorithmBase& arg) const;
const String& className() const;
boolean apply(Vector<AlgorithmData>& output, const Vector<AlgorithmData>& input);
boolean setParser(SofParser* parser);
boolean readDataCommon(Sof& sof, const String& pname, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeDataCommon(Sof& sof, const String& pname) const;
boolean computeSelectIndex(VectorFloat& output, const VectorFloat& input);
boolean computeRemoveIndex(VectorFloat& output, const VectorFloat& input);
boolean insert(VectorByte& src, long start_index, long num_elem, byte mode);
// isip include files // #include <Mask.h> // main program starts here // int main(int argc, const char **argv) { // declare the local variables // VectorFloat input; VectorFloat output; String str; // set the variables // input.assign(L"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,32,32,0,32,-32,16"); str.assign(L"3, 14-19, 21"); Mask mask(str); // set algorithm and implementation // mask.setAlgorithm(Mask::SELECT); mask.setImplementation(Mask::INDEX); // compute the output that contains the selected elements // if(!mask.compute(output, input)) { Error::handle(mask.name(), L"compute", Error::TEST, __FILE__, __LINE__); } // print the input and the output // input.debug(L"input:"); mask.debug(L"mask:"); output.debug(L"output:"); str.assign(L"0-2, 4-13, 20"); // set algorithm and elements that will be removed // mask.setAlgorithm(Mask::REMOVE); mask.set(str); // compute the output that contains the elements other than the // selected ones // if(!mask.compute(output, input)) { Error::handle(mask.name(), L"compute", Error::TEST, __FILE__, __LINE__); } // print the input and the output // input.debug(L"input:"); mask.debug(L"mask:"); output.debug(L"output:"); // exit gracefully // Integral::exit(); }