typedef sequence<SObject> ListOfSObject;
//! Get the persistent reference to the %Study.
PersistentReference GetPersistentReference() raises(StudyInvalidReference);
-//! Get a transient reference to the %Study.
- SalomeReference GetTransientReference() raises(StudyInvalidReference);
/*! \brief indicate whether the %Study is empty
*/
ListOfAttributes GetAllAttributes();
-/*! Gets the study of a given %SObject.
- \return The study containing the given %SObject.
-*/
- Study GetStudy();
-
/*! Gets the CORBA object by its own IOR attribute.
Returns nil, if can't.
\return The CORBA object of the %SObject.
/** Canonic constructor. The object can't be used without a setStudy() */
SALOME_StudyEditor::SALOME_StudyEditor() {
-}
-
-void SALOME_StudyEditor::setStudy(SALOMEDS::Study_ptr study) {
- _study = study;
- _sbuilder = _study->NewBuilder();
-}
-
-SALOME_StudyEditor::SALOME_StudyEditor(SALOMEDS::Study_ptr study) {
- this->setStudy(study);
+ _sbuilder = KERNEL::getStudy()->NewBuilder();
}
SALOMEDS::SObject_ptr SALOME_StudyEditor::newObject(SALOMEDS::SObject_ptr parent) {
}
SALOMEDS::SObject_ptr SALOME_StudyEditor::findObject(const char * entry) {
- SALOMEDS::SObject_var sobject = _study->FindObjectID(entry);
+ SALOMEDS::SObject_var sobject = KERNEL::getStudy()->FindObjectID(entry);
return sobject._retn();
}
}
SALOMEDS::SComponent_ptr SALOME_StudyEditor::findRoot(const char * moduleName) {
- return _study->FindComponent(moduleName);
+ return KERNEL::getStudy()->FindComponent(moduleName);
}
void SALOME_StudyEditor::setName(SALOMEDS::SObject_var sobject, const char * value) {
class KERNELHELPERS_EXPORT SALOME_StudyEditor {
public:
- SALOME_StudyEditor(SALOMEDS::Study_ptr study);
+ SALOME_StudyEditor();
typedef std::vector<SALOMEDS::SObject_ptr> SObjectList;
static const int UNDEFINED = -1;
-protected:
- SALOME_StudyEditor();
- void setStudy(SALOMEDS::Study_ptr study);
-
- SALOMEDS::Study_var _study;
-
private:
SALOMEDS::StudyBuilder_var _sbuilder;
};
SalomeGenericObj
SalomeLifeCycleCORBA
SalomeIDLKernel
+ SalomeDSClient
${HDF5_C_LIBRARIES}
)
PortableServer::ObjectId_var aStudy_iid = root_poa->activate_object(aStudy_i);
aStudy = aStudy_i->_this();
namingService.Register(aStudy, "/Study");
-
- // Assign the value of the IOR in the study->root
- CORBA::String_var IORStudy = orb->object_to_string(aStudy);
- aStudy_i->GetImpl()->SetTransientReference((char*)IORStudy.in());
aStudy_i->GetImpl()->GetDocument()->SetModified(false);
aStudy_i->_remove_ref();
}
return so->GetSObject();
}
- SALOMEDS_EXPORT
- SALOMEDS::Study_ptr ConvertStudy(const _PTR(Study)& theStudy)
- {
- SALOMEDS_Study* study = _CAST(Study, theStudy);
- if ( !theStudy || !study )
- return SALOMEDS::Study::_nil();
- return study->GetStudy();
- }
-
SALOMEDS_EXPORT
SALOMEDS::StudyBuilder_ptr ConvertBuilder(const _PTR(StudyBuilder)& theBuilder)
{
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
#include "SALOMEDS_AttributeName_i.hxx"
-#include "SALOME_NamingService.hxx"
+#include "SALOME_KernelServices.hxx"
#include "utilities.h"
#include "HDFOI.hxx"
* Purpose :
*/
//============================================================================
-static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO, int offset) {
+static void DumpComponent(SALOMEDS::SObject_ptr SO, int offset) {
SALOMEDS::SObject_var RefSO;
- SALOMEDS::ChildIterator_var it = Study->NewChildIterator(SO);
+ SALOMEDS::ChildIterator_var it = KERNEL::getStudy()->NewChildIterator(SO);
for (; it->More();it->Next()){
SALOMEDS::SObject_var CSO= it->Value();
SALOMEDS::GenericAttribute_var anAttr;
MESSAGE(" ");
MESSAGE("*Reference"<<RefSO->GetID());
}
- DumpComponent(Study,CSO,offset+2);
+ DumpComponent(CSO,offset+2);
}
}
* Purpose :
*/
//============================================================================
-static void DumpStudy (SALOMEDS::Study_ptr Study) {
+static void DumpStudy() {
MESSAGE("Explore Study and Write name of each object if it exists");
char* name;
- SALOMEDS::SComponentIterator_var itcomp = Study->NewComponentIterator();
+ SALOMEDS::SComponentIterator_var itcomp = KERNEL::getStudy()->NewComponentIterator();
int offset = 1;
for (; itcomp->More(); itcomp->Next()) {
SALOMEDS::SComponent_var SC = itcomp->Value();
name = SC->ComponentDataType();
MESSAGE("-> ComponentDataType is "<<name);
- DumpComponent(Study,SC,offset);
+ DumpComponent(SC,offset);
}
}
* Purpose :
*/
//============================================================================
-static void Test(SALOMEDS::Study_ptr myStudy)
+static void Test()
{
try {
char* name;
+ SALOMEDS::Study_var myStudy = KERNEL::getStudy();
+
MESSAGE("Create Builder ");
SALOMEDS::StudyBuilder_var StudyBuild = myStudy->NewBuilder();
Name->SetValue("mesh_cylinder_0");
StudyBuild->CommitCommand();
- MESSAGE("Test GetStudy");
- SALOMEDS::Study_var stu = mesh_cylinder->GetStudy();
- MESSAGE ("-> Study Name is "<<stu->Name());
-
- DumpStudy(myStudy);
+ DumpStudy();
StudyBuild->Undo();
// Study should have no trace of object mesh_cylinder
- DumpStudy(myStudy);
+ DumpStudy();
// Save as
myStudy->SaveAs("/home/edeville/Study1.hdf", false, false);
name = myStudy->GetPersistentReference();
MESSAGE("Persitent Reference of the study " << name);
- // Get Transient Reference of the study test
- name = myStudy->GetTransientReference();
- MESSAGE("Transient Reference of the study " << name);
-
// FindComponent Test
SALOMEDS::SComponent_var compo = myStudy->FindComponent("GEOM");
// Get ComponentDataType test
else {
MESSAGE("-> Name is not found");
}
- //DumpStudy(myStudy);
+ //DumpStudy();
}
catch(HDFexception)
{
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
- SALOME_NamingService * salomens = new SALOME_NamingService(orb);
-
- MESSAGE("Find Study ");
- CORBA::Object_ptr obj2 = salomens->Resolve("/Study");
- SALOMEDS::Study_var myStudy = SALOMEDS::Study::_narrow(obj2);
-
// Obtain a POAManager, and tell the POA to start accepting
// requests on its objects.
PortableServer::POAManager_var pman = poa->the_POAManager();
pman->activate();
// Test basic services
- Test(myStudy);
+ Test();
- delete salomens;
orb->run();
orb->destroy();
}
//
#include "SALOMEDS_IParameters.hxx"
+#include <SALOMEDSClient_ClientFactory.hxx>
+#include <SALOME_KernelServices.hxx>
#include <utilities.h>
#define PT_INTEGER 0
{
if(!ap) return;
_ap = ap;
- _PTR(SObject) so = _ap->GetSObject();
- _study = so->GetStudy();
}
SALOMEDS_IParameters::~SALOMEDS_IParameters()
std::string SALOMEDS_IParameters::decodeEntry(const std::string& entry)
{
- if(!_study) return entry;
int pos = entry.rfind("_");
if(pos < 0 || pos >= entry.length()) return entry;
std::string compName(entry, 0, pos), compID, tail(entry, pos+1, entry.length()-1);
if(_compNames.find(compName) == _compNames.end()) {
- _PTR(SObject) so = _study->FindComponent(compName);
+ _PTR(SObject) so = ClientFactory::Study(KERNEL::getStudy())->FindComponent(compName);
if(!so) return entry;
compID = so->GetID();
_compNames[compName] = compID;
return newEntry;
}
-void SALOMEDS_IParameters::setDumpPython(_PTR(Study) study, const std::string& theID)
+void SALOMEDS_IParameters::setDumpPython(const std::string& theID)
{
std::string anID;
if(theID == "") anID = getDefaultVisualComponent();
else anID = theID;
- _PTR(AttributeParameter) ap = study->GetCommonParameters(anID, 0);
- ap->SetBool(_AP_DUMP_PYTHON_, !isDumpPython(study, theID));
+ _PTR(AttributeParameter) ap = ClientFactory::Study(KERNEL::getStudy())->GetCommonParameters(anID, 0);
+ ap->SetBool(_AP_DUMP_PYTHON_, !isDumpPython(theID));
}
-bool SALOMEDS_IParameters::isDumpPython(_PTR(Study) study, const std::string& theID)
+bool SALOMEDS_IParameters::isDumpPython(const std::string& theID)
{
std::string anID;
if(theID == "") anID = getDefaultVisualComponent();
else anID = theID;
- _PTR(AttributeParameter) ap = study->GetCommonParameters(anID, 0);
+ _PTR(AttributeParameter) ap = ClientFactory::Study(KERNEL::getStudy())->GetCommonParameters(anID, 0);
if(!ap) return false;
if(!ap->IsSet(_AP_DUMP_PYTHON_, PT_BOOLEAN)) return false;
return (bool)ap->GetBool(_AP_DUMP_PYTHON_);
/*!
Enables/Disables the dumping visual parameters
*/
- virtual void setDumpPython(_PTR(Study) study, const std::string& theID = "");
+ virtual void setDumpPython(const std::string& theID = "");
/*!
Returns whether there is the dumping visual parameters
*/
- virtual bool isDumpPython(_PTR(Study) study, const std::string& theID = "");
+ virtual bool isDumpPython(const std::string& theID = "");
/*!
Returns a default name of the component where the visula parameters are stored.
private:
_PTR(AttributeParameter) _ap;
- _PTR(Study) _study;
std::map<std::string, std::string> _compNames;
};
return ret;
}
-_PTR(Study) SALOMEDS_SObject::GetStudy()
-{
- if (_isLocal) {
- SALOMEDS::Locker lock;
- return _PTR(Study)(new SALOMEDS_Study(_local_impl->GetStudy()));
- }
- SALOMEDS::Study_var study=_corba_impl->GetStudy();
- return _PTR(Study)(new SALOMEDS_Study(study));
-}
-
std::string SALOMEDS_SObject::Name()
{
std::string aName;
virtual bool FindAttribute(_PTR(GenericAttribute)& anAttribute, const std::string& aTypeOfAttribute);
virtual bool ReferencedObject(_PTR(SObject)& theObject);
virtual bool FindSubObject(int theTag, _PTR(SObject)& theObject);
- virtual _PTR(Study) GetStudy();
virtual std::string Name();
virtual void Name(const std::string& theName);
virtual std::vector<_PTR(GenericAttribute)> GetAllAttributes();
return so._retn();
}
-//============================================================================
-/*! Function :
- * Purpose :
- */
-//============================================================================
-SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy()
-{
- SALOMEDS::Locker lock;
- SALOMEDSImpl_Study* aStudy = _impl->GetStudy();
- if(!aStudy) {
- MESSAGE("Problem GetStudy");
- return SALOMEDS::Study::_nil();
- }
-
- std::string IOR = aStudy->GetTransientReference();
- CORBA::Object_var obj = _orb->string_to_object(IOR.c_str());
- SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(obj) ;
- ASSERT(!CORBA::is_nil(Study));
- return SALOMEDS::Study::_duplicate(Study);
-}
-
//============================================================================
/*! Function : FindAttribute
* Purpose : Find attribute of given type on this SObject
virtual CORBA::Boolean ReferencedObject(SALOMEDS::SObject_out obj) ;
virtual CORBA::Boolean FindSubObject(CORBA::Long atag, SALOMEDS::SObject_out obj );
- virtual SALOMEDS::Study_ptr GetStudy() ;
virtual char* Name();
virtual void Name(const char*);
virtual SALOMEDS::ListOfAttributes* GetAllAttributes();
NS->init_orb( orb );
}
NS->Register(Study, "/Study");
-
- // Assign the value of the IOR in the study->root
- if ( myStudy_i->GetImpl()->GetTransientReference().empty() ) {
- CORBA::String_var IORStudy = orb->object_to_string(Study);
- myStudy_i->GetImpl()->SetTransientReference((char*)IORStudy.in());
- }
-
myStudy_i->_remove_ref();
// Obtain a POAManager, and tell the POA to start accepting
bool SALOMEDS_Study::Save(bool theMultiFile, bool theASCII)
{
- //SRN: Pure CORBA save as the save operation require CORBA in any case
+ if(CORBA::is_nil(_corba_impl))
+ return false;
+
return _corba_impl->Save(theMultiFile, theASCII);
}
bool SALOMEDS_Study::SaveAs(const std::string& theUrl, bool theMultiFile, bool theASCII)
{
- //SRN: Pure CORBA save as the save operation require CORBA in any case
+ if(CORBA::is_nil(_corba_impl))
+ return false;
+
return _corba_impl->SaveAs((char*)theUrl.c_str(), theMultiFile, theASCII);
}
else aRef = (CORBA::String_var)_corba_impl->GetPersistentReference();
return aRef;
}
-
-std::string SALOMEDS_Study::GetTransientReference()
-{
- std::string aRef;
- if (_isLocal) {
- SALOMEDS::Locker lock;
- aRef = _local_impl->GetTransientReference();
- }
- else aRef = _corba_impl->GetTransientReference();
- return aRef;
-}
bool SALOMEDS_Study::IsEmpty()
{
bool isPublished,
bool isMultiFile)
{
- //SRN: Pure CORBA DumpStudy as it does more cleaning than the local one
- if(CORBA::is_nil(_corba_impl)) GetStudy(); //If CORBA implementation is null then retrieve it
- bool ret = _corba_impl->DumpStudy(thePath.c_str(), theBaseName.c_str(), isPublished, isMultiFile);
- return ret;
+ if(CORBA::is_nil(_corba_impl))
+ return false;
+
+ return _corba_impl->DumpStudy(thePath.c_str(), theBaseName.c_str(), isPublished, isMultiFile);
}
void SALOMEDS_Study::SetStudyLock(const std::string& theLockerID)
return _orb->string_to_object(theIOR.c_str());
}
-SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy()
-{
- if (_isLocal) {
- SALOMEDS::Locker lock;
-
- if (!CORBA::is_nil(_corba_impl)) return SALOMEDS::Study::_duplicate(_corba_impl);
- std::string anIOR = _local_impl->GetTransientReference();
- SALOMEDS::Study_var aStudy;
- if (!_local_impl->IsError() && anIOR != "") {
- aStudy = SALOMEDS::Study::_narrow(_orb->string_to_object(anIOR.c_str()));
- }
- else {
- SALOME_NamingService* namingService = KERNEL::getNamingService();
- CORBA::Object_var obj = namingService->Resolve("/Study");
- aStudy = SALOMEDS::Study::_narrow(obj);
- if( !CORBA::is_nil( aStudy ) ) {
- _local_impl->SetTransientReference(_orb->object_to_string(aStudy));
- }
- }
- _corba_impl = SALOMEDS::Study::_duplicate(aStudy);
- return aStudy._retn();
- }
- else {
- return SALOMEDS::Study::_duplicate(_corba_impl);
- }
-
- return SALOMEDS::Study::_nil();
-}
-
-
_PTR(AttributeParameter) SALOMEDS_Study::GetCommonParameters(const std::string& theID, int theSavePoint)
{
SALOMEDSClient_AttributeParameter* AP = NULL;
void SALOMEDS_Study::attach(SALOMEDS::Observer_ptr theObserver,bool modify)
{
- if(CORBA::is_nil(_corba_impl)) GetStudy(); //If CORBA implementation is null then retrieve it
+ if(CORBA::is_nil(_corba_impl))
+ return;
+
_corba_impl->attach(theObserver,modify);
}
void SALOMEDS_Study::detach(SALOMEDS::Observer_ptr theObserver)
{
- if(CORBA::is_nil(_corba_impl)) GetStudy(); //If CORBA implementation is null then retrieve it
+ if(CORBA::is_nil(_corba_impl))
+ return;
+
_corba_impl->detach(theObserver);
}
virtual _PTR(SObject) Paste(const _PTR(SObject)& theSO);
virtual std::string GetPersistentReference();
- virtual std::string GetTransientReference();
virtual bool IsEmpty();
virtual _PTR(SComponent) FindComponent (const std::string& aComponentName);
virtual _PTR(SComponent) FindComponentID(const std::string& aComponentID);
std::string ConvertObjectToIOR(CORBA::Object_ptr theObject);
CORBA::Object_ptr ConvertIORToObject(const std::string& theIOR);
-
- SALOMEDS::Study_ptr GetStudy();
SALOMEDSImpl_Study* GetLocalImpl() { return _local_impl; }
aSession->emitMessageOneWay(str.c_str());
SALOMEDS::lock();
}
-
- std::string anIOR = _impl->GetTransientReference();
- if ( anIOR.empty() ) {
- CORBA::Object_var obj = aNamingService->Resolve("/Study");
- SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow( obj );
- CORBA::String_var IORStudy = _orb->object_to_string(aStudy);
- _impl->SetTransientReference((char*)IORStudy.in());
- }
- _impl->GetDocument()->SetModified(false);
-
}
//============================================================================
throw SALOMEDS::Study::StudyInvalidReference();
return CORBA::string_dup(_impl->GetPersistentReference().c_str());
}
-//============================================================================
-/*! Function : GetTransientReference
- * Purpose : Get IOR of the Study (registred in OCAF document in doc->Root)
- */
-//============================================================================
-char* SALOMEDS_Study_i::GetTransientReference()
-{
- SALOMEDS::Locker lock;
- if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
- return CORBA::string_dup(_impl->GetTransientReference().c_str());
-}
//============================================================================
/*! Function : IsEmpty
_impl->UpdateIORLabelMap(std::string((char*)anIOR), std::string((char*)anEntry));
}
-SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb)
-{
- SALOMEDS::Locker lock;
-
- SALOMEDSImpl_AttributeIOR* Att = NULL;
- if ((Att=(SALOMEDSImpl_AttributeIOR*)theLabel.Root().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))){
- char* IOR = CORBA::string_dup(Att->Value().c_str());
- CORBA::Object_var obj = orb->string_to_object(IOR);
- SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj) ;
- ASSERT(!CORBA::is_nil(aStudy));
- return SALOMEDS::Study::_duplicate(aStudy);
- } else {
- MESSAGE("GetStudy: Problem to get study");
- }
- return SALOMEDS::Study::_nil();
-}
-
void SALOMEDS_Study_i::IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute)
{
SALOMEDS::Locker lock;
*/
virtual char* GetPersistentReference();
-
- //! method to Get transient reference of study
- /*!
- \return char* arguments, the transient reference of the study
- */
- virtual char* GetTransientReference();
-
//! method to detect if a study is empty
/*!
\return bool arguments, true if study is empty
*/
virtual void URL(const char* url);
- static SALOMEDS::Study_ptr GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb);
-
static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute);
virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
CPPUNIT_ASSERT(so->FindSubObject(1, so2));
CPPUNIT_ASSERT(so2->GetID() == so1->GetID());
- //Check method GetStudy
- CPPUNIT_ASSERT(so->GetStudy() == study);
-
//Check methods Name
so->Name("test");
CPPUNIT_ASSERT(so->Name() == "test");
CPPUNIT_ASSERT(componentIterator);
- //Check method GetTransientReference
- CPPUNIT_ASSERT(!study->GetTransientReference().empty());
-
//Check method URL (get/set)
study->URL("");
CPPUNIT_ASSERT(study->URL() == "");
#define BUILDER_FACTORY "BuilderFactory"
#define GET_PARAMETERS "GetIParameters"
#define CONVERT_SOBJECT "ConvertSObject"
-#define CONVERT_STUDY "ConvertStudy"
#define CONVERT_BUILDER "ConvertBuilder"
typedef SALOMEDSClient_SObject* (*SOBJECT_FACTORY_FUNCTION) (SALOMEDS::SObject_ptr);
typedef SALOMEDSClient_StudyBuilder* (*BUILDER_FACTORY_FUNCTION) (SALOMEDS::StudyBuilder_ptr);
typedef SALOMEDSClient_IParameters* (*GET_PARAMETERS_FACTORY) (const _PTR(AttributeParameter)&);
typedef SALOMEDS::SObject_ptr (*CONVERT_SOBJECT_FUNCTION) (const _PTR(SObject)&);
-typedef SALOMEDS::Study_ptr (*CONVERT_STUDY_FUNCTION) (const _PTR(Study)&);
typedef SALOMEDS::StudyBuilder_ptr (*CONVERT_BUILDER_FUNCTION) (const _PTR(StudyBuilder)&);
static BUILDER_FACTORY_FUNCTION aBuilderFactory = NULL;
static GET_PARAMETERS_FACTORY aGetIParameters = NULL;
static CONVERT_SOBJECT_FUNCTION aConvertSObject = NULL;
-static CONVERT_STUDY_FUNCTION aConvertStudy = NULL;
static CONVERT_BUILDER_FUNCTION aConvertBuilder = NULL;
_PTR(SObject) ClientFactory::SObject(SALOMEDS::SObject_ptr theSObject)
return so._retn();
}
-
-SALOMEDS::Study_ptr ClientFactory::crbStudy(const _PTR(Study)& theStudy)
-{
- SALOMEDS::Study_var study;
-
-#ifdef WIN32
- if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
- if(!aConvertStudy) aConvertStudy = (CONVERT_STUDY_FUNCTION)::GetProcAddress(_libHandle, CONVERT_STUDY);
-#else
- if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
- if(!aConvertStudy) aConvertStudy = (CONVERT_STUDY_FUNCTION) dlsym(_libHandle, CONVERT_STUDY);
-#endif
-
- if(aConvertStudy) study = aConvertStudy(theStudy);
-
- if(CORBA::is_nil(study)) return SALOMEDS::Study::_nil();
- return study._retn();
-}
-
SALOMEDS::StudyBuilder_ptr ClientFactory::crbStudyBuilder(const _PTR(StudyBuilder)& theStudyBuilder)
{
SALOMEDS::StudyBuilder_var studyBuilder;
*/
static SALOMEDS::SObject_ptr crbSObject(const _PTR(SObject)& theSObject);
- /*!
- * Returns a CORBA Study that corresponds %theStudy
- */
- static SALOMEDS::Study_ptr crbStudy(const _PTR(Study)& theStudy);
-
/*!
* Returns a CORBA StudyBuilder that corresponds %theStudyBuilder
*/
/*!
Enables/Disables the dumping visual parameters, static implementation is supposed
*/
- virtual void setDumpPython(_PTR(Study) study, const std::string& theID = "") = 0;
+ virtual void setDumpPython(const std::string& theID = "") = 0;
/*!
Returns whether there is the dumping visual parameters, static implementation is supposed
*/
- virtual bool isDumpPython(_PTR(Study) study, const std::string& theID = "") = 0;
+ virtual bool isDumpPython(const std::string& theID = "") = 0;
/*!
Returns a default name of the component where the visula parameters are stored.
virtual bool FindAttribute(_PTR(GenericAttribute)& anAttribute, const std::string& aTypeOfAttribute) = 0;
virtual bool ReferencedObject(_PTR(SObject)& theObject) = 0;
virtual bool FindSubObject(int theTag, _PTR(SObject)& theObject) = 0;
- virtual _PTR(Study) GetStudy() = 0;
virtual std::string Name() = 0;
virtual void Name(const std::string& theName) = 0;
virtual std::vector<_PTR(GenericAttribute)> GetAllAttributes() = 0;
virtual bool Open(const std::string& theStudyUrl) = 0;
virtual std::string GetPersistentReference() = 0;
- virtual std::string GetTransientReference() = 0;
virtual bool IsEmpty() = 0;
virtual _PTR(SComponent) FindComponent (const std::string& aComponentName) = 0;
virtual _PTR(SComponent) FindComponentID(const std::string& aComponentID) = 0;
//remove IOR entry in study
if(theValue != myString)
{
- SALOMEDSImpl_Study* study=SALOMEDSImpl_Study::GetStudy(Label());
+ SALOMEDSImpl_Study* study=SALOMEDSImpl_Study::GetStudyImpl(Label());
study->RegisterGenObj(theValue, Label());
study->UnRegisterGenObj(myString, Label());
study->DeleteIORLabelMapItem(myString);
DF_Label aLabel = Label();
if(aLabel.IsNull()) return;
- SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
+ SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudyImpl(aLabel);
if(!aStudy) return;
if(aStudy->IsLocked()) {
aStudy->_errorCode = "LockProtection";
DF_Label aLabel = Label();
if(aLabel.IsNull()) return;
- SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
+ SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudyImpl(aLabel);
if(aStudy) aStudy->modifySO_Notification(GetSObject(), reason);
if(aStudy) aStudy->Modify();
}
{
if(!ap) return;
_ap = ap;
- SALOMEDSImpl_SObject so = _ap->GetSObject();
- _study = so.GetStudy();
}
SALOMEDSImpl_IParameters::~SALOMEDSImpl_IParameters()
std::string SALOMEDSImpl_IParameters::decodeEntry(const std::string& entry)
{
- if(!_study) return entry;
int pos = entry.rfind("_");
if(pos < 0 || pos >= entry.size()) return entry;
std::string compName(entry, 0, pos), compID, tail(entry, pos+1, entry.length()-1);
if(_compNames.find(compName) == _compNames.end()) {
- SALOMEDSImpl_SObject so = _study->FindComponent(compName);
+ SALOMEDSImpl_SObject so = SALOMEDSImpl_Study::GetStudyImpl( _ap->GetSObject().GetLabel() )->FindComponent(compName);
if(!so) return entry;
compID = so.GetID();
_compNames[compName] = compID;
private:
SALOMEDSImpl_AttributeParameter* _ap;
- SALOMEDSImpl_Study* _study;
std::map<std::string, std::string> _compNames;
};
if(LF.IsRoot()) return sco;
- return GetStudy()->GetSComponent(LF);
+ return SALOMEDSImpl_Study::SComponent(LF);
}
//============================================================================
//============================================================================
SALOMEDSImpl_SObject SALOMEDSImpl_SObject::GetFather() const
{
- return GetStudy()->GetSObject(_lab.Father());
+ return SALOMEDSImpl_Study::SObject(_lab.Father());
}
//============================================================================
return _lab.LastChildTag();
}
-//============================================================================
-/*! Function : GetStudy
- * Purpose :
- */
-//============================================================================
-SALOMEDSImpl_Study* SALOMEDSImpl_SObject::GetStudy() const
-{
- return SALOMEDSImpl_Study::GetStudy(_lab);
-}
-
//============================================================================
/*! Function : FindAttribute
* Purpose : Find attribute of given type on this SObject
if (!(Ref=(SALOMEDSImpl_AttributeReference*)_lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID())))
return false;
- theObject = GetStudy()->GetSObject(Ref->Get());
+ theObject = SALOMEDSImpl_Study::SObject(Ref->Get());
return true;
}
DF_Label L = _lab.FindChild(theTag, false);
if (L.IsNull()) return false;
- theObject = GetStudy()->GetSObject(L);
+ theObject = SALOMEDSImpl_Study::SObject(L);
return true;
}
virtual bool ReferencedObject(SALOMEDSImpl_SObject& theObject) const ;
virtual bool FindSubObject(int theTag, SALOMEDSImpl_SObject& theObject);
- virtual SALOMEDSImpl_Study* GetStudy() const;
virtual std::string Name() const { return _name; }
virtual void Name(const std::string& theName) { _name = theName; }
virtual std::vector<DF_Attribute*> GetAllAttributes() const;
bool aStructureOnly; // copy only SObjects and attributes without component help
aStructureOnly = !theObject.GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID());
- // get component-engine
- SALOMEDSImpl_Study* aStudy = theObject.GetStudy();
-
if (!_doc) {
_errorCode = "Document is null";
return false;
_errorCode = "";
return URL();
}
-//============================================================================
-/*! Function : GetTransientReference
- * Purpose : Get IOR of the Study (registred in Document in doc->Root)
- */
-//============================================================================
-std::string SALOMEDSImpl_Study::GetTransientReference()
-{
- _errorCode = "";
- std::string IOR = "";
-
- SALOMEDSImpl_AttributeIOR* Att;
- DF_Label _lab = _doc->Root();
- if ((Att=(SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
- IOR = Att->Value();
- }
- else {
- _errorCode = "IOR is empty";
- }
-
- return IOR;
-}
-
-void SALOMEDSImpl_Study::SetTransientReference(const std::string& theIOR)
-{
- _errorCode = "";
-
- SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties();
- int aLocked = aProp->IsLocked();
- if (aLocked) aProp->SetLocked(false);
-
- // Assign the value of the IOR in the study->root
- SALOMEDSImpl_AttributeIOR::Set(_doc->Main().Root(), theIOR);
-
- if (aLocked) aProp->SetLocked(true);
-}
//============================================================================
/*! Function : IsEmpty
}
}
-SALOMEDSImpl_Study* SALOMEDSImpl_Study::GetStudy(const DF_Label& theLabel)
+SALOMEDSImpl_Study* SALOMEDSImpl_Study::GetStudyImpl(const DF_Label& theLabel)
{
SALOMEDSImpl_StudyHandle* Att;
if ((Att=(SALOMEDSImpl_StudyHandle*)theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID()))) {
SALOMEDSImpl_SObject SALOMEDSImpl_Study::SObject(const DF_Label& theLabel)
{
- return GetStudy(theLabel)->GetSObject(theLabel);
+ return GetStudyImpl(theLabel)->GetSObject(theLabel);
}
SALOMEDSImpl_SComponent SALOMEDSImpl_Study::SComponent(const DF_Label& theLabel)
{
- return GetStudy(theLabel)->GetSComponent(theLabel);
+ return GetStudyImpl(theLabel)->GetSComponent(theLabel);
}
void SALOMEDSImpl_Study::IORUpdated(const SALOMEDSImpl_AttributeIOR* theAttribute)
{
std::string aString = theAttribute->Label().Entry();
- GetStudy(theAttribute->Label())->UpdateIORLabelMap(theAttribute->Value(), aString);
+ GetStudyImpl(theAttribute->Label())->UpdateIORLabelMap(theAttribute->Value(), aString);
}
std::vector<SALOMEDSImpl_SObject> SALOMEDSImpl_Study::FindDependances(const SALOMEDSImpl_SObject& anObject)
public:
- static SALOMEDSImpl_Study* GetStudy(const DF_Label& theLabel);
+ static SALOMEDSImpl_Study* GetStudyImpl(const DF_Label& theLabel);
static SALOMEDSImpl_SObject SObject(const DF_Label& theLabel);
static SALOMEDSImpl_SComponent SComponent(const DF_Label& theLabel);
static void IORUpdated(const SALOMEDSImpl_AttributeIOR* theAttribute);
//! method to Get persistent reference of study (idem URL())
virtual std::string GetPersistentReference();
- //! method to Get transient reference of study
- virtual std::string GetTransientReference();
-
- virtual void SetTransientReference(const std::string& theIOR);
-
//! method to detect if a study is empty
virtual bool IsEmpty();
aCurrentNode->Append(aNode);
// Mantis issue 0020136: Drag&Drop in OB
- theObject.GetStudy()->addSO_Notification(theObject);
+ SALOMEDSImpl_Study::GetStudyImpl(theObject.GetLabel())->addSO_Notification(theObject);
return true;
}
bool ret = aFather->Append(aNode);
// Mantis issue 0020136: Drag&Drop in OB
- theObject.GetStudy()->addSO_Notification(theObject);
+ SALOMEDSImpl_Study::GetStudyImpl(theObject.GetLabel())->addSO_Notification(theObject);
return ret;
}
bool ret = aNode->InsertBefore(aFirstNode);
// Mantis issue 0020136: Drag&Drop in OB
- theFirst.GetStudy()->addSO_Notification(theFirst);
+ SALOMEDSImpl_Study::GetStudyImpl(theFirst.GetLabel())->addSO_Notification(theFirst);
return ret;
}