monsieurgustav / UE-OSC

OSC plugin for Unreal Engine 4 Blueprints
MIT License
323 stars 95 forks source link

Make Structures and Relevant Classes Public #51

Closed calben closed 7 years ago

calben commented 7 years ago

I've got an application for which I need to loop through a set of data element structs. That the definitions for these types are private makes this a little more complicated, so I'll probably be pulling them into public and exposing them.

Is there a reason they are private? I don't want to make a mess!

monsieurgustav commented 7 years ago

Hi, The "value" is private because it is stored at the same memory location whatever the type is (float, int, bool, string, etc.) just like a "union" in C is. So you need functions to cast the "whatever" type to the actual type.

I wonder why that makes anything more complicated though.

You can loop over the content of an array of elements, as any other array. You cannot loop over the types an element might be, (at least, not yet) but what would that bring? Could you expand a bit more?

calben commented 7 years ago

I'd like to iterate like so: for (FOscDataElemStruct elem : input), but I don't think I can simply include the OscDataElemStruct.h since it isn't in a public include path. I'm hoping to convert an awful bit of Blueprints to C++

https://i.imgur.com/6Znz5YK.png.

monsieurgustav commented 7 years ago

OK, I completely missed your point ! :)

I blindly follow my mantra "put it all in private, unless you have a reason not to". So no technical reason. Maybe I overdid it though... I push an update, that exposes most useful stuff. Tell me if it works for you!

calben commented 7 years ago

Thank you! I probably overdo privacy the other way, probably, everything is public in my projects.

Thanks again and this works great.