13 #ifndef HTGS_CONNECTOR_HPP 14 #define HTGS_CONNECTOR_HPP 20 #if defined( __GLIBCXX__ ) || defined( __GLIBCPP__ ) 27 #ifdef USE_PRIORITY_QUEUE 63 static_assert(std::is_base_of<IData, T>::value,
"T must derive from IData");
86 std::cout <<
"consume largest queue size: " <<
queue.getQueueActiveMaxSize() << std::endl;
96 return queue.getQueueActiveMaxSize();
104 this->
queue.resetMaxQueueSize();
110 std::shared_ptr<T> dataCast = std::dynamic_pointer_cast<T>(data);
126 std::shared_ptr<T> data = this->
queue.
poll(timeout);
156 for (std::shared_ptr<T> v : *data) {
164 std::string getQueueTiming()
override {
165 return std::to_string(
queue.getEnqueueLockTime()) +
", " 166 + std::to_string(
queue.getDequeueLockTime()) +
", " 167 + std::to_string(
queue.getEnqueueWaitTime()) +
", " 168 + std::to_string(
queue.getDequeueWaitTime());
177 #if defined( __GLIBCXX__ ) || defined( __GLIBCPP__ ) 179 char *realName = abi::__cxa_demangle(
typeid(T).name(), 0, 0, &status);
180 std::string ret(realName);
186 return typeid(T).name();
196 #ifdef USE_PRIORITY_QUEUE 205 #endif //HTGS_CONNECTOR_HPP Connector()
Initializes the Connector with no producer tasks.
Definition: Connector.hpp:69
void wakeupConsumer() override
Awakens all Tasks that are consuming data from this connector.
Definition: Connector.hpp:80
std::string typeName() override
Gets the demangled type name of the connector.
Definition: Connector.hpp:176
bool isEmpty()
Gets whether the queue is empty or not.
Definition: BlockingQueue.hpp:93
Parent class for Connector, which removes the template type of the Connector.
Definition: AnyConnector.hpp:39
#define HTGS_DEBUG_VERBOSE(msg)
Prints a debug message to std:cerr with VERBOSE level.
Definition: debug_message.hpp:75
void produceData(std::shared_ptr< T > data)
Produces data into the queue.
Definition: Connector.hpp:146
size_t size()
Gets the number of elements in the queue.
Definition: BlockingQueue.hpp:101
Creates a thread-safe queue that will wait when no data is available and can block if the queue is fu...
Definition: BlockingQueue.hpp:32
Manages the input/output of IData between Tasks.
Definition: Connector.hpp:62
Implements a thread-safe BlockingQueue.
void profileConsume(size_t numThreads, bool showQueueSize) override
Provides profile output for the consume operation.
Definition: Connector.hpp:84
void Enqueue(T const &value)
Adds an element into the queue.
Definition: BlockingQueue.hpp:126
void resetMaxQueueSize() override
Resets the max queue size profile.
Definition: Connector.hpp:102
~Connector()
Destructor.
Definition: Connector.hpp:74
Implements the IData class, which is used for all data types entering/leaving a task graph...
Implements a thread-safe PriorityBlockingQueue.
size_t getQueueSize() override
Gets the size of the queue that this connector has in its data queue.
Definition: Connector.hpp:90
Holds parent class for Connector, removes template type of Connector.
BlockingQueue< std::shared_ptr< T > > queue
The blocking queue associated with the connector (thread safe) (can be switched to a priority queue u...
Definition: Connector.hpp:201
Creates a thread-safe priority queue that will wait when no data is available and can block if the qu...
Definition: PriorityBlockingQueue.hpp:33
T Dequeue()
Removes an element from the queue.
Definition: BlockingQueue.hpp:162
bool isInputTerminated() override
Checks whether the producer for this Connector has finished pushing data onto its queue...
Definition: Connector.hpp:76
T poll(size_t timeout)
Polls for data given the specified timeout time in microseconds.
Definition: BlockingQueue.hpp:189
std::shared_ptr< T > pollConsumeData(size_t timeout)
Polls for data for a consumer given a timeout.
Definition: Connector.hpp:125
std::shared_ptr< T > consumeData()
Consumes data from the queue.
Definition: Connector.hpp:137
size_t getMaxQueueSize() override
Gets the maximum queue size that this connector has in its data queue.
Definition: Connector.hpp:94
Connector< T > * copy() override
Creates a copy of the BaseConnector.
Definition: Connector.hpp:78
void produceAnyData(std::shared_ptr< IData > data) override
Produces any data into the queue.
Definition: Connector.hpp:108
void produceData(std::list< std::shared_ptr< T >> *data)
Produces a list of data adding each element into the queue.
Definition: Connector.hpp:155
void profileProduce(size_t numThreads) override
Provide profile output for the produce operation.
Definition: Connector.hpp:82
Definition: Bookkeeper.hpp:23
Provides functionality for debug messaging.