RTEMS Logo

RTEMS 4.9.3 On-Line Library


Chains Nodes

PREV UP NEXT Bookshelf RTEMS Ada User's Guide

28.2.1: Nodes

A chain is made up from nodes that orginate from a chain control object. A node is of type rtems.chain_node. The node is designed to be part of a user data structure and a cast is used to move from the node address to the user data structure address. For example:

typedef struct foo
{
  rtems.chain_node node;
  int              bar;
} foo;

creates a type foo that can be placed on a chain. To get the foo structure from the list you perform the following:

foo* get_foo(rtems.chain_control* control)
{
  return (foo*) rtems.chain_get(control);
}

The node is placed at the start of the user's structure to allow the node address on the chain to be easly cast to the user's structure address.


PREV UP NEXT Bookshelf RTEMS Ada User's Guide

Copyright © 1988-2008 OAR Corporation