ndmspc v1.2.0-0.1.rc5
Loading...
Searching...
No Matches
NCloudEvent.h
1#ifndef NdmspcHttpNCloudEvent_H
2#define NdmspcHttpNCloudEvent_H
3
4#include <TObject.h>
5#include "NLogger.h"
6
7class THttpCallArg;
8namespace Ndmspc {
9
21class 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.
std::string fType
Event type.
bool IsValid() const
Checks if the event is valid.
Definition NCloudEvent.h:60
void HandleNCloudEventRequest(THttpCallArg *arg)
Handles an HTTP request for a CloudEvent.
void SetDatacontentType(std::string datacontenttype)
Sets the event data content type.
std::string fSource
Event source URI-reference.
bool fIsValid
Validity flag for the event.
virtual ~NCloudEvent()
Destroys the NCloudEvent instance.
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.
std::string GetInfo() const
Gets additional event information.
void SetData(std::string data)
Sets the event data payload.
void SetSpecVersion(std::string specVersion)
Sets the CloudEvent specification version.
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.
void SetId(std::string id)
Sets the event identifier.
std::string fData
Event data payload.
std::string fId
Event identifier.
std::string GetId() const
Gets the event identifier.
Definition NCloudEvent.h:66
std::string fSpecVersion
CloudEvent specification version.
virtual void Clear(Option_t *opt="")
Clears the event data.
std::string GetData() const
Gets the event data payload.
Definition NCloudEvent.h:96
virtual void Print(Option_t *opt="") const
Prints the event details.
void SetSource(std::string source)
Sets the event source URI.
std::string GetType() const
Gets the event type.
Definition NCloudEvent.h:84
Global callback function for libwebsockets client events.