Salome HOME
Updated copyright comment
[modules/kernel.git] / src / SALOMESDS / SALOMESDS_PickelizedPyObjRdExtServer.hxx
1 // Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony GEAY (EDF R&D)
20
21 #ifndef __SALOMESDS_PICKELIZEDPYOBJRDEXTSERVER_HXX__
22 #define __SALOMESDS_PICKELIZEDPYOBJRDEXTSERVER_HXX__
23
24 #include "SALOMEconfig.h"
25 #include CORBA_SERVER_HEADER(SALOME_SDS)
26
27 #include <Python.h>
28
29 #include "SALOMESDS_PickelizedPyObjServer.hxx"
30 #include "SALOMESDS_Sha1Keeper.hxx"
31
32 namespace SALOMESDS
33 {
34   class PickelizedPyObjRdExtInitServer;
35   
36   class PickelizedPyObjRdExtServer : public PickelizedPyObjServerModifiable, public virtual POA_SALOME::PickelizedPyObjRdExtServer
37   {
38   public:
39     PickelizedPyObjRdExtServer(DataScopeServerBase *father, const std::string& varName, const SALOME::ByteVec& value);
40     PickelizedPyObjRdExtServer(DataScopeServerBase *father, const std::string& varName, PyObject *obj);
41     virtual ~PickelizedPyObjRdExtServer();
42     SALOME::PickelizedPyObjRdExtServer_ptr invokePythonMethodOn(const char *method, const SALOME::ByteVec& args);
43     virtual PickelizedPyObjRdExtInitServer *buildInitInstanceFrom(const std::string& varName);
44   public:
45     std::string getAccessStr() const;
46   private:
47     void checkRdExtnessOf(const std::string& methodName, PyObject *argsPy);
48     void checkListRdExtnessOf(const std::string& methodName, PyObject *argsPy);
49     void checkDictRdExtnessOf(const std::string& methodName, PyObject *argsPy);
50     void checkDictSetitemRdExtness(PyObject *argsPy);
51   public:
52     static const char ACCESS_REPR[];
53   };
54
55   class PickelizedPyObjRdExtFreeStyleServer : public PickelizedPyObjRdExtServer, public Sha1Keeper
56   {
57   public:
58     PickelizedPyObjRdExtFreeStyleServer(DataScopeServerBase *father, const std::string& varName, const SALOME::ByteVec& value, std::string&& compareFuncContent, SALOME::AutoPyRef&& compareFunc):PickelizedPyObjRdExtServer(father,varName,value),Sha1Keeper(std::move(compareFuncContent),std::move(compareFunc)) { }
59     PickelizedPyObjRdExtFreeStyleServer(DataScopeServerBase *father, const std::string& varName, PyObject *obj, std::string&& compareFuncContent, SALOME::AutoPyRef&& compareFunc):PickelizedPyObjRdExtServer(father,varName,obj),Sha1Keeper(std::move(compareFuncContent),std::move(compareFunc)) { }
60     PickelizedPyObjRdExtInitServer *buildInitInstanceFrom(const std::string& varName) override;
61   };
62 }
63
64 #endif