Update ccapi to 7.9.3 (compatible w/ new boost)
This commit is contained in:
1 parent
bd7ccb5f44
commit
9fa7a9898e
117 files changed
+9016
-11255
No files matched your search
@@ -4,14 +4,16 @@
|
||||
|
||||
#include "ccapi_cpp/ccapi_logger.h"
|
||||
#include "ccapi_cpp/ccapi_message.h"
|
||||
|
||||
namespace ccapi {
|
||||
|
||||
/**
|
||||
** A single event resulting from a subscription or a request. Event objects are created by the API and passed to the application either through a registered
|
||||
*EventHandler or EventQueue. Event objects contain Message objects which can be accessed using the getMessageList() function. The Event object is a handle to an
|
||||
*event. The event is the basic unit of work provided to applications. Each Event object consists of an Type attribute and zero or more Message objects.
|
||||
*/
|
||||
|
||||
class Event CCAPI_FINAL {
|
||||
class Event {
|
||||
public:
|
||||
enum class Type {
|
||||
UNKNOWN,
|
||||
@@ -23,7 +25,9 @@ class Event CCAPI_FINAL {
|
||||
AUTHORIZATION_STATUS,
|
||||
FIX,
|
||||
FIX_STATUS,
|
||||
HEARTBEAT,
|
||||
};
|
||||
|
||||
static std::string typeToString(Type type) {
|
||||
std::string output;
|
||||
switch (type) {
|
||||
@@ -54,26 +58,34 @@ class Event CCAPI_FINAL {
|
||||
case Type::FIX_STATUS:
|
||||
output = "FIX_STATUS";
|
||||
break;
|
||||
case Type::HEARTBEAT:
|
||||
output = "HEARTBEAT";
|
||||
break;
|
||||
default:
|
||||
CCAPI_LOGGER_FATAL(CCAPI_UNSUPPORTED_VALUE);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
std::string toString() const {
|
||||
std::string output = "Event [type = " + typeToString(type) + ", messageList = " + ccapi::toString(messageList) + "]";
|
||||
return output;
|
||||
}
|
||||
std::string toStringPretty(const int space = 2, const int leftToIndent = 0, const bool indentFirstLine = true) const {
|
||||
|
||||
std::string toPrettyString(const int space = 2, const int leftToIndent = 0, const bool indentFirstLine = true) const {
|
||||
std::string sl(leftToIndent, ' ');
|
||||
std::string ss(leftToIndent + space, ' ');
|
||||
std::string output = (indentFirstLine ? sl : "") + "Event [\n" + ss + "type = " + typeToString(type) + ",\n" + ss +
|
||||
"messageList = " + ccapi::toStringPretty(messageList, space, leftToIndent + space, false) + "\n" + sl + "]";
|
||||
"messageList = " + ccapi::toPrettyString(messageList, space, leftToIndent + space, false) + "\n" + sl + "]";
|
||||
return output;
|
||||
}
|
||||
|
||||
const std::vector<Message>& getMessageList() const { return messageList; }
|
||||
|
||||
void addMessages(const std::vector<Message>& newMessageList) {
|
||||
this->messageList.insert(std::end(this->messageList), std::begin(newMessageList), std::end(newMessageList));
|
||||
}
|
||||
|
||||
void addMessages(std::vector<Message>& newMessageList) {
|
||||
if (this->messageList.empty()) {
|
||||
this->messageList = std::move(newMessageList);
|
||||
@@ -82,11 +94,17 @@ class Event CCAPI_FINAL {
|
||||
std::move(std::begin(newMessageList), std::end(newMessageList), std::back_inserter(this->messageList));
|
||||
}
|
||||
}
|
||||
|
||||
void addMessage(const Message& newMessage) { this->messageList.push_back(newMessage); }
|
||||
|
||||
void addMessage(Message& newMessage) { this->messageList.emplace_back(std::move(newMessage)); }
|
||||
|
||||
void setMessageList(const std::vector<Message>& messageList) { this->messageList = messageList; }
|
||||
|
||||
void setMessageList(std::vector<Message>& messageList) { this->messageList = std::move(messageList); }
|
||||
|
||||
Type getType() const { return type; }
|
||||
|
||||
void setType(Type type) { this->type = type; }
|
||||
#ifndef CCAPI_EXPOSE_INTERNAL
|
||||
|
||||
@@ -95,5 +113,6 @@ class Event CCAPI_FINAL {
|
||||
Type type{Type::UNKNOWN};
|
||||
std::vector<Message> messageList;
|
||||
};
|
||||
|
||||
} /* namespace ccapi */
|
||||
#endif // INCLUDE_CCAPI_CPP_CCAPI_EVENT_H_
|
||||
Reference in new issue
Block a user