| 123456789101112131415161718192021222324252627282930313233343536373839 |
- #ifndef SOPHIAR2_SOPHIAR_OBJ_HPP
- #define SOPHIAR2_SOPHIAR_OBJ_HPP
- #include "core/sophiar_manager.h"
- #include <boost/asio/io_context.hpp>
- #include <nlohmann/json.hpp>
- namespace sophiar {
- extern boost::asio::io_context global_context;
- class sophiar_obj {
- public:
- virtual ~sophiar_obj() = default;
- // 加载初始化配置
- [[deprecated]] virtual void load_construct_config(const nlohmann::json &config) {};
- static constexpr auto &get_context() {
- return global_context;
- }
- static constexpr auto &get_manager() {
- return global_sophiar_manager;
- }
- };
- #define DEFAULT_NEW_INSTANCE(DerivedT) \
- static sophiar_obj *new_instance() { \
- return new DerivedT{}; \
- }
- }
- #endif //SOPHIAR2_SOPHIAR_OBJ_HPP
|