Question & Answer
Question
How to implement 'Queue' in Rational Rhapsody?
Answer
A Queue is a particular kind of collection in which the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear terminal position and removal of entities from the front terminal position.
Rhapsody's framework defines OSAL classes that can be used to implement message queue. For RiC it is the 'RiCOSMessageQueue' class and for RiCpp it is the 'OMMessageQueue' class. Both the classes have the various functions with respect to handling a message queue. The framework files have the implementation of the various queue handling functions which can be used as per requirement.
Attached is a RiC project showing the implementation of Queue. Some of the queue handling functions used in this project are:
- RiCQueue_Init() - Initialize the queue.
- RiCQueue_setFixedSize() - Get queue to fixed size flag.
- RiCQueue_push() - Push an element to the queue.
- RiCQueue_pop - Pop an element from the queue.
These functions are defined in the framework file 'RicQueue.c'. In this model, there is a simple integer queue and have pushed and pop'ed elements to/from the same.
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21398189