Back to index

salome-kernel  6.5.0
Defines | Functions | Variables
SALOMEDSImpl_Study.cxx File Reference
#include "SALOMEDSImpl_Study.hxx"
#include <string.h>
#include <KERNEL_version.h>
#include <Basics_Utils.hxx>
#include "DF_Application.hxx"
#include "DF_ChildIterator.hxx"
#include "SALOMEDSImpl_ChildNodeIterator.hxx"
#include "SALOMEDSImpl_Attributes.hxx"
#include "SALOMEDSImpl_UseCaseIterator.hxx"
#include "SALOMEDSImpl_AttributeReference.hxx"
#include "SALOMEDSImpl_StudyHandle.hxx"
#include "SALOMEDSImpl_Tool.hxx"
#include "SALOMEDSImpl_IParameters.hxx"
#include "SALOMEDSImpl_ScalarVariable.hxx"
#include <fstream>
#include <sstream>

Go to the source code of this file.

Defines

#define WITHOUT_TABS
#define DIRECTORYID   16661
#define FILELOCALID   26662
#define FILEID   "FILE: "
#define VARIABLE_SEPARATOR   ':'
#define OPERATION_SEPARATOR   '|'

Functions

static std::string replace_tabs (const std::string &in)
static std::string GetComponentHeader (const char *theComponentName)
void dumpSO (const SALOMEDSImpl_SObject &theSO, std::fstream &fp, const std::string &Tab, SALOMEDSImpl_Study *theStudy)

Variables

static const int indent_size = 2
 number of spaces for indentation in Python dump files (to replace symbols)

Define Documentation

#define DIRECTORYID   16661

Definition at line 51 of file SALOMEDSImpl_Study.cxx.

#define FILEID   "FILE: "

Definition at line 53 of file SALOMEDSImpl_Study.cxx.

#define FILELOCALID   26662

Definition at line 52 of file SALOMEDSImpl_Study.cxx.

#define OPERATION_SEPARATOR   '|'

Definition at line 55 of file SALOMEDSImpl_Study.cxx.

#define VARIABLE_SEPARATOR   ':'

Definition at line 54 of file SALOMEDSImpl_Study.cxx.

#define WITHOUT_TABS

Definition at line 49 of file SALOMEDSImpl_Study.cxx.


Function Documentation

void dumpSO ( const SALOMEDSImpl_SObject &  theSO,
std::fstream &  fp,
const std::string &  Tab,
SALOMEDSImpl_Study *  theStudy 
)

Definition at line 1470 of file SALOMEDSImpl_Study.cxx.

{
  std::string aTab(Tab), anID(theSO.GetID());
  fp << aTab << anID << std::endl;
  std::vector<DF_Attribute*> attribs = theSO.GetLabel().GetAttributes();
  for(int i = 0; i<attribs.size(); i++) {
    SALOMEDSImpl_GenericAttribute* anAttr = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(attribs[i]);

    if(!anAttr) {
      continue;
    }

    std::string aType = anAttr->GetClassType();
    fp << Tab << "  -- " << aType;

    if(aType == std::string("AttributeReal")) {
      fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeReal*>(anAttr)->Value();
    }
    else if(aType == std::string("AttributeInteger")) {
      fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeInteger*>(anAttr)->Value();
    }
    else if(aType ==  std::string("AttributeName")) {
      fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeName*>(anAttr)->Value();
    }
    else if(aType == std::string("AttributeComment")) {
      fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeComment*>(anAttr)->Value();
    }
    else if(aType == std::string("AttributeReference")) {
      fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeReference*>(anAttr)->Save();
    }
    fp << std::endl;
  }

  SALOMEDSImpl_ChildIterator Itr = theStudy->NewChildIterator(theSO);
  std::string aNewTab("   ");
  aNewTab+=aTab;
  for(; Itr.More(); Itr.Next()) {
    dumpSO(Itr.Value(), fp, aNewTab, theStudy);
  }

  return;
}
static std::string GetComponentHeader ( const char *  theComponentName) [static]

Definition at line 1192 of file SALOMEDSImpl_Study.cxx.

{
  std::stringstream txt;
  txt << "###" << std::endl;
  txt << "### " << theComponentName << " component" << std::endl;
  txt << "###" << std::endl;
  return txt.str();
}
static std::string replace_tabs ( const std::string &  in) [static]

Definition at line 1179 of file SALOMEDSImpl_Study.cxx.

{
  std::string out = in;
#ifdef WITHOUT_TABS
  size_t pos = out.find( '\t' );
  while ( pos != std::string::npos ) {
    out.replace( pos, 1, indent_size, ' ' );
    pos = out.find( '\t' );
  }
#endif
  return out;
}

Variable Documentation

const int indent_size = 2 [static]

number of spaces for indentation in Python dump files (to replace symbols)

Definition at line 1177 of file SALOMEDSImpl_Study.cxx.