Queue in C++

C++ Classes and Members

class DragonException : public std::exception

Public Functions

DragonException(dragonError_t err, std::string msg)

Encapsulates Dragon error and message.

Objects of this class are constructed and thrown when error conditions with Dragon Occur. Subclasses of this exception identify errors on a more granular level so they may be caught and dealt with using specific exception handling.

virtual ~DragonException()

The DragonException destructor.

Insures proper cleanup of the exception when it is no longer needed.

class DragonManagedQueueBuf : public std::streambuf

This provides a Managed Queue Stream Buffer.

This class provides a managed queue as a stream for sending and receiving data via a managed queue in the Dragon run-time. This class can be used to construct a stream, either an ostream or an istream for reading and writing data to/from a Dragon queue.

Public Functions

DragonManagedQueueBuf(std::string name, size_t buffer_size, size_t maxsize, bool joinable, dragonQueueAttr_t *queue_attr, dragonPolicy_t *policy)

Construct a Dragon Managed Queue streambuf.

This creates the buffer and the underlying managed queue instance.

Parameters
  • name – A unique name to be assigned to this stream buffer in the user’s application.

  • buffer_size – The size of the buffer to be allocated for reading/writing data.

  • maxsize – is the total capacity of the Queue.

  • joinable – is a flag whether or not the dragon_queue_task_done() and dragon_queue_join() calls function (these calls are not shown below yet).

  • queue_attr – is a pointer to Queue attributes or NULL to use default values.

  • policy – is a pointer to the Policy structure to use.

virtual ~DragonManagedQueueBuf()

Destructor for a DragonManagedQueueBuf.

This destroys/detaches from the underlying managed queue object.

class DragonUnmanagedQueueBuf : public std::streambuf

This provides an Unmanaged Queue Stream Buffer.

This class provides a unmanaged queue as a stream for sending and receiving data via an unmanaged queue in the Dragon run-time. This class can be used to construct a stream, either an ostream or an istream for reading and writing data to/from a Dragon queue.

Public Functions

DragonUnmanagedQueueBuf(size_t buffer_size, dragonMemoryPoolDescr_t *pool, size_t maxsize, bool joinable, dragonQueueAttr_t *queue_attr, dragonPolicy_t *policy)

Construct a Dragon Unmanaged Queue streambuf.

This creates the buffer and the underlying unmanaged queue instance.

Parameters
  • buffer_size – The size of the buffer to be allocated for reading/writing data.

  • pool – is the Managed Memory Pool to allocate space for the Queue from.

  • maxsize – is the total capacity of the Queue.

  • joinable – is a flag whether or not the dragon_queue_task_done() and dragon_queue_join() calls function.

  • queue_attr – is a pointer to Queue attributes or NULL to use default values.

  • policy – is a pointer to the Policy structure to use, of which affinity and reference counting will be ignored.

DragonUnmanagedQueueBuf(std::string ch_ser, size_t buffer_size)

Construct a Dragon Unmanaged Queue streambuf.

This creates the buffer and the underlying unmanaged queue instance.

Parameters
  • ch_ser – A Dragon base64 encoded serialized descriptor to a channel.

  • buffer_size – The size of the buffer to be allocated for reading/writing data.

std::string serialize()

Obtain a serialized descriptor for the unmanaged queue buffer.

This returns a string which may be sent to another process for use in attaching to this unmanaged queue via the appropriate DragonUnmanagedQueueBuf constructor.

virtual ~DragonUnmanagedQueueBuf()

Destructor for a DragonManagedQueueBuf.

This destroys/detaches from the underlying managed queue object.