source: PSPA/Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc @ 485

Last change on this file since 485 was 485, checked in by lemeur, 10 years ago

liste des logiciels compatibles dans les tooltip des elements

File size: 2.1 KB
Line 
1#include "abstractSoftware.h"
2#include "dataManager.h"
3#include <algorithm>
4#include <iostream>
5
6abstractSoftware::abstractSoftware()
7{
8  dataManager_ = NULL;
9  nameOfSoftware_ =  new nomDeLogiciel("unknownSoftware");
10}
11
12abstractSoftware::abstractSoftware(string inputFileName, sectionToExecute* sect, dataManager* data)
13{
14  inputFileName_ = inputFileName;
15  sectionToExecute_ = sect;
16  dataManager_ = data;
17  nameOfSoftware_ = new nomDeLogiciel("unknownSoftware");
18}
19
20
21// void abstractSoftware::registerElement(nomdElements::typedElement nomdel,trivaluedBool b)
22// {
23//   //  std::cout << " abstractSoftware::registerElement soft : " << nameOfSoftware_.getString() << std::endl;
24//   if (b == TBoolIgnore) {
25//     //    std::cout << " abstractSoftware::registerElement j'enregistre element " <<  nomdel << "   ignore " << std::endl;
26//     ignoredElements_.push_back(nomdel);
27//   } else if (b == TBoolOk) {
28//     //    std::cout << " abstractSoftware::registerElement j'enregistre element " <<  nomdel << "  OK " << std::endl;
29//     acceptedElements_.push_back(nomdel);
30//   }
31// }
32
33// trivaluedBool abstractSoftware::doAcceptElement(nomdElements::typedElement typdel)
34// {
35
36//   //xx
37//   if (acceptedElements_.size() == 0 && nameOfSoftware_ != nomDeLogiciel::unknownSoftware) {
38//     return TBoolError;
39//   }
40
41//   if (std::find(acceptedElements_.begin(),acceptedElements_.end(),typdel) != acceptedElements_.end()) {
42//     return TBoolOk;
43//   }
44
45//   if (ignoredElements_.size() == 0) {
46//     return TBoolError;
47//   }
48
49//   if (std::find(ignoredElements_.begin(),ignoredElements_.end(),typdel) != ignoredElements_.end()) {
50//     return TBoolIgnore;
51//   }
52
53//   return TBoolOk;
54// }
55
56bool abstractSoftware::launchJob(string commandLine, string& resul)
57{
58  bool ExecuteStatus = true;
59
60  FILE* pp = popen(commandLine.c_str(), "r");
61  ostringstream sortie;
62  if (pp == NULL) {
63    sortie << " launching failed : " << commandLine << endl;
64    ExecuteStatus = false;
65  } else {
66    // on copie la sortie dans le fichier assigne
67    char buf[132];
68    while (fgets(buf, sizeof buf, pp))
69      {
70        sortie << buf;
71      }
72    pclose(pp);
73  }
74  resul =  sortie.str();
75  return ExecuteStatus;
76}
Note: See TracBrowser for help on using the repository browser.