Salome HOME
Light Cleaning up
authorbri <bri@opencascade.com>
Mon, 10 Feb 2014 13:55:36 +0000 (17:55 +0400)
committerbri <bri@opencascade.com>
Mon, 10 Feb 2014 13:55:36 +0000 (17:55 +0400)
src/SimanIO_Link.cxx
src/old_CMakeLists.txt [deleted file]
src/old_SimanIO_Configuration.cxx [deleted file]

index d460a517841bfd4fd166eaddd9614eedc1933c7e..dc5dfc0efb5ccec9bdad35f3dd12ffc9a3addda6 100644 (file)
@@ -140,10 +140,10 @@ SimanIO_Configuration SimanIO_Link::RetrieveConf()
         string aFileName = aURL.substr(aURL.find_last_of("/\\")+1);
         
         //cout << "aURL = " << "http://" << aSimanWSHost << "/repository/" << aURL << "\n";
-        string aPathToVault = aResponseFilePath.substr(0, aResponseFilePath.find("download")) + "vault\\";
+        string aPathToVault = aResponseFilePath.substr(0, aResponseFilePath.find("download")) + "vault/";
         
         //only for test only for WIN
-        replace(aURL.begin(),aURL.end(),'/','\\');
+        //replace(aURL.begin(),aURL.end(),'/','\\');
         //end only for test only for WIN
         
         //cout << "Path to vault" << aPathToVault + aURL << "\n";
diff --git a/src/old_CMakeLists.txt b/src/old_CMakeLists.txt
deleted file mode 100644 (file)
index 2e2100f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-project(SimanSrc CXX)
-
-set(SimanSrc_SRCS SimanIO_Activity.cxx SimanIO_Configuration.cxx SimanIO_Document.cxx SimanIO_Link.cxx)
-set(SimanSrc_HEADERS SimanIO_Activity.hxx SimanIO_Configuration.hxx SimanIO_Document.hxx SimanIO_Link.hxx)
-include_directories($(PROJECT_SOURCE_DIR))
-
-add_library(SimanIO SHARED ${SimanSrc_SRCS} ${SimanSrc_HEADERS})
-
-install(TARGETS SimanIO DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
-install(FILES ${SimanSrc_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
diff --git a/src/old_SimanIO_Configuration.cxx b/src/old_SimanIO_Configuration.cxx
deleted file mode 100644 (file)
index d011a60..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-#include <SimanIO_Configuration.hxx>
-
-#include <stdlib.h>
-
-// maximum length of the line in the parsed conf file
-const int MAX_BUFFER_SIZE=10000;
-
-using namespace std;
-
-SimanIO_Configuration::SimanIO_Configuration()
-{
-}
-
-///! Returns true is the given symbol is white space
-static bool IsWhite(const char theSym) {
-  return theSym == ' ' || theSym == '\t';
-}
-
-///! Returns true if theLine starts with theCommand, returns in theVal rest part of the line in this case
-static bool IsCommand(const char* theCommand, char* theLine, char*& theVal) {
-  string aLine(theLine);
-  char* aComPtr = (char*)theCommand;
-  theVal = theLine;
-  while(*aComPtr != 0 && *theVal != 0) {
-    if (IsWhite(*aComPtr)) { // skip white spaces in the command line
-      aComPtr++;
-      continue;
-    }
-    if (IsWhite(*theVal)) { // skip white spaces in the processed line
-      theVal++;
-      continue;
-    }
-     //cout<<"Compare symbols "<<tolower(*aComPtr)<<" and "<<tolower(*theVal)<<endl;
-    if (tolower(*aComPtr) != tolower(*theVal)) // symbols are not match (case is not significant)
-      break;
-    aComPtr++;
-    theVal++;
-  }
-  if (*aComPtr == 0) { // command has been found
-    while(*theVal != 0 && IsWhite(*theVal)) { // skip white spaces in the processed line
-      theVal++;
-    }
-    return true;
-  }
-  return false;
-}
-
-///! Converts string to the integer value, or returns the default vaule if failed
-static int toInt(const char* theStr, int theDefault) {
-  int aResult;
-  try {
-    aResult = atol(theStr);
-  } catch(...) {
-    aResult = theDefault;
-  }
-  return aResult;
-}
-
-// unification of the error handling in the Parse method
-#define PARSE_ERROR(condition, message) if (condition) {cerr<<message<<endl; return false;}
-
-bool SimanIO_Configuration::Parse(const char* theConfFileName)
-{
-  ifstream f(theConfFileName);
-  myF = &f;
-  PARSE_ERROR(!f.good(), "Can not read conf file "<<theConfFileName)
-  char aBuffer[MAX_BUFFER_SIZE];
-  myBuffer = aBuffer; // buffer for one line reading
-  myReuseLine = false; // to read current line from the file
-  char* aVal; // value in line, that is located after the identifier of the command
-  while(!f.eof()) {
-    ReadLine();
-    if (IsCommand("Study ID :", myBuffer, aVal)) {
-      // skip study ID: this info is known in Link
-    } else if (IsCommand("Scenario ID :", myBuffer, aVal)) {
-      // skip scenario ID: this info is known in Link
-    } else if (IsCommand("User ID :", myBuffer, aVal)) {
-      // skip user ID: this info is known in Link
-    } else if (IsCommand("Activity", myBuffer, aVal)) {
-      if (!ParseActivity(aVal)) return false;
-    } else {
-      PARSE_ERROR(true, "Invalid line of conf file: '"<<myBuffer<<"'");
-    }
-  }
-  return true;
-}
-
-bool SimanIO_Configuration::ParseActivity(char* aName)
-{
-  SimanIO_Activity aNewActivity;
-  aNewActivity.SetName(aName);
-  int activityID = -1; // to be imported later
-  char* aVal; // value in line, that is located after the identifier of the command
-  while(!myF->eof()) {
-    ReadLine();
-    if (IsCommand("Activity ID :", myBuffer, aVal)) {
-      PARSE_ERROR(activityID != -1, "Duplicated activity identifier '"<<myBuffer<<"'");
-      activityID = toInt(aVal, -1);
-      PARSE_ERROR(activityID < 1, "Invalid activity identifier '"<<aVal<<"'");
-    } else if (IsCommand("Module :", myBuffer, aVal)) { // read only if module not yet imported before
-      PARSE_ERROR(aNewActivity.Module()[0] != 0, "Duplicated module name in '"<<myBuffer<<"'")
-      PARSE_ERROR(aVal[0] == 0, "Invalid module name in '"<<myBuffer<<"'")
-      aNewActivity.SetModule(aVal);
-    } else if (IsCommand("Document :", myBuffer, aVal)) {
-      if (!ParseDocument(aVal, aNewActivity)) return false;
-    } else { // unknown command will be processed in higher level method
-      myReuseLine = true;
-      break;
-    }
-  }
-  PARSE_ERROR(activityID == -1, "Activity '"<<aNewActivity.Name()<<"' ID is not defined");
-  PARSE_ERROR(aNewActivity.Module()[0] == 0, "Module of the activity '"<<aNewActivity.Name()<<"' is not defined");
-  AddActivity(aNewActivity, activityID);
-  return true;
-}
-
-bool SimanIO_Configuration::ParseDocument(char* aName, SimanIO_Activity& theActivity)
-{
-  SimanIO_Document aNewDocument;
-  aNewDocument.SetName(aName);
-  int aDocID = -1; // to be imported later
-  char* aVal; // value in line, that is located after the identifier of the command
-  while(!myF->eof()) {
-    ReadLine();
-    if (IsCommand("Document ID :", myBuffer, aVal)) {
-      PARSE_ERROR(aDocID != -1, "Duplicated document identifier '"<<myBuffer<<"'");
-      aDocID = toInt(aVal, -1);
-      PARSE_ERROR(aDocID < 1, "Invalid document identifier '"<<aVal<<"'");
-    } else if (IsCommand("Source file:", myBuffer, aVal) || IsCommand("Result file:", myBuffer, aVal)) {
-      if (!ParseFile(aNewDocument)) return false;
-    } else { // unknown command will be processed in higher level method
-      myReuseLine = true;
-      break;
-    }
-  }
-  PARSE_ERROR(aDocID == -1, "Document '"<<aNewDocument.Name()<<"' ID is not defined");
-  theActivity.AddDocument(aDocID, aNewDocument);
-  return true;
-}
-
-bool SimanIO_Configuration::ParseFile(SimanIO_Document& theDocument)
-{
-  SimanIO_File aNewFile;
-  aNewFile.id = -1;
-  int aDocID = -1; // to be imported later
-  char* aVal; // value in line, that is located after the identifier of the command
-  
-  // current line contains one of the next two commands
-  if (IsCommand("Result file :", myBuffer, aVal)) {
-    aNewFile.result = true;
-    aNewFile.url = aVal;
-  } else if (IsCommand("Source file :", myBuffer, aVal)) {
-    aNewFile.result = false;
-    aNewFile.url = aVal;
-  }
-  PARSE_ERROR(aNewFile.url.empty(), "File '"<<myBuffer<<"' has invalid URL");
-  while(!myF->eof()) {
-    ReadLine();
-    if (IsCommand("Automatic processing :", myBuffer, aVal)) {
-      char* aVal2;
-      if (IsCommand("file-download", aVal, aVal2)) aNewFile.proc = FILE_DOWNLOAD;
-      else if (IsCommand("file-import", aVal, aVal2)) aNewFile.proc = FILE_IMPORT;
-      else PARSE_ERROR(true, "Invalid automatic processing value '"<<aVal<<"'");
-    } else if (IsCommand("State :", myBuffer, aVal)) {
-      char* aVal2;
-      if (IsCommand("file-actual", aVal, aVal2)) aNewFile.state = FILE_ACTUAL;
-      else if (IsCommand("file-outdated", aVal, aVal2)) aNewFile.state = FILE_OUTDATED;
-      else PARSE_ERROR(true, "Invalid state value '"<<aVal<<"'");
-    } else if (IsCommand("File ID :", myBuffer, aVal)) {
-      PARSE_ERROR(aNewFile.id != -1, "Duplicated file identifier '"<<myBuffer<<"'");
-      aNewFile.id = toInt(aVal, -1);
-      PARSE_ERROR(aNewFile.id < 0, "Invalid file identifier '"<<aVal<<"'");
-    } else { // unknown command will be processed in higher level method
-      myReuseLine = true;
-      break;
-    }
-  }
-  PARSE_ERROR(aNewFile.id < 0, "File '"<<aNewFile.url<<"' ID is not defined");
-  theDocument.AddFile(aNewFile);
-  return true;
-}
-
-int SimanIO_Configuration::AddActivity(const SimanIO_Activity& theActivity, const int theId)
-{
-  int anId = theId;
-  if (theId < 0) { // generate the maximum unique Id
-    if (myActivities.empty()) anId = 1; // the first
-    else {
-      anId = myActivities.rbegin()->first + 1; // take the maximum Id plus one (in map integers are ordered)
-    }
-  }
-  myActivities[anId] = theActivity;
-}
-
-SimanIO_Activity& SimanIO_Configuration::GetOrCreateActivity(const int theId)
-{
-  if (myActivities.find(theId) == myActivities.end()) {
-    myActivities[theId] = SimanIO_Activity();
-  }
-  return myActivities[theId];
-}
-
-void SimanIO_Configuration::ReadLine() {
-  if (myReuseLine) { // reuse current line
-    myReuseLine = false;
-    return;
-  }
-  do {
-    myF->getline(myBuffer, MAX_BUFFER_SIZE - 1);
-  } while(!myF->eof() && myBuffer[0] == 0); // continue if there is empty line
-}
-
-/////////////////////////////////// iterator methods ///////////////////////////
-
-SimanIO_Configuration::ActivitiesIterator::ActivitiesIterator(SimanIO_Configuration& theConf)
-{
-  myIter = theConf.myActivities.begin();
-  myEnd = theConf.myActivities.end();
-}
-
-void SimanIO_Configuration::ActivitiesIterator::Next()
-{
-  myIter++;
-}
-
-bool SimanIO_Configuration::ActivitiesIterator::More()
-{
-  return myIter != myEnd;
-}
-
-const int SimanIO_Configuration::ActivitiesIterator::ActivityId()
-{
-  return myIter->first;
-}
-
-SimanIO_Activity& SimanIO_Configuration::ActivitiesIterator::Activity()
-{
-  return myIter->second;
-}