// file: $isip/class/algo/Math/math_06.cc // version: $Id: math_06.cc 8283 2002-07-03 21:08:37Z picone $ // // isip include files // #include "Math.h" // method: getOperation // // arguments: // String& output: (output) string with all operations listed // // return: logical error status // // create a string out of all the operations // bool8 Math::getOperation(String& output_a) const { // initialize the output // output_a.clear(); for (int32 i = 0; i < operation_d.length(); i++) { if (i == 0) { output_a.assign(OPER_MAP(operation_d(i))); } else { output_a.concat(DELIM); output_a.concat(OPER_MAP(operation_d(i))); } } // exit gracefully // return true; } // method: getFunction // // arguments: // String& output: (output) string with all functions listed // // return: logical error status // // create a string out of all the functions // bool8 Math::getFunction(String& output_a) const { // initialize the output // output_a.clear(); for (int32 i = 0; i < function_d.length(); i++) { if (i == 0) { output_a.assign(FUNC_MAP(function_d(i))); } else { output_a.concat(DELIM); output_a.concat(FUNC_MAP(function_d(i))); } } // exit gracefully // return true; } // method: setOperation // // arguments: // const String& operations: (input) string with all operations listed // // return: logical error status // // set the operations by parsing this input string // bool8 Math::setOperation(const String& operations_a) { // determine the number of tokens and create a vector // int32 size = operations_a.countTokens(DELIM); VectorLong vec(size); // local variables for tokenization // int32 pos = 0; String token; // tokenize the string into the VectorLong // int32 i = 0; while (operations_a.tokenize(token, pos, DELIM)) { token.trim(); vec(i++) = OPER_MAP(token); } // call the master method // return setOperation(vec); } // method: setFunction // // arguments: // const String& functions: (input) string with all functions listed // // return: logical error status // // set the functions by parsing this input string // bool8 Math::setFunction(const String& functions_a) { // determine the number of tokens and create a vector // int32 size = functions_a.countTokens(DELIM); VectorLong vec(size); // local variables for tokenization // int32 pos = 0; String token; // tokenize the string into the VectorLong // int32 i = 0; while (functions_a.tokenize(token, pos, DELIM)) { token.trim(); vec(i++) = FUNC_MAP(token); } // call the master method // return setFunction(vec); }