Home > Articles > Programming > C/C++

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

A Service Queue in the NMS

Listing 2 shows a queue element type and a class interface that provides a simple queue.

Listing 2 Queue Type and Class

struct QueueElement
{
  char* requiredOperation;
  QueueElement* nextQueueElement;
};
typedef QueueElement* QueueElementPtr;

class NMSServiceQueue
{
public:
  explicit NMSServiceQueue(void);
  virtual ~NMSServiceQueue(void);
  void add(QueueElementPtr serviceRequest);
  const QueueElementPtr remove(void);
  void examineQueue(void);
  bool queueIsEmpty() const;

private:
  QueueElementPtr startOfQueue;
  QueueElementPtr endOfQueue;
};

Listing 2 shows a queue data type and a class for manipulating data structures made up of a queue instance. The queue allows for elements to be added at one end and removed at the opposite end.

  • + Share This
  • 🔖 Save To Your Account