OPCUA-Open62541

 view release on metacpan or  search on metacpan

Open62541-packed.xsh  view on Meta::CPAN

	hv = (HV*)SvRV(in);

	svp = hv_fetchs(hv, "VariableTypeAttributes_specifiedAttributes", 0);
	if (svp != NULL)
		unpack_UA_UInt32(&out->specifiedAttributes, *svp);

	svp = hv_fetchs(hv, "VariableTypeAttributes_displayName", 0);
	if (svp != NULL)
		unpack_UA_LocalizedText(&out->displayName, *svp);

	svp = hv_fetchs(hv, "VariableTypeAttributes_description", 0);
	if (svp != NULL)
		unpack_UA_LocalizedText(&out->description, *svp);

	svp = hv_fetchs(hv, "VariableTypeAttributes_writeMask", 0);
	if (svp != NULL)
		unpack_UA_UInt32(&out->writeMask, *svp);

	svp = hv_fetchs(hv, "VariableTypeAttributes_userWriteMask", 0);
	if (svp != NULL)
		unpack_UA_UInt32(&out->userWriteMask, *svp);

	svp = hv_fetchs(hv, "VariableTypeAttributes_value", 0);
	if (svp != NULL)
		unpack_UA_Variant(&out->value, *svp);

	svp = hv_fetchs(hv, "VariableTypeAttributes_dataType", 0);
	if (svp != NULL)
		unpack_UA_NodeId(&out->dataType, *svp);

	svp = hv_fetchs(hv, "VariableTypeAttributes_valueRank", 0);
	if (svp != NULL)
		unpack_UA_Int32(&out->valueRank, *svp);

	svp = hv_fetchs(hv, "VariableTypeAttributes_arrayDimensions", 0);
	if (svp != NULL) {
		if (!SvROK(*svp) || SvTYPE(SvRV(*svp)) != SVt_PVAV)
			CROAK("No ARRAY reference for VariableTypeAttributes_arrayDimensions");
		av = (AV*)SvRV(*svp);
		top = av_top_index(av);
		out->arrayDimensions = UA_Array_new(top + 1, &UA_TYPES[UA_TYPES_UINT32]);
		if (out->arrayDimensions == NULL)
			CROAKE("UA_Array_new");
		out->arrayDimensionsSize = top + 1;
		for (i = 0; i <= top; i++) {
			svp = av_fetch(av, i, 0);
			if (svp != NULL)
				unpack_UA_UInt32(&out->arrayDimensions[i], *svp);
		}
	}

	svp = hv_fetchs(hv, "VariableTypeAttributes_isAbstract", 0);
	if (svp != NULL)
		unpack_UA_Boolean(&out->isAbstract, *svp);

	return;
}
#endif

/* ReferenceTypeAttributes */
#ifdef UA_TYPES_REFERENCETYPEATTRIBUTES
static void pack_UA_ReferenceTypeAttributes(SV *out, const UA_ReferenceTypeAttributes *in);
static void unpack_UA_ReferenceTypeAttributes(UA_ReferenceTypeAttributes *out, SV *in);

static void
pack_UA_ReferenceTypeAttributes(SV *out, const UA_ReferenceTypeAttributes *in)
{
	dTHX;
	SV *sv;
	HV *hv;

	hv = newHV();
	sv_setsv(out, sv_2mortal(newRV_noinc((SV*)hv)));

	sv = newSV(0);
	hv_stores(hv, "ReferenceTypeAttributes_specifiedAttributes", sv);
	pack_UA_UInt32(sv, &in->specifiedAttributes);

	sv = newSV(0);
	hv_stores(hv, "ReferenceTypeAttributes_displayName", sv);
	pack_UA_LocalizedText(sv, &in->displayName);

	sv = newSV(0);
	hv_stores(hv, "ReferenceTypeAttributes_description", sv);
	pack_UA_LocalizedText(sv, &in->description);

	sv = newSV(0);
	hv_stores(hv, "ReferenceTypeAttributes_writeMask", sv);
	pack_UA_UInt32(sv, &in->writeMask);

	sv = newSV(0);
	hv_stores(hv, "ReferenceTypeAttributes_userWriteMask", sv);
	pack_UA_UInt32(sv, &in->userWriteMask);

	sv = newSV(0);
	hv_stores(hv, "ReferenceTypeAttributes_isAbstract", sv);
	pack_UA_Boolean(sv, &in->isAbstract);

	sv = newSV(0);
	hv_stores(hv, "ReferenceTypeAttributes_symmetric", sv);
	pack_UA_Boolean(sv, &in->symmetric);

	sv = newSV(0);
	hv_stores(hv, "ReferenceTypeAttributes_inverseName", sv);
	pack_UA_LocalizedText(sv, &in->inverseName);

	return;
}

static void
unpack_UA_ReferenceTypeAttributes(UA_ReferenceTypeAttributes *out, SV *in)
{
	dTHX;
	SV **svp;
	HV *hv;

	SvGETMAGIC(in);
	if (!SvROK(in) || SvTYPE(SvRV(in)) != SVt_PVHV)
		CROAK("Not a HASH reference");
	UA_ReferenceTypeAttributes_init(out);
	hv = (HV*)SvRV(in);



( run in 1.263 second using v1.01-cache-2.11-cpan-ad19def0cd9 )