FCNN.cpp
// parses command-line arguments, builds the network via BuildNetwork() using them and checks for additional options in command-line

parses command-line arguments, builds the network via BuildNetwork() using them and checks for additional options in command-line
parses command - line arguments builds the network via BuildNetwork () using them and checks for additional options in command - line
bool ParseArgs(int argc, const char* argv[], DBManager& dbm, NeuralNetwork& nn) {
	if (argc < 2) {
		Usage(argv[0]);
	}
	std::list<string> params;
	for (int i = 1; i < argc; ++i) {
		params.push_back(StrToUpper(argv[i]));
	}
	if (!BuildNetwork(nn, params)) {
		return false;
	}
	for (const auto& param : params) {
		if (param.substr(0, 2) != "--") {
			cerr << "  unknown parameter ignored: " << param << endl;
			continue;
		}
		auto sep = param.find('=');
		if (sep == string::npos) {
			cerr << "  unknown parameter ignored: " << param << endl;
			continue;
		}
		string pname = param.substr(2, sep - 2); 
		string pval = param.substr(sep + 1, string::npos); 
		{
			auto it = global_strOpts.find(pname);
			if (it != global_strOpts.end()) {
				*(it->second) = pval;
				continue;
			}
		}
		{
			auto it = global_intOpts.find(pname);
			if (it != global_intOpts.end()) {
				if (!IsInteger(pval)) {
					cerr << "  " << pname << " option has to be an integer" << endl;
					return false;
				}
				else {
					*(it->second) = atoi(pval.c_str());
				}
				continue;
			}
		}
		{
			auto it = global_floatOpts.find(pname);
			if (it != global_floatOpts.end()) {
				if (!IsFloat(pval)) {
					cerr << "  " << pname << " option has to be a number" << endl;
					return false;
				}
				*(it->second) = static_cast<sca_t>(atof(pval.c_str()));
				continue;
			}
		}
		cerr << "  unknown option ignored: " << pname << endl;
	} 
	return true;
}
bool ParseArgs ( int argc , const char * argv [ ] , DBManager & dbm , NeuralNetwork & nn ) { if ( argc < 2 ) { Usage ( argv [ 0 ] ) ; } std :: list < string > params ; for ( int i = 1 ; i < argc ; ++ i ) { params . push_back ( StrToUpper ( argv [ i ] ) ) ; } if ( ! BuildNetwork ( nn , params ) ) { return false ; } for ( const auto & param : params ) { if ( param . substr ( 0 , 2 ) != " " ) { cerr << " " << param << endl ; continue ; } auto sep = param . find ( ' ' ) ; if ( sep == string :: npos ) { cerr << " " << param << endl ; continue ; } string pname = param . substr ( 2 , sep - 2 ) ; string pval = param . substr ( sep + 1 , string :: npos ) ; { auto it = global_strOpts . find ( pname ) ; if ( it != global_strOpts . end ( ) ) { * ( it -> second ) = pval ; continue ; } } { auto it = global_intOpts . find ( pname ) ; if ( it != global_intOpts . end ( ) ) { if ( ! IsInteger ( pval ) ) { cerr << " " << pname << " " << endl ; return false ; } else { * ( it -> second ) = atoi ( pval . c_str ( ) ) ; } continue ; } } { auto it = global_floatOpts . find ( pname ) ; if ( it != global_floatOpts . end ( ) ) { if ( ! IsFloat ( pval ) ) { cerr << " " << pname << " " << endl ; return false ; } * ( it -> second ) = static_cast < sca_t > ( atof ( pval . c_str ( ) ) ) ; continue ; } } cerr << " " << pname << endl ; } return true ; }
parses command-line arguments, builds the network via BuildNetwork() using them and checks for additional options in command-line
parses command - line arguments builds the network via BuildNetwork () using them and checks for additional options in command - line
// for i
