diff options
Diffstat (limited to 'veslibrary/ves_cpplibrary/src/lib/transport/include/XQueue.h')
-rwxr-xr-x | veslibrary/ves_cpplibrary/src/lib/transport/include/XQueue.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/veslibrary/ves_cpplibrary/src/lib/transport/include/XQueue.h b/veslibrary/ves_cpplibrary/src/lib/transport/include/XQueue.h new file mode 100755 index 0000000..c2a08b6 --- /dev/null +++ b/veslibrary/ves_cpplibrary/src/lib/transport/include/XQueue.h @@ -0,0 +1,40 @@ +#pragma once
+
+#include <string>
+#include <memory>
+
+namespace vagt
+{
+ namespace queue
+ {
+ /*************************************************************************************************//**
+ * @brief Error codes
+ *****************************************************************************************************/
+ enum XErrorCode : unsigned short
+ {
+ XErrorOk, /**< The operation is successful */
+ XErrorNok, /**< General failure */
+ XErrorFull, /**< The buffer is full */
+ XErrorEmpty, /**< The buffer is empty */
+ };
+
+ class XQueue
+ {
+ public:
+ virtual bool empty() = 0;
+ virtual XErrorCode push(const std::string& val) = 0;
+ virtual void pop() = 0;
+ virtual std::string front() = 0;
+
+ /*************************************************************************************************//**
+ * Create a queue in memory with specified capacity.
+ *****************************************************************************************************/
+ static std::shared_ptr<XQueue> create(int capacity);
+
+ /*************************************************************************************************//**
+ * Create a queue on disk.
+ *****************************************************************************************************/
+ static std::shared_ptr<XQueue> create(const std::string& path);
+ };
+ }
+}
\ No newline at end of file |