Revision: 74276
http://sourceforge.net/p/brlcad/code/74276
Author: starseeker
Date: 2019-10-31 18:23:07 +0000 (Thu, 31 Oct 2019)
Log Message:
-----------
MSVC isn't liking calling the methods from the dll - see if we can use the
PImpl pattern for this...
Modified Paths:
--------------
brlcad/trunk/src/libbrep/cdt_mesh.cpp
brlcad/trunk/src/libbrep/cdt_mesh.h
brlcad/trunk/src/libbrep/tests/brep_cdt_mesh.cpp
Modified: brlcad/trunk/src/libbrep/cdt_mesh.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_mesh.cpp 2019-10-31 16:29:30 UTC (rev
74275)
+++ brlcad/trunk/src/libbrep/cdt_mesh.cpp 2019-10-31 18:23:07 UTC (rev
74276)
@@ -4313,6 +4313,46 @@
} // close namespace cdt_mesh
+// PImpl exposure of some mesh operations for use in tests
+struct cdt_bmesh_impl {
+ cdt_mesh::cdt_mesh_t fmesh;
+};
+
+int
+cdt_bmesh_create(struct cdt_bmesh **m)
+{
+ if (!m) return -1;
+ (*m) = new cdt_bmesh;
+ (*m)->i = new cdt_bmesh_impl;
+ return (!(*m)->i) ? -1 : 0;
+}
+
+void
+cdt_bmesh_destroy(struct cdt_bmesh *m)
+{
+ if (!m) return;
+ delete m->i;
+ delete m;
+}
+
+int
+cdt_bmesh_deserialize(const char *fname, struct cdt_bmesh *m)
+{
+ if (!fname || !m) return -1;
+ if (!bu_file_exists(fname, NULL)) return -1;
+ m->i->fmesh.deserialize(fname);
+ return 0;
+}
+
+int
+cdt_bmesh_repair(struct cdt_bmesh *m)
+{
+ if (!m) return -1;
+ bool rsuccess = m->i->fmesh.repair();
+ return (rsuccess) ? 0 : 1;
+}
+
+
// Local Variables:
// tab-width: 8
// mode: C++
Modified: brlcad/trunk/src/libbrep/cdt_mesh.h
===================================================================
--- brlcad/trunk/src/libbrep/cdt_mesh.h 2019-10-31 16:29:30 UTC (rev 74275)
+++ brlcad/trunk/src/libbrep/cdt_mesh.h 2019-10-31 18:23:07 UTC (rev 74276)
@@ -638,6 +638,23 @@
}
+// PImpl exposure of some mesh operations for use in tests
+#if defined(__cplusplus)
+extern "C" {
+#endif
+ struct cdt_bmesh_impl;
+ struct cdt_bmesh {
+ struct cdt_bmesh_impl *i;
+ };
+ int cdt_bmesh_create(struct cdt_bmesh **m);
+ void cdt_bmesh_destroy(struct cdt_bmesh *m);
+
+ int cdt_bmesh_deserialize(const char *fname, struct cdt_bmesh *m);
+ int cdt_bmesh_repair(struct cdt_bmesh *m);
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* __cdt_mesh_h__ */
/*
Modified: brlcad/trunk/src/libbrep/tests/brep_cdt_mesh.cpp
===================================================================
--- brlcad/trunk/src/libbrep/tests/brep_cdt_mesh.cpp 2019-10-31 16:29:30 UTC
(rev 74275)
+++ brlcad/trunk/src/libbrep/tests/brep_cdt_mesh.cpp 2019-10-31 18:23:07 UTC
(rev 74276)
@@ -30,10 +30,18 @@
if (argc != 2) {
std::cerr << "brep_cdt_mesh <serialization_file>\n";
}
- cdt_mesh::cdt_mesh_t fmesh;
- fmesh.deserialize(argv[1]);
- fmesh.repair();
+ struct cdt_bmesh *fmesh;
+ if (cdt_bmesh_create(&fmesh)) return -1;
+ if (cdt_bmesh_deserialize(argv[1], fmesh)) {
+ cdt_bmesh_destroy(fmesh);
+ return -1;
+ }
+ if (cdt_bmesh_repair(fmesh)) {
+ cdt_bmesh_destroy(fmesh);
+ return -1;
+ }
+ cdt_bmesh_destroy(fmesh);
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits