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()
command object_type *get(uint8_t position)
command result_t insert(object_type *obj)
command uint8_t max()
command uint8_t next(uint8_t n)
command uint8_t populated()
command result_t remove(object_type *obj)
command bool valid(uint8_t n)
Commands - Details
first
command uint8_t first()
- Returns:
-
the first not-NULL element in the pool, or max if the pool is empty
get
command object_type *get(uint8_t 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)
- Parameters:
-
obj
- the object to be inserted
- Returns:
-
SUCCESS if the object was inserted into the pool
max
command uint8_t max()
- Returns:
-
the number of entries in the pool
next
command uint8_t next(uint8_t n)
populated
command uint8_t populated()
- Returns:
-
the number of entries in the pool
remove
command result_t remove(object_type *obj)
- Parameters:
-
obj
- the object to be removed
- Returns:
-
SUCCESS if the object was removed the pool
valid
command bool valid(uint8_t n)