<commit_before>#ifndef PIPELINE_SIMPLE_PROCESS_NODE_H__
#define PIPELINE_SIMPLE_PROCESS_NODE_H__

#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/bind.hpp>

#include <signals/Slot.h>
#include <signals/Slots.h>
#include <pipeline/signals/all.h>
#include <pipeline/Data.h>
#include <pipeline/Input.h>
#include <pipeline/Inputs.h>
#include <pipeline/Output.h>
#include <pipeline/ProcessNode.h>

namespace pipeline {

enum InputType {

	Required,
	Optional
};

/**
 * Don't perform input/output locking on updateOutputs. Use this strategy if you
 * want to control which inputs and outputs to lock yourself.
 */
class NoLockingStrategy {

public:

	void lockInput(InputBase&, boost::function<void()> next) {

		next();
	}

	void lockOutput(OutputBase&, boost::function<void()> next) {

		next();
	}
};

/**
 * Lock only the inputs. Allocates read locks on all inputs.
 */
class InputLockingStrategy : public NoLockingStrategy {

public:

	void lockInput(InputBase& input, boost::function<void()> next) {

		if (input.hasAssignedOutput()) {<commit_msg>bugfix: SimpleProcessNode needs check for != 0 before locking input<commit_after>#ifndef PIPELINE_SIMPLE_PROCESS_NODE_H__
#define PIPELINE_SIMPLE_PROCESS_NODE_H__

#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/bind.hpp>

#include <signals/Slot.h>
#include <signals/Slots.h>
#include <pipeline/signals/all.h>
#include <pipeline/Data.h>
#include <pipeline/Input.h>
#include <pipeline/Inputs.h>
#include <pipeline/Output.h>
#include <pipeline/ProcessNode.h>

namespace pipeline {

enum InputType {

	Required,
	Optional
};

/**
 * Don't perform input/output locking on updateOutputs. Use this strategy if you
 * want to control which inputs and outputs to lock yourself.
 */
class NoLockingStrategy {

public:

	void lockInput(InputBase&, boost::function<void()> next) {

		next();
	}

	void lockOutput(OutputBase&, boost::function<void()> next) {

		next();
	}
};

/**
 * Lock only the inputs. Allocates read locks on all inputs.
 */
class InputLockingStrategy : public NoLockingStrategy {

public:

	void lockInput(InputBase& input, boost::function<void()> next) {

		if (input.hasAssignedOutput() && input.getSharedDataPointer()) {
{'fraction_non_alphanumeric': 0.12866015971606035, 'fraction_numerical': 0.00044365572315882877, 'mean_word_length': 5.212121212121212, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6675186', 'n_tokens_mistral': 770, 'n_tokens_neox': 753, 'n_words': 185}