#ifndef FEIQMODEL_H #define FEIQMODEL_H #include "fellow.h" #include #include #include #include "filetask.h" #include "uniqueid.h" using namespace std; class FeiqModel { public: FeiqModel(); public: void addFellow(shared_ptr fellow); shared_ptr getFullInfoOf(shared_ptr fellow); shared_ptr findFirstFellowOf(const string& ip); list> searchFellow(const string& text); shared_ptr getShared(const Fellow* fellow); public: shared_ptr addDownloadTask(shared_ptr fellow, shared_ptr fileContent); shared_ptr addUploadTask(shared_ptr fellow, shared_ptr fileContent); shared_ptr findTask(IdType packetNo, IdType fileId, FileTaskType type = FileTaskType::Upload); list> searchTask(function predict); void removeFileTask(function predict); private: list> mFellows; list> mFileTasks; mutex mFellowLock; mutex mFileTaskLock; }; #endif // FEIQMODEL_H