123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- /*
- * @Description:
- * @Version: 1.0
- * @Autor: lishengyin
- * @Date: 2022-04-01 15:07:56
- * @LastEditors: lishengyin
- * @LastEditTime: 2022-04-11 10:57:16
- */
- #ifndef __ISNS_MODEL_HPP_
- #define __ISNS_MODEL_HPP_
- #include <string.h>
- #include <unistd.h>
- #include <string>
- #include <vector>
- #include <iostream>
- #include "private/ins_module_private.hpp"
- using namespace std;
- namespace ins{
- class ModelCenter:private NonCopyable
- {
- private:
- ModelCenter(){}
- public:
- using Ptr = std::shared_ptr<ModelCenter>;
-
- ~ModelCenter(){}
- /**
- * @description: 注册
- * @param {string} ModelName
- * @param {Ptr&} ptr
- * @return {*}
- */
- static int8_t Register(std::string ModelName);
- /**
- * @description: 注销
- * @param {string} ModelName
- * @return {*}
- */
- static int8_t Cancel(std::string ModelName);
- /**
- * @description: 获取getModels
- * @param {*}
- * @return {*}
- */
- static vector<std::string> getModels();
- };
- class Module: private NonCopyable
- {
- public:
- using Ptr = std::shared_ptr<Module>;
- Module(std::string name): name_(name) {
- ins::ModelCenter::Register(name);
- }
-
- virtual ~Module(){
- ins::ModelCenter::Cancel(name_);
- }
- /**
- * @description: 初始化
- * @param {*}
- * @return {*}
- */
- virtual int8_t Init() = 0;
- /**
- * @description: 销毁
- * @param {*}
- * @return {*}
- */
- virtual void Destroy() = 0;
- /**
- * @description: 是否正常
- * @param {*}
- * @return {*}
- */
- virtual bool isNormally() = 0;
- /**
- * @description: 返回名字
- * @param {*}
- * @return {*}
- */
- virtual std::string getName(){
- return this->name_;
- }
-
-
- protected:
- bool valid = false;
- std::string name_;
- };
- };
- #endif
|