From cbfd3b438f0f1d00499bba212d4caacc29bad1a3 Mon Sep 17 00:00:00 2001 From: Hugues Delorme Date: Mon, 25 Apr 2016 17:17:39 +0200 Subject: [PATCH] fake_support/opencascade: simplify Handle and array classes --- src/gmio_support/stl_occ_mesh.h | 3 +- src/gmio_support/stl_occ_meshvs.h | 3 +- tests/fake_support/main.cpp | 2 +- .../opencascade/MeshVS_DataSource.hxx | 6 ++- .../fake_support/opencascade/StlMesh_Mesh.hxx | 13 +++-- .../opencascade/StlMesh_MeshTriangle.hxx | 5 +- .../StlMesh_SequenceOfMeshTriangle.hxx | 2 +- .../opencascade/TColStd_Array1OfReal.hxx | 49 +++++++------------ tests/fake_support/opencascade/gp_XYZ.hxx | 13 ++--- 9 files changed, 43 insertions(+), 53 deletions(-) diff --git a/src/gmio_support/stl_occ_mesh.h b/src/gmio_support/stl_occ_mesh.h index 757d209..1194a20 100644 --- a/src/gmio_support/stl_occ_mesh.h +++ b/src/gmio_support/stl_occ_mesh.h @@ -81,10 +81,11 @@ struct gmio_stl_occmesh_iterator explicit gmio_stl_occmesh_iterator(const StlMesh_Mesh* mesh); explicit gmio_stl_occmesh_iterator(const Handle_StlMesh_Mesh& hnd); + inline const StlMesh_Mesh* mesh() const; + bool move_to_next_tri(uint32_t tri_id); inline const Handle_StlMesh_MeshTriangle& domain_tri(uint32_t tri_id) const; inline const TColgp_SequenceOfXYZ& domain_vertices() const; - inline const StlMesh_Mesh* mesh() const; private: void init(const StlMesh_Mesh* mesh); diff --git a/src/gmio_support/stl_occ_meshvs.h b/src/gmio_support/stl_occ_meshvs.h index 183fae9..11cf02a 100644 --- a/src/gmio_support/stl_occ_meshvs.h +++ b/src/gmio_support/stl_occ_meshvs.h @@ -66,10 +66,11 @@ struct gmio_stl_occmesh_datasource_iterator explicit gmio_stl_occmesh_datasource_iterator(const MeshVS_DataSource* data_src); explicit gmio_stl_occmesh_datasource_iterator(const Handle_MeshVS_DataSource& hnd); + inline const MeshVS_DataSource* data_src() const; + inline void move_to_next_tri(); inline int current_element_key() const; inline TColStd_Array1OfReal& cached_element_coords(); - inline const MeshVS_DataSource* data_src() const; private: const MeshVS_DataSource* m_data_src; diff --git a/tests/fake_support/main.cpp b/tests/fake_support/main.cpp index 3e151c0..c14aa8e 100644 --- a/tests/fake_support/main.cpp +++ b/tests/fake_support/main.cpp @@ -4,7 +4,7 @@ #include "../../src/gmio_support/stream_cpp.h" #include -#include +#include #include int main() diff --git a/tests/fake_support/opencascade/MeshVS_DataSource.hxx b/tests/fake_support/opencascade/MeshVS_DataSource.hxx index 5572e74..a5ee445 100644 --- a/tests/fake_support/opencascade/MeshVS_DataSource.hxx +++ b/tests/fake_support/opencascade/MeshVS_DataSource.hxx @@ -2,8 +2,7 @@ #define _MeshVS_DataSource_HeaderFile #include "Standard_TypeDef.hxx" -#include "Handle_MeshVS_DataSource.hxx" -class TColStd_Array1OfReal; +#include "TColStd_Array1OfReal.hxx" class TColStd_PackedMapOfInteger; typedef enum @@ -41,4 +40,7 @@ public: { return 0; } }; +#include "generic_handle.h" +typedef FakeOcc::GenericHandle Handle_MeshVS_DataSource; + #endif // _MeshVS_DataSource_HeaderFile diff --git a/tests/fake_support/opencascade/StlMesh_Mesh.hxx b/tests/fake_support/opencascade/StlMesh_Mesh.hxx index d34a046..8884334 100644 --- a/tests/fake_support/opencascade/StlMesh_Mesh.hxx +++ b/tests/fake_support/opencascade/StlMesh_Mesh.hxx @@ -1,7 +1,6 @@ #ifndef _StlMesh_Mesh_HeaderFile #define _StlMesh_Mesh_HeaderFile -#include #include #include @@ -11,8 +10,7 @@ public: StlMesh_Mesh() { } - virtual void AddDomain() - { } + virtual void AddDomain() { } virtual int AddTriangle( const int /*V1*/, const int /*V2*/, const int /*V3*/, @@ -23,11 +21,9 @@ public: const double /*X*/, const double /*Y*/, const double /*Z*/) { return -1; } - virtual int NbTriangles(const int /*DomainIndex*/) const - { return 0; } + virtual int NbTriangles(const int /*DomainIndex*/) const { return 0; } - virtual int NbDomains() const - { return 0; } + virtual int NbDomains() const { return 0; } virtual const StlMesh_SequenceOfMeshTriangle& Triangles( const int /*DomainIndex = 1*/) const @@ -44,4 +40,7 @@ public: } }; +#include "generic_handle.h" +typedef FakeOcc::GenericHandle Handle_StlMesh_Mesh; + #endif // _StlMesh_Mesh_HeaderFile diff --git a/tests/fake_support/opencascade/StlMesh_MeshTriangle.hxx b/tests/fake_support/opencascade/StlMesh_MeshTriangle.hxx index 268a694..756e405 100644 --- a/tests/fake_support/opencascade/StlMesh_MeshTriangle.hxx +++ b/tests/fake_support/opencascade/StlMesh_MeshTriangle.hxx @@ -1,8 +1,6 @@ #ifndef _StlMesh_MeshTriangle_HeaderFile #define _StlMesh_MeshTriangle_HeaderFile -#include - class StlMesh_MeshTriangle { public: @@ -12,4 +10,7 @@ public: { } }; +#include "generic_handle.h" +typedef FakeOcc::GenericHandle Handle_StlMesh_MeshTriangle; + #endif // _StlMesh_MeshTriangle_HeaderFile diff --git a/tests/fake_support/opencascade/StlMesh_SequenceOfMeshTriangle.hxx b/tests/fake_support/opencascade/StlMesh_SequenceOfMeshTriangle.hxx index 11e3358..7cbb0fd 100644 --- a/tests/fake_support/opencascade/StlMesh_SequenceOfMeshTriangle.hxx +++ b/tests/fake_support/opencascade/StlMesh_SequenceOfMeshTriangle.hxx @@ -1,7 +1,7 @@ #ifndef _StlMesh_SequenceOfMeshTriangle_HeaderFile #define _StlMesh_SequenceOfMeshTriangle_HeaderFile -#include +#include class StlMesh_SequenceOfMeshTriangle { diff --git a/tests/fake_support/opencascade/TColStd_Array1OfReal.hxx b/tests/fake_support/opencascade/TColStd_Array1OfReal.hxx index e6788dd..ce4eab7 100644 --- a/tests/fake_support/opencascade/TColStd_Array1OfReal.hxx +++ b/tests/fake_support/opencascade/TColStd_Array1OfReal.hxx @@ -1,34 +1,23 @@ -#ifndef _TColStd_Array1OfReal_HeaderFile -#define _TColStd_Array1OfReal_HeaderFile +// Copyright (c) 1998-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. -class TColStd_Array1OfReal -{ -public: - TColStd_Array1OfReal(const int, const int) {} +#ifndef TColStd_Array1OfReal_HeaderFile +#define TColStd_Array1OfReal_HeaderFile - int Length() const { return 0; } - int Lower() const { return 1; } - int Upper() const { return 1; } +#include +#include - void SetValue (const int, const double&) {} +typedef NCollection_Array1 TColStd_Array1OfReal; - const double& Value(const int) const - { - static const double v = 0; - return v; - } - - const double& operator()(const int Index) const - { return Value(Index); } - - double& ChangeValue(const int) - { - static double v = 0; - return v; - } - - double& operator()(const int Index) - { return ChangeValue(Index); } -}; - -#endif // _TColStd_Array1OfReal_HeaderFile +#endif diff --git a/tests/fake_support/opencascade/gp_XYZ.hxx b/tests/fake_support/opencascade/gp_XYZ.hxx index 30bd004..dd0fbaf 100644 --- a/tests/fake_support/opencascade/gp_XYZ.hxx +++ b/tests/fake_support/opencascade/gp_XYZ.hxx @@ -1,17 +1,14 @@ #ifndef _gp_XYZ_HeaderFile #define _gp_XYZ_HeaderFile +#include + class gp_XYZ { public: - double X() const - { return 0.; } - - double Y() const - { return 0.; } - - double Z() const - { return 0.; } + Standard_Real X() const { return 0.; } + Standard_Real Y() const { return 0.; } + Standard_Real Z() const { return 0.; } }; #endif // _gp_XYZ_HeaderFile