コード例 #1
0
ファイル: xsarray.c プロジェクト: Insomnia-/mrpt
/*! \relates XsArray
	\brief Initializes the XsArray with a copy of \a src 
	\param src A pointer to the objects to copy. The object may be empty, but src may not be 0
*/
void XsArray_copyConstruct(void* thisPtr, void const* src)
{
	XsArray* thisArray = (XsArray*) thisPtr;
	XsArray const* srcArray = (XsArray const*) src;
	assert(srcArray);
	XsArray_construct(thisArray, srcArray->m_descriptor, srcArray->m_size, srcArray->m_data);
}
コード例 #2
0
ファイル: xsarray.c プロジェクト: Insomnia-/mrpt
/*! \relates XsArray
	\brief Reinitializes the XsArray with space for \a count items and copies them from \a src 
	\details This function reinitializes the object reserving space for at least \a count items in the
	buffer. \a count may be 0. If \a src is not 0, \a count items will be copied from \a src.
	Previous data will be cleared automatically, but the reserved space will not be reduced.
	\param count the number of items in src
	\param src a pointer to an array of output configuration objects
	\sa XsArray_reserve
*/
void XsArray_assign(void* thisPtr, XsSize count, void const* src)
{
	XsSize i;
	XsArray* thisArray = (XsArray*) thisPtr;

	// check if we need to reallocate
	if (count > thisArray->m_reserved)
	{
		assert(thisArray->m_flags & XSDF_Managed);

		if (thisArray->m_data)
			XsArray_destruct(thisArray);
		XsArray_construct(thisArray, thisArray->m_descriptor, count, src);
		return;
	}

	// no reallocation necessary, clear excess objects
	if (thisArray->m_descriptor->itemDestruct)
		for (i=count; i<thisArray->m_size; ++i)
			thisArray->m_descriptor->itemDestruct(elemAt(thisArray->m_data, i));

	if (src)
		for (i=0; i<count; ++i)
			thisArray->m_descriptor->itemCopy(elemAt(thisArray->m_data, i), elemAt(src, i));

	*((XsSize*) &thisArray->m_size) = count;
}
コード例 #3
0
ファイル: xsstringarray.c プロジェクト: Aharobot/mrpt
/*! \copydoc XsArray_construct
	\note Specialization for XsStringArray
*/
void XsStringArray_construct(XsStringArray* thisPtr, XsSize count, XsString const* src)
{
	XsArray_construct(thisPtr, &g_xsStringArrayDescriptor, count, src);
}
コード例 #4
0
/*! \copydoc XsArray_construct
	\note Specialization for XsStringArray
*/
void XsDeviceIdArray_construct(XsDeviceIdArray* thisPtr, XsSize count, XsDeviceId const* src)
{
	XsArray_construct(thisPtr, &g_xsDeviceIdArrayDescriptor, count, src);
}
コード例 #5
0
ファイル: xsmessagearray.c プロジェクト: 3660628/mrpt
/*! \copydoc XsArray_construct
	\note Specialization for XsStringArray
*/
void XsMessageArray_construct(XsMessageArray* thisPtr, XsSize count, XsMessage const* src)
{
	XsArray_construct(thisPtr, &g_xsMessageArrayDescriptor, count, src);
}
コード例 #6
0
ファイル: xsint64array.c プロジェクト: GYengera/mrpt
/*! \copydoc XsArray_construct
	\note Specialization for XsInt64Array
*/
void XsInt64Array_construct(XsInt64Array* thisPtr, XsSize count, int64_t const* src)
{
	XsArray_construct(thisPtr, &g_xsInt64ArrayDescriptor, count, src);
}
コード例 #7
0
ファイル: xsbytearray.c プロジェクト: Lab-RoCoCo/thin_drivers
/*! \copydoc XsArray_construct
	\note Specialization for XsByteArray
*/
void XsByteArray_construct(XsByteArray* thisPtr, XsSize count, uint8_t const* src)
{
	XsArray_construct(thisPtr, &g_xsByteArrayDescriptor, count, src);
}
コード例 #8
0
/*! \copydoc XsArray_construct
	\note Specialization for XsStringArray
*/
void XsOutputConfigurationArray_construct(XsOutputConfigurationArray* thisPtr, XsSize count, XsOutputConfiguration const* src)
{
	XsArray_construct(thisPtr, &g_xsOutputConfigurationArrayDescriptor, count, src);
}
コード例 #9
0
ファイル: xsstring.c プロジェクト: Insomnia-/mrpt
/*! \copydoc XsArray_construct
	\note Specialization for XsString
*/
void XsString_construct(XsString* thisPtr)
{
	XsArray_construct(thisPtr, &g_xsStringDescriptor, 0, 0);
}
コード例 #10
0
/*! \copydoc XsArray_construct
	\note Specialization for XsStringArray
*/
void XsPortInfoArray_construct(XsPortInfoArray* thisPtr, XsSize count, XsPortInfo const* src)
{
	XsArray_construct(thisPtr, &g_xsPortInfoArrayDescriptor, count, src);
}