summaryrefslogtreecommitdiff
path: root/source/LCM/Queue.h
diff options
context:
space:
mode:
authorViktor Mladenovski <viktor.mladenovski@stericsson.com>2011-05-20 14:10:59 +0200
committerViktor Mladenovski <viktor.mladenovski@stericsson.com>2011-05-20 14:10:59 +0200
commitf7e95217e936da34d7124aaced590692eb515923 (patch)
tree2d9ef4750a67d9d1dd3fe9180a4fef2929fad54b /source/LCM/Queue.h
Initial contribution of loader_communication
ST-Ericsson ID: 326913 ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10204 Change-Id: I171cfc2ee458a8a0a91a1916137d131f0f7ecee5
Diffstat (limited to 'source/LCM/Queue.h')
-rw-r--r--source/LCM/Queue.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/source/LCM/Queue.h b/source/LCM/Queue.h
new file mode 100644
index 0000000..838fc05
--- /dev/null
+++ b/source/LCM/Queue.h
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (C) ST-Ericsson SA 2011
+ * License terms: 3-clause BSD license
+ ******************************************************************************/
+
+#ifndef _QUEUE_H_
+#define _QUEUE_H_
+
+#include "t_queue.h"
+#include "error_codes.h"
+#ifdef _WIN32
+#include "WinApiWrappers.h"
+#else
+#include <stdio.h>
+#include "LinuxApiWrappers.h"
+#endif
+#include "Logger.h"
+
+class Queue
+{
+public:
+ Queue(void);
+ ~Queue(void);
+
+ void Create(void **const Queue_pp, const uint32 MaxLength, void (*DestroyElement)(void *Element_p));
+ void Destroy(void **const Queue_pp);
+ ErrorCode_e Enqueue(void *const Queue_p, void *const Value_p);
+ void *Dequeue(void *const Queue_p);
+ QueueCallback_fn SetCallback(void *const Queue_p, const QueueCallbackType_e Type, const QueueCallback_fn Callback, void *const Param_p);
+ boolean IsEmpty(const void *const Queue_p);
+ boolean IsMember(const void *const Queue_p, void *Value_p, boolean(*Match)(void *Value1_p, void *Value2_p));
+ int GetNrOfElements(const void *const Queue_p);
+
+ //Reentrant
+ void RCreate(void **const Queue_pp, const uint32 MaxLength, void (*DestroyElement)(void *Element_p));
+ void RDestroy(void **const Queue_pp);
+ ErrorCode_e REnqueue(void *const Queue_p, void *const Value_p);
+ void *RDequeue(void *const Queue_p);
+ QueueCallback_fn RSetCallback(void *const Queue_p, const QueueCallbackType_e Type, const QueueCallback_fn Callback, void *const Param_p);
+ boolean RIsEmpty(const void *const Queue_p);
+ boolean RIsMember(const void *const Queue_p, void *Value_p, boolean(*Match)(void *Value1_p, void *Value2_p));
+ int RGetNrOfElements(const void *const Queue_p);
+
+ void SetLogger(Logger *logger) {
+ logger_ = logger;
+ }
+private:
+ CCriticalSectionObject QueueCSO;
+ Logger *logger_;
+ void PrintF(const char *text, void *pVoid);
+};
+
+#endif // _QUEUE_H_