<commit_before>#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include <winsock2.h>
#include <ws2bth.h>
#include <map>
#include <vector>

#include "../module_headers/module.h"
#include "../module_headers/robot_module.h"

#include "tarakan_robot_module.h"
#include "SimpleIni.h"

#pragma comment(lib, "Ws2_32.lib")

typedef std::vector< std::pair< int, int > > universalVec;
typedef CSimpleIniA::TNamesDepend::const_iterator ini_i;

#define DEFAULT_SOCKET_BUFLEN 512

EXTERN_C IMAGE_DOS_HEADER __ImageBase;

/* GLOBALS CONFIG */
const unsigned int COUNT_FUNCTIONS = 6;
const unsigned int COUNT_AXIS = 3;

#define DEFINE_ALL_AXIS \
	ADD_ROBOT_AXIS("locked", 1, 0)\
	ADD_ROBOT_AXIS("straight", 2, 0)\
	ADD_ROBOT_AXIS("rotation", 2, 0)

universalVec vec_rotate, vec_move;

bool pred(const std::pair<int, int> &a, const std::pair<int, int> &b) {
	return a.first < b.first;
}

long int getParametrsToTime(variable_value parametr, bool what){
	universalVec::const_iterator iter_key;
	universalVec* linkOfaddressMemVec;
	if (what){ 
		linkOfaddressMemVec = &vec_rotate;
	}else{ 
		linkOfaddressMemVec = &vec_move;
	}
	int min = 0, max = 0, minValue = 0, maxValue = 0, count = 0;
	long double y = 0;
	bool flagEnd = false;
		for (iter_key = linkOfaddressMemVec->begin(); iter_key != linkOfaddressMemVec->end(); ++iter_key){
			if (parametr >= iter_key->first){
				min = iter_key->first;
				count = iter_key->second;
			}
			else{
				max = iter_key->first;
				maxValue = iter_key->second;
				minValue = count;
				flagEnd = true;
				break;
			}
			count++;
		}
		if (!flagEnd){
			--iter_key;
			max = iter_key->first;
			maxValue = iter_key->second;
			--iter_key;
			min = iter_key->first;
			minValue = iter_key->second;
		}

	y = (((maxValue - minValue)*(parametr - min)) / (max - min)) + minValue;

	return long(std::rint(y));
}

/////////////////////////////////////////////////

TarakanRobotModule::TarakanRobotModule() {
	{
		robot_functions = new FunctionData*[COUNT_FUNCTIONS];
		system_value function_id = 0;

		//DEFINE_ALL_FUNCTIONS
		FunctionData::ParamTypes *moveToParams = new FunctionData::ParamTypes[2];
		moveToParams[0] = FunctionData::FLOAT;
		moveToParams[1] = FunctionData::FLOAT;
		robot_functions[function_id] = new FunctionData(function_id + 1, 2, moveToParams, "moveTo");
		function_id++;


		FunctionData::ParamTypes *rotateToParams = new FunctionData::ParamTypes[2];
		rotateToParams[0] = FunctionData::FLOAT;
		rotateToParams[1] = FunctionData::FLOAT;
		robot_functions[function_id] = new FunctionData(function_id + 1, 2, rotateToParams, "rotateTo");
		function_id++;


		FunctionData::ParamTypes *moveToByTimeParams = new FunctionData::ParamTypes[2];
		moveToByTimeParams[0] = FunctionData::FLOAT;
		moveToByTimeParams[1] = FunctionData::FLOAT;
		robot_functions[function_id] = new FunctionData(function_id + 1, 2, moveToByTimeParams, "moveToByTime");
		function_id++;


		FunctionData::ParamTypes *rotateToByTimeParams = new FunctionData::ParamTypes[2];
		rotateToByTimeParams[0] = FunctionData::FLOAT;
		rotateToByTimeParams[1] = FunctionData::FLOAT;
		robot_functions[function_id] = new FunctionData(function_id + 1, 2, rotateToByTimeParams, "rotateToByTime");
		function_id++;

		
		FunctionData::ParamTypes *changeLightModeParams = new FunctionData::ParamTypes[3];
		changeLightModeParams[0] = FunctionData::FLOAT;
		changeLightModeParams[1] = FunctionData::FLOAT;
		changeLightModeParams[2] = FunctionData::FLOAT;
		robot_functions[function_id] = new FunctionData(function_id + 1, 3, changeLightModeParams, "changeLightMode");
		function_id++;


		FunctionData::ParamTypes *getDistanceObstacleParams = new FunctionData::ParamTypes[1];
		getDistanceObstacleParams[0] = FunctionData::FLOAT;
		robot_functions[function_id] = new FunctionData(function_id + 1, 1, getDistanceObstacleParams, "getDistanceObstacle");

	}
	{
		robot_axis = new AxisData*[COUNT_AXIS];
		system_value axis_id = 0;
		DEFINE_ALL_AXIS
	}
}

const char *TarakanRobotModule::getUID() {
	return "Tarakan robot module 1.00 for presentaion";<commit_msg>1 Указатель Params для всех функций.<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include <winsock2.h>
#include <ws2bth.h>
#include <map>
#include <vector>

#include "../module_headers/module.h"
#include "../module_headers/robot_module.h"

#include "tarakan_robot_module.h"
#include "SimpleIni.h"

#pragma comment(lib, "Ws2_32.lib")

typedef std::vector< std::pair< int, int > > universalVec;
typedef CSimpleIniA::TNamesDepend::const_iterator ini_i;

#define DEFAULT_SOCKET_BUFLEN 512

EXTERN_C IMAGE_DOS_HEADER __ImageBase;

/* GLOBALS CONFIG */
const unsigned int COUNT_FUNCTIONS = 6;
const unsigned int COUNT_AXIS = 3;

#define DEFINE_ALL_AXIS \
	ADD_ROBOT_AXIS("locked", 1, 0)\
	ADD_ROBOT_AXIS("straight", 2, 0)\
	ADD_ROBOT_AXIS("rotation", 2, 0)

universalVec vec_rotate, vec_move;

bool pred(const std::pair<int, int> &a, const std::pair<int, int> &b) {
	return a.first < b.first;
}

long int getParametrsToTime(variable_value parametr, bool what){
	universalVec::const_iterator iter_key;
	universalVec* linkOfaddressMemVec;
	if (what){ 
		linkOfaddressMemVec = &vec_rotate;
	}else{ 
		linkOfaddressMemVec = &vec_move;
	}
	int min = 0, max = 0, minValue = 0, maxValue = 0, count = 0;
	long double y = 0;
	bool flagEnd = false;
		for (iter_key = linkOfaddressMemVec->begin(); iter_key != linkOfaddressMemVec->end(); ++iter_key){
			if (parametr >= iter_key->first){
				min = iter_key->first;
				count = iter_key->second;
			}
			else{
				max = iter_key->first;
				maxValue = iter_key->second;
				minValue = count;
				flagEnd = true;
				break;
			}
			count++;
		}
		if (!flagEnd){
			--iter_key;
			max = iter_key->first;
			maxValue = iter_key->second;
			--iter_key;
			min = iter_key->first;
			minValue = iter_key->second;
		}

	y = (((maxValue - minValue)*(parametr - min)) / (max - min)) + minValue;

	return long(std::rint(y));
}

/////////////////////////////////////////////////

TarakanRobotModule::TarakanRobotModule() {
	{
		robot_functions = new FunctionData*[COUNT_FUNCTIONS];
		system_value function_id = 0;

		//DEFINE_ALL_FUNCTIONS
		FunctionData::ParamTypes *Params = new FunctionData::ParamTypes[2];
		Params[0] = FunctionData::FLOAT;
		Params[1] = FunctionData::FLOAT;
		robot_functions[function_id] = new FunctionData(function_id + 1, 2, Params, "moveTo");
		function_id++;


		Params = new FunctionData::ParamTypes[2];
		Params[0] = FunctionData::FLOAT;
		Params[1] = FunctionData::FLOAT;
		robot_functions[function_id] = new FunctionData(function_id + 1, 2, Params, "rotateTo");
		function_id++;


		Params= new FunctionData::ParamTypes[2];
		Params[0] = FunctionData::FLOAT;
		Params[1] = FunctionData::FLOAT;
		robot_functions[function_id] = new FunctionData(function_id + 1, 2, Params, "moveToByTime");
		function_id++;


		Params = new FunctionData::ParamTypes[2];
		Params[0] = FunctionData::FLOAT;
		Params[1] = FunctionData::FLOAT;
		robot_functions[function_id] = new FunctionData(function_id + 1, 2, Params, "rotateToByTime");
		function_id++;

		
		Params = new FunctionData::ParamTypes[3];
		Params[0] = FunctionData::FLOAT;
		Params[1] = FunctionData::FLOAT;
		Params[2] = FunctionData::FLOAT;
		robot_functions[function_id] = new FunctionData(function_id + 1, 3, Params, "changeLightMode");
		function_id++;


		FunctionData::ParamTypes *getDistanceObstacleParams = new FunctionData::ParamTypes[1];
		getDistanceObstacleParams[0] = FunctionData::FLOAT;
		robot_functions[function_id] = new FunctionData(function_id + 1, 1, getDistanceObstacleParams, "getDistanceObstacle");

	}
	{
		robot_axis = new AxisData*[COUNT_AXIS];
		system_value axis_id = 0;
		DEFINE_ALL_AXIS
	}
}

const char *TarakanRobotModule::getUID() {
	return "Tarakan robot module 1.00 for presentaion";
{'fraction_non_alphanumeric': 0.14435762776995004, 'fraction_numerical': 0.014730370180607147, 'mean_word_length': 4.96030534351145, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 49, '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': '6854164', 'n_tokens_mistral': 3043, 'n_tokens_neox': 2743, 'n_words': 556}