-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7adbdfe
commit f430139
Showing
4 changed files
with
73 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#ifndef _FACTORY_H_ | ||
#define _FACTORY_H_ | ||
|
||
#include <io/logger/ILogger.h> | ||
#include <io/reader/ITaskInstanceReader.h> | ||
#include <io/reader/ITaskReader.h> | ||
|
||
#include <memory> | ||
#include <optional> | ||
|
||
namespace e2e { | ||
namespace setup { | ||
namespace factory { | ||
|
||
using namespace e2e::io; | ||
|
||
template <typename LoggerType, typename... Args> | ||
std::unique_ptr<ILogger> makeLogger(Args... args) | ||
requires std::is_base_of_v<ILogger, LoggerType>; | ||
|
||
template <typename TaskInstanceReaderType, typename... Args> | ||
std::unique_ptr<ITaskInstanceReader> makeTaskInstanceReader(Args... args) | ||
requires std::is_base_of_v<ITaskInstanceReader, TaskInstanceReaderType>; | ||
|
||
template <typename TaskReaderType, typename... Args> | ||
std::unique_ptr<ITaskReader> makeTaskReader(Args... args) | ||
requires std::is_base_of_v<ITaskReader, TaskReaderType>; | ||
|
||
template <typename LoggerType, typename... Args> | ||
inline std::unique_ptr<ILogger> makeLogger(Args... args) | ||
requires std::is_base_of_v<ILogger, LoggerType> | ||
{ | ||
return std::make_unique<LoggerType>(args...); | ||
} | ||
|
||
template <typename TaskInstanceReaderType, typename... Args> | ||
inline std::unique_ptr<ITaskInstanceReader> makeTaskInstanceReader(Args... args) | ||
requires std::is_base_of_v<ITaskInstanceReader, TaskInstanceReaderType> | ||
{ | ||
return std::make_unique<TaskInstanceReaderType>(args...); | ||
} | ||
|
||
template <typename TaskReaderType, typename... Args> | ||
inline std::unique_ptr<ITaskReader> makeTaskReader(Args... args) | ||
requires std::is_base_of_v<ITaskReader, TaskReaderType> | ||
{ | ||
return std::make_unique<TaskReaderType>(args...); | ||
} | ||
|
||
} // namespace factory | ||
} // namespace setup | ||
} // namespace e2e | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters