status_t decodeLine(string * strLine) { std::string::size_type bracketPos; string verb = ""; string arguments = ""; status_t decodeResult; bracketPos = strLine->find('(', 0); if (bracketPos == std::string::npos) throw format_Error(ENN_ERR_NON_FILE); if (verbArguement(strLine, verb, arguments)) { if (verb == "inputVector") { #ifdef _DEBUG_ cout << "Decoding Input Vector\n"; #endif return decodeInputVector(&arguments); } if (verb == "networkTopology") { #ifdef _DEBUG_ cout << "Decode Topology\n"; #endif vector<unsigned int> layerWidths(maxLayers); decodeResult = decodeNetworkTopology(&arguments, maxLayers, &layerWidths); if (layerWidths[0] != ((nn*) theNetwork)->layerZeroWidth()) throw format_Error(ENN_ERR_NONMATCHING_TOPOLOGY); return decodeResult; } // errMessage.Format("%s: %s", ENN_ERR_UNK_KEY_WORD, verb.GetBuffer()); errMessage = ENN_ERR_UNK_KEY_WORD; errMessage += ": "; errMessage += verb; throw format_Error(errMessage.c_str()); } else throw format_Error(ENN_ERR_NON_FILE); return FAILURE; // will not happen }
status_t decodeLine(string * strLine) { std::string::size_type bracketPos; string verb = ""; string arguements = ""; bracketPos = strLine->find('(', 0); if (bracketPos == std::string::npos) throw format_Error(ENN_ERR_NON_FILE); if (verbArguement(strLine, verb, arguements)) { if (verb == "inputVector") { if (lineCount++ == 0) inputArray = new twoDFloatArray(net.standardInputNodes()); else inputArray->addRow(); #ifdef _DEBUG_ cout << "Decoding Input Vector\n"; #endif return decodeInputVector(&arguements, inputArray->values(lineCount - 1)); } if (verb == "networkTopology") { #ifdef _DEBUG_ cout << "Decode Topology\n"; #endif return decodeNetworkTopology(&arguements); } // errMessage.Format("%s: %s", ENN_ERR_UNK_KEY_WORD, verb.GetBuffer()); errMessage = ENN_ERR_UNK_KEY_WORD; errMessage += ": "; errMessage += verb; throw format_Error(errMessage.c_str()); } else throw format_Error(ENN_ERR_NON_FILE); return FAILURE; // will not happen }