Back to index

salome-med  6.5.0
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes
Med_Gen_Driver_i Class Reference

#include <Med_Gen_Driver_i.hxx>

Inheritance diagram for Med_Gen_Driver_i:
Inheritance graph
[legend]
Collaboration diagram for Med_Gen_Driver_i:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Med_Gen_Driver_i (CORBA::ORB_ptr orb)
 standard constructor
virtual ~Med_Gen_Driver_i ()
 Destructor.
SALOMEDS::TMPFile * Save (SALOMEDS::SComponent_ptr theComponent, const char *theURL, bool isMultiFile)
 Save data published under MED component.
SALOMEDS::TMPFile * SaveASCII (SALOMEDS::SComponent_ptr theComponent, const char *theURL, bool isMultiFile)
 Save data published under MED component in ASCII file.
CORBA::Boolean Load (SALOMEDS::SComponent_ptr theComponent, const SALOMEDS::TMPFile &theStream, const char *theURL, bool isMultiFile)
 CORBA: Load Mesh objects (called when an existing study is opened)
CORBA::Boolean LoadASCII (SALOMEDS::SComponent_ptr theComponent, const SALOMEDS::TMPFile &theStream, const char *theURL, bool isMultiFile)
void Close (SALOMEDS::SComponent_ptr theComponent)
 CORBA:
char * IORToLocalPersistentID (SALOMEDS::SObject_ptr theSObject, const char *IORString, CORBA::Boolean isMultiFile, CORBA::Boolean isASCII)
 CORBA: give a persistent reference of a transient object (for study save)
char * LocalPersistentIDToIOR (SALOMEDS::SObject_ptr theSObject, const char *aLocalPersistentID, CORBA::Boolean isMultiFile, CORBA::Boolean isASCII) throw (SALOME::SALOME_Exception)
 CORBA: give a transient reference (when loading an object, opening study)
bool CanPublishInStudy (CORBA::Object_ptr theIOR)
 returns true, if can publish object
SALOMEDS::SObject_ptr PublishInStudy (SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject, CORBA::Object_ptr theObject, const char *theName) throw (SALOME::SALOME_Exception)
 publish the given object
CORBA::Boolean CanCopy (SALOMEDS::SObject_ptr theObject)
 returns true, if can copy the object
SALOMEDS::TMPFile * CopyFrom (SALOMEDS::SObject_ptr theObject, CORBA::Long &theObjectID)
 create copy of the object and put it to the stream
CORBA::Boolean CanPaste (const char *theComponentName, CORBA::Long theObjectID)
 returns true, if can copy the object
SALOMEDS::SObject_ptr PasteInto (const SALOMEDS::TMPFile &theStream, CORBA::Long theObjectID, SALOMEDS::SObject_ptr theObject)
 returns true, if can copy the object
virtual
Engines::EngineComponent_ptr 
GetComponentInstance ()=0

Static Public Member Functions

static MEDMEM::MED_i * GetMED (SALOMEDS::SComponent_ptr theStudy)
 GetMED [ static ].

Protected Attributes

SALOME_NamingService * _NS

Private Member Functions

 Med_Gen_Driver_i ()
 default constructor: not for use

Private Attributes

CORBA::ORB_ptr _driver_orb

Static Private Attributes

static std::map< std::string,
MEDMEM::MED_i * > 
_MedCorbaObj

Detailed Description

Definition at line 47 of file Med_Gen_Driver_i.hxx.


Constructor & Destructor Documentation

default constructor: not for use

Definition at line 65 of file Med_Gen_Driver_i.cxx.

{
  MESSAGE("Med_Gen_Driver_i::Med_Gen_Driver_i");
}
Med_Gen_Driver_i::Med_Gen_Driver_i ( CORBA::ORB_ptr  orb)

standard constructor

Definition at line 75 of file Med_Gen_Driver_i.cxx.

{
  MESSAGE("activate object");
  _driver_orb = CORBA::ORB::_duplicate(orb);

  // get a NamingService interface
  _NS = SINGLETON_<SALOME_NamingService>::Instance();
  ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting());
  _NS->init_orb( _driver_orb );
}

Destructor.

Definition at line 91 of file Med_Gen_Driver_i.cxx.

{
  MESSAGE("Med_Gen_Driver_i::~Med_Gen_Driver_i");
}

Member Function Documentation

CORBA::Boolean Med_Gen_Driver_i::CanCopy ( SALOMEDS::SObject_ptr  theObject)

returns true, if can copy the object

Definition at line 829 of file Med_Gen_Driver_i.cxx.

{
  // Try to retrieve known by MED component mesh by given IOR
  SALOMEDS::GenericAttribute_var anAttr;
  if (!theObject->FindAttribute(anAttr, "AttributeIOR")) return false;
  try {
    CORBA::Object_var anObj =
      _driver_orb->string_to_object(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value());
    SALOME_MED::MESH_var aMesh = SALOME_MED::MESH::_narrow(anObj);
    // If the object is null one it can't be copied: return false
    if (aMesh->_is_nil()) return false;
  } catch(...) {
    return false;
  }
  return true;
}
CORBA::Boolean Med_Gen_Driver_i::CanPaste ( const char *  theComponentName,
CORBA::Long  theObjectID 
)

returns true, if can copy the object

Definition at line 896 of file Med_Gen_Driver_i.cxx.

{
  // The MED component can paste only objects copied by MED component
  // and with the object type = 1 (mesh)
  if (strcmp(theComponentName, ComponentDataType()) != 0 || theObjectID != 1) return false;
  return true;
}
bool Med_Gen_Driver_i::CanPublishInStudy ( CORBA::Object_ptr  theIOR)

returns true, if can publish object

Definition at line 747 of file Med_Gen_Driver_i.cxx.

{
  SALOME_MED::MESH_var aMesh = SALOME_MED::MESH::_narrow(theIOR);
  if ( !aMesh->_is_nil())
    return true;
  SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(theIOR);
  if ( !aField->_is_nil())
    return true;
  //SALOME_MED::SUPPORT_var aSupport = SALOME_MED::SUPPORT::_narrow(theIOR);
  //if ( !aSupport->_is_nil())
  //  return true;
  return false;
}
void Med_Gen_Driver_i::Close ( SALOMEDS::SComponent_ptr  theComponent)

CORBA:

Definition at line 500 of file Med_Gen_Driver_i.cxx.

{
  MESSAGE("Med_Gen_Driver_i::Close");
  SALOMEDS::SObject_var aMedMeshFather = theComponent->GetStudy()->FindObject("MEDMESH");
  if (!CORBA::is_nil(aMedMeshFather)) {
    SALOMEDS::ChildIterator_var anIter = theComponent->GetStudy()->NewChildIterator(aMedMeshFather);
    for(; anIter->More(); anIter->Next()) {
      SALOMEDS::SObject_var aSO = anIter->Value();
      SALOMEDS::GenericAttribute_var anAttr;
      if (aSO->FindAttribute(anAttr,"AttributeIOR")) {
        CORBA::Object_var myIOR =
          _driver_orb->string_to_object(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value());
        SALOME_MED::MESH_var myMesh = SALOME_MED::MESH::_narrow(myIOR);
        // here must call method destroy of myMesh, but it not implemented yet
      }
    }
  }
}
SALOMEDS::TMPFile * Med_Gen_Driver_i::CopyFrom ( SALOMEDS::SObject_ptr  theObject,
CORBA::Long &  theObjectID 
)

create copy of the object and put it to the stream

Definition at line 851 of file Med_Gen_Driver_i.cxx.

{
  // Declare a sequence of the byte to store the copied object
  SALOMEDS::TMPFile_var aStreamFile;

  // Try to get GEOM_Shape object by given SObject
  SALOMEDS::GenericAttribute_var anAttr;
  if (!theObject->FindAttribute(anAttr, "AttributeIOR")) return new SALOMEDS::TMPFile(0);
  CORBA::String_var anIOR = CORBA::string_dup(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value());
  CORBA::Object_var anObj = _driver_orb->string_to_object(anIOR);
  SALOME_MED::MESH_var aMesh = SALOME_MED::MESH::_narrow(anObj);
  if (aMesh->_is_nil()) return new SALOMEDS::TMPFile(0);

  // Get a temporary directory to store a temporary file
  CORBA::String_var aTmpDir = SALOMEDS_Tool::GetTmpDir().c_str();
  // Create a list to store names of created files
  SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
  aSeq->length(1);
  aSeq[0] = CORBA::string_dup(aMesh->getName());
  char* aFullName = new char[strlen(aTmpDir)+strlen(aSeq[0])+1];
  strcpy(aFullName, aTmpDir);
  strcpy(aFullName+strlen(aTmpDir), aSeq[0]);

  long driverId = aMesh->addDriver(SALOME_MED::MED_DRIVER,aFullName , aMesh->getName());
  aMesh->write(driverId,"");

  //  aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq.in(), false);
  char* aFullName1 = new char[strlen(aTmpDir)+1];
  strcpy(aFullName1, aTmpDir);
  aStreamFile = SALOMEDS_Tool::PutFilesToStream(aFullName1, aSeq.in(), false);
  //  SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
  SALOMEDS_Tool::RemoveTemporaryFiles(aFullName1, aSeq.in(), true);

  // Assign an ID = 1 the the type SALOME_MED::MESH
  theObjectID = 1;

  return aStreamFile._retn();
}
virtual Engines::EngineComponent_ptr Med_Gen_Driver_i::GetComponentInstance ( ) [pure virtual]

Implemented in MED_EXPORT.

MEDMEM::MED_i * Med_Gen_Driver_i::GetMED ( SALOMEDS::SComponent_ptr  theComponent) [static]

GetMED [ static ].

Get Med of the study (for persistance)

Reimplemented in MED_EXPORT.

Definition at line 103 of file Med_Gen_Driver_i.cxx.

{
  // we have a separate MED_i for each component in a study
  SALOMEDS::Study_var study = theComponent->GetStudy();
  ostringstream os;
  os << study->StudyId() << "_" << theComponent->Tag();
  string mapKey = os.str();

  MED_i* med_i;
  map <string, MEDMEM::MED_i*>::iterator id_med;
  id_med = _MedCorbaObj.find( mapKey );
  if ( id_med == _MedCorbaObj.end() )
    _MedCorbaObj[ mapKey ] = med_i = new MED_i();
  else
    med_i = id_med->second;
  return med_i;
}

Here is the caller graph for this function:

char * Med_Gen_Driver_i::IORToLocalPersistentID ( SALOMEDS::SObject_ptr  theSObject,
const char *  IORString,
CORBA::Boolean  isMultiFile,
CORBA::Boolean  isASCII 
)

CORBA: give a persistent reference of a transient object (for study save)

Definition at line 524 of file Med_Gen_Driver_i.cxx.

{
  SCRUTE(IORString);

  if (string(IORString).size()==0) return CORBA::string_dup("_MED");
  // Well, we know where put object (_saveFilename) and we know object (IORString)
  // cast object :
  CORBA::Object_var myIOR = _driver_orb->string_to_object(IORString);

  // MED
  SALOME_MED::MED_var myMed = SALOME_MED::MED::_narrow(myIOR);
  if (! CORBA::is_nil(myMed))
  {
    string str_MedName="_MED Objet Med + /OBJ_MED/";
    return CORBA::string_dup(str_MedName.c_str());
  }

  // MESH
  SALOME_MED::MESH_var myMesh = SALOME_MED::MESH::_narrow(myIOR);
  if (! CORBA::is_nil(myMesh))
  {
    CORBA::String_var aName((string("_MEDMESH_")+ myMesh->getName() + ".med").c_str());
    return aName._retn();
  }

  // SUPPORT
  SALOME_MED::SUPPORT_var mySupport = SALOME_MED::SUPPORT::_narrow(myIOR);
  if (! CORBA::is_nil(mySupport))
  {
    string type, str_SupportName;
    SALOME_MED::FAMILY_var family = SALOME_MED::FAMILY::_narrow(myIOR);
    if ( !family->_is_nil() )
      type = "_MED_FAMILY";
    else {
      SALOME_MED::GROUP_var grp = SALOME_MED::GROUP::_narrow(myIOR);
      if ( !grp->_is_nil() )
        type = "_MED_GROUP";
      else
        type = "_MED_SUPPORT";
    }
    try  {
      ostringstream os;
      os << type << "/" << mySupport->getName();
      os << "/ENS_MAA/" << mySupport->getMesh()->getName();
      os << "/ENTITY/" << mySupport->getEntity();
      str_SupportName = os.str();
    }
    catch(...) {
      MESSAGE("Unable to save the support");
      THROW_SALOME_CORBA_EXCEPTION("Unable to save Field in Med"\
                                   ,SALOME::INTERNAL_ERROR);
    }
    return CORBA::string_dup(str_SupportName.c_str());
  }

  SALOME_MED::FIELD_var myField = SALOME_MED::FIELD::_narrow(myIOR);
  if (! CORBA::is_nil(myField))
  {
    string str_FieldName;
    ostringstream a,b;
    a<< myField->getOrderNumber();
    b<< myField->getIterationNumber();
    CORBA::String_var aName((string("_MEDFIELD_")+ myField->getName() +
                             string("_ORDRE_")+a.str()+
                             string("_ITER_")+b.str() +
                             ".med").c_str());
    return aName._retn();
  }

  //THROW_SALOME_CORBA_EXCEPTION("Unable to save IOR",SALOME::BAD_PARAM);
  return CORBA::string_dup("_MED");
}
CORBA::Boolean Med_Gen_Driver_i::Load ( SALOMEDS::SComponent_ptr  theComponent,
const SALOMEDS::TMPFile &  theStream,
const char *  theURL,
bool  isMultiFile 
)

CORBA: Load Mesh objects (called when an existing study is opened)

Definition at line 476 of file Med_Gen_Driver_i.cxx.

{
  loadStudy ( theComponent, theStream, theURL, isMultiFile, NON_ASCII );

  return true;
}
CORBA::Boolean Med_Gen_Driver_i::LoadASCII ( SALOMEDS::SComponent_ptr  theComponent,
const SALOMEDS::TMPFile &  theStream,
const char *  theURL,
bool  isMultiFile 
)

Definition at line 486 of file Med_Gen_Driver_i.cxx.

{
  loadStudy ( theComponent, theStream, theURL, isMultiFile, ASCII );
  return true;
}
char * Med_Gen_Driver_i::LocalPersistentIDToIOR ( SALOMEDS::SObject_ptr  theSObject,
const char *  aLocalPersistentID,
CORBA::Boolean  isMultiFile,
CORBA::Boolean  isASCII 
) throw (SALOME::SALOME_Exception)

CORBA: give a transient reference (when loading an object, opening study)

Definition at line 605 of file Med_Gen_Driver_i.cxx.

{
  // all object are restored in Load() if their name in study coincides
  // with a default one generated by object.addInStudy(...)
  CORBA::String_var ior = theSObject->GetIOR();
  bool restoredByLoad = ( ior.in() && strlen( ior ) > 0 );

  if ( !restoredByLoad )
  {
    CORBA::Object_var object;
    SALOMEDS::SComponent_var component = theSObject->GetFatherComponent();
    MED_i* med_i = Med_Gen_Driver_i::GetMED(component);
    SALOME_MED::MED_var med = med_i->_this();

    // MED
    if (strcmp(aLocalPersistentID, "_MED Objet Med + /OBJ_MED/") == 0)
    {
      //object = med;
      object = SALOME_MED::MED::_duplicate(med);
    }
    // MESH
    else if (strncmp(aLocalPersistentID, "_MEDMESH_",9) == 0)
    {
      int aMeshNameLen = strlen(aLocalPersistentID) - 12;
      string aMeshName( &(aLocalPersistentID[9]), aMeshNameLen);
      aMeshName[aMeshNameLen-1] = 0;
      try {
        object = med->getMeshByName( aMeshName.c_str() );
        if ( CORBA::is_nil( object )) {
          aMeshName = healName( aMeshName );
          object = med->getMeshByName( aMeshName.c_str() );
        }
      }
      catch (const std::exception & ex) {
        SCRUTE(ex.what());
        THROW_SALOME_CORBA_EXCEPTION("Unable to find a mesh by name in this file",
                                     SALOME::INTERNAL_ERROR);
      }
    }
    // FIELD
    else if (strncmp(aLocalPersistentID, "_MEDFIELD_",10) == 0)
    {
      // Field Name
      string aFieldName;
      CORBA::Long aNumOrdre, anIterNumber;
      getFieldNameAndDtIt( aLocalPersistentID, aFieldName, aNumOrdre, anIterNumber );
      // Get a field that is already read
      try {
        object = med->getField( aFieldName.c_str(), anIterNumber, aNumOrdre );
        if ( CORBA::is_nil( object )) {
          aFieldName = healName( aFieldName );
          object = med->getField( aFieldName.c_str(), anIterNumber, aNumOrdre );
        }
      }
      catch (const std::exception & ex) {
        SCRUTE(ex.what());
        THROW_SALOME_CORBA_EXCEPTION("Unable to find a field by name in this file",
                                     SALOME::INTERNAL_ERROR);
      }
    }
    // SUPPORT?
    else {
      string type, name, meshName, entity;
      if ( getSupportData( aLocalPersistentID, type, name, meshName, entity ))
      {
        MED_EN::medEntityMesh medEntity( atoi( entity.c_str() ));

        if ( type == "SUPPORT" ) {
          try {
            object = med_i->getSupport( meshName, medEntity );
            if ( CORBA::is_nil( object )) {
              meshName = healName( meshName );
              object = med_i->getSupport( meshName, medEntity );
            }
          }
          catch (const std::exception & ex) {
            SCRUTE(ex.what());
            THROW_SALOME_CORBA_EXCEPTION("Unable to find support in this file",
                                         SALOME::INTERNAL_ERROR);
          }
        }
        else {
          SALOME_MED::GMESH_var mesh;
          try {
            mesh = med->getMeshByName( meshName.c_str() );
            if ( mesh->_is_nil() ) {
              meshName = healName( meshName );
              mesh = med->getMeshByName( meshName.c_str() );
            }
          }
          catch (const std::exception & ex) {
            SCRUTE(ex.what());
            THROW_SALOME_CORBA_EXCEPTION("Unable to find mesh in this file",
                                         SALOME::INTERNAL_ERROR);
          }
          if ( !mesh->_is_nil() ) {
            string healedName = healName( name );
            try {
              if ( type == "FAMILY" ) {
                SALOME_MED::Family_array_var families = mesh->getFamilies( medEntity );
                for ( int i = 0; CORBA::is_nil(object) && i <= (int)families->length(); ++i )
                  if ( families[ i ]->getName() == name ||
                       families[ i ]->getName() == healedName )
                    object = SALOME_MED::FAMILY::_duplicate( families[ i ]);
              }
              else {
                SALOME_MED::Group_array_var groups = mesh->getGroups( medEntity );
                for ( int i = 0; CORBA::is_nil(object) && i <= (int)groups->length(); ++i )
                  if ( groups[ i ]->getName() == name ||
                       groups[ i ]->getName() == healedName )
                    object = SALOME_MED::GROUP::_duplicate( groups[ i ]);
              }
            }
            catch (const std::exception & ex) {
              SCRUTE(ex.what());
              THROW_SALOME_CORBA_EXCEPTION("Unable to find support in this file",
                                           SALOME::INTERNAL_ERROR);
            }
          }
        }
      }
    }
    if ( !CORBA::is_nil(object) )
      ior = _driver_orb->object_to_string( object );
    else
      THROW_SALOME_CORBA_EXCEPTION("Unable to find the object in this file",
                                   SALOME::INTERNAL_ERROR);

  } // !restoredByLoad

  return ior._retn();
}

Here is the call graph for this function:

SALOMEDS::SObject_ptr Med_Gen_Driver_i::PasteInto ( const SALOMEDS::TMPFile &  theStream,
CORBA::Long  theObjectID,
SALOMEDS::SObject_ptr  theObject 
)

returns true, if can copy the object

Definition at line 909 of file Med_Gen_Driver_i.cxx.

{
  SALOMEDS::SObject_var aResultSO = SALOMEDS::SObject::_duplicate(theObject);
  if (theStream.length() == 0) return aResultSO._retn();

  SALOMEDS::Study_var aStudy = theObject->GetStudy();

  CORBA::String_var aTmpDir = CORBA::string_dup(SALOMEDS_Tool::GetTmpDir().c_str());
  char* aFullName2 = new char[strlen(aTmpDir)+1];
  strcpy(aFullName2,aTmpDir);
  //  SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir, false);
  SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aFullName2, false);
  CORBA::String_var aMeshName = CORBA::string_dup(aSeq[0]);
  char* aFullName = new char[strlen(aTmpDir)+strlen(aMeshName)+1];
  strcpy(aFullName, aTmpDir);
  strcpy(aFullName+strlen(aTmpDir), aMeshName);

  MESH * myMesh= new MESH();
  //  myMesh->setName(aMeshName.c_str());
  char* aFullMeshName = new char[strlen(aMeshName)+1];
  strcpy(aFullMeshName,aMeshName);
  myMesh->setName(aFullMeshName);
  MED_MESH_RDONLY_DRIVER myMeshDriver(aFullName, myMesh);
  try {
    myMeshDriver.setMeshName(aFullMeshName);
    myMeshDriver.open();
  } catch (const std::exception & ex) {
    MESSAGE("Exception Interceptee : ");
    SCRUTE(ex.what());
    return aResultSO._retn();
  };
  try {
    myMeshDriver.read();
    MESSAGE("apres read");
    myMeshDriver.close();
  } catch (const std::exception & ex) {
    MESSAGE("Exception Interceptee : ");
    SCRUTE(ex.what());
    return aResultSO._retn();
  };
  // set new mesh name, becouse now there are no possibility to operate meshes with the same names
//    srand((unsigned int)time(NULL));
  int aRND = rand(); //Get a random number to present a name of a copied mesh
  char aCopiedMeshName[127];
  sprintf(aCopiedMeshName,"MESH_COPY_%d",aRND);
  myMesh->setName(aCopiedMeshName);
  MESH_i * meshi = new MESH_i(myMesh);
  SALOME_MED::MESH_ptr mesh = meshi->_this();
  // add the mesh object in study
  meshi->addInStudy(aStudy,mesh);
  // get the IOR attribute of just added mesh
  CORBA::String_var anIORString = _driver_orb->object_to_string(mesh);
  aResultSO = aStudy->FindObjectIOR(anIORString);

  char * aFullName1 = new char[strlen(aTmpDir)+1];
  strcpy(aFullName1,aTmpDir);
  //  SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
  SALOMEDS_Tool::RemoveTemporaryFiles(aFullName1, aSeq.in(), true);

  return aResultSO._retn();
}
SALOMEDS::SObject_ptr Med_Gen_Driver_i::PublishInStudy ( SALOMEDS::Study_ptr  theStudy,
SALOMEDS::SObject_ptr  theSObject,
CORBA::Object_ptr  theObject,
const char *  theName 
) throw (SALOME::SALOME_Exception)

publish the given object

Definition at line 766 of file Med_Gen_Driver_i.cxx.

{
  SALOMEDS::SObject_var aResultSO;

  if (CORBA::is_nil(theObject)) return aResultSO;
  if (theStudy->_is_nil()) return aResultSO;

  SALOMEDS::StudyBuilder_var aBuilder = theStudy->NewBuilder();
  SALOMEDS::SComponent_var aFather = theStudy->FindComponent(ComponentDataType());

  if (aFather->_is_nil()) {
    aFather = aBuilder->NewComponent(ComponentDataType());
    if (aFather->_is_nil()) return aResultSO;

    SALOMEDS::GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute(aFather, "AttributeName");
    SALOMEDS::AttributeName_var    aName = SALOMEDS::AttributeName::_narrow(anAttr);
    //NRI    aName->SetValue("MED");

    CORBA::Object_var objVarN = _NS->Resolve("/Kernel/ModulCatalog");
    SALOME_ModuleCatalog::ModuleCatalog_var Catalogue =
      SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN);
    SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent(ComponentDataType());
    if (!Comp->_is_nil()) {
      aName->SetValue(Comp->componentusername());
    }

    aBuilder->DefineComponentInstance(aFather, GetComponentInstance());
  }

  if (CORBA::is_nil(theSObject)) {
    SALOME_MED::MESH_var aMesh = SALOME_MED::MESH::_narrow(theObject);
    if (!aMesh->_is_nil()) {
      aMesh->addInStudy(theStudy, aMesh);
    }
    else {
      SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(theObject);
      if (!aField->_is_nil()) {
        aField->addInStudyToComponent(aFather, aField);
      }
      //else {
      //  SALOME_MED::SUPPORT_var aSupport = SALOME_MED::SUPPORT::_narrow(theObject);
      //  if (!aSupport->_is_nil())
      //    aSupport->addInStudy(theStudy, aSupport);
      //}
    }
    aResultSO = theStudy->FindObjectIOR(_driver_orb->object_to_string(theObject));
  } else {
    //if (!theSObject->ReferencedObject(aResultSO))
    //  THROW_SALOME_CORBA_EXCEPTION("Publish in study MED object error",SALOME::BAD_PARAM);
  }
  //aBuilder->Addreference(theObject, aResultSO);
  return aResultSO._retn();
}
SALOMEDS::TMPFile * Med_Gen_Driver_i::Save ( SALOMEDS::SComponent_ptr  theComponent,
const char *  theURL,
bool  isMultiFile 
)

Save data published under MED component.

Parameters:
theComponent- MED component
theURL- path to store
isMultiFile- store mode
Return values:
SALOMEDS::TMPFile*- result file

Definition at line 447 of file Med_Gen_Driver_i.cxx.

{
  return saveStudy ( theComponent, theURL, isMultiFile, NON_ASCII );
}
SALOMEDS::TMPFile * Med_Gen_Driver_i::SaveASCII ( SALOMEDS::SComponent_ptr  theComponent,
const char *  theURL,
bool  isMultiFile 
)

Save data published under MED component in ASCII file.

Parameters:
theComponent- MED component
theURL- path to store
isMultiFile- store mode
Return values:
SALOMEDS::TMPFile*- result file

Definition at line 463 of file Med_Gen_Driver_i.cxx.

{
  return saveStudy ( theComponent, theURL, isMultiFile, ASCII );
}

Member Data Documentation

CORBA::ORB_ptr Med_Gen_Driver_i::_driver_orb [private]

Definition at line 114 of file Med_Gen_Driver_i.hxx.

map< string, MEDMEM::MED_i * > Med_Gen_Driver_i::_MedCorbaObj [static, private]

Definition at line 112 of file Med_Gen_Driver_i.hxx.

SALOME_NamingService* Med_Gen_Driver_i::_NS [protected]

Definition at line 117 of file Med_Gen_Driver_i.hxx.


The documentation for this class was generated from the following files: