File indexing completed on 2026-06-02 08:51:49
0001 #ifndef SERVICE_OBJECT_H
0002 #define SERVICE_OBJECT_H
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <ElementaryUtils/parameters/Parameters.h>
0012 #include <ElementaryUtils/thread/Packet.h>
0013 #include <string>
0014
0015 #include "beans/gpd/GPDType.h"
0016 #include "beans/collinear_distribution/CollinearDistributionType.h"
0017 #include "beans/List.h"
0018 #include "utils/thread/ThreadManager.h"
0019 #include "utils/thread/ThreadQueue.h"
0020
0021 namespace PARTONS {
0022 class AutomationService;
0023 class ModuleObjectFactory;
0024 class Task;
0025 }
0026
0027 namespace PARTONS {
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 class ServiceObject: public BaseObject {
0041
0042 public:
0043
0044
0045
0046
0047
0048 ServiceObject(const std::string &className);
0049
0050
0051
0052
0053 virtual ~ServiceObject();
0054
0055 virtual void resolveObjectDependencies();
0056
0057
0058
0059
0060
0061
0062 virtual void computeTask(Task &task) = 0;
0063
0064
0065
0066
0067 void addTasks(const List<ElemUtils::Packet> &tasks);
0068
0069
0070
0071
0072 bool isEmptyTaskQueue();
0073
0074
0075
0076
0077 ElemUtils::Packet popTaskFormQueue();
0078
0079
0080
0081
0082 void initComputationalThread(ModuleObject* pModuleObject);
0083
0084
0085
0086
0087 void launchAllThreadAndWaitingFor();
0088
0089
0090
0091
0092 void clearAllThread();
0093
0094 protected:
0095
0096 ModuleObjectFactory* m_pModuleObjectFactory;
0097 AutomationService* m_pAutomationService;
0098
0099
0100
0101
0102 List<GPDType> getGPDTypeListFromTask(Task &task) const;
0103
0104
0105
0106
0107 List<CollinearDistributionType> getCollinearDistributionTypeListFromTask(Task &task) const;
0108
0109
0110
0111
0112 void errorUnknownMethod(const Task &task) const;
0113
0114 private:
0115
0116 ThreadQueue m_queueOfTask;
0117 ThreadManager m_threadManager;
0118 };
0119
0120 }
0121
0122 #endif