ndmspc  0.20250128.0
GitlabEvent.h
1 #ifndef GitlabEvent_H
2 #define GitlabEvent_H
3 
4 #include <TObject.h>
5 #include <TH1S.h>
6 #include <TClonesArray.h>
7 #include <TDatime.h>
8 #include "GitlabTrack.h"
9 #include <nlohmann/json.hpp>
10 using json = nlohmann::json;
11 
12 namespace Ndmspc {
13 namespace Gitlab {
20 
21 class Event : public TObject {
22 
23  public:
24  Event();
25  Event(Long64_t id);
26  virtual ~Event();
27 
65 
73 
81 
85 
86  Long64_t GetID() const { return fID; }
87  TDatime GetDateTime() const { return fDateTime; }
88 
89  void SetID(Long64_t id) { fID = id; }
90  void SetTimeDate(Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec);
91 
92  Long64_t GetNIssues() const { return fNIssues; }
93  Track * GetIssue(Long64_t id) { return (Track *)fIssues->At(id); }
94  Track * AddIssue();
95 
96  Long64_t GetNMergeRequests() const { return fNMergeRequests; }
97  Track * GetMergeRequest(Long64_t id) { return (Track *)fMergeRequests->At(id); }
99 
100  TH1S * GetListOfAuthors() const { return fAuthors; }
101  TH1S * GetListOfProjects() const { return fProjects; }
102  TH1S * GetListOfMilestones() const { return fMilestones; }
103  void ShrinkMappingHistograms(bool verbose = true);
104 
105  bool FillGitlabFromJson(std::string issues, std::string mergrerequests);
106  bool FillIssuesFromJson(const json root);
107  bool FillMergeRequestsFromJson(const json root);
108 
109  virtual void Print(Option_t * option = "") const;
110  virtual void Clear(Option_t * option = "");
111 
112  private:
113  Long64_t fID;
114  TDatime fDateTime;
115  Int_t fNIssues;
117 
119  TClonesArray * fIssues; //->
121  TClonesArray * fMergeRequests; //->
122 
123  TH1S * fAuthors{nullptr};
124  TH1S * fProjects{nullptr};
125  TH1S * fMilestones{nullptr};
126 
127  // TODO
129  Event(const Event &);
130  Event & operator=(const Event &);
131 
132  std::string ParseProjectName(std::string in, char d = '!') const;
133  void FillAuthorProjectAxis(std::string author, std::string project);
134  void ShrinkHistogram(const char * name, TH1 * h, bool verbose);
135 
137  ClassDef(Event, 1);
139 }; // namespace TObject
140 } // namespace Gitlab
141 } // namespace Ndmspc
142 #endif
Event object.
Definition: GitlabEvent.h:21
virtual void Print(Option_t *option="") const
bool FillIssuesFromJson(const json root)
Definition: GitlabEvent.cxx:99
void SetTimeDate(Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec)
bool FillMergeRequestsFromJson(const json root)
Int_t fNIssues
Number of Issues.
Definition: GitlabEvent.h:115
TDatime fDateTime
Time of event.
Definition: GitlabEvent.h:114
Long64_t GetID() const
Event ID.
Definition: GitlabEvent.h:86
Long64_t fID
ID of event.
Definition: GitlabEvent.h:113
std::string ParseProjectName(std::string in, char d='!') const
not implemented
TClonesArray * fIssues
Array with all issues.
Definition: GitlabEvent.h:119
Long64_t GetNMergeRequests() const
Definition: GitlabEvent.h:96
Event & operator=(const Event &)
not implemented
virtual void Clear(Option_t *option="")
TH1S * GetListOfAuthors() const
Returns List of authors as TAxis.
Definition: GitlabEvent.h:100
Event(const Event &)
! List of milestones in current event
Long64_t GetNIssues() const
Definition: GitlabEvent.h:92
TDatime GetDateTime() const
Event date and time.
Definition: GitlabEvent.h:87
TH1S * GetListOfProjects() const
Returns List of Projects as TAxis.
Definition: GitlabEvent.h:101
void ShrinkMappingHistograms(bool verbose=true)
Track * GetIssue(Long64_t id)
Definition: GitlabEvent.h:93
Int_t fNMergeRequests
Number of MergeRequests.
Definition: GitlabEvent.h:116
bool FillGitlabFromJson(std::string issues, std::string mergrerequests)
Definition: GitlabEvent.cxx:64
TH1S * fProjects
! List of authors in current event
Definition: GitlabEvent.h:124
TH1S * fMilestones
! List of projects in current event
Definition: GitlabEvent.h:125
void SetID(Long64_t id)
Definition: GitlabEvent.h:89
TClonesArray * fMergeRequests
Array with all merge requests.
Definition: GitlabEvent.h:121
Track * GetMergeRequest(Long64_t id)
Definition: GitlabEvent.h:97
Track object.
Definition: GitlabTrack.h:15