Dear community,
I am having trouble understanding some details in the following chunk of C++ code:
class CV_EXPORTS LayerFactory
{
public:
//! Each Layer class must provide this function to the factory
typedef Ptr<Layer>(*Constructor)(LayerParams ¶ms);
//! Registers the layer class with typename @p type and specified @p constructor. Thread-safe.
static void registerLayer(const String &type, Constructor constructor);
//! Unregisters registered layer with specified type name. Thread-safe.
static void unregisterLayer(const String &type);
/** @brief Creates instance of registered layer.
* @param type type name of creating layer.
* @param params parameters which will be used for layer initialization.
* @note Thread-safe.
*/
static Ptr<Layer> createLayerInstance(const String &type, LayerParams& params);
private:
LayerFactory();
};
In particular, I know this class has a registerLayer
and an unregisterLayer
member function, but I'm mostly confused about this line
typedef Ptr<Layer>(*Constructor)(LayerParams ¶ms);
How to parse the syntax? What exactly is typedef
defining? Why is there a *Constructor
--- I can't find its definition anywhere in the source.
Thanks! This piece of code is from opencv/modules/dnn/include/opencv2/dnn/layer.hpp