diff options
author | Jan Belle | 2017-12-14 21:51:00 +0000 |
---|---|---|
committer | Jan Belle | 2017-12-14 21:51:00 +0000 |
commit | 8d1cde6da1afc6e63eb4930544bb43922f2154bd (patch) | |
tree | f110e06d48627e7463631d974ef1790ee29a04b6 /runtime | |
parent | 5ec7fb22f369a60402a06fbfd6992491357ff23f (diff) | |
download | org.eclipse.etrice-8d1cde6da1afc6e63eb4930544bb43922f2154bd.tar.gz org.eclipse.etrice-8d1cde6da1afc6e63eb4930544bb43922f2154bd.tar.xz org.eclipse.etrice-8d1cde6da1afc6e63eb4930544bb43922f2154bd.zip |
[releng] compile xtend files in gradle build
[runtime.c] moved etStaticDeque documentation to DoxyGen comments
Change-Id: Iaa3232d709bce2acf7a00e35fa577ff2a7d15065
Diffstat (limited to 'runtime')
3 files changed, 77 insertions, 38 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.c b/runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.c index 09d1e5a2a..763185dee 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.c +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.c @@ -12,6 +12,8 @@ #include "etStaticDeque.h" +#include <string.h> + void etStaticDeque_construct(etStaticDeque* const self, void* memory, int size, int objectSize) { self->size = 0; self->first = 0; @@ -28,12 +30,12 @@ void etStaticDeque_clear(etStaticDeque* const self) { } void* etStaticDeque_get(const etStaticDeque* const self, int position) { - // TODO JB: Handle position out of bounds exception + /* TODO JB: Handle position out of bounds exception */ return (void*) &self->memory[(self->first + position * self->objectSize) % (self->objectSize * self->maxSize)]; } void etStaticDeque_push_front(etStaticDeque* const self, void* object) { - // TODO JB: Handle out of memory exception + /* TODO JB: Handle out of memory exception */ if(self->size < self->maxSize) { ++self->size; self->first = (self->first + (self->maxSize - 1) * self->objectSize) % (self->objectSize * self->maxSize); @@ -42,7 +44,7 @@ void etStaticDeque_push_front(etStaticDeque* const self, void* object) { } void etStaticDeque_push_back(etStaticDeque* const self, void* object) { - // TODO JB: Handle out of memory exception + /* TODO JB: Handle out of memory exception */ if(self->size < self->maxSize) { ++self->size; memcpy(etStaticDeque_back(self), object, self->objectSize); @@ -50,7 +52,7 @@ void etStaticDeque_push_back(etStaticDeque* const self, void* object) { } void etStaticDeque_pop_front(etStaticDeque* const self) { - // TODO JB: Handle deque empty exception + /* TODO JB: Handle deque empty exception */ if(self->size > 0) { self->first = (self->first + self->objectSize) % (self->objectSize * self->maxSize); --self->size; @@ -58,7 +60,7 @@ void etStaticDeque_pop_front(etStaticDeque* const self) { } void etStaticDeque_pop_back(etStaticDeque* const self) { - // TODO JB: Handle deque empty exception + /* TODO JB: Handle deque empty exception */ if(self->size > 0) { --self->size; } diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.h b/runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.h index 23cc4ca67..2333bb0dc 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.h @@ -16,7 +16,10 @@ #include <stdint.h> /** - * Implementation of a double ended queue with a circular buffer + * etStaticDeque (static double ended queue) is a data structure for storing objects of equal size in order. + * The size of the deque is limited by the memory provided by the user. + * Pushing/Popping elements to/from the front and the back as well as arbitrary access is supported in constant time. + * The data structure relies on a circular buffer implemented as an array. */ typedef struct etStaticDeque { uint8_t* memory; /* memory for the objects */ @@ -27,47 +30,74 @@ typedef struct etStaticDeque { } etStaticDeque; /** - * Constructs the Deque on the given memory with specified size and objectSize + * Constructs the Deque on the given memory with specified size and objectSize. + * + * \param self the pointer to the StaticDeque + * \param memory a pointer to the memory for the objects of the StaticDeque + * \param size the maximum count of objects that fit into the specified memory + * \param objectSize the size of the objects stored in the StaticDeque */ void etStaticDeque_construct(etStaticDeque* self, void* memory, int size, int objectSize); /** - * Clears the Deque, removes all objects + * Clears the Deque, removes all objects. + * + * \param self the pointer to the StaticDeque */ -void etStaticDeque_clear(etStaticDeque* const self); +void etStaticDeque_clear(etStaticDeque* self); /** - * Returns a reference to an arbitrary object at the specified position + * Returns a reference to an arbitrary object at the specified position. + * + * \param self the pointer to the StaticDeque + * \param position the position of the object to be returned + * \return the object at the specified position */ void* etStaticDeque_get(const etStaticDeque* self, int position); /** * Copies the object and stores it at the front + * + * \param self the pointer to the StaticDeque + * \param object the object to push to the front of the queue */ void etStaticDeque_push_front(etStaticDeque* self, void* object); /** * Copies the object and stores it at the end + * + * \param self the pointer to the StaticDeque + * \param object the object to push to the end of the queue */ void etStaticDeque_push_back(etStaticDeque* self, void* object); /** * Removes the first object + * + * \param self the pointer to the StaticDeque */ void etStaticDeque_pop_front(etStaticDeque* self); /** * Removes the last element + * + * \param self the pointer to the StaticDeque */ void etStaticDeque_pop_back(etStaticDeque* self); /** * Returns a reference to the first object + * + * \param self the pointer to the StaticDeque + * \return the object at the front of the queue */ void* etStaticDeque_front(const etStaticDeque* self); /** * Returns a reference to the last object + * + * \param self the pointer to the StaticDeque + * \return the object at the end of the queue */ void* etStaticDeque_back(const etStaticDeque* self); diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSocket.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSocket.h index ca1e5e397..de729de9a 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSocket.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSocket.h @@ -28,59 +28,66 @@ typedef struct { etServerSocket; /* - * Constructs a new etSocket and connects to the specified host - * @param self: pointer to etSocket - * @param address: address of the host to connect to - * @param port: port of the host - * @return: 0 on success + * Constructs a new etSocket and connects to the specified host. + * + * \param self pointer to etSocket + * \param address address of the host to connect to + * \param port port of the host + * \return 0 on success */ int etSocket_construct(etSocket* self, const char* address, short port); /* - * Destructs the etSocket - * @param self: pointer to etSocket - * @return: 0 on success + * Destructs the etSocket. + * + * \param self pointer to etSocket + * \return 0 on success */ int etSocket_destruct(etSocket* self); /* - * Receives data from an etSocket - * @param self: pointer to etSocket - * @param buffer: buffer for received data - * @param length: max length of received data - * @return: length of received data, -1 when failed + * Receives data from an etSocket. + * + * \param self pointer to etSocket + * \param buffer buffer for received data + * \param length max length of received data + * \return length of received data, -1 when failed */ int etSocket_recv(etSocket* self, uint8* buffer, size_t length); /* - * Sends data over the etSocket - * @param self: pointer to etSocket - * @param buffer: buffer that holds the data to be sent - * @param length: length of the data - * @return: length of sent data, -1 when failed + * Sends data over the etSocket. + * + * \param self pointer to etSocket + * \param buffer buffer that holds the data to be sent + * \param length length of the data + * \return length of sent data, -1 when failed */ int etSocket_send(etSocket* self, uint8* buffer, size_t length); /* - * Constructs a new etServerSocket and starts to listen on the specified port - * @param self: pointer to etServerSocket - * @param port: port number - * @return: 0 on success + * Constructs a new etServerSocket and starts to listen on the specified port. + * + * \param self pointer to etServerSocket + * \param port port number + * \return: 0 on success */ int etServerSocket_construct(etServerSocket* self, short port); /* - * Destructs an etServerSocket - * @param self: pointer to etServerSocket - * @return: 0 on success + * Destructs an etServerSocket. + * + * \param self pointer to etServerSocket + * \return 0 on success */ int etServerSocket_destruct(etServerSocket* self); /* - * Accepts a new connection - * @param self: pointer to etServerSocket - * @param socket: pointer to the etSocket for the new connection + * Accepts a new connection. + * + * \param self pointer to etServerSocket + * \param socket pointer to the etSocket for the new connection */ int etServerSocket_accept(etServerSocket* self, etSocket* socket); |