RTEMS Logo

RTEMS 4.9.3 On-Line Library


Object Services Decomposing and Recomposing an Object Id

PREV UP NEXT Bookshelf RTEMS Ada User's Guide

27.3.1: Decomposing and Recomposing an Object Id

Services are provided to decompose an object Id into its subordinate components. The following services are used to do this:

The following C language example illustrates the decomposition of an Id and printing the values.

void printObjectId(rtems_id id)
{
  printf(
    "API=%d Class=%d Node=%d Index=%d\n",
    rtems_object_id_get_api(id),
    rtems_object_id_get_class(id),
    rtems_object_id_get_node(id),
    rtems_object_id_get_index(id)
  );
}

This prints the components of the Ids as integers.

It is also possible to construct an arbitrary Id using the rtems.build_id service. The following C language example illustrates how to construct the "next Id."

rtems_id nextObjectId(rtems_id id)
{
  return rtems_build_id(
    rtems_object_id_get_api(id),
    rtems_object_id_get_class(id),
    rtems_object_id_get_node(id),
    rtems_object_id_get_index(id) + 1
  );
}

Note that this Id may not be valid in this system or associated with an allocated object.


PREV UP NEXT Bookshelf RTEMS Ada User's Guide

Copyright © 1988-2008 OAR Corporation