Asterisk.org: Developer Documentation (28 Oct 2009)

Wed Oct 28 15:49:25 2009

## Asterisk developer's documentation

# ao2_iterator Struct Reference

`#include <astobj2.h>`

Collaboration diagram for ao2_iterator:

[legend]

## Data Fields

int | bucket
struct ao2_container * | c
unsigned int | c_version
int | flags
void * | obj
unsigned int | version

## Detailed Description

You are not supposed to know the internals of an iterator! We would like the iterator to be opaque, unfortunately its size needs to be known if we want to store it around without too much trouble. Anyways... The iterator has a pointer to the container, and a flags field specifying various things e.g. whether the container should be locked or not while navigating on it. The iterator "points" to the current object, which is identified by three values:

- a bucket number;
- the object_id, which is also the container version number when the object was inserted. This identifies the object univoquely, however reaching the desired object requires scanning a list.
- a pointer, and a container version when we saved the pointer. If the container has not changed its version number, then we can safely follow the pointer to reach the object in constant time. Details are in the implementation of ao2_iterator_next() A freshly-initialized iterator has bucket=0, version = 0.

Definition at line 533 of file astobj2.h.

## Field Documentation

int bucket

current bucket

Definition at line 540 of file astobj2.h.

Referenced by ao2_iterator_next().

struct ao2_container* c`[read]`

the container

Definition at line 535 of file astobj2.h.

Referenced by ao2_iterator_init(), and ao2_iterator_next().

unsigned int c_version

container version

Definition at line 542 of file astobj2.h.

Referenced by ao2_iterator_next().

int flags

operation flags

Definition at line 537 of file astobj2.h.

Referenced by ao2_iterator_init(), and ao2_iterator_next().

void* obj

pointer to the current object

Definition at line 544 of file astobj2.h.

Referenced by ao2_iterator_next().

unsigned int version

container version when the object was created

Definition at line 546 of file astobj2.h.

Referenced by ao2_iterator_next().

The documentation for this struct was generated from the following file:

- astobj2.h