ndmspc  v1.2.0-0.1.rc3
NCloudEvent.h
1 #ifndef NdmspcHttpNCloudEvent_H
2 #define NdmspcHttpNCloudEvent_H
3 
4 #include <TObject.h>
5 #include "NLogger.h"
6 
7 class THttpCallArg;
8 namespace Ndmspc {
9 
21 class NCloudEvent : public TObject {
22  public:
30  NCloudEvent(std::string id = "0", std::string source = "unknown", std::string specVersion = "1.0",
31  std::string type = "unknown");
32 
37  NCloudEvent(THttpCallArg * arg);
38 
42  virtual ~NCloudEvent();
43 
48  virtual void Clear(Option_t * opt = "");
49 
54  virtual void Print(Option_t * opt = "") const;
55 
60  bool IsValid() const { return fIsValid; }
61 
66  std::string GetId() const { return fId; }
67 
72  std::string GetSource() const { return fSource; }
73 
78  std::string GetSpecVersion() const { return fSpecVersion; }
79 
84  std::string GetType() const { return fType; }
85 
90  std::string GetDatacontentType() const { return fDataContentType; }
91 
96  std::string GetData() const { return fData; }
97 
102  std::string GetInfo() const;
103 
108  void HandleNCloudEventRequest(THttpCallArg * arg);
109 
114  void SetId(std::string id) { fId = id; }
115 
120  void SetSource(std::string source) { fSource = source; }
121 
126  void SetSpecVersion(std::string specVersion) { fSpecVersion = specVersion; }
127 
132  void SetDatacontentType(std::string datacontenttype) { fDataContentType = datacontenttype; }
133 
138  void SetType(std::string type) { fType = type; }
139 
144  void SetData(std::string data) { fData = data; }
145 
146  private:
147  bool fIsValid{false};
148  std::string fId{};
149  std::string fSource{};
150  std::string fSpecVersion{};
151  std::string fType{};
152  std::string fDataContentType{};
153  std::string fData{};
154 
156  ClassDef(NCloudEvent, 1);
158 };
159 } // namespace Ndmspc
160 #endif
Represents a CloudEvent object for HTTP communication.
Definition: NCloudEvent.h:21
void SetType(std::string type)
Sets the event type.
Definition: NCloudEvent.h:138
std::string fType
Event type.
Definition: NCloudEvent.h:151
bool IsValid() const
Checks if the event is valid.
Definition: NCloudEvent.h:60
void HandleNCloudEventRequest(THttpCallArg *arg)
Handles an HTTP request for a CloudEvent.
Definition: NCloudEvent.cxx:21
void SetDatacontentType(std::string datacontenttype)
Sets the event data content type.
Definition: NCloudEvent.h:132
std::string fSource
Event source URI-reference.
Definition: NCloudEvent.h:149
bool fIsValid
Validity flag for the event.
Definition: NCloudEvent.h:147
virtual ~NCloudEvent()
Destroys the NCloudEvent instance.
Definition: NCloudEvent.cxx:19
NCloudEvent(std::string id="0", std::string source="unknown", std::string specVersion="1.0", std::string type="unknown")
Constructs a new NCloudEvent with specified parameters.
Definition: NCloudEvent.cxx:11
std::string GetInfo() const
Gets additional event information.
Definition: NCloudEvent.cxx:64
void SetData(std::string data)
Sets the event data payload.
Definition: NCloudEvent.h:144
void SetSpecVersion(std::string specVersion)
Sets the CloudEvent specification version.
Definition: NCloudEvent.h:126
std::string GetSpecVersion() const
Gets the CloudEvent specification version.
Definition: NCloudEvent.h:78
std::string GetDatacontentType() const
Gets the event data content type.
Definition: NCloudEvent.h:90
std::string GetSource() const
Gets the event source URI.
Definition: NCloudEvent.h:72
std::string fDataContentType
Event data content type.
Definition: NCloudEvent.h:152
void SetId(std::string id)
Sets the event identifier.
Definition: NCloudEvent.h:114
std::string fData
Event data payload.
Definition: NCloudEvent.h:153
std::string fId
Event identifier.
Definition: NCloudEvent.h:148
std::string GetId() const
Gets the event identifier.
Definition: NCloudEvent.h:66
std::string fSpecVersion
CloudEvent specification version.
Definition: NCloudEvent.h:150
virtual void Clear(Option_t *opt="")
Clears the event data.
Definition: NCloudEvent.cxx:71
std::string GetData() const
Gets the event data payload.
Definition: NCloudEvent.h:96
virtual void Print(Option_t *opt="") const
Prints the event details.
Definition: NCloudEvent.cxx:81
void SetSource(std::string source)
Sets the event source URI.
Definition: NCloudEvent.h:120
std::string GetType() const
Gets the event type.
Definition: NCloudEvent.h:84