Sprout from BR_QT4_Dev2 2008-09-18 11:48:17 UTC mkr <mkr@opencascade.com> 'TestRecorder support.'
Cherrypick from BR_QT4_Dev2 2008-07-08 06:25:07 UTC admin <salome-admin@opencascade.com> 'This commit was generated by cvs2git to create branch 'BR_QT4_Dev2'.':
src/Communication/Receiver.cxx
src/SALOMEDS/README_attributes
src/SALOMEDS/SALOMEDS_AttLong_i.cxx
src/SALOMEDS/SALOMEDS_AttLong_i.hxx
src/SALOMEDS/SALOMEDS_AttReal_i.cxx
src/SALOMEDS/SALOMEDS_AttReal_i.hxx
src/SALOMEDS/SALOMEDS_BasicAttributeFactory.cxx
src/SALOMEDS/SALOMEDS_BasicAttributeFactory.hxx
src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx
src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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 "Receiver.hxx"
+#include <string.h>
+using namespace std;
+
+/*!
+ return a deep copy of the array contained in the servant.
+ */
+void *Receiver::getLocalValue(long &size,SALOME_Sender_i* servant)
+{
+ const void *src=servant->getData(size);
+ long lgr=size*servant->getSizeOf();
+ void *ret=new char[lgr];
+ memcpy(ret,src,lgr);
+ return ret;
+ //return (void *)servant->getData(size);
+}
+
+void *Receiver::getValue(long &size,SALOME::Sender_ptr sender)
+{
+ SALOME_Sender_i* data=SALOME_Sender_i::find(sender);
+ if(data)
+ return getLocalValue(size,data);
+ else
+ return getDistValue(size);
+}
+
--- /dev/null
+
+$Header$
+
+How to add a new attribute (without WOK):
+-----------------------------------------
+
+This works only for simple types (ex: string)
+
+example: add attribute FileType (string)
+
+# new files (copied from files specific to ExternalFileDef attribute = string):
+
+? src/SALOMEDS/Handle_SALOMEDS_FileType.hxx <--- Handle_SALOMEDS_ExternalFileDef.hxx
+? src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx <--- SALOMEDS_AttributeExternalFileDef_i.cxx
+? src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx <--- SALOMEDS_AttributeExternalFileDef_i.hxx
+? src/SALOMEDS/SALOMEDS_FileType.cdl <--- SALOMEDS_ExternalFileDef.cdl
+? src/SALOMEDS/SALOMEDS_FileType.cxx <--- SALOMEDS_ExternalFileDef.cxx
+? src/SALOMEDS/SALOMEDS_FileType.hxx <--- SALOMEDS_ExternalFileDef.hxx
+? src/SALOMEDS/SALOMEDS_FileType.ixx <--- SALOMEDS_ExternalFileDef.ixx
+? src/SALOMEDS/SALOMEDS_FileType.jxx <--- SALOMEDS_ExternalFileDef.jxx
+
+# files modified:
+
+M idl/SALOMEDS_Attributes.idl
+M src/SALOMEDS/Makefile.in
+M src/SALOMEDS/SALOMEDS_SObject_i.cxx
+M src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx
+
+# detailled modifications:
+
+- in new files,
+change ExternalFileDef in FileType everywhere
+- in SALOMEDS_FileType.cxx,
+Standard_GUID (Global Universal IDentifier) must be changed.
+To obtain a new GUID, it is possible to use guidgen.exe on windows (with visual C++).
+
+- in src/SALOMEDS/Makefile.in,
+add under LIB_SRC = \
+ SALOMEDS_FileType.cxx \
+ SALOMEDS_AttributeExternalFileDef_i.cxx \
+
+- in src/SALOMEDS/SALOMEDS_SObject_i.cxx,
+- in src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx,
+- in idl/SALOMEDS_Attributes.idl,
+find portions of code containing ExternalFileDef, duplicate and replace
+
--- /dev/null
+// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : SALOMEDS_AttLong_i.cxx
+// Author : Estelle Deville
+// Module : SALOME
+// $Header$
+
+#include "SALOMEDS_AttLong_i.hxx"
+#include "utilities.h"
+#include <stdio.h>
+#include <SALOMEDSImpl_AttributeInteger.hxx>
+using namespace std;
+
+//============================================================================
+/*! Function : Set
+ * Purpose : Affect a value to the basic attribute
+ */
+//============================================================================
+void SALOMEDS_AttLong_i::Set(CORBA::Long i)
+{
+ CheckLocked();
+ SALOMEDSImpl_AttributeInteger::Set (_Lab,i);
+}
+
+//============================================================================
+/*! Function : Get
+ * Purpose : Get basic attribute's value
+ */
+//============================================================================
+CORBA::Long SALOMEDS_AttLong_i::Get()
+{
+ SALOMEDSImpl_AttributeInteger* Att = NULL;
+ CORBA::Long x;
+ if ((Att=(SALOMEDSImpl_AttributeInteger*)_Lab.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID())))
+ x = Att->Get ();
+ return x;
+}
+
+//============================================================================
+/*! Function : Save
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_AttLong_i::Save()
+{
+ BEGIN_OF("SALOMEDS_AttLong_i::Save");
+ CORBA::Long x = this->Get();
+ char* out= new char[12];
+ sprintf(out,"%ld",x);
+ return out;
+}
+
+//============================================================================
+/*! Function : Load
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_AttLong_i::Load()
+{
+ BEGIN_OF("SALOMEDS_AttLong_i::Load");
+}
+
+//============================================================================
+/*! Function : GetPtr
+ * Purpose : return sobject associated to the basic attribute (if exist)
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_AttLong_i::GetPtr(SALOMEDS::SObject_ptr anObject)
+{
+ return (_Lab.IsAttribute(SALOMEDSImpl_AttributeInteger::GetID()));
+}
+
+//============================================================================
+/*! Function : GetType
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_AttLong_i::GetType()
+{
+ return CORBA::string_dup(_type);
+}
--- /dev/null
+// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : SALOMEDS_AttLong_i.hxx
+// Author : Estelle Deville
+// Module : SALOME
+// $Header$
+
+#ifndef __SALOMEDS_ATTLONG_I_H__
+#define __SALOMEDS_ATTLONG_I_H__
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_AttLong)
+#include "SALOMEDS_BasicAttribute_i.hxx"
+
+class SALOMEDS_AttLong_i: public POA_SALOMEDS::AttLong,
+ public SALOMEDS_BasicAttribute_i {
+protected:
+ char * _type;
+
+public:
+
+ SALOMEDS_AttLong_i() { _type = "AttLong";};
+ ~SALOMEDS_AttLong_i() {};
+ void Set(CORBA::Long i);
+ CORBA::Long Get();
+ virtual char* Save();
+ virtual void Load();
+ CORBA::Boolean GetPtr(SALOMEDS::SObject_ptr so);
+ virtual char* GetType();
+};
+#endif
--- /dev/null
+// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : SALOMEDS_AttReal_i.cxx
+// Author : Estelle Deville
+// Module : SALOME
+// $Header$
+
+#include "SALOMEDS_AttReal_i.hxx"
+#include "utilities.h"
+#include <stdio.h>
+#include <cstring>
+#include <SALOMEDSImpl_AttributeReal.hxx>
+using namespace std;
+
+//============================================================================
+/*! Function : Set
+ * Purpose : Affect a value to the basic attribute
+ */
+//============================================================================
+void SALOMEDS_AttReal_i::Set(CORBA::Double r)
+{
+ CheckLocked();
+ SALOMEDSImpl_AttributeReal::Set (_Lab,r);
+}
+
+//============================================================================
+/*! Function : Get
+ * Purpose : Get basic attribute's value
+ */
+//============================================================================
+CORBA::Double SALOMEDS_AttReal_i::Get()
+{
+ SALOMEDSImpl_AttributeReal* Att;
+ CORBA::Double x;
+ if ((Att=(SALOMEDSImpl_AttributeReal*)_Lab.FindAttribute(TDataStd_Real::GetID())))
+ x = Att->Get ();
+ return x;
+}
+
+//============================================================================
+/*! Function : Save
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_AttReal_i::Save()
+{
+ BEGIN_OF("SALOMEDS_AttReal_i::Save");
+ CORBA::Double x = this->Get();
+ char* out= new char[12];
+ sprintf(out,"%g",x);
+ return out;
+}
+
+//============================================================================
+/*! Function : Load
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_AttReal_i::Load()
+{
+ BEGIN_OF("SALOMEDS_AttReal_i::Load");
+}
+
+//============================================================================
+/*! Function : GetPtr
+ * Purpose : return sobject associated to the basic attribute (if exist)
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_AttReal_i::GetPtr(SALOMEDS::SObject_ptr anObject)
+{
+ return _Lab.IsAttribute(SALOMEDSImpl_AttributeReal::GetID());
+}
+
+//============================================================================
+/*! Function : GetType
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_AttReal_i::GetType()
+{
+ return CORBA::string_dup(_type);
+}
--- /dev/null
+// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : SALOMEDS_AttReal_i.hxx
+// Author : Estelle Deville
+// Module : SALOME
+// $Header$
+
+#ifndef __SALOMEDS_ATTREAL_I_H__
+#define __SALOMEDS_ATTREAL_I_H__
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_AttReal)
+#include "SALOMEDS_BasicAttribute_i.hxx"
+
+class SALOMEDS_AttReal_i: public POA_SALOMEDS::AttReal,
+ public SALOMEDS_BasicAttribute_i {
+protected:
+ char * _type;
+
+public:
+
+ SALOMEDS_AttReal_i() { _type = "AttReal";};
+ ~SALOMEDS_AttReal_i() {};
+ void Set(CORBA::Double r);
+ CORBA::Double Get();
+ virtual char* Save();
+ virtual void Load();
+ CORBA::Boolean GetPtr(SALOMEDS::SObject_ptr so);
+ virtual char* GetType();
+};
+#endif
--- /dev/null
+// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : SALOMEDS_BasicAttributeFactory.cxx
+// Author : Estelle Deville, CEA
+// Module : SALOME
+// $Header$
+
+#include "SALOMEDS_BasicAttributeFactory.hxx"
+#include "utilities.h"
+using namespace std;
+
+//============================================================================
+/*! Function : Create
+ * Purpose : create new basic attributes
+ */
+//============================================================================
+SALOMEDS_BasicAttribute_i* BasicAttributeFactory::Create(const char* type)
+ throw (SALOME_Exception)
+{
+ try {
+ if (!strcmp(type,"AttReal"))
+ {
+ SALOMEDS_AttReal_i *A = new SALOMEDS_AttReal_i();
+ return A;
+ }
+ else if(!strcmp(type,"AttLong"))
+ {
+ SALOMEDS_AttLong_i *A = new SALOMEDS_AttLong_i();
+ return A;
+ }
+ else throw(SALOME_Exception(LOCALIZED("bad attribute type name")));
+ } catch (...) {throw(SALOME_Exception(LOCALIZED("Unexpected exception was caught")));}
+}
--- /dev/null
+// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : SALOMEDS_BasicAttributeFactory.hxx
+// Author : Estelle Deville, CEA
+// Module : SALOME
+// $Header$
+
+#ifndef _BASIC_ATTRIBUTEFACTORY_HXX_
+#define _BASIC_ATTRIBUTEFACTORY_HXX_
+#include "SALOMEDS_BasicAttribute_i.hxx"
+// Add new Attribute type here
+#include "SALOMEDS_AttReal_i.hxx"
+#include "SALOMEDS_AttLong_i.hxx"
+
+#include "Utils_SALOME_Exception.hxx"
+
+class BasicAttributeFactory
+{
+public:
+ BasicAttributeFactory() {};
+ virtual ~BasicAttributeFactory() {};
+
+ SALOMEDS_BasicAttribute_i* Create(const char* type)
+ throw (SALOME_Exception);
+};
+
+#endif
--- /dev/null
+// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : SALOMEDS_BasicAttribute_i.cxx
+// Author : Estelle Deville, CEA
+// Module : SALOME
+// $Header$
+
+#include "SALOMEDS_BasicAttribute_i.hxx"
+using namespace std;
+
+//============================================================================
+/*! Function : SetLabel
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_BasicAttribute_i::SetLabel(const DF_Label& Lab)
+{
+ _Lab = Lab;
+}
+
--- /dev/null
+// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : SALOMEDS_BasicAttribute_i.hxx
+// Author : Estelle Deville, CEA
+// Module : SALOME
+// $Header$
+
+#ifndef _BASIC_ATTRIBUTE_I_HXX_
+#define _BASIC_ATTRIBUTE_I_HXX_
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include <DF_Label.hxx>
+
+class SALOMEDS_BasicAttribute_i: public POA_SALOMEDS::BasicAttribute,
+ public PortableServer::ServantBase {
+protected:
+ DF_Label _Lab;
+
+public:
+ SALOMEDS_BasicAttribute_i() {};
+
+ ~SALOMEDS_BasicAttribute_i() {};
+
+ virtual char * Save() =0;
+ virtual void Load () =0;
+ CORBA::Boolean GetPtr(SALOMEDS::SObject so);
+ void SetLabel(const DF_Label& Lab);
+ virtual char* GetType() = 0;
+
+};
+
+#endif