h4plugins icon indicating copy to clipboard operation
h4plugins copied to clipboard

What is the STAG() macro used for?

Open julianrendell opened this issue 4 years ago • 1 comments

I'm working with a student to make an ArtNet service plugin...

We've come across the STAG macro- https://github.com/philbowles/h4plugins/search?q=STAG

Couple of questions:

  • what is it supposed to mean? (Service TAG?)
  • is every service plugin required to define a STAG?
  • where are the parameters to the usages of STAG in H4Service.h defined? e.g. STAG(age) - where is age defined? We've tried searching in files and not found a definition that we understand; I've also tried using Visual Studio Codes and it can't find the definition either ;-)
  • if a new service plugin should define a STAG, where should it declare it?

Thanks in advance!

julianrendell avatar Oct 12 '21 17:10 julianrendell

Hi It's intended to define a function that returns the exact passed literals as c-string.

#define STAG(x) constexpr const char* x##Tag(){ return #x; }

So a STAG(all) call defined a function as following:

constexpr const char* allTag(){ return "all"; }

It's intended to standardize the tags used, and to raise a compilation error if one isn't spelled correctly. so if happened that someone typed alTag(), it'll give a compilation error because it's not defined.

HamzaHajeir avatar Aug 26 '22 17:08 HamzaHajeir