Example #1
0
	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 == "networkTopology")
			{
#ifdef _DEBUG_
				cout << "Decode Topology\n";
#endif
				vector<unsigned int> layerWidths(maxLayers);
				decodeResult = decodeNetworkTopology(&arguments, maxLayers, &layerWidths);
				if ((layerWidths[0] == ((nn*) theNetwork)->layerZeroWidth())
						&& (layerWidths[3] == ((nn*) theNetwork)->layerNWidth()))
					return decodeResult;
				else
					throw format_Error(ENN_ERR_NONMATCHING_TOPOLOGY);

				return decodeResult;
			}
			if (verb == "inputOutputVector")
			{
#ifdef _DEBUG_
				cout << "Decode Input/Output Vector\n";
#endif

				return decodeTrainingVector(&arguments);
			}
			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
	}
Example #2
0
    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 ==  "networkTopology")
                            {
#ifdef _DEBUG_
                                        	cout << "Decode Topology\n";
#endif
                                return decodeNetworkTopology(&arguements);
                            }
                            if (verb ==  "inputOutputVector")
                            {
                                if (lineCount++ == 0)
                                {
#ifdef _DEBUG_
                                        	cout << "Decode Input/Output Vector\n";
#endif
                                    inputArray = new twoDFloatArray(net.standardInputNodes());
                                    outputArray = new twoDFloatArray(net.outputNodes());
                                }
                                else
                                {
                                    inputArray->addRow();
                                    outputArray->addRow();
                                }

                                return decodeTrainingVector(&arguements, inputArray->values(lineCount -1), outputArray->values(lineCount - 1));
                            }
                            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
                    }