RmsMessage.h
Go to the documentation of this file.
1 #ifndef _RMS_MESSAGE_H
2 #define _RMS_MESSAGE_H
3 
4 /**
5  * @package gov.fnal.cd.rms.base
6  *
7  * @brief A group of data structures that are
8  * used with RMS.
9  *
10  * The classes inside base consist mostly of data structures
11  * that are passed between user programs and RMS itself. These
12  * include the destination class that is used to define where a
13  * message is headed, as well as the message class itself.
14  */
15 
16 #include <rms/RmsMessageSchema.h>
17 #include <rms/base/RmsDestination.h>
18 #include <rms/base/RmsMessageSource.h>
19 #include <rms/base/RmsMessageBody.h>
20 #include <rms/base/RmsStatus.h>
21 
22 #include <boost/shared_ptr.hpp>
23 #include <boost/date_time/posix_time/posix_time.hpp>
24 
25 #include <string>
26 
27 namespace gov {
28 
29 namespace fnal {
30 
31 namespace cd {
32 
33 namespace rms {
34 
35 namespace base {
36 
37 /**
38  * A class for the message and replies that are transmitted
39  * between applications.
40  *
41  * @author Kurt Biery
42  * @author Steve Foulkes
43  * @version $Revision: 1.3.18.1 $ $Date: 2019/09/27 00:07:31 $
44  */
45 
46 class RmsMessage : public gov::fnal::cd::rms::xsd::rmsMessage {
47  public:
48  /**
49  * Creates an instance from an instance of the XSD base class.
50  *
51  * @param baseMsg The object we want to copy
52  */
53  RmsMessage(const xsd::rmsMessage &baseMsg) : xsd::rmsMessage(baseMsg) {}
54 
55  RmsMessage();
57  RmsMessage(std::string serializedData);
58  RmsMessage(const novadaq::XMLSerializable& bodyObject);
59 
60  const std::string getId() const;
61  const std::string getCorrelationId() const;
62 
65 
66  boost::posix_time::ptime getSentTime() const;
67  boost::posix_time::ptime getCorrelationTime() const;
68 
69  long getTimeToLive() const;
70  int getPriority() const;
71 
73  RmsMessageBody getBody() const;
74  boost::shared_ptr<novadaq::XMLSerializable> getBodyObject() const;
75 
76  void setId(const std::string uuid);
77  void setCorrelationId(const std::string uuid);
79  void setReplyDestination(const RmsDestination& destination);
80 
81  void setSentTime();
82  void setSentTime(boost::posix_time::ptime timestamp);
83  void setCorrelationTime(boost::posix_time::ptime timestamp);
84  void setTimeToLive(long seconds);
85 
86  void setPriority(int priority);
87 
88  void setSource(const RmsMessageSource& source);
89 
90  void setBody(const RmsMessageBody& body);
91  void setBody(const novadaq::XMLSerializable& bodyObject);
92 
93  void setMessageStatus(const RmsStatus& messageStatus);
95 
96  boost::shared_ptr<RmsMessage> createReply() const;
97 
98  /**
99  * Returns the fully-qualified class name of the RmsMessage.
100  */
102  return "gov::fnal::cd::rms::base::RmsMessage";
103  }
104 
105  /**
106  * Returns a copy of the RmsMessage.
107  */
108  boost::shared_ptr<novadaq::XMLSerializable> clone() const {
109  RmsMessage *copy = new RmsMessage(*this);
110  boost::shared_ptr<novadaq::XMLSerializable> copyPtr(copy);
111 
112  return copyPtr;
113  }
114 
115  private:
116  /**
117  * The status of the message
118  */
120 
121 };
122 
123 } // end of namespace base
124 
125 } // end of namespace rms
126 
127 } // end of namespace cd
128 
129 } // end of namespace fnal
130 
131 } // end of namespace gov
132 
133 #endif
boost::shared_ptr< novadaq::XMLSerializable > getBodyObject() const
Definition: RmsMessage.cpp:171
RmsDestination getReplyDestination() const
Definition: RmsMessage.cpp:92
void setMessageStatus(const RmsStatus &messageStatus)
Definition: RmsMessage.cpp:317
string body
Definition: readPickles.py:54
void setId(const std::string uuid)
Definition: RmsMessage.cpp:198
const XML_Char int const XML_Char int const XML_Char * base
Definition: expat.h:331
void setSource(const RmsMessageSource &source)
Definition: RmsMessage.cpp:283
boost::posix_time::ptime getCorrelationTime() const
Definition: RmsMessage.cpp:117
RmsMessageBody getBody() const
Definition: RmsMessage.cpp:158
boost::shared_ptr< RmsMessage > createReply() const
Definition: RmsMessage.cpp:341
RmsMessage(const xsd::rmsMessage &baseMsg)
Definition: RmsMessage.h:53
void setCorrelationTime(boost::posix_time::ptime timestamp)
Definition: RmsMessage.cpp:256
void setBody(const RmsMessageBody &body)
Definition: RmsMessage.cpp:294
Definition: fnal.py:1
RmsMessageSource getSource() const
Definition: RmsMessage.cpp:147
const char * source
Definition: lz4.h:436
boost::shared_ptr< novadaq::XMLSerializable > clone() const
Definition: RmsMessage.h:108
RmsDestination getDestination() const
Definition: RmsMessage.cpp:79
void setDestination(const RmsDestination &destination)
Definition: RmsMessage.cpp:218
boost::posix_time::ptime getSentTime() const
Definition: RmsMessage.cpp:103
const std::string getId() const
Definition: RmsMessage.cpp:59
void setReplyDestination(const RmsDestination &destination)
Definition: RmsMessage.cpp:229
void setCorrelationId(const std::string uuid)
Definition: RmsMessage.cpp:209
std::string getClassName() const
Definition: RmsMessage.h:101
c cd(1)
const std::string getCorrelationId() const
Definition: RmsMessage.cpp:70
enum BeamMode string