ResourceFactory.h 1.1 KB
Newer Older
W
wxyu 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
/*******************************************************************************
 * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 * Proprietary and confidential.
 ******************************************************************************/
#pragma once

#include <string>
#include <memory>

#include "resource/Resource.h"
#include "resource/CpuResource.h"
#include "resource/GpuResource.h"
#include "resource/DiskResource.h"


namespace zilliz {
namespace milvus {
namespace engine {

class ResourceFactory {
public:
    static std::shared_ptr<Resource>
    Create(const std::string &name, const std::string &alias = "") {
        if (name == "disk") {
            return std::make_shared<CpuResource>(alias);
        } else if (name == "cpu") {
            return std::make_shared<CpuResource>(alias);
        } else if (name == "gpu") {
            return std::make_shared<CpuResource>(alias);
        } else {
            return nullptr;
        }
    }
};


}
}
}