<commit_before>
#pragma once

#include "QueuedTracker.h"
#include <list>
#include "threads.h"

// Labview interface packing
#pragma pack(push,1)
struct ResultManagerConfig
{
	int numBeads;
	vector3f scaling;
	vector3f offset; // output will be   (position + offset) * scaling
	int writeInterval;
	uint maxFramesInMemory; // 0 for infinite
	uint8_t binaryOutput;
};
#pragma pack(pop)

// Runs a seperate result fetching thread
class ResultManager
{
public:
	ResultManager(const char *outfile, ResultManagerConfig *cfg);
	~ResultManager();

	void EnableResultFetch(QueuedTracker *qtrk);

	//int GetStartFrame() { return startFrame; }
	//int GetLastFrame() { return fullFrames; }
	//int GetLastWrittenFrame() { return lastSaveFrame; }
	int GetBeadPositions(int startFrame, int endFrame, int bead, LocalizationResult* r);
	int GetResults(LocalizationResult* results, int startFrame, int numResults);
	void Flush();

	void GetFrameCounters(int* startFrame, int *fullFrames, int *lastSaveFrame);

protected:
	void Write();
	void StoreResult(LocalizationResult* r);

	struct FrameResult
	{
		FrameResult() {count=0; results=0; }
		LocalizationResult* results;
		int count;
	};

	Threads::Mutex frameCountMutex, resultMutex;

	std::deque< FrameResult > frameResults;<commit_msg>* Mikrotron camera working as a regular camera.<commit_after>
#pragma once

#include "QueuedTracker.h"
#include <list>
#include "threads.h"

// Labview interface packing
#pragma pack(push,1)
struct ResultManagerConfig
{
	int numBeads;
	vector3f scaling;
	vector3f offset; // output will be   (position + offset) * scaling
	int writeInterval;
	uint maxFramesInMemory; // 0 for infinite
	uint8_t binaryOutput;
};
#pragma pack(pop)

// Runs a seperate result fetching thread
class ResultManager
{
public:
	ResultManager(const char *outfile, ResultManagerConfig *cfg);
	~ResultManager();

	void EnableResultFetch(QueuedTracker *qtrk);

	//int GetStartFrame() { return startFrame; }
	//int GetLastFrame() { return fullFrames; }
	//int GetLastWrittenFrame() { return lastSaveFrame; }
	int GetBeadPositions(int startFrame, int endFrame, int bead, LocalizationResult* r);
	int GetResults(LocalizationResult* results, int startFrame, int numResults);
	void Flush();

	void GetFrameCounters(int* startFrame, int *fullFrames, int *lastSaveFrame);

	// Configure output of an additional frame info file
	void SetFrameInfoFile(const char* outfile, int numcols);
	void SetFrameInfo(int frame, float* columns);

protected:
	void Write();
	void StoreResult(LocalizationResult* r);

	struct FrameResult
	{
		FrameResult() {count=0; results=0; }
		LocalizationResult* results;
		int count;
	};

	Threads::Mutex frameCountMutex, resultMutex;

	std::deque< FrameResult > frameResults;
{'fraction_non_alphanumeric': 0.10387710314557425, 'fraction_numerical': 0.005120702267739576, 'mean_word_length': 5.590361445783133, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5968473', 'n_tokens_mistral': 878, 'n_tokens_neox': 848, 'n_words': 255}