aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/basic/GpgFunctionObject.h
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2023-11-06 09:17:47 +0000
committersaturneric <[email protected]>2023-11-06 09:17:47 +0000
commit0251f35c93e3f0e0a6853a50fb5bd82c1b9e4187 (patch)
tree0025299b6b6bb0be2c41e6798ae7b09d16b52773 /src/core/function/basic/GpgFunctionObject.h
parentfeat: update thridparty libraries (diff)
downloadGpgFrontend-0251f35c93e3f0e0a6853a50fb5bd82c1b9e4187.tar.gz
GpgFrontend-0251f35c93e3f0e0a6853a50fb5bd82c1b9e4187.zip
refactor: clean up core's codes
Diffstat (limited to '')
-rw-r--r--src/core/function/basic/GpgFunctionObject.h (renamed from src/core/GpgFunctionObject.h)112
1 files changed, 3 insertions, 109 deletions
diff --git a/src/core/GpgFunctionObject.h b/src/core/function/basic/GpgFunctionObject.h
index b59ca84e..59bc5715 100644
--- a/src/core/GpgFunctionObject.h
+++ b/src/core/function/basic/GpgFunctionObject.h
@@ -28,118 +28,12 @@
#pragma once
-#include <shared_mutex>
+#include "core/function/basic/ChannelObject.h"
+#include "core/function/basic/SingletonStorage.h"
+#include "core/function/basic/SingletonStorageCollection.h"
namespace GpgFrontend {
-static constexpr int kGpgFrontendDefaultChannel =
- 0; ///< the default channel id
-
-/**
- * @brief object which in channel system
- *
- */
-class GPGFRONTEND_CORE_EXPORT ChannelObject {
- public:
- /**
- * @brief Construct a new Default Channel Object object
- *
- */
- ChannelObject() noexcept;
-
- /**
- * @brief Construct a new Channel Object object
- *
- * @param channel
- */
- explicit ChannelObject(int channel);
-
- /**
- * @brief Get the Default Channel object
- *
- * @return int
- */
- static auto GetDefaultChannel() -> int;
-
- /**
- * @brief Get the Channel object
- *
- * @return int
- */
- [[nodiscard]] auto GetChannel() const -> int;
-
- /**
- * @brief Set the Channel object
- *
- * @param channel
- */
- void SetChannel(int channel);
-
- private:
- int channel_ = kGpgFrontendDefaultChannel; ///< The channel id
-};
-
-class GPGFRONTEND_CORE_EXPORT SingletonStorage {
- public:
- /**
- * @brief
- *
- * @param channel
- */
- void ReleaseChannel(int channel);
-
- /**
- * @brief
- *
- * @param channel
- * @return T*
- */
- auto FindObjectInChannel(int channel) -> ChannelObject*;
-
- /**
- * @brief Get all the channel ids
- *
- * @return std::vector<int>
- */
- auto GetAllChannelId() -> std::vector<int>;
-
- /**
- * @brief Set a new object in channel object
- *
- * @param channel
- * @param p_obj
- * @return T*
- */
- auto SetObjectInChannel(int channel, std::unique_ptr<ChannelObject> p_obj)
- -> ChannelObject*;
-
- private:
- std::shared_mutex instances_mutex_; ///< mutex for _instances_map
- std::map<int, std::unique_ptr<ChannelObject>>
- instances_map_; ///< map of singleton instances
-};
-
-class GPGFRONTEND_CORE_EXPORT SingletonStorageCollection {
- public:
- /**
- * @brief Get the Instance object
- *
- * @return SingletonStorageCollection*
- */
- static auto GetInstance(bool force_refresh) -> SingletonStorageCollection*;
-
- /**
- * @brief Get the Singleton Storage object
- *
- * @param singleton_function_object
- * @return SingletonStorage*
- */
- auto GetSingletonStorage(const std::type_info&) -> SingletonStorage*;
-
- private:
- std::shared_mutex storages_mutex_; ///< mutex for storages_map_
- std::map<size_t, std::unique_ptr<SingletonStorage>> storages_map_;
-};
/**
* @brief
*