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