Conversation
|
|
||
| uint32_t express::Base::id() const { return data()->id(); } | ||
|
|
||
| const InstanceData* express::Base::data() const { |
There was a problem hiding this comment.
This method, as well as the non-const version, defeats using smart pointers. Once the raw pointer is returned it is no longer managed and could be deleted by the caller. Why not
auto sp = data_.lock();
if (sp) {
return sp;
} else {
throw std::runtime_error("Trying to access deleted instance reference")
}
There was a problem hiding this comment.
That's true, but I have the feeling that maybe this should be marked private instead and then it doesn't really matter anymore.
|
Does the weak_ptr encapsulated in the express::Base retain file scope lifetime of objects? It seems like shared_ptr would be required. Though, I don't have a complete understanding. Creating entities as part of the file without constructors has a trade-off. Instead of create() + add() a user of the SDK must do create() + multiple parameter initialization steps by calling set() methods. This isn't bad, but it has these consequences:
I very much like eliminating the custom classes for aggregates. I found them difficult to use. It was difficult to know which one of the classes where needed in different situations. Their interface wasn't the same as std collections, so looping wasn't as easy and they couldn't be used in the std algorithms. This is going to break a lot of my code, but the fixes appear to be easy to deal with. @aothms Let's set up a time for you to walk me through the bigger picture. I'm sure there are lots of details that I'm missing. |
|
|
||
| // Disable warnings coming from IfcOpenShell | ||
| #pragma warning(disable : 4018 4267 4250 4984 4985) | ||
| /******************************************************************************** |
There was a problem hiding this comment.
It looks like a different example has been applied over the IfcAlignment.cpp example. The revised file is significantly different. Is this intentional?
There was a problem hiding this comment.
Sorry that was sloppy, it's back and updated for the code changes
Yes the file have the shared_ptr not so much for sharing ownership but just so that we have the option to have a weak_ptr derived from them. So that when you have instances pointing to a deleted file or to instances from the file that have been deleted.
Yes that's very valid. The discovery is indeed not really there. I'm also fine with forwarding the arguments from file.create and reinstate the constructor. But as I said since the arguments are not named I find them a bit unclear especially with all the std::nullopts for all the optional arguments, it's hard to interpret. Boost has this named parameters idea, but I think it's a bit lengthy to setup https://www.boost.org/doc/libs/latest/libs/graph/doc/bgl_named_params.html
I think that's indeed also a nice compromise. Then we also have autocompletion in our IDE because I think with std::forward from file.create() I think IDE's will be pretty clueless. Very flexible to have a call these days, let me know some times that suit you please. |
|
I emailed your personal account with some proposed times for next week |
|
I experienced segfaults when doing ifcopenshell.open() (after all those compilation fixes in the previous comment) on the ISSUE_159_kleine_Wohnung_R22.ifc model (from the list of profiling models). Here's an updated AI generated findings.md with an explanation of that fix, and a patch showing all the changes so far. I'm also getting iterator initialisation errors on the advanced_model.ifc model saying "Trying to access deleted instance reference" (with detailed logging turned on). Haven't yet found a solution to that yet though. Other than that, with those patches I can compile, and the profiling code is able to basically recreate the same numbers (apart from that initialisation error on that model) as the main branch. |
|
Hm yes apparently openai codex only bothered to verify compilation on windows. These template/typename things are notoriously different between compiler implementations. |
|
Woke up this morning and the "Trying to access deleted instance reference" was solved by AI with this explanation: |
|
Thanks! that fix we probably cannot use, because that means that every deleted instance equals every other deleted instance. We want this generally to bubble up as an exception (I think). But the root cause is super useful we just need to catch this a bit earlier, because apparently this is not a very common issue so I don't think it warrants a fix so high up in the abstraction level. I have a bit of a backlog of other work because I missed a good couple of days due to back issues, but I'll get to this later this week. If you want to have it chew at some other tasks in the meantime, essentially:
|
|
Maybe bug? ● Update(src/ifcgeom/mapping/IfcOffsetCurveByDistance.cpp) |
|
BTW I have rebased the work on the viewer on the datamodel-v1.0 branch: #7930 |
|
Another observation: I think the normals coming from manifold aren't right. At least the viewer gives me funky colours :) |
Something so simple I had better built myself. Now that I better see the code I think it needs to be thrown away, but at least this particular issue is gone.
It appears it doesn't populate anything so you're likely reading random data. Will have a look tomorrow. |





For the past couple of days I have been rethinking what a sane v1.0 data model on the C++ side would look like that balances safety, readability, performance and a bit more modern language features. I still have work todo but wanted to share a bit of what's going on.
This has huge implications on client C++ code, so to feel the pain I went through most of the code base already. @RickBrice as one of the more active C++ devs lately I'm curious what your thoughts are.
Outcome:
Before:
After:
Rationale
reason for weak_ptr encapsulated in object:
reason for creation as part of file
reasons for no constructor:
no custom class anymore for aggregates (aggregate_of_instance)