Make module instances unique ptrs

This commit is contained in:
2021-09-04 13:57:12 +01:00
parent 8ef5b31268
commit 463e1a58b9
10 changed files with 34 additions and 43 deletions
+7 -6
View File
@@ -34,17 +34,17 @@
* @}
*/
#include <memory>
#include <vector>
#include "CalypFrame.h"
#include "CalypOptions.h"
#define REGISTER_CLASS_MAKER( X ) \
extern "C" CalypModuleIf* Maker() { return new X; }
#define REGISTER_CLASS_FACTORY( X ) \
public: \
static CalypModuleIf* Create() { return new X(); } \
void Delete() { delete this; }
extern "C" CalypModulePtr Maker() { return std::make_unique<X>(); }
#define REGISTER_CLASS_FACTORY( X ) \
public: \
static CalypModulePtr Create() { return std::make_unique<X>(); }
#define _BASIC_MODULE_API_2_CHECK_ \
if( apcFrameList.size() != m_uiNumberOfFrames ) \
return false; \
@@ -140,7 +140,6 @@ public:
m_iFrameBufferCount = 0;
}
virtual ~CalypModuleIf() {}
virtual void Delete() = 0;
virtual void destroy() = 0;
const char* getModuleLongName()
@@ -174,4 +173,6 @@ public:
};
};
using CalypModulePtr = std::unique_ptr<CalypModuleIf>;
#endif // __CALYPMODULESIF_H__