Session_ServerLauncher.hxx
Session_ServerThread.hxx
Session_Session_i.hxx
+ Session_Promises.hxx
)
# --- resources ---
Session_ServerLauncher.cxx
Session_ServerThread.cxx
Session_Session_i.cxx
+ Session_Promises.cxx
)
# --- rules ---
#include "Session_Session_i.hxx"
#include "Session_ServerCheck.hxx"
#include "Session_ServerLauncher.hxx"
+#include "Session_Promises.hxx"
#include "GUI_version.h"
#include "Qtx.h"
SALOME::Session_var GUIAppNewStyle::getSession()
{
- /*SALOMEDS::Study_var session = KERNEL::getStudyServantSA();
- return session;*/
+ GetSessionRefSingleton()->get_future().wait();
+ SALOME::Session_var session = GetSessionRefSingleton()->get_future().get();
+ return session;
}
// ---------------------------- MAIN -----------------------
--- /dev/null
+// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "Session_Promises.hxx"
+
+std::promise<SALOME::Session_var> *GetSessionRefSingleton()
+{
+ static std::promise<SALOME::Session_var> _my_unique_study_ref;
+ return &_my_unique_study_ref;
+}
--- /dev/null
+// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOME_Session)
+
+#include <future>
+
+std::promise<SALOME::Session_var> *GetSessionRefSingleton();
// Author : Paul RASCLE, EDF
#include "Session_ServerThread.hxx"
+#include "Session_Promises.hxx"
#include <SALOME_NamingService.hxx>
#include <SALOME_Container_i.hxx>
MESSAGE("poa->activate_object(mySALOME_Session)");
CORBA::Object_var obj = mySALOME_Session->_this();
+ SALOME::Session_var objC = SALOME::Session::_narrow(obj);
+ GetSessionRefSingleton()->set_value(objC);
CORBA::String_var sior(_orb->object_to_string(obj));
mySALOME_Session->_remove_ref();