<commit_before>/*!
  \copyright (c) RDO-Team, 2011
  \file      calc_array.cpp
  \author     
  \date      02.05.2011
  \brief        - 
  \indent    4T
*/

// ---------------------------------------------------------------------------- PCH
#include "simulator/runtime/pch.h"
// ----------------------------------------------------------------------- INCLUDES
// ----------------------------------------------------------------------- SYNOPSIS
#include "simulator/runtime/calc/calc_array.h"
#include "simulator/runtime/rdo_array.h"
// --------------------------------------------------------------------------------

OPEN_RDO_RUNTIME_NAMESPACE

// --------------------------------------------------------------------------------
// -------------------- RDOCalcArraySize
// --------------------------------------------------------------------------------
RDOCalcArraySize::RDOCalcArraySize(CREF(LPRDOCalc) pCalc)
	: m_pCalc(pCalc)
{}

REF(RDOValue) RDOCalcArraySize::doCalc(CREF(LPRDORuntime) pRuntime)
{
	REF(RDOValue) value = m_pCalc->calcValue(pRuntime);
	LPRDOArrayType pArrayType = value.type().object_dynamic_cast<RDOArrayType>();
	ASSERT(pArrayType);
	CREF(LPRDOArrayValue) pArrayValue = value.getPointer<RDOArrayValue>();
	ASSERT(pArrayValue);
	m_value = RDOValue(pArrayValue->size());
	return m_value;
}

// --------------------------------------------------------------------------------
// -------------------- RDOCalcArrayItem
// --------------------------------------------------------------------------------
RDOCalcArrayItem::RDOCalcArrayItem(CREF(LPRDOCalc) pArray, CREF(LPRDOCalc) pArrayInd)
	: m_pArray   (pArray   )
	, m_pArrayInd(pArrayInd)
{}

REF(RDOValue) RDOCalcArrayItem::doCalc(CREF(LPRDORuntime) pRuntime)
{
	REF(RDOValue) value = m_pArray->calcValue(pRuntime);

	CREF(LPRDOArrayValue) pArrayValue = value.getPointerSafety<RDOArrayType>();
	ASSERT(pArrayValue);

	m_value = pArrayValue->getItem(m_pArrayInd->calcValue(pRuntime),this->srcInfo(),pRuntime);
	return m_value;
}

// --------------------------------------------------------------------------------
// -------------------- RDOCalcSetArrayItem
// --------------------------------------------------------------------------------
RDOCalcSetArrayItem::RDOCalcSetArrayItem(CREF(LPRDOCalc) pArray, CREF(LPRDOCalc) pArrayInd, CREF(LPRDOCalc) pSetItem)
	: m_pArray   (pArray   )
	, m_pArrayInd(pArrayInd)
	, m_pSetItem (pSetItem )
{}

REF(RDOValue) RDOCalcSetArrayItem::doCalc(CREF(LPRDORuntime) pRuntime)
{
	m_value = m_pArray->calcValue(pRuntime);

	CREF(LPRDOArrayValue) pArrayValue = m_value.getPointerSafety<RDOArrayType>();
	ASSERT(pArrayValue);
	pArrayValue->setItem(m_pArrayInd->calcValue(pRuntime), m_pSetItem->calcValue(pRuntime),this->srcInfo(),pRuntime);

	return m_value;
}

CLOSE_RDO_RUNTIME_NAMESPACE
<commit_msg> - srcInfo калка для работы с элементами массива настроено на индекс элемента.Форматирование.<commit_after>/*!
  \copyright (c) RDO-Team, 2011
  \file      calc_array.cpp
  \author     
  \date      02.05.2011
  \brief        - 
  \indent    4T
*/

// ---------------------------------------------------------------------------- PCH
#include "simulator/runtime/pch.h"
// ----------------------------------------------------------------------- INCLUDES
// ----------------------------------------------------------------------- SYNOPSIS
#include "simulator/runtime/calc/calc_array.h"
#include "simulator/runtime/rdo_array.h"
// --------------------------------------------------------------------------------

OPEN_RDO_RUNTIME_NAMESPACE

// --------------------------------------------------------------------------------
// -------------------- RDOCalcArraySize
// --------------------------------------------------------------------------------
RDOCalcArraySize::RDOCalcArraySize(CREF(LPRDOCalc) pCalc)
	: m_pCalc(pCalc)
{}

REF(RDOValue) RDOCalcArraySize::doCalc(CREF(LPRDORuntime) pRuntime)
{
	REF(RDOValue) value = m_pCalc->calcValue(pRuntime);
	LPRDOArrayType pArrayType = value.type().object_dynamic_cast<RDOArrayType>();
	ASSERT(pArrayType);
	CREF(LPRDOArrayValue) pArrayValue = value.getPointer<RDOArrayValue>();
	ASSERT(pArrayValue);
	m_value = RDOValue(pArrayValue->size());
	return m_value;
}

// --------------------------------------------------------------------------------
// -------------------- RDOCalcArrayItem
// --------------------------------------------------------------------------------
RDOCalcArrayItem::RDOCalcArrayItem(CREF(LPRDOCalc) pArray, CREF(LPRDOCalc) pArrayInd)
	: m_pArray   (pArray   )
	, m_pArrayInd(pArrayInd)
{}

REF(RDOValue) RDOCalcArrayItem::doCalc(CREF(LPRDORuntime) pRuntime)
{
	setSrcInfo(m_pArrayInd->srcInfo());
	REF(RDOValue) value = m_pArray->calcValue(pRuntime);

	CREF(LPRDOArrayValue) pArrayValue = value.getPointerSafety<RDOArrayType>();
	ASSERT(pArrayValue);

	m_value = pArrayValue->getItem(m_pArrayInd->calcValue(pRuntime), srcInfo(), pRuntime);
	return m_value;
}

// --------------------------------------------------------------------------------
// -------------------- RDOCalcSetArrayItem
// --------------------------------------------------------------------------------
RDOCalcSetArrayItem::RDOCalcSetArrayItem(CREF(LPRDOCalc) pArray, CREF(LPRDOCalc) pArrayInd, CREF(LPRDOCalc) pSetItem)
	: m_pArray   (pArray   )
	, m_pArrayInd(pArrayInd)
	, m_pSetItem (pSetItem )
{}

REF(RDOValue) RDOCalcSetArrayItem::doCalc(CREF(LPRDORuntime) pRuntime)
{
	m_value = m_pArray->calcValue(pRuntime);
	setSrcInfo(m_pArrayInd->srcInfo());

	CREF(LPRDOArrayValue) pArrayValue = m_value.getPointerSafety<RDOArrayType>();
	ASSERT(pArrayValue);
	pArrayValue->setItem(m_pArrayInd->calcValue(pRuntime), m_pSetItem->calcValue(pRuntime), srcInfo(), pRuntime);

	return m_value;
}

CLOSE_RDO_RUNTIME_NAMESPACE

{'fraction_non_alphanumeric': 0.3755495434562056, 'fraction_numerical': 0.00439634764964491, 'mean_word_length': 1.4182338511856092, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 33, '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': '7318023', 'n_tokens_mistral': 1820, 'n_tokens_neox': 1744, 'n_words': 203}