A Custom operator can define constants in its state
clause, but how does one define a constant that can be used across multiple operators, and across multiple files?
Ideally, I'm looking for a way to define constants in a namespace.
You can define a trivial SPL function to return a constant:
namespace my.name.space;
...
float64 MAX_LATITUDE() {return 90.0;}
...
composite MyMainComposite
{
...
This is automatically available throughout the namespace. Other than the parentheses, it works just like any constant wherever you use it. I haven't looked at the generated code in detail but I'm assuming that the SPL or C++ compiler will inline whatever it needs to, ensuring that there is no actual function call overhead at runtime.