13 #ifndef HTGS_RULEMANAGER_HPP 14 #define HTGS_RULEMANAGER_HPP 23 template<
class V,
class W>
56 template<
class T,
class U>
58 static_assert(std::is_base_of<IData, T>::value,
"T must derive from IData");
59 static_assert(std::is_base_of<IData, U>::value,
"U must derive from IData");
80 if (this->
rule->canUseLocks()) {
81 this->
rule->getMutex().lock();
90 if (result !=
nullptr && result->size() > 0) {
93 sendWSProfileUpdate(
this, StatusCode::ACTIVATE_EDGE);
103 if (this->
rule->canUseLocks()) {
104 this->
rule->getMutex().unlock();
115 return this->
rule->getName() + inOutLabel;
145 sendWSProfileUpdate(this->
connector.get(), StatusCode::DECREMENT);
160 " to connector " << this->connector);
172 if (this->
connector->isInputTerminated()) {
176 sendWSProfileUpdate(this->
connector.get(), StatusCode::DECREMENT);
186 void sendWSProfileUpdate(
void *addr, StatusCode code)
188 if (this->
getName() ==
"WebSocketProfiler")
190 std::shared_ptr<ProfileData> updateStatus(
new ChangeStatusProfile(addr, code));
191 std::shared_ptr<DataPacket> dataPacket(
new DataPacket(this->
getName(),
"",
"WebSocketProfiler",
"0", updateStatus));
192 this->communicator->produceDataPacket(dataPacket);
200 std::string inTypeName() {
201 #if defined( __GLIBCXX__ ) || defined( __GLIBCPP__ ) 203 char *realName = abi::__cxa_demangle(
typeid(T).name(), 0, 0, &status);
204 std::string ret(realName);
210 return typeid(T).name();
218 std::string outTypeName() {
219 #if defined( __GLIBCXX__ ) || defined( __GLIBCPP__ ) 221 char *realName = abi::__cxa_demangle(
typeid(U).name(), 0, 0, &status);
222 std::string ret(realName);
228 return typeid(U).name();
235 std::shared_ptr<IRule<T, U>>
rule;
248 #endif //HTGS_RULEMANAGER_HPP void executeTask(std::shared_ptr< T > data) override
Processes the input data, which is forwarded to the IRule synchronously.
Definition: RuleManager.hpp:78
Implements the base class for the rule manager, but only providing the input type.
void initialize(size_t pipelineId, size_t numPipelines, std::string address) override
Initializes the RuleManager.
Definition: RuleManager.hpp:126
std::string address
The address for the rule manager.
Definition: RuleManager.hpp:240
#define HTGS_DEBUG_VERBOSE(msg)
Prints a debug message to std:cerr with VERBOSE level.
Definition: debug_message.hpp:75
Provides the Connector class for managing input/output of AbsData between Tasks.
virtual ~RuleManager() override
Destructor.
Definition: RuleManager.hpp:76
volatile bool terminated
Whether this RuleManager is terminated or not.
Definition: RuleManager.hpp:242
Manages the input/output of IData between Tasks.
Definition: Connector.hpp:62
Provides an interface to send data along RuleManager edges for processing state and dependencies...
Definition: ExecutionPipeline.hpp:34
Implements the Bookkeeper class.
void setOutputConnector(std::shared_ptr< AnyConnector > connector) override
Sets the output connector that the RuleManager is attached to.
Definition: RuleManager.hpp:157
std::shared_ptr< AnyConnector > getConnector() override
Gets the output connector associated with the RuleManager.
Definition: RuleManager.hpp:122
Provides an interface to send data along RuleManager edges for processing state and dependencies...
std::shared_ptr< htgs::Connector< U > > connector
The connector for producing data from the rule.
Definition: RuleManager.hpp:241
size_t numPipelines
The number of execution pipelines.
Definition: RuleManager.hpp:239
Implements the base class for the rule manager, but only provides the input type. ...
Definition: AnyRuleManagerInOnly.hpp:27
#define HTGS_DEBUG(msg)
Prints a debug message to std::cerr with standard level If DEBUG_FLAG is not defined, this equates to a no op Each message includes the file and line number for where the debug is called.
Definition: debug_message.hpp:65
std::string getName(int flags=0) override
Gets the name of the RuleManager and the names of all IRules that it manages.
Definition: RuleManager.hpp:112
RuleManager(std::shared_ptr< htgs::IRule< T, U >> rule)
Creates a rule manager with a rule.
Definition: RuleManager.hpp:70
Connects a Bookkeeper to another ITask using one or more IRule(s).
Definition: RuleManager.hpp:57
#define DOTGEN_FLAG_SHOW_IN_OUT_TYPES
Shows input and output types for all tasks.
Definition: TaskGraphDotGenFlags.hpp:32
size_t pipelineId
The execution pipeline id.
Definition: RuleManager.hpp:238
Implements a data packet that is transmitted to the TaskGraphCommunicator.
void shutdown() override
Shuts down the RuleManager.
Definition: RuleManager.hpp:133
std::shared_ptr< IRule< T, U > > rule
The rule associated with the RuleManager.
Definition: RuleManager.hpp:235
bool isTerminated() override
Checks whether the RuleManager is terminated or not.
Definition: RuleManager.hpp:153
void checkRuleTermination() override
Checks if the rule can be terminated or not.
Definition: RuleManager.hpp:166
void debug() override
Provides debug output.
Definition: RuleManager.hpp:118
Definition: Bookkeeper.hpp:23
RuleManager< T, U > * copy() override
Creates a copy of the RuleManager.
Definition: RuleManager.hpp:108