First time here? Check our help page!
3

When does and doesn't the OpenStudio API retrieve properties with methods?

I was curious as to when the OpenStudio API retrieves properties with a method or just by directly accessing the property? For example, using a space object conveniently named "space", why is the call to get it's name space.name() where as to get it's spaceType is simply space.spaceType? These both will return optional objects, but the call for the name property is a method. I'm using the C# bindings.

pflaumingo's avatar
1.9k
pflaumingo
asked 2016-04-04 13:43:09 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-10-03 16:23:13 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

Here's a "I don't know really, but I'll try anyways" answer.

space.name doesn't work? What about space.spaceType()? I'm no C++ expert and certainly know nothing about C#, but it does look like spaceType is a method as well no? See Space.cpp#L486

One thing is that all OpenStudio objects actually have a name (and a handle), and this method (.name) isn't defined in the class itself (nowhere in Space.cpp, Space.hpp, Space_Impl.hpp) while the space.spaceType is actually defined there. That might be it.

Julien Marrec's avatar
29.7k
Julien Marrec
answered 2016-04-05 05:10:24 -0500
edit flag offensive 0 remove flag delete link

Comments

1

Yeh, I thought it was too, but I get compile errors unless used as I've stated above. I wonder if it's something to do with SWIG, which I know very little about. The name and handles seems to be inherited from IdfObject and spaceType is local to the object, but defaultConstructionSet is also local and used like a method (space.defaultConstructionSet()).

pflaumingo's avatar pflaumingo (2016-04-05 10:29:55 -0500) edit
add a comment see more comments