cmvr-es/cmvr-es/device_manager/include/device_factory.h
2026-06-17 14:50:37 +08:00

45 lines
1.6 KiB
C++

//
// Created by xtkuang on 2025/5/13.
//
#ifndef CMVR_ES_DEVICE_FACTORY_H
#define CMVR_ES_DEVICE_FACTORY_H
#pragma once
#include "../../devices/agv/abstract_agv.h"
#include "../../devices/battery/abstract_battery.h"
#include "../../devices/camera/abstract_camera.h"
#include "../../devices/dexhand/abstract_dexhand.h"
#include "../../devices/gripper/abstract_gripper.h"
#include "../../devices/robot/abstract_robot.h"
#include "../../devices/microphone/abstract_microphone.h"
#include "../../devices/speaker/abstract_speaker.h"
#include "../../devices/biohead/abstract_biohead.h"
namespace cmvr::device {
class DeviceFactory {
public:
DeviceFactory() = default;
template <typename DeviceType>
std::shared_ptr<DeviceType> create(const XmlNode& cfg);
template <typename DeviceType, typename ConfigType>
std::shared_ptr<DeviceType> createFromConfig(const ConfigType& cfg);
private:
std::shared_ptr<AbstractAgv> create_agv_(const XmlNode& cfg);
std::shared_ptr<AbstractBattery> create_battery_(const XmlNode& cfg);
std::shared_ptr<AbstractCamera> create_camera_(const XmlNode& cfg);
std::shared_ptr<AbstractDexHand> create_dexhand_(const XmlNode& cfg);
std::shared_ptr<AbstractGripper> create_gripper_(const XmlNode& cfg);
std::shared_ptr<AbstractMicrophone> create_mic_(const XmlNode& cfg);
std::shared_ptr<AbstractRobot> create_robot_(const XmlNode& cfg);
std::shared_ptr<AbstractSpeaker> create_speaker_(const XmlNode& cfg);
std::shared_ptr<AbstractBiohead> create_biohead_(const XmlNode& cfg);
};
}
#endif //CMVR_ES_DEVICE_FACTORY_H