Changeset 2755 in Sophya for trunk/SophyaPI/PIext


Ignore:
Timestamp:
May 23, 2005, 6:33:02 PM (20 years ago)
Author:
ansari
Message:

1/ Correction bug trace des lignes ds PINTuple
2/ Ajout methode IsThreadable() (declaration conformite thread separe pour certaines commandes) ds baseexecut.h .cc (plot2d plot3d ...) , ds pawexecut.cc (n/plot ...) et ds cxxexecutor.h .cc (c++exec c++execfrf ...)
3/ Ajout de ZMutex (et ZSync) pour la gestion des commandes threadable - ds les
executeurs et ds servnobjm.h .cc
4/ bug d'execution en thread identifie et corrige ds nobjmgr.h .cc (ajout des
methodes GetObj_P() GetObjAdapter_P() et ReadObj_P()
5/ Ajout de l'appel a ZSync::NOp() pour eviter les warnings 'unused variable zs ...'

Reza 23 Mai 2005

Location:
trunk/SophyaPI/PIext
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/basexecut.cc

    r2718 r2755  
    5353/* Macro pour tester si flag normalized coordinate est present */
    5454#define _CkBoolNC_(_jk_) ((tokens.size()>_jk_) && (tokens[_jk_] == "true")) ? true : false;
    55  
     55
     56
    5657/* --Methode-- */
    5758int PIABaseExecutor::Execute(string& kw, vector<string>& tokens, string& toks)
     
    11251126
    11261127return(0);
     1128}
     1129
     1130/* --Methode-- */
     1131bool PIABaseExecutor::IsThreadable(string const & keyw)
     1132{
     1133  if ( (keyw == "fillvec") || (keyw == "fillmtx") ||
     1134       (keyw == "fillnt") || (keyw == "ntloop") )  return true;
     1135  else if (keyw.substr(0,4) == "func")  return true;
     1136  else {
     1137    string skw = keyw.substr(0,5);
     1138    if ( (skw == "plot2") || (skw == "plot3") || (skw == "projh") )  return true;
     1139  }
     1140  return false;
    11271141}
    11281142
  • trunk/SophyaPI/PIext/basexecut.h

    r1276 r2755  
    1414  virtual       ~PIABaseExecutor();
    1515  virtual int   Execute(string& keyw, vector<string>& args, string& toks);
     16  virtual bool  IsThreadable(string const & keyw);
    1617
    1718protected :
  • trunk/SophyaPI/PIext/cxxexecutor.cc

    r2616 r2755  
    155155    return(1);
    156156  }
     157  // Pour synchronisation d'execution simultanee
     158  ZSync zs(mutx_cxxe, 2);  zs.NOp(); // 2 -> broadcast lors de la destruction
     159
    157160  rc = ExecuteCXX(toks); if(rc) return(1);
    158161
     
    162165    return(1);
    163166  }
     167  // Pour synchronisation d'execution simultanee
     168  ZSync zs(mutx_cxxe, 2);  zs.NOp(); // 2 -> broadcast lors de la destruction
     169
    164170  rc = FillUserCode(tokens[0]); if(rc) return(1);
    165171  if(tokens.size()>1) rc = FillUserFctFrF(tokens[1]);
     
    181187    return(1);
    182188  }
     189  // Pour synchronisation d'execution simultanee
     190  ZSync zs(mutx_cxxe, 2);  zs.NOp(); // 2 -> broadcast lors de la destruction
     191
    183192  rc = FillUserCode(toks,2);        if(rc) return(1);
    184193  rc = FillUserFctFrS();            if(rc) return(1);
     
    190199    return(1);
    191200  }
     201  // Pour synchronisation d'execution simultanee
     202  ZSync zs(mutx_cxxe, 2);  zs.NOp(); // 2 -> broadcast lors de la destruction
     203
    192204  rc = FillUserCode(tokens[2]); if(rc) return(1);
    193205  if(tokens.size()>3) rc = FillUserFctFrF(tokens[3]);
     
    197209
    198210} else if(kw == "c++compile") {
     211  // Pour synchronisation d'execution simultanee
     212  ZSync zs(mutx_cxxe, 2);  zs.NOp(); // 2 -> broadcast lors de la destruction
     213
    199214  if(tokens.size()>=1) rc = Compile(tokens[0]);
    200215  else                 rc = Compile();
     
    202217
    203218} else if(kw == "c++link") {
     219  // Pour synchronisation d'execution simultanee
     220  ZSync zs(mutx_cxxe, 2);  zs.NOp(); // 2 -> broadcast lors de la destruction
     221
    204222  if(tokens.size()>=2)      rc = Link(tokens[0],tokens[1]);
    205223  else if(tokens.size()>=1) rc = Link(tokens[0]);
     
    262280
    263281return(0);
     282}
     283
     284/* --Methode-- */
     285bool  CxxExecutor::IsThreadable(string const & kw)
     286{
     287if ( (kw == "c++exec") || (kw == "c++execfrf") ||
     288     (kw == "c++create") || (kw == "c++createfrf") ||
     289     (kw == "c++compile") || (kw == "c++link") )   return true;
     290else return false;
    264291}
    265292
  • trunk/SophyaPI/PIext/cxxexecutor.h

    r2322 r2755  
    2424
    2525  virtual int Execute(string& keyw,vector<string>& args, string& toks);
     26  virtual bool  IsThreadable(string const & keyw);
    2627
    2728  inline void SetPrtLevel(uint_2 lp=2) {mPrtLevel = lp;}
     
    9697  uint_2 mPrtLevel;
    9798  bool   mFgPutVar;  // if true , declare ObjMgr variables as $varname, default=false
     99
     100  // Mutex de controle de thread pour dynamic-link
     101  ZMutex mutx_cxxe;
     102
    98103};
    99104
  • trunk/SophyaPI/PIext/nobjmgr.cc

    r2701 r2755  
    9595static DVList* myVars = NULL;  // Pour stocker les variables
    9696
    97 static string* TmpDir;  // Repertoire pour les compilations / link dynamique
     97static string* TmpDir = NULL;  // Repertoire pour les compilations / link dynamique
    9898
    9999// Pour gestion multithread
    100 static ZMutex* myMutex;
     100static ZMutex* myMutex = NULL;
    101101// ..................................................................
    102102
     
    122122  myObjs = new NObjList; 
    123123  myVars = new DVList;
     124  myMutex = new ZMutex;
    124125  currDir = new string("home");
    125126  string dirn = "home";
     
    144145  if ( (l>0) && ((*TmpDir)[l-1] != '/') )  (*TmpDir) += '/';
    145146  servnobjm = new Services2NObjMgr(*TmpDir);
    146   myMutex = new ZMutex;
    147147  }
    148148fgOInit++;
     
    230230    return(false);
    231231  }
    232   ZSync(*myMutex);
     232  ZSync zs(*myMutex); zs.NOp();
    233233#ifdef SANS_EVOLPLANCK
    234234  bool fg = true;
     
    248248    return(false);
    249249  }
    250   ZSync(*myMutex);
     250  ZSync zs(*myMutex); zs.NOp();
    251251#ifdef SANS_EVOLPLANCK
    252252  DVList::ValList::const_iterator it;
     
    266266    return(false);
    267267  }
    268   ZSync(*myMutex);
     268  ZSync zs(*myMutex); zs.NOp();
    269269#ifdef SANS_EVOLPLANCK
    270270  return(false);
     
    281281    return("");
    282282  }
    283   ZSync(*myMutex);
     283  ZSync zs(*myMutex); zs.NOp();
    284284  //  cout << " DEBUG::GetVar " << *myVars << endl;
    285285  return(myVars->GetS(key));
     
    290290{
    291291  //  cout << " DEBUG::GetVarList " << *myVars << endl;
    292   ZSync(*myMutex);
     292  ZSync zs(*myMutex); zs.NOp();
    293293  return(*myVars);
    294294}
     
    297297bool NamedObjMgr::CreateDir(string & dirname)
    298298{
    299   ZSync(*myMutex);
     299  ZSync zs(*myMutex); zs.NOp();
    300300  return CreateDir_P(dirname);
    301301}
     
    337337  return(false);
    338338  }
    339 ZSync(*myMutex);
     339ZSync zs(*myMutex); zs.NOp();
    340340NObjDirList::iterator it = myDirs->find(dirname);
    341341if (it == myDirs->end()) {
     
    369369void NamedObjMgr::LockDir(string & dirname)
    370370{
    371 ZSync(*myMutex);
     371ZSync zs(*myMutex); zs.NOp();
    372372if ( !CheckDirName(dirname) ) return;
    373373NObjDirList::iterator it = myDirs->find(dirname);
     
    381381void NamedObjMgr::UnlockDir(string & dirname)
    382382{
    383 ZSync(*myMutex);
     383ZSync zs(*myMutex); zs.NOp();
    384384if ( !CheckDirName(dirname) ) return;
    385385NObjDirList::iterator it = myDirs->find(dirname);
     
    393393void NamedObjMgr::SetKeepOldDirAtt(string & dirname, bool keepold)
    394394{
    395 ZSync(*myMutex);
     395ZSync zs(*myMutex); zs.NOp();
    396396if ( !CheckDirName(dirname) ) return;
    397397NObjDirList::iterator it = myDirs->find(dirname);
     
    409409bool NamedObjMgr::SetCurrentDir(string & dirname)
    410410{
    411 ZSync(*myMutex);
     411ZSync zs(*myMutex); zs.NOp();
    412412if ( !CheckDirName(dirname) ) {
    413413  cout << "NamedObjMgr::SetCurrentDir( " << dirname << ") Error - Invalid name !" << endl;
     
    427427void NamedObjMgr::GetCurrentDir(string & dirname)
    428428{
    429 ZSync(*myMutex);
     429ZSync zs(*myMutex); zs.NOp();
    430430dirname = *currDir;
    431431}
     
    434434void NamedObjMgr::ListDirs(string & patt)
    435435{
    436 ZSync(*myMutex);
     436ZSync zs(*myMutex); zs.NOp();
    437437NObjDirList::iterator it;
    438438string cn;
     
    454454void NamedObjMgr::GetDirList(string & patt, vector<string>& lstd)
    455455{
    456 ZSync(*myMutex);
     456ZSync zs(*myMutex); zs.NOp();
    457457NObjDirList::iterator it;
    458458string cn;
     
    467467void NamedObjMgr::CleanDir(string & dirname)
    468468{
    469 ZSync(*myMutex);
     469ZSync zs(*myMutex); zs.NOp();
    470470CleanDir_P(dirname);
    471471}
     
    533533bool NamedObjMgr::AddObj(AnyDataObj* obj, string & nom, bool crd)
    534534{
    535   ZSync(*myMutex);
     535  ZSync zs(*myMutex); zs.NOp();
    536536  return AddObj_P(obj, nom, crd);
    537537}
     
    625625bool NamedObjMgr::AddObj(AnyDataObj& obj, string & nom, bool crd)
    626626{
    627 ZSync(*myMutex);
     627ZSync zs(*myMutex); zs.NOp();
    628628NObjMgrAdapter* adap = GetServiceObj()->GetAdapter(&obj);
    629629if (adap == NULL) {
     
    643643bool NamedObjMgr::RenameObj(string & nom, string& nomnew)
    644644{
    645   ZSync(*myMutex);
     645  ZSync zs(*myMutex); zs.NOp();
    646646  return RenameObj_P(nom, nomnew);
    647647}
     
    710710bool NamedObjMgr::CopyObj(string & nom, string& nomcp)
    711711{
    712 ZSync(*myMutex);
     712ZSync zs(*myMutex); zs.NOp();
    713713if(nomcp.length()<=0)
    714714  {cout<<"NamedObjMgr::CopyObj() Error, copied obj name "<<nomcp<<" not valid"<<endl;
    715715  return(false);}
    716 NObjMgrAdapter* obnom = GetObjAdapter(nom);
     716NObjMgrAdapter* obnom = GetObjAdapter_P(nom);
    717717if(obnom==NULL)
    718718  {cout<<"NamedObjMgr::CopyObj() Error -  No "<<nom<<" object !"<<endl;
     
    727727bool NamedObjMgr::DelObj(string & nom, bool fgd)
    728728{
    729   ZSync(*myMutex);
     729  ZSync zs(*myMutex); zs.NOp();
    730730  return DelObj_P(nom, fgd);
    731731}
     
    778778bool NamedObjMgr::DelObj_Id(int oid)
    779779{
    780 ZSync(*myMutex);
     780ZSync zs(*myMutex); zs.NOp();
    781781NObjList::iterator it;
    782782string nom;
     
    794794void NamedObjMgr::DelObjects(string & patt, bool fgd)
    795795{
    796 ZSync(*myMutex);
     796ZSync zs(*myMutex); zs.NOp();
    797797string n1,r1;
    798798ParseObjectName(patt, r1, n1);
     
    812812AnyDataObj* NamedObjMgr::GetObj(string & nom)
    813813{
    814 ZSync(*myMutex);
     814ZSync zs(*myMutex); zs.NOp();
     815return GetObj_P(nom);
     816}
     817
     818/* --Methode-- */
     819AnyDataObj* NamedObjMgr::GetObj_P(string & nom)
     820{
    815821string n1,r1;
    816822ParseObjectName(nom, r1, n1);
     
    824830NObjMgrAdapter* NamedObjMgr::GetObjAdapter(string & nom)
    825831{
    826 ZSync(*myMutex);
     832ZSync zs(*myMutex); zs.NOp();
     833return GetObjAdapter_P(nom);
     834}
     835
     836/* --Methode-- */
     837NObjMgrAdapter* NamedObjMgr::GetObjAdapter_P(string & nom)
     838{
    827839string n1,r1;
    828840ParseObjectName(nom, r1, n1);
     
    836848void NamedObjMgr::ListObjs(string & patt)
    837849{
    838 ZSync(*myMutex);
     850ZSync zs(*myMutex); zs.NOp();
    839851int k;
    840852AnyDataObj* obj=NULL;
     
    865877void NamedObjMgr::GetObjList(string & patt, vector<string> &lst)
    866878{
    867 ZSync(*myMutex);
     879ZSync zs(*myMutex); zs.NOp();
    868880string n1,r1;
    869881if (patt.length() < 1)  return;
     
    901913void NamedObjMgr::ReadObj(string const & flnm, string & nobj)
    902914{
    903 ZSync(*myMutex);
     915ZSync zs(*myMutex); zs.NOp();
    904916PPersist* ppobj=NULL;
    905917bool ok = true;
     
    934946{
    935947if(flnm_objname.size()<2) return;
    936 ZSync(*myMutex);
     948ZSync zs(*myMutex); zs.NOp();
    937949int nread=0;
    938950try {
     
    963975void NamedObjMgr::ReadObj(PInPersist& s, int num)
    964976{
    965 ZSync(*myMutex);
     977ZSync zs(*myMutex); zs.NOp();
     978ReadObj_P(s, num);
     979}
     980
     981/* --Methode-- */
     982void NamedObjMgr::ReadObj_P(PInPersist& s, int num)
     983{
    966984int_4 i; // $CHECK$ int -> int_4 a cause de TagKey
    967985#ifdef SANS_EVOLPLANCK
     
    10461064void NamedObjMgr::ReadAll(string const & flnm)
    10471065{
    1048 ZSync(*myMutex);
     1066ZSync zs(*myMutex); zs.NOp();
    10491067#ifdef SANS_EVOLPLANCK
    10501068bool ok = true;
     
    10651083  AddObj_P(obj->DataObj(), nom, false);
    10661084  }
    1067 else ReadObj((*ppin), -1);
     1085else ReadObj_P((*ppin), -1);
    10681086delete ppin;
    10691087#else
     
    10771095      cout << " ... Reading " << pis.NbNameTags() << " objects at NameTags " ;
    10781096    }
    1079     ReadObj(pis, -1);
     1097    ReadObj_P(pis, -1);
    10801098    return;
    10811099  }
     
    11011119void NamedObjMgr::ReadFits(string const & flnm, string & nobj)
    11021120{
    1103 ZSync(*myMutex);
     1121ZSync zs(*myMutex); zs.NOp();
    11041122#ifdef SANS_EVOLPLANCK
    11051123bool ok = false;
     
    11611179void NamedObjMgr::SaveObj(string & nom, POutPersist& s, bool keeppath)
    11621180{
    1163   ZSync(*myMutex);
     1181  ZSync zs(*myMutex); zs.NOp();
    11641182  SaveObj_P(nom, s, keeppath);
    11651183}
     
    11751193NObjMgrAdapter* obja=NULL;
    11761194string nomf = (keeppath) ? nom : nob;
    1177 obja = GetObjAdapter(nom);
     1195obja = GetObjAdapter_P(nom);
    11781196if (obja == NULL)  return;
    11791197printf("NamedObjMgr::SaveObj(%s, )  (Type=%s) \n", 
     
    11861204void NamedObjMgr::SaveObjects(string & patt, string const& flnm)
    11871205{
    1188 ZSync(*myMutex);
     1206ZSync zs(*myMutex); zs.NOp();
    11891207string n1,r1;
    11901208if (patt.length() < 1)  return;
     
    12281246// dont le nom est le dernier argument (liste[n-1])
    12291247{
    1230  ZSync(*myMutex);
     1248 ZSync zs(*myMutex); zs.NOp();
    12311249
    12321250 if(liste.size()<2) {
     
    12601278void NamedObjMgr::SaveAll(string const& flnm)
    12611279{
    1262 ZSync(*myMutex);
     1280ZSync zs(*myMutex); zs.NOp();
    12631281bool ok = true;
    12641282
     
    12931311void NamedObjMgr::SaveFits(string& nom, string const & flnm)
    12941312{
    1295 ZSync(*myMutex);
     1313ZSync zs(*myMutex); zs.NOp();
    12961314
    12971315NObjMgrAdapter* obja=NULL;
    1298 obja = GetObjAdapter(nom);
     1316obja = GetObjAdapter_P(nom);
    12991317if (obja == NULL)  return;
    13001318cout << "  SaveFits: Object" << nom << " to FITS file " << flnm << endl;
     
    13081326void NamedObjMgr::PrintObj(string& nom)
    13091327{
    1310 ZSync(*myMutex);
     1328ZSync zs(*myMutex); zs.NOp();
    13111329NObjMgrAdapter* obja=NULL;
    1312 obja = GetObjAdapter(nom);
     1330obja = GetObjAdapter_P(nom);
    13131331if (obja == NULL)  return;
    13141332AnyDataObj* ob = obja->GetDataObj();
     
    13301348if ( (dopt == "nodisp") || (dopt == "nodisplay") ) return;
    13311349
    1332 ZSync(*myMutex);
     1350ZSync zs(*myMutex); zs.NOp();
    13331351
    13341352NObjMgrAdapter* obja=NULL;
    1335 obja = GetObjAdapter(nom);
     1353obja = GetObjAdapter_P(nom);
    13361354if (obja == NULL) {
    13371355  cout << "NamedObjMgr::DisplayObj() Error , No object with name " << nom << endl;
     
    13801398if ( (dopt == "nodisp") || (dopt == "nodisplay") ) return;
    13811399
    1382 ZSync(*myMutex);
     1400ZSync zs(*myMutex); zs.NOp();
    13831401
    13841402NObjMgrAdapter* obja=NULL;
    1385 obja = GetObjAdapter(nom);
     1403obja = GetObjAdapter_P(nom);
    13861404if (obja == NULL) {
    13871405  cout << "NamedObjMgr::DisplayImage() Error , No such object " << nom << endl;
     
    14201438if ( (dopt == "nodisp") || (dopt == "nodisplay") ) return;
    14211439
    1422 ZSync(*myMutex);
     1440ZSync zs(*myMutex); zs.NOp();
    14231441
    14241442NObjMgrAdapter* obja=NULL;
    1425 obja = GetObjAdapter(nom);
     1443obja = GetObjAdapter_P(nom);
    14261444if (obja == NULL) {
    14271445  cout << "NamedObjMgr::DisplaySurf3D() Error , No such object " << nom << endl;
     
    14701488if ( (dopt == "nodisp") || (dopt == "nodisplay") ) return;
    14711489
    1472 ZSync(*myMutex);
    1473 
    1474 AnyDataObj* obj=GetObj(nom);
     1490ZSync zs(*myMutex); zs.NOp();
     1491
     1492AnyDataObj* obj=GetObj_P(nom);
    14751493if (obj == NULL) {
    14761494  cout << "NamedObjMgr::DisplayNT() Error , No such object " << nom << endl;
     
    15361554if ( (dopt == "nodisp") || (dopt == "nodisplay") ) return;
    15371555
    1538 ZSync(*myMutex);
    1539 
    1540 AnyDataObj* obj=GetObj(nom);
     1556ZSync zs(*myMutex); zs.NOp();
     1557
     1558AnyDataObj* obj=GetObj_P(nom);
    15411559if(obj == NULL)
    15421560  {cout << "NamedObjMgr::DisplayGFD() Error , No such object " << nom << endl;
     
    15921610if ( (dopt == "nodisp") || (dopt == "nodisplay") ) return;
    15931611
    1594 ZSync(*myMutex);
     1612ZSync zs(*myMutex); zs.NOp();
    15951613
    15961614#ifdef SANS_EVOLPLANCK
     
    16011619
    16021620AnyDataObj* obj;
    1603 obj = GetObj(nomvx);
     1621obj = GetObj_P(nomvx);
    16041622if(obj == NULL) {
    16051623  cout << "NamedObjMgr::DisplayVector() Error , No such object " << nomvx << endl;
     
    16131631}
    16141632
    1615 obj = GetObj(nomvy);
     1633obj = GetObj_P(nomvy);
    16161634if(obj == NULL) {
    16171635  cout << "NamedObjMgr::DisplayVector() Error , No such object " << nomvy << endl;
     
    17061724{
    17071725if (!myImgApp)  return;
    1708 ZSync(*myMutex);
     1726ZSync zs(*myMutex); zs.NOp();
    17091727if ( !_fgimgapp )  myImgApp->LockMutex();
    17101728
  • trunk/SophyaPI/PIext/nobjmgr.h

    r2669 r2755  
    116116  virtual bool          RenameObj_P(string & nom, string& nomnew);
    117117  virtual bool          DelObj_P(string & nom, bool fgd=true);
     118  virtual AnyDataObj*   GetObj_P(string & nom);
     119  virtual NObjMgrAdapter*       GetObjAdapter_P(string & nom);
     120  virtual void          ReadObj_P(PInPersist& s, int num=-1);
    118121  virtual void          SaveObj_P(string & nom, POutPersist& s, bool keeppath=false);
    119122
  • trunk/SophyaPI/PIext/pawexecut.cc

    r2709 r2755  
    319319} else return(1);
    320320}
     321
     322/* methode */
     323bool PAWExecutor::IsThreadable(string const & keyw)
     324{
     325  if ( (keyw == "n/plot")  || (keyw == "n/pl") ||
     326       (keyw == "n/proj") )  return true;
     327  else return false;
     328}
     329
    321330
    322331/* methode */
     
    435444}
    436445
     446
    437447/* methode */
    438448void PAWExecutor::n_proj(vector<string>& tokens)
     
    630640}
    631641
     642
    632643/* methode */
    633644#define __LENLINE_N_READ__ 8192
  • trunk/SophyaPI/PIext/pawexecut.h

    r2707 r2755  
    1919  virtual     ~PAWExecutor();
    2020  virtual int Execute(string& keyw, vector<string>& args, string& toks);
     21  virtual bool  IsThreadable(string const & keyw);
     22
    2123protected:
    2224  void  reset(vector<string>& tokens);
  • trunk/SophyaPI/PIext/piacmd.cc

    r2677 r2755  
    366366  Commander::SetCurrentPrompt(pr);
    367367  if (mImgApp) {
    368     ZSync(mImgApp->getMutex());
     368    ZSync zs(mImgApp->getMutex()); zs.NOp();
    369369    mImgApp->GetConsole()->SetPrompt(pr);
    370370  }
     
    378378  char va = (att == 0) ? 0 : PIVA_Magenta;
    379379  if (mImgApp) {
    380     ZSync(mImgApp->getMutex());
     380    ZSync(mImgApp->getMutex()); zs.NOp();
    381381    mImgApp->GetConsole()->AddStr(msg, va);
    382382  }
  • trunk/SophyaPI/PIext/pintuple.cc

    r2690 r2755  
    198198npolyg = 0;
    199199NptDraw = 0;
     200
     201// Mai 2005: Correction bug trace des lignes avec le pts en dehors de la zone (Reza)
     202// flags pour la gestion des points/lignes a tracer
     203bool fgokcurpt = true;  // Point courant dans la zone a tracer
     204bool fgoklastpt = true;   // Le dernier point etait dans la zone a tracer
    200205for (long i=0; i<(long)mNT->NbLines(); i++) {
    201   xl = xp;  yl = yp;
     206  xl = xp;  yl = yp; fgoklastpt = fgokcurpt;
     207
    202208  xp = mNT->GetCell(i, xK);
    203209  yp = mNT->GetCell(i, yK);
    204   if ( (xp < xmin2) || (xp > xmax2) || (yp < ymin2) || (yp > ymax2) )  continue;
    205   nok++;
    206   if ( (xp < xmin) || (xp > xmax) || (yp < ymin) || (yp > ymax) )  continue;
    207 
    208   NptDraw++;
     210
     211  // Comptage du nombre de pts dans la zone graphique du widget
     212  if ( !((xp < xmin2) || (xp > xmax2) || (yp < ymin2) || (yp > ymax2)) )  nok++;
     213  // Gestion des limites a tracer
     214  fgokcurpt = true;
     215  if ( (xp < xmin) || (xp > xmax) || (yp < ymin) || (yp > ymax) ) fgokcurpt = false;
     216  else NptDraw++;
     217
    209218// Taille - couleur de marker en fonction du poids
    210   if (wK >= 0) wp = mNT->GetCell(i, wK);
    211   if (mrkSzScale && (wK >= 0)) {  // Changement de taille
     219  if ( fgokcurpt &&(wK >= 0) ) wp = mNT->GetCell(i, wK);
     220  if ( fgokcurpt && mrkSzScale && (wK >= 0) ) {  // Changement de taille
    212221    sz = (int)((wp-wMin)/dw);
    213222    if (sz < 0) sz = 0;
     
    218227  }
    219228// Couleur du marker en fonction du poids
    220   if( colorScale && (wK >= 0) && cmap ) {
     229  if( fgokcurpt && colorScale && (wK >= 0) && cmap ) {
    221230    int cid = (int)((wp-wMin)/dwc);
    222231    if (cid < 0) cid = 0;
     
    227236  // Trace d'une ligne reliant les points
    228237  if( connectPts ) {
    229     if((npolyg==0) && (i>0)) {xpolyg[0]=xl; ypolyg[0]=yl; npolyg=1;}
    230     if(npolyg<NMXMULTP_LOCAL)
     238    // On initialise le polygone avec le dernier point, si ce dernier ok
     239    if((npolyg==0) && (i>0) && fgokcurpt) {xpolyg[0]=xl; ypolyg[0]=yl; npolyg=1;}
     240    // On ajoute le point courant au polygone - sauf si celui-ci est vide
     241    if((npolyg<NMXMULTP_LOCAL) && (npolyg>0))
    231242      {xpolyg[npolyg]=xp; ypolyg[npolyg]=yp; npolyg++;}
    232     if(npolyg==NMXMULTP_LOCAL)
     243    // On trace le polygone s'il est plein - ou le point courant en dehors
     244    // (point courant en dehors -> discontinuite de la ligne
     245    if( !fgokcurpt || (npolyg==NMXMULTP_LOCAL) )
    233246      {g->DrawPolygon(xpolyg,ypolyg,npolyg,false); npolyg=0;}
    234247  }
    235248
     249  // Plus rien a faire si point en dehors -- on s'en va
     250  if (!fgokcurpt)  continue;
     251
    236252  // Trace des erreurs selon X et Y
    237   if ( xebK >= 0 ) {
     253  if (xebK >= 0) {
    238254    xer = mNT->GetCell(i, xebK);
    239255    if(xer>0.) g->DrawLine(xp-xer, yp, xp+xer, yp);
    240256  }
    241   if ( yebK >= 0 ) {
     257  if (yebK >= 0) {
    242258    yer = mNT->GetCell(i, yebK);
    243259    if(yer>0.) g->DrawLine(xp, yp-yer, xp, yp+yer);
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r2701 r2755  
    10351035{
    10361036// <ZThread> global PIApplication event loop synchronisation
    1037 ZSync zs(thr_glsyn, 2); 
     1037ZSync zs(thr_glsyn, 2);  zs.NOp();
    10381038
    10391039PIDrawer *eld=CurrentElDrawer();
     
    10621062{
    10631063// <ZThread> global PIApplication event loop synchronisation
    1064 ZSync zs(thr_glsyn, 2); 
     1064ZSync zs(thr_glsyn, 2);  zs.NOp();
    10651065
    10661066PIDrawer *eld=CurrentElDrawer();
     
    10901090{
    10911091// <ZThread> global PIApplication event loop synchronisation
    1092 ZSync zs(thr_glsyn, 2); 
     1092ZSync zs(thr_glsyn, 2);  zs.NOp();
    10931093
    10941094PIDrawer *eld=CurrentElDrawer();
     
    11161116{
    11171117// <ZThread> global PIApplication event loop synchronisation
    1118 ZSync zs(thr_glsyn, 2); 
     1118ZSync zs(thr_glsyn, 2);  zs.NOp();
    11191119
    11201120PIDrawer *eld=CurrentElDrawer();
     
    11561156{
    11571157// <ZThread> global PIApplication event loop synchronisation
    1158 ZSync zs(thr_glsyn, 2); 
     1158ZSync zs(thr_glsyn, 2);  zs.NOp();
    11591159
    11601160PIDrawer *eld=CurrentElDrawer();
     
    11831183{
    11841184// <ZThread> global PIApplication event loop synchronisation
    1185 ZSync zs(thr_glsyn, 2); 
     1185ZSync zs(thr_glsyn, 2);  zs.NOp();
    11861186
    11871187PIDrawer *eld=CurrentElDrawer();
     
    12091209{
    12101210// <ZThread> global PIApplication event loop synchronisation
    1211 ZSync zs(thr_glsyn, 2); 
     1211ZSync zs(thr_glsyn, 2);  zs.NOp();
    12121212
    12131213PIDrawer *eld=CurrentElDrawer();
     
    12331233{
    12341234// <ZThread> global PIApplication event loop synchronisation
    1235 ZSync zs(thr_glsyn, 2); 
     1235ZSync zs(thr_glsyn, 2);  zs.NOp();
    12361236
    12371237PIDrawer *eld=CurrentElDrawer();
     
    12591259{
    12601260// <ZThread> global PIApplication event loop synchronisation
    1261 ZSync zs(thr_glsyn, 2); 
     1261ZSync zs(thr_glsyn, 2);  zs.NOp();
    12621262
    12631263PIDrawer *eld=CurrentElDrawer();
     
    12861286{
    12871287// <ZThread> global PIApplication event loop synchronisation
    1288 ZSync zs(thr_glsyn, 2); 
     1288ZSync zs(thr_glsyn, 2);  zs.NOp();
    12891289
    12901290PIDrawer *eld=CurrentElDrawer();
     
    13121312{
    13131313// <ZThread> global PIApplication event loop synchronisation
    1314 ZSync zs(thr_glsyn, 2); 
     1314ZSync zs(thr_glsyn, 2);  zs.NOp();
    13151315
    13161316PIDrawer *eld=CurrentElDrawer();
  • trunk/SophyaPI/PIext/servnobjm.cc

    r2681 r2755  
    107107if (!mImgapp)  return;
    108108
     109// Pour synchronisation d'execution simultanee
     110ZSync zs(mutx_dynlink, 2);  zs.NOp(); // 2 -> broadcast lors de la destruction
     111
    109112cmd = "rm -f " + fname;
    110113rc = system(cmd.c_str());
     
    141144
    142145if (!mImgapp)  return;
     146// Pour synchronisation d'execution simultanee
     147ZSync zs(mutx_dynlink, 2);  zs.NOp(); // 2 -> broadcast lors de la destruction
    143148
    144149cmd = "rm " + fname;
     
    170175                                       double xmin, double xmax, int np, string dopt)
    171176{
     177// Pour synchronisation d'execution simultanee
     178ZSync zs(mutx_dynlink, 2);  zs.NOp(); // 2 -> broadcast lors de la destruction
    172179DlFunctionOfX f = (DlFunctionOfX) LinkFunctionFromFile(fname, func);
    173180if (!f) return;
     
    181188                                         double xmin, double xmax, double ymin, double ymax, int npx, int npy, string dopt)
    182189{
     190// Pour synchronisation d'execution simultanee
     191ZSync zs(mutx_dynlink, 2);  zs.NOp(); // 2 -> broadcast lors de la destruction
    183192DlFunctionOfXY f = (DlFunctionOfXY) LinkFunctionFromFile(fname, func);
    184193if (!f)  return;
     
    884893  }
    885894
     895// Pour synchronisation d'execution simultanee
     896ZSync zs(mutx_dynlink, 2);  zs.NOp(); // 2 -> broadcast lors de la destruction
     897
    886898NTLoopExprFunc f = (NTLoopExprFunc)LinkFunctionFromFile(fname, funcname);
    887899if (!f) {
     
    11771189if (objnt == NULL)  return;
    11781190string  vardec = objnt->VarList_C("_zz6qi_");
     1191
     1192// Pour synchronisation d'execution simultanee
     1193ZSync zs(mutx_dynlink, 2);  zs.NOp(); // 2 -> broadcast lors de la destruction
    11791194
    11801195PlotExprFunc f = LinkExprFunc(vardec, expx, expy, expz, expt, expcut);
  • trunk/SophyaPI/PIext/servnobjm.h

    r2491 r2755  
    1717#include "dlftypes.h"
    1818#include "anydataobj.h"
     19
     20#include "zthread.h"
    1921
    2022#ifdef SANS_EVOLPLANCK
     
    135137  PDynLinkMgr * dynlink;  // shared-lib lib.so
    136138  string TmpDir;          // Pour fichiers temporaires
     139  // Mutex de controle de thread pour dynamic-link
     140  ZMutex mutx_dynlink;
    137141
    138142  PIStdImgApp* mImgapp;
    139143  NamedObjMgr* mOmg;
     144
    140145 
    141146};
Note: See TracChangeset for help on using the changeset viewer.