/*
 * @Description: 
 * @Version: 1.0
 * @Autor: lishengyin
 * @Date: 2022-04-01 15:08:06
 * @LastEditors: lishengyin
 * @LastEditTime: 2022-04-11 10:56:15
 */
#include "ins_module.hpp"
#include "Util/logger.h"
#include <vector>
#include <iostream>
#include<algorithm>

using namespace toolkit;
using namespace std;

namespace ins
{
    vector<std::string> m_models;

    /**
     * @description: 注册
     * @param {string} ModelName
     * @param {Ptr&} ptr
     * @return {*}
     */    
    int8_t ModelCenter::Register(std::string ModelName){
        vector<std::string>::iterator iter = std::find(m_models.begin(), m_models.end(), ModelName);
        if(iter == m_models.end()){
            InfoL << "Register:" << ModelName << endl;
            m_models.push_back(ModelName);
        }else{
            WarnL << "The module record already exists" << endl;
            return ERR;
        }
        return OK;
    }
    
    /**
     * @description: 注销
     * @param {string} ModelName
     * @return {*}
     */    
    int8_t ModelCenter::Cancel(std::string ModelName){
        InfoL << "Cancel:" << ModelName << endl;
        return OK;
    }

    /**
     * @description: 获取models
     * @param {*}
     * @return {*}
     */    
    vector<std::string> ModelCenter::getModels(){
        return m_models;
    }
} // namespace ins


