Changeset 3366 in Sophya for trunk/SophyaPI/PIext/piacmd.cc
- Timestamp:
- Oct 30, 2007, 1:57:40 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/piacmd.cc
r2999 r3366 401 401 Commander::ShowMessage(msg, att); 402 402 } 403 404 405 /* --Methode-- */ 406 SOpExObj::SOpExObj(PIStdImgApp* app) 407 { 408 mImgApp = app; 409 fg_thrstop = false; 410 fg_threxe = false; 411 } 412 413 /* --Methode-- */ 414 SOpExObj::~SOpExObj() 415 { 416 } 417 418 /* --Methode-- */ 419 void SOpExObj::AddOpe(string const & line) 420 { 421 mutx_inps.lock(); 422 inputlines.push(line); // Ajout d'un element en fin de queue 423 mutx_inps.unlock(); 424 mutx_inps.broadcast(); 425 } 426 427 /* --Methode-- */ 428 void SOpExObj::run() 429 { 430 NamedObjMgr omg; 431 while (!fg_thrstop) { 432 mutx_inps.lock(); 433 while (inputlines.empty()) { 434 fg_threxe = false; 435 mutx_inps.wait(); 436 } 437 string cmd = inputlines.front().substr(0,3); // On recupere l'element de tete 438 string nom = inputlines.front().substr(4); // On recupere l'element de tete 439 inputlines.pop(); // On supprime l'element de tete 440 fg_threxe = true; 441 mutx_inps.unlock(); 442 try { 443 if (cmd == "SCO") { // set cobj 444 string ss = "set cobj "; 445 ss += nom; 446 cout << " Defining cobj : " << ss << endl; 447 mImgApp->CmdInterpreter()->AddInputLine(ss); 448 } 449 else if (cmd == "DIS") { // display obj 450 omg.DisplayObj(nom); 451 } 452 else if (cmd == "PRT") { // print obj 453 omg.PrintObj(nom); 454 } 455 else if (cmd == "DEL") { // delete obj 456 omg.DelObj(nom); 457 } 458 else if (cmd == "SAV") { // saveppf obj 459 if (mImgApp->mPpfout) omg.SaveObj(nom, *(mImgApp->mPpfout), false); 460 } 461 else cerr << "SOpExObj::run() ERROR CMD= " << cmd << endl; 462 } 463 catch (PThrowable& pex) { // Catching SOPHYA exceptions 464 cerr << "SOpExObj::run() SOPHYA exception CMD=" << cmd << " NOM=" << nom << "\n" 465 << (string)typeid(pex).name() << " Msg= " << pex.Msg() << endl; 466 } 467 catch (std::exception& sex) { 468 cerr << "SOpExObj::run() std::exception CMD=" << cmd << " NOM=" << nom << "\n" 469 << (string)typeid(sex).name() << " Msg= " << sex.what() << endl; 470 } 471 catch (...) { 472 cerr << "SOpExObj::run() unknown exception (...) CMD=" 473 << cmd << " NOM=" << nom << endl; 474 } 475 } 476 }
Note:
See TracChangeset
for help on using the changeset viewer.