int main(int argc, char** argv) { if (argc != 3 && argc != 5 && argc != 6) { cout << VERSION << endl; cout << "USAGE FOR STANDALONE: qsspn qsspn_file ctrl_file" << endl; cout << "USAGE FOR SERVER: qsspn qsspn_file ctrl_file address port cache_size" << endl; cout << "USAGE FOR CLIENT: qsspn qsspn_file ctrl_file address port" << endl; cout << "The qsspn_file file with extension .json is read as Json file" << endl; cout << "The qsspn file without .json extension is assumed to be in old qsspn format" << endl; cout << "Example cache size is 100000000" << endl; exit(1); } if (argc == 3) {//standalone PetriNet *pn = new PetriNet(); string path(argv[1]); string path1(argv[2]); if (isJason(path)) { pn->readModel(path); } else { pn->readPetriNet(path); } pn->runWorkflowStandalone(path1); exit(0); } else if (argc == 5) {//client PetriNet *pn = new PetriNet(); string path(argv[1]); string path1(argv[2]); string serverAddress(argv[3]); string serverPort(argv[4]); if (isJason(path)) { pn->readModel(path); } else { pn->readPetriNet(path); } pn->runWorkflowClient(path1, serverAddress, serverPort); exit(0); } else try {//server string path(argv[1]); string path1(argv[2]); string address(argv[3]); string port(argv[4]); int cache_size = atoi(argv[5]); Cache *cache = new Cache(cache_size); PetriNet *pn = new PetriNet(); if (isJason(path)) { pn->readModel(path); } else { pn->readPetriNet(path); } fstream infile; string word; vector<string> text; infile.open(path1.c_str()); if (!infile) { cerr << "Could not open file:" << path1 << endl; exit(0); } while (infile >> word) text.push_back(word); infile.close(); asio::io_service io_service; MetabolismServer server(address, port, io_service, 1, pn, cache, text); server.run(); delete pn; delete cache; } catch (std::exception& e) { std::cerr << "Error: " << e.what() << std::endl; return 1; } return 0; }