-void Yaz_IR_Assoc::set_otherInformationString (
- Z_OtherInformation **otherInformation,
- int *oid, int categoryValue,
- const char *str)
-{
- Z_OtherInformationUnit *oi =
- set_otherInformation(otherInformation, oid, categoryValue);
- if (!oi)
- return;
- oi->information.characterInfo = odr_strdup (odr_encode(), str);
-}
-
-Z_OtherInformationUnit *Yaz_IR_Assoc::set_otherInformation (
- Z_OtherInformation **otherInformationP,
- int *oid, int categoryValue)
-{
- int i;
- Z_OtherInformation *otherInformation = *otherInformationP;
- if (!otherInformation)
- {
- otherInformation = *otherInformationP = (Z_OtherInformation *)
- odr_malloc (odr_encode(), sizeof(*otherInformation));
- otherInformation->num_elements = 0;
- otherInformation->list = (Z_OtherInformationUnit **)
- odr_malloc (odr_encode(), 8*sizeof(*otherInformation));
- for (i = 0; i<8; i++)
- otherInformation->list[i] = 0;
- }
- for (i = 0; i<otherInformation->num_elements; i++)
- {
- assert (otherInformation->list[i]);
- if (!oid)
- {
- if (!otherInformation->list[i]->category)
- return otherInformation->list[i];
- }
- else
- {
- if (otherInformation->list[i]->category &&
- categoryValue ==
- *otherInformation->list[i]->category->categoryValue &&
- !oid_oidcmp (oid, otherInformation->list[i]->category->
- categoryTypeId))
- return otherInformation->list[i];
- }
- }
- otherInformation->list[i] = (Z_OtherInformationUnit*)
- odr_malloc (odr_encode(), sizeof(Z_OtherInformationUnit));
- if (oid)
- {
- otherInformation->list[i]->category = (Z_InfoCategory*)
- odr_malloc (odr_encode(), sizeof(Z_InfoCategory));
- otherInformation->list[i]->category->categoryTypeId = (int*)
- odr_oiddup (odr_encode(), oid);
- otherInformation->list[i]->category->categoryValue = (int*)
- odr_malloc (odr_encode(), sizeof(int));
- *otherInformation->list[i]->category->categoryValue =
- categoryValue;
- }
- else
- otherInformation->list[i]->category = 0;
- otherInformation->list[i]->which = Z_OtherInfo_characterInfo;
- otherInformation->list[i]->information.characterInfo = 0;
-
- otherInformation->num_elements = i+1;
- return otherInformation->list[i];
-}
-