📄 const_00.cc
字号:
// file: $isip/class/algo/Constant/const_00.cc// version: $Id: const_00.cc,v 1.6 2002/08/14 22:40:06 gao Exp $//// isip include files//#include "Constant.h"//------------------------------------------------------------------------//// required public methods////-----------------------------------------------------------------------// method: assign//// arguments:// const Constant& arg: (input) object to be assigned//// return: a boolean value indicating status//// this method assigns the input object to the current object//boolean Constant::assign(const Constant& arg_a) { // assign data from the input Constant object // algorithm_d = arg_a.algorithm_d; implementation_d = arg_a.implementation_d; data_type_d = arg_a.data_type_d; filename_d.assign(arg_a.filename_d); data_exist_d = arg_a.data_exist_d; return AlgorithmBase::assign(arg_a);}// method: eq//// arguments:// const Constant& arg: (input) object to be compared//// return: a boolean value indicating status//// this method checks whether the current object is identical to the// input object//boolean Constant::eq(const Constant& arg_a) const { // compare the data members // if ((algorithm_d != arg_a.algorithm_d) || (implementation_d != arg_a.implementation_d) || !(filename_d.eq(arg_a.filename_d)) || (data_type_d != arg_a.data_type_d) || (data_exist_d != arg_a.data_exist_d)) { return false; } // exit gracefully // return true;}// method: clear//// arguments:// Integral::CMODE ctype: (input) clear mode//// return: a boolean value indicating status//// this method resets the data members to the default values//boolean Constant::clear(Integral::CMODE ctype_a) { // reset the data members unless the mode is RETAIN // if (ctype_a != Integral::RETAIN) { // clear the design parameters // algorithm_d = DEF_ALGORITHM; implementation_d = DEF_IMPLEMENTATION; data_type_d = AlgorithmData::DEF_DTYPE; data_exist_d = DEF_DATA_EXIST; } // exit gracefully // return AlgorithmBase::clear(ctype_a);}//---------------------------------------------------------------------------//// class-specific public methods:// public methods required by the AlgorithmBase interface contract////---------------------------------------------------------------------------// method: assign//// arguments:// const AlgorithmBase& arg: (input) object to be assigned//// return: a boolean value indicating status//// this method assigns the input algorithm object to the current object.//boolean Constant::assign(const AlgorithmBase& arg_a) { // case: input is an Constant object // if (typeid(arg_a) == typeid(Constant)) { return assign((Constant&)arg_a); } // case: other // if the input algorithm object is not an Constant object, error. // else { return Error::handle(name(), L"assign", Error::ARG, __FILE__, __LINE__); }}// method: eq//// arguments:// const AlgorithmBase& arg: (input) object to be compared//// return: a boolean value indicating status//// this method checks whether the current Constant object is identical// to the input algorithm object.//boolean Constant::eq(const AlgorithmBase& arg_a) const { // case: input is an Constant object // if (typeid(arg_a) == typeid(Constant)) { return eq((Constant&)arg_a); } // case: other // if the input algorithm object is not an Constant object, error. // else { return Error::handle(name(), L"eq", Error::ARG, __FILE__, __LINE__); }}// method: init//// arguments: none//// return: a boolean value indicating status//// this method precomputes various constants used in this class// boolean Constant::init() { // check algorithm: DATA // if (algorithm_d == DATA) { // no initialization needed } is_valid_d = true; // exit gracefully // return true;}//-----------------------------------------------------------------------------//// we define non-integral constants in the default constructor// //-----------------------------------------------------------------------------// constants: class name//const String Constant::CLASS_NAME(L"Constant");// constants: i/o related constants//const String Constant::DEF_PARAM(L"");const String Constant::DEF_FILENAME(L"diagnose_file.sof");const String Constant::PARAM_ALGORITHM(L"algorithm");const String Constant::PARAM_IMPLEMENTATION(L"implementation");const String Constant::PARAM_DATATYPE(L"datatype"); const String Constant::PARAM_FILENAME(L"filename");const String Constant::PARAM_CHANNEL(L"channels");const String Constant::PARAM_CHANNEL_INDEX(L"channel_index"); // constants: default values of the class data//// constants: name map(s) for the enumerated values//const NameMap Constant::ALGO_MAP(L"DATA");const NameMap Constant::IMPL_MAP(L"READ, WRITE");// static instantiations: memory manager//MemoryManager Constant::mgr_d(sizeof(Constant), Constant::name());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -