-
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
1cd17b0
commit e5434fd
Showing
5 changed files
with
53 additions
and
26 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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
# Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. | ||
# CMakeLists for MinIoc. | ||
|
||
add_library(mioc INTERFACE) | ||
target_include_directories(mioc INTERFACE include) | ||
# Add all source files | ||
file(GLOB_RECURSE SRC_LIST CONFIGURE_DEPENDS src/*.cpp) | ||
|
||
# Add source to this project's executable. | ||
add_library(mioc STATIC ${SRC_LIST} "src/ServiceContainer.cpp") | ||
|
||
target_include_directories(mioc PUBLIC include) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <mioc/ServiceContainer.h> | ||
|
||
MIOC_BEGIN | ||
|
||
ServiceContainer::ServiceContainer(bool lazy) : _lazy(lazy) | ||
{ | ||
} | ||
|
||
// This is a random number, change it as you wish. | ||
int ServiceContainer::_nextTypeId = 75159; | ||
|
||
MIOC_END |
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,25 @@ | ||
#include <mioc/SingletonContainer.h> | ||
|
||
MIOC_BEGIN | ||
|
||
|
||
ServiceContainerPtr SingletonContainer::GetContainer() | ||
{ | ||
if (_container == nullptr) | ||
{ | ||
_container = ServiceContainer::New(_lazy); | ||
} | ||
return _container; | ||
} | ||
|
||
ServiceContainerPtr SingletonContainer::GetContainer(bool lazy) | ||
{ | ||
_lazy = lazy; | ||
return GetContainer(); | ||
} | ||
|
||
std::shared_ptr<ServiceContainer> SingletonContainer::_container; | ||
bool SingletonContainer::_lazy = DEFAULT_LAZINESS; | ||
|
||
|
||
MIOC_END |