/
Zero_Fly
/
parall
Обзор
Документация
Войти
/
Zero_Fly
/
parall
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/parallel-executor/deviceB.h
28 строк
720 B
akulyanin
for mq
14 янв 2025, 10:57
14 янв 2025, 10:57
740d97d
Код
Авторство
О чём код?
#include"device.h" #include<string> #include<memory> #include<vector> #include<thread> using namespace std; class ReadB: public Read{ shared_ptr<string> read(string msg) override{ std::this_thread::sleep_for(5000ms); return make_shared<string>(msg); } }; class DeviceB: public Device{ public: DeviceB(int _lifeTime, Read* rd):Device(_lifeTime, rd){} shared_ptr<string> getDataAsString() override{ if(lifeTime == 0) return nullptr; else { decLife(); string msg = to_string(rand()%199) + " " + to_string(rand()%199) + " " + to_string(rand()%199); return reader->read(msg); } } string getName() override{ return "B";} };