ReUseX
0.0.1
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
IMLBackend.hpp
Go to the documentation of this file.
1
#pragma once
2
#include <
ReUseX/vision/IDataset.hpp
>
3
#include <
ReUseX/vision/IModel.hpp
>
4
#include <filesystem>
5
6
namespace
ReUseX::vision
{
7
8
enum class
Model
{
Yolo
,
Sam3
};
9
10
class
IMLBackend
{
11
public
:
12
/* The destructor is declared as virtual to ensure that the correct destructor
13
* is called when an object of a derived class is deleted through a pointer to
14
* the base class. This is important for proper resource management and to
15
* avoid memory leaks. By declaring the destructor as virtual, we allow for
16
* polymorphic behavior, enabling the correct cleanup of resources allocated
17
* by derived classes when they are destroyed through a base class pointer. */
18
virtual
~IMLBackend
() =
default
;
19
20
/* The createModel function is a pure virtual function that must be
21
* implemented by any class that inherits from IMLBackend. It takes a Model
22
* type and a filesystem path to the model as parameters and returns a unique
23
* pointer to an IModel object. The function is responsible for creating and
24
* initializing the appropriate model based on the specified type and model
25
* path. The use of std::unique_ptr ensures that the created model object is
26
* properly managed and will be automatically deallocated when it goes out of
27
* scope, preventing memory leaks. The createDataset function is also a pure
28
* virtual function that must be implemented by derived classes. It takes a
29
* filesystem path to the dataset as a parameter and returns a unique pointer
30
* to an IDataset object. This function is responsible for creating and
31
* initializing the dataset based on the provided dataset path. Similar to
32
* createModel, the use of std::unique_ptr ensures proper memory management
33
* for the created dataset object.
34
* @param type The type of model to create, specified as an enum value.
35
* @param modelPath The filesystem path to the model file.
36
* @return A unique pointer to the created IModel object.
37
*/
38
virtual
std::unique_ptr<IModel>
39
createModel
(
const
Model
type,
const
std::filesystem::path &modelPath) = 0;
40
41
/* The createDataset function is a pure virtual function that must be
42
* implemented by any class that inherits from IMLBackend. It takes a
43
* filesystem path to the dataset as a parameter and returns a unique pointer
44
* to an IDataset object. This function is responsible for creating and
45
* initializing the dataset based on the provided dataset path. Similar to
46
* createModel, the use of std::unique_ptr ensures proper memory management
47
* for the created dataset object.
48
* @param datasetPath The filesystem path to the dataset.
49
* @return A unique pointer to the created IDataset object.
50
*/
51
virtual
std::unique_ptr<IDataset>
52
createDataset
(
const
std::filesystem::path &datasetPath) = 0;
53
};
54
}
// namespace ReUseX::vision
IDataset.hpp
IModel.hpp
ReUseX::vision::IMLBackend
Definition
IMLBackend.hpp:10
ReUseX::vision::IMLBackend::~IMLBackend
virtual ~IMLBackend()=default
ReUseX::vision::IMLBackend::createDataset
virtual std::unique_ptr< IDataset > createDataset(const std::filesystem::path &datasetPath)=0
ReUseX::vision::IMLBackend::createModel
virtual std::unique_ptr< IModel > createModel(const Model type, const std::filesystem::path &modelPath)=0
ReUseX::vision
Definition
annotate.hpp:25
ReUseX::vision::Model
Model
Definition
IMLBackend.hpp:8
ReUseX::vision::Model::Yolo
@ Yolo
Definition
IMLBackend.hpp:8
ReUseX::vision::Model::Sam3
@ Sam3
Definition
IMLBackend.hpp:8
libs
reusex
include
ReUseX
vision
IMLBackend.hpp
Generated by
1.16.1