Interface: moteiv.tos.lib.util.pool.ObjectPool

interface ObjectPool<typedef object_type>

A generic interface for storing objects into a pool structure.

Author:
Joe Polastre, Moteiv Corporation <info@moteiv.com>

Commands
command uint8_t first() Get the first not-NULL element in the pool, or ObjectPool.max otherwise.
command object_type *get(uint8_t position) Get the entry at a certain position
command result_t insert(object_type *obj) Insert a message into the pool
command uint8_t max() Get the maximum number of possible entries in the pool
command uint8_t next(uint8_t n)
command uint8_t populated() Get the maximum number of populated entries in the pool
command result_t remove(object_type *obj) Remove a message from the pool
command bool valid(uint8_t n)

Commands - Details

first

command uint8_t first()

Get the first not-NULL element in the pool, or ObjectPool.max otherwise.

Returns:
the first not-NULL element in the pool, or max if the pool is empty

get

command object_type *get(uint8_t position)

Get the entry at a certain position

Parameters:
position - the position of interest
Returns:
a pointer to the object at the specified position

insert

command result_t insert(object_type *obj)

Insert a message into the pool

Parameters:
obj - the object to be inserted
Returns:
SUCCESS if the object was inserted into the pool

max

command uint8_t max()

Get the maximum number of possible entries in the pool

Returns:
the number of entries in the pool

next

command uint8_t next(uint8_t n)

populated

command uint8_t populated()

Get the maximum number of populated entries in the pool

Returns:
the number of entries in the pool

remove

command result_t remove(object_type *obj)

Remove a message from the pool

Parameters:
obj - the object to be removed
Returns:
SUCCESS if the object was removed the pool

valid

command bool valid(uint8_t n)