GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> RIM / V3-1-2 > rim / linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

RIM_map.c File Reference

Provides functionality concerned with creating and manipulating a RIM map. More...

#include <RIM_p.h>
#include <RIM/RIM_msgs.h>
#include <RIM_number.ic>
#include <RIM_AG_init_p.h>
#include <string.h>

Functions

static unsigned mapIndex (const RIM_map *map, RIM_type type, const RIM_addr *addr, unsigned *index)
 Convert the address into an index appropriate for this type of map as well as performing various checks on the input parameters.
size_t RIM_sizeofMap (void)
 Calculate the total size of a RIM_map object.
RIM_mapRIM_constructMap (void *buf)
 Initialise the supplied memory as a RIM_map object.
unsigned RIM_setBit (RIM_map *map, RIM_type type, const RIM_addr *addr)
 Set a bit in the map.
unsigned RIM_clearBit (RIM_map *map, RIM_type type, const RIM_addr *addr)
 Clear a bit in the map.
int RIM_countMap (const RIM_map *map, RIM_type type)
 Count the number of set bits in the map.
int RIM_checkBit (const RIM_map *map, RIM_type type, const RIM_addr *addr)
 Check a bit in the map.
void RIM_clearMap (RIM_map *map)
 Clear the map.


Detailed Description

Provides functionality concerned with creating and manipulating a RIM map.

Author:
James Swain & Owen Saxton
$Id: RIM_map.c,v 1.3 2011/03/27 06:53:19 saxton Exp $

Function Documentation

unsigned mapIndex ( const RIM_map map,
RIM_type  type,
const RIM_addr addr,
unsigned *  index 
) [static]

Convert the address into an index appropriate for this type of map as well as performing various checks on the input parameters.

Parameters:
map Pointer to a map structure
type Type of the map
addr Pointer to an address structure identifying the required bit
index Pointer to location to store the calculated index
Return values:
RIM_SUCCESS if everything goes well
RIM_TYPEUNKN if the type does not exist
RIM_MAPNONE if there is no sub-map corresponding to this type
RIM_ADDRBCST if the address contains a mixture of broadcast and singlecast addresses
RIM_ADDRRNGE if any component of the address is out of range
RIM_ADDRINDX if the final index exceeds the total number of bits in the map

References RIM_getIndex(), and RIM_number().

Referenced by RIM_checkBit(), RIM_clearBit(), and RIM_setBit().

int RIM_checkBit ( const RIM_map map,
RIM_type  type,
const RIM_addr addr 
)

Check a bit in the map.

Parameters:
map Structure being manipulated
type Identifies map to manipulate
addr bit to check
Return values:
0 if the bit is clear
1 if the bit is set

References checkBit(), and mapIndex().

unsigned RIM_clearBit ( RIM_map map,
RIM_type  type,
const RIM_addr addr 
)

Clear a bit in the map.

Parameters:
map Structure being manipulated
type Identifies map to manipulate
addr bit to clear
Return values:
RIM_SUCCESS if everything goes well
RIM_TYPEUNKN if the type does not exist
RIM_MAPNONE if there is no sub-map corresponding to this type
RIM_ADDRBCST if the address contains a mixture of broadcast and singlecast addresses
RIM_ADDRRNGE if any component of the address is out of range
RIM_ADDRINDX if the final index exceeds the total number of bits in the map

References clearBit(), and mapIndex().

void RIM_clearMap ( RIM_map map  ) 

Clear the map.

Parameters:
map Structure being manipulated

References clearMap().

Referenced by RIM_clear().

RIM_map* RIM_constructMap ( void *  buf  ) 

Initialise the supplied memory as a RIM_map object.

Parameters:
buf Block of memory, at least as large as RIM_sizeofMap, to initalise as a RIM_map object
Returns:
Pointer to an initialised RIM_map object

References sizeofMap().

Referenced by RIM_construct().

int RIM_countMap ( const RIM_map map,
RIM_type  type 
)

Count the number of set bits in the map.

Parameters:
map Structure being manipulated
type Identifies map to count
Returns:
Number of bits set in the map, or -1 for an illegal type

Referenced by RIM_export().

unsigned RIM_setBit ( RIM_map map,
RIM_type  type,
const RIM_addr addr 
)

Set a bit in the map.

Parameters:
map Structure being manipulated
type Identifies map to manipulate
addr bit to set
Return values:
RIM_SUCCESS if everything goes well
RIM_TYPEUNKN if the type does not exist
RIM_MAPNONE if there is no sub-map corresponding to this type
RIM_ADDRBCST if the address contains a mixture of broadcast and unicast addresses
RIM_ADDRRNGE if any component of the address is out of range
RIM_ADDRINDX if the final index exceeds the total number of bits in the map

References mapIndex(), and setBit().

size_t RIM_sizeofMap ( void   ) 

Calculate the total size of a RIM_map object.

Returns:
Amount of memory required to accomodate a RIM_map object

References sizeofMap().

Referenced by RIM_sizeof().


Generated on Fri Sep 30 18:27:32 2011 by  doxygen 1.5.8