openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

ofxOSC: consider renaming ofxOscReceiver::message_buffer, should it be private? remove ofxOscMessage::getRemoteIp()

Open danomatika opened this issue 9 months ago • 5 comments

With of_v20250330_osx_release:

There is a new ofxOscReceiver::message_buffer member variable. I suggest that it should be renamed "messageBuffer" in order to better match the overall OF API, however this is not a container (vector) but a single message, so maybe "buffer" doesn't quite make sense?

Also, should this be public? It looks like it is a storage object for calls to getMessage(). I suggest adding a comment about that this is for so we can know if we should use it or not, etc.

danomatika avatar Mar 31 '25 16:03 danomatika

Somewhat related: ofxOscMessage::getRemoteIp() is deprecated but it was added since the OF 0.12.0 release. Can we just remove it?

danomatika avatar Mar 31 '25 16:03 danomatika

I reported the last post as spam.

danomatika avatar Apr 16 '25 18:04 danomatika

@danomatika it seems getRemoteIp() got deprecated 8 years ago — but recently the deprecations moved from OF_DEPRECATED_MSG() to [[deprecated]] — maybe that's what you're picking up? https://github.com/openframeworks/openFrameworks/blame/70bb1b22b5175c6779ed95cceff482302f919208/addons/ofxOsc/src/ofxOscMessage.h#L29

the ofxOscReceiver::message_buffer should indeed be private; it's a scratch buffer to pass to the swap within the thread channel. maybe ofxOscReceiver::scratch_channel_message would be more precise? due to the working of thread channel a placeholder is required prior to the call, and the idea is not to constantly/needlessly reallocate an empty ofxOscMessage. I wonder now if the const is useful, and if and explicit std::move would be appropriate to ensure the optional alloc skips copies when possible? (maybe it already does?) the swap does not mind a moved-from state object as it's never used as such on the other side of the channel.

artificiel avatar Apr 29 '25 20:04 artificiel

I think ofxOscMessage::getRemoteIp() is very useful. I use it a lot to sync interface to remote devices via osc messages.

dimitre avatar Nov 18 '25 22:11 dimitre

the discussion is not about removing anything but noticing getRemoteIp() was deprecated sometimes ago (in favour of getRemoteHost()), but got picked up as new from the Lua binding scanning — presumably because the deprecation went from the original macro to the standard [[deprecated ...]] form between 12.0 and 12.1.

	[[deprecated("Use getRemoteHost()")]]
	std::string getRemoteIp() const;

in other words, nothing to report.

otherwise as stated ofxOscReceiver::message_buffer should be private, and is maybe not the best name.

artificiel avatar Nov 19 '25 03:11 artificiel