Servers by jDrones

Dumb C++ question about AP_Param class

Hi,

I am confused. AP_Param is a singleton class. However, the templated classes that inherit from AP_Param (like AP_Float) are not singletons. That is, there can be more than one AP_Float at a time. Why is this?

Thanks :slight_smile:

because we want to be able to have more than one parameter (there are about 1k of them)
AP_Float is just a float with the ability to be written to storage.

No I get that. My question is more about C++. Is the ‘singleton-ness’ not inherited?

EDIT: Perhaps the reason it isn’t is that when an AP_Float is created, the AP_Param constructor that’s triggered is the empty one that does not initialise _singleton = this and does not check for it?

Servers by jDrones