New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WorkspaceObject::setString allows setting invalid names for ModelObjects #4205
Comments
Why would you call |
Interesting, the IdfObject does the right thing. OpenStudio/src/utilities/idf/IdfObject.cpp Lines 442 to 445 in 1de7dfe
The WorkspaceObject does hardcode to zero: OpenStudio/src/utilities/idf/WorkspaceObject.cpp Lines 433 to 436 in 1de7dfe
|
Well, IdfObject isn't doing the right thing I think. I don't understand why we don't have a warning poping up for this... OpenStudio/src/utilities/idf/IdfObject.cpp Lines 442 to 445 in 1de7dfe
OpenStudio/src/utilities/idd/IddObject.cpp Lines 250 to 255 in 1de7dfe
|
Ok after testing on Compiler explorer and looking at the assembly (see https://godbolt.org/z/8aGbxE) this works as intended, but I still find it confusing. |
setName("") is allowed though...
Can anyone justify this behavior? Should this block be OpenStudio/src/utilities/idf/WorkspaceObject.cpp Lines 361 to 364 in 1de7dfe
|
If you change it to >= instead of >, you get the following failures:
Click to see verbose log
|
I should have told you I was working on this locally. This is related to openstudiocoalition/OpenStudioApplication#314 |
I have some code I will push up once I get things sorted, it's a pain because Meter uses name to store the E+ meter name and breaks the idea of what a name should be |
Yeah I saw the test failing and understood why. I would probably consider changing the OutputMeter API (and IDD) to be more sane. |
At first I was going to suggest changing OutputMeter's |
Issue overview
WorkspaceObject::setString allows setting invalid names for ModelObjects
Current Behavior
WorkspaceObject::setString assumes name index is always 0, for ModelObjects name index is 1. This allows user to set invalid names using WorkspaceObject::setString.
Expected Behavior
The following test should pass:
The text was updated successfully, but these errors were encountered: