@@ -14,11 +14,9 @@ namespace dotnamecpp::v1 {
1414 return ;
1515 }
1616
17- logger_-> infoStream () << libName_ << " initialized ... " ;
17+ // just an example of asset usage
1818 const auto logoPath = assetManager_->resolveAsset (" DotNameCppLogo.svg" );
19- if (assetManager_->assetExists (" DotNameCppLogo.svg" )) {
20- logger_->debugStream () << " Logo: " << logoPath << " found" ;
21- } else {
19+ if (!assetManager_->assetExists (" DotNameCppLogo.svg" )) {
2220 logger_->warningStream () << " Logo not found: " << logoPath;
2321 }
2422
@@ -29,51 +27,16 @@ namespace dotnamecpp::v1 {
2927 // └──────────────────────────────────────────────────────────────────┘
3028
3129 isInitialized_ = true ;
32- logger_->infoStream () << libName_ << " initialized successfully ." ;
30+ logger_->infoStream () << libName_ << " initialized .. ." ;
3331 }
3432
3533 DotNameLib::~DotNameLib () {
3634 if (isInitialized_) {
37- // Ensure graceful shutdown
3835 stop ();
39- logger_->infoStream () << libName_ << " destructed" ;
36+ logger_->infoStream () << libName_ << " ... destructed" ;
4037 } else {
41- logger_->infoStream () << libName_ << " (not initialized) destructed" ;
42- }
43- }
44-
45- DotNameLib::DotNameLib (DotNameLib &&other) noexcept
46- : logger_(std::move(other.logger_)), assetManager_(std::move(other.assetManager_)),
47- assetsPath_ (std::move(other.assetsPath_)), isInitialized_(other.isInitialized_),
48- shouldStop_(other.shouldStop_.load()) {
49- other.isInitialized_ = false ;
50- other.shouldStop_ .store (false );
51- if (logger_) {
52- logger_->infoStream () << libName_ << " move constructed" ;
53- }
54- }
55-
56- DotNameLib &DotNameLib::operator =(DotNameLib &&other) noexcept {
57- if (this != &other) {
58- // Stop current instance
59- if (isInitialized_) {
60- stop ();
61- }
62-
63- // Move all members
64- logger_ = std::move (other.logger_ );
65- assetManager_ = std::move (other.assetManager_ );
66- assetsPath_ = std::move (other.assetsPath_ );
67- isInitialized_ = other.isInitialized_ ;
68- shouldStop_.store (other.shouldStop_ .load ());
69-
70- other.isInitialized_ = false ;
71- other.shouldStop_ .store (false );
72- if (logger_) {
73- logger_->infoStream () << libName_ << " move assigned" ;
74- }
38+ logger_->infoStream () << libName_ << " ... (not initialized) destructed" ;
7539 }
76- return *this ;
7740 }
7841
7942 bool DotNameLib::run (int durationSeconds) {
@@ -92,11 +55,9 @@ namespace dotnamecpp::v1 {
9255 // │ Example: Start services, process data, etc. │
9356 // └──────────────────────────────────────────────────────────────────┘
9457
95- logger_->infoStream () << libName_ << " started successfully" ;
96-
9758 // Run for specified duration
9859 if (durationSeconds > 0 ) {
99- logger_->infoStream () << " Running for " << durationSeconds << " seconds..." ;
60+ logger_->infoStream () << " MOCK BUSINESS LOGIC running for " << durationSeconds << " seconds ..." ;
10061 for (int i = 0 ; i < durationSeconds && !shouldStop_.load (); ++i) {
10162 std::this_thread::sleep_for (std::chrono::seconds (1 ));
10263 }
@@ -106,7 +67,6 @@ namespace dotnamecpp::v1 {
10667 } else {
10768 logger_->infoStream () << libName_ << " finished after " << durationSeconds << " seconds" ;
10869 }
109- stop ();
11070 } else {
11171 logger_->infoStream () << " Running indefinitely. Call stop() to terminate." ;
11272 constexpr int pollIntervalMs = 100 ;
@@ -129,7 +89,7 @@ namespace dotnamecpp::v1 {
12989 return ;
13090 }
13191
132- logger_->infoStream () << " Stopping " << libName_ << " ..." ;
92+ logger_->infoStream () << " Stopping " << libName_ << " ..." ;
13393 shouldStop_.store (true );
13494
13595 // ┌──────────────────────────────────────────────────────────────────┐
@@ -140,6 +100,9 @@ namespace dotnamecpp::v1 {
140100 }
141101
142102 bool DotNameLib::isInitialized () const noexcept { return isInitialized_; }
143- const std::filesystem::path &DotNameLib::getAssetsPath () const noexcept { return assetsPath_; }
103+ const std::shared_ptr<dotnamecpp::assets::IAssetManager> &
104+ DotNameLib::getAssetManager () const noexcept {
105+ return assetManager_;
106+ }
144107
145108} // namespace dotnamecpp::v1
0 commit comments