Motr  M0
m0_vec_cursor Struct Reference

#include <vec.h>

Collaboration diagram for m0_vec_cursor:
Collaboration graph

Data Fields

const struct m0_vecvc_vec
 
uint32_t vc_seg
 
m0_bcount_t vc_offset
 

Detailed Description

Position within a vector.

m0_vec_cursor is a cursor associated with a m0_vec instance. A cursor can be moved in the forward direction.

A cursor can be in one of the two exclusive states:

  • it is positioned within one of the vector segments. In this state
cur->vc_seg < cur->vc_vec->v_nr &&
cur->vc_offset < cur->vc_vec->v_count[cur->vc_seg]

invariant is maintained. This is called a "normal" state.

  • or a cursor is in an "end of the vector" state. In this state
cur->vc_seg == cur->vc_vec->v_nr && cur->vc_offset == 0

Note that a cursor over an empty vector (one with vec::v_nr == 0) is always in the end of the vector state.

Also note, that according to the normal state invariant, a cursor cannot be positioned in an empty segment (one with zero count). Empty segments are skipped over by all cursor manipulating functions, including constructor.

Definition at line 91 of file vec.h.

Field Documentation

◆ vc_offset

m0_bcount_t vc_offset

Offset within the segment that the cursor is positioned at.

Definition at line 96 of file vec.h.

◆ vc_seg

uint32_t vc_seg

Segment that the cursor is currently in.

Definition at line 94 of file vec.h.

◆ vc_vec

const struct m0_vec* vc_vec

Definition at line 92 of file vec.h.


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