LMAP (RPGLE)

Map Implementation : Linked Map
Details ....

Copybooks  

LMAP_H
LMAP_INT_H
Linked Map : Internal Prototypes
CEEAPI_H
ILE CEE API Prototypes
LIBC_H
C-Prototypes for RPG
QSYSINC/QRPGLESRC,QUSEC
COMMON STRUCTURE FOR ERROR CODE PARAMETER

Procedures  

getMapEntry
Get entry by key
internal_swapexported
Swap entries
isLinkedMapImpl
Check for map implementation
lmap_abortIterationexported
Abort iteration
lmap_addexported
Add map entry
lmap_addAllexported
Add all entries
lmap_addBooleanexported
Add boolean
lmap_addDateexported
Add date
lmap_addDecimalexported
Add decimal
lmap_addDoubleexported
Add double
lmap_addFloatexported
Add float
lmap_addIntegerexported
Add integer
lmap_addLongexported
Add long
lmap_addShortexported
Add short
lmap_addStringexported
Add string
lmap_addTimeexported
Add time
lmap_addTimestampexported
Add timestamp
lmap_clearexported
Clear map
lmap_containsKeyexported
Contains key
lmap_containsValueexported
Contains value
lmap_createexported
Create map
lmap_disposeexported
Dispose map
lmap_getexported
Get value
lmap_getBooleanexported
Get boolean value
lmap_getDateexported
Get date value
lmap_getDecimalexported
Get decimal value
lmap_getDoubleexported
Get double value
lmap_getFloatexported
Get float value
lmap_getIntegerexported
Get integer value
lmap_getLongexported
Get long value
lmap_getShortexported
Get short value
lmap_getStringexported
Get string value
lmap_getTimeexported
Get time value
lmap_getTimestampexported
Get timestamp value
lmap_isEmptyexported
Is map empty
lmap_iterateexported
Get next entry
lmap_removeexported
Remove entry
lmap_sizeexported
Map size
sendEscapeMessage
Send Escape Message

Detailed Description  

This map implementation uses a linked list as a backend zu save the data and is a associative container where key value pairs can be stored.
Author:
Mihael Schmidt
Date:
01.06.2008
Links:
http://en.wikipedia.org/wiki/Associative_array

Procedure Documentation  

getMapEntry  

pointergetMapEntry(pointer, pointer, unsigned)
Returns the entry associated with the passed key.
Parameter:
pointer   constPointer to the map
pointer   constPointer to key
numeric (unsigned) (10)   constLength of key
Return value:
pointerPointer to the entry or null if the entry is not found

internal_swap  

voidinternal_swap(pointer, pointer, pointer)
Swaps the positions of the passed entries. The entries don't have to lay next to each other.
Parameter:
pointer   constMap pointer
pointer   constPointer to entry
pointer   constPointer to entry
Exported.

isLinkedMapImpl  

booleanisLinkedMapImpl(pointer)
Checks if the pointer points to a map implementation. The map implementation of this service program has an id in the first 20 bytes of the map header.

If the pointer does not point to a map implementation an escape message will be sent.
Parameter:
pointer   constPointer to the map
Return value:
boolean*on = is map implementation
*off = is no map implementation (escape message)
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_abortIteration  

voidlmap_abortIteration(pointer)
If the iteration through the list should be aborted early this procedure should be called.
Parameter:
pointer   constMap pointer
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_add  

voidlmap_add(pointer, pointer, unsigned, pointer, unsigned)
Adds an entry to the map. If the key already exists in the map the old value will be replaced by the new one.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
pointer   constPointer to the value
numeric (unsigned) (10)   constValue length (in byte)
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_addAll  

voidlmap_addAll(pointer, pointer)
Adds all entries from an existing map.

Parameter:
pointer   constPointer to destination map
pointer   constPointer to source map
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_addBoolean  

voidlmap_addBoolean(pointer, pointer, unsigned, boolean)
Adds an entry to the map with a boolean value. If the key already exists the old value will be replaced by the new one.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
boolean   constValue
Exported.
Author:
Mihael Schmidt
Date:
23.12.2009

lmap_addDate  

voidlmap_addDate(pointer, pointer, unsigned, date)
Adds an entry to the map with a date value. If the key already exists the old value will be replaced by the new one.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
date   constValue
Exported.
Author:
Mihael Schmidt
Date:
23.12.2009

lmap_addDecimal  

voidlmap_addDecimal(pointer, pointer, unsigned, packed)
Adds an entry to the map with a decimal value. If the key already exists the old value will be replaced by the new one.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
numeric (packed) (15,5)   constValue
Exported.
Author:
Mihael Schmidt
Date:
23.12.2009

lmap_addDouble  

voidlmap_addDouble(pointer, pointer, unsigned, float)
Adds an entry to the map with a double value. If the key already exists the old value will be replaced by the new one.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
numeric (float) (8,)   constValue
Exported.
Author:
Mihael Schmidt
Date:
23.12.2009

lmap_addFloat  

voidlmap_addFloat(pointer, pointer, unsigned, float)
Adds an entry to the map with a float value. If the key already exists the old value will be replaced by the new one.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
numeric (float) (4,)   constValue
Exported.
Author:
Mihael Schmidt
Date:
23.12.2009

lmap_addInteger  

voidlmap_addInteger(pointer, pointer, unsigned, integer)
Adds an entry to the map with an integer value. If the key already exists the old value will be replaced by the new one.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
numeric (integer) (10)   constValue
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_addLong  

voidlmap_addLong(pointer, pointer, unsigned, integer)
Adds an entry to the map with a long value. If the key already exists the old value will be replaced by the new one.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
numeric (integer) (20)   constValue
Exported.
Author:
Mihael Schmidt
Date:
23.12.2009

lmap_addShort  

voidlmap_addShort(pointer, pointer, unsigned, integer)
Adds an entry to the map with a short value. If the key already exists the old value will be replaced by the new one.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
numeric (integer) (5)   constValue
Exported.
Author:
Mihael Schmidt
Date:
27.12.2009

lmap_addString  

voidlmap_addString(pointer, pointer, unsigned, character)
Adds an entry to the map with a string value. If the key already exists the old value will be replaced by the new one.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
character (65535)   const   varyingValue
Exported.
Author:
Mihael Schmidt
Date:
26.12.2009

lmap_addTime  

voidlmap_addTime(pointer, pointer, unsigned, time)
Adds an entry to the map with a time value. If the key already exists the old value will be replaced by the new one.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
time   constValue
Exported.
Author:
Mihael Schmidt
Date:
23.12.2009

lmap_addTimestamp  

voidlmap_addTimestamp(pointer, pointer, unsigned, timestamp)
Adds an entry to the map with a timestamp value. If the key already exists the old value will be replaced by the new one.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
timestamp   constValue
Exported.
Author:
Mihael Schmidt
Date:
23.12.2009

lmap_clear  

voidlmap_clear(pointer)
Removes all entries from the map.
Parameter:
pointer   constMap pointer
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_containsKey  

booleanlmap_containsKey(pointer, pointer, unsigned)
Checks if the key exists in the map.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
Return value:
boolean*on = map contains key
*off = map does not contain key
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_containsValue  

booleanlmap_containsValue(pointer, pointer, unsigned)
Checks if the map contains the value.
Parameter:
pointer   constMap pointer
pointer   constPointer to the value
numeric (unsigned) (10)   constValue length (in byte)
Return value:
boolean*on = map contains value
*off = map does not contain value
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_create  

pointerlmap_create()
Creates a map. A header is generated for the map and the pointer to the map returned.

A map must be disposed via the procedure dispose to free all allocated memory.
Return value:
pointerMap pointer
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_dispose  

voidlmap_dispose(pointer)
The memory for the whole map is released (deallocated). The map pointer is set to *null;
Parameter:
pointerMap pointer
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_get  

pointerlmap_get(pointer, pointer, unsigned)
Returns the value to the passed key.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in Byte)
Return value:
pointerPointer to the null-terminated value or *null if the key does not exist in the map
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_getBoolean  

booleanlmap_getBoolean(pointer, pointer, unsigned)
Returns the boolean value to the passed key.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in Byte)
Return value:
booleanValue
Exported.
Author:
Mihael Schmidt
Date:
27.12.2009

lmap_getDate  

datelmap_getDate(pointer, pointer, unsigned)
Returns the date value to the passed key.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in Byte)
Return value:
dateValue
Exported.
Author:
Mihael Schmidt
Date:
27.12.2009

lmap_getDecimal  

packedlmap_getDecimal(pointer, pointer, unsigned)
Returns the decimal value to the passed key.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in Byte)
Return value:
numeric (packed) (15,5)Value
Exported.
Author:
Mihael Schmidt
Date:
27.12.2009

lmap_getDouble  

floatlmap_getDouble(pointer, pointer, unsigned)
Returns the double value to the passed key.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in Byte)
Return value:
numeric (float) (8,)Value
Exported.
Author:
Mihael Schmidt
Date:
27.12.2009

lmap_getFloat  

floatlmap_getFloat(pointer, pointer, unsigned)
Returns the float value to the passed key.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in Byte)
Return value:
numeric (float) (4,)Value
Exported.
Author:
Mihael Schmidt
Date:
27.12.2009

lmap_getInteger  

integerlmap_getInteger(pointer, pointer, unsigned)
Returns the integer value to the passed key.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in Byte)
Return value:
numeric (integer) (10)Value
Exported.
Author:
Mihael Schmidt
Date:
27.12.2009

lmap_getLong  

integerlmap_getLong(pointer, pointer, unsigned)
Returns the long value to the passed key.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in Byte)
Return value:
numeric (integer) (20)Value
Exported.
Author:
Mihael Schmidt
Date:
27.12.2009

lmap_getShort  

integerlmap_getShort(pointer, pointer, unsigned)
Returns the short value to the passed key.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in Byte)
Return value:
numeric (integer) (5)Value
Exported.
Author:
Mihael Schmidt
Date:
27.12.2009

lmap_getString  

characterlmap_getString(pointer, pointer, unsigned)
Returns the string value to the passed key.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in Byte)
Return value:
character (65535)Value
Exported.
Author:
Mihael Schmidt
Date:
27.12.2009

lmap_getTime  

timelmap_getTime(pointer, pointer, unsigned)
Returns the time value to the passed key.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in Byte)
Return value:
timeValue
Exported.
Author:
Mihael Schmidt
Date:
27.12.2009

lmap_getTimestamp  

timestamplmap_getTimestamp(pointer, pointer, unsigned)
Returns the timestamp value to the passed key.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in Byte)
Return value:
timestampValue
Exported.
Author:
Mihael Schmidt
Date:
27.12.2009

lmap_isEmpty  

booleanlmap_isEmpty(pointer)
Checks if the map is empty.
Parameter:
pointer   constMap pointer
Return value:
boolean*on = map is empty
*off = map is not empty (has at least one entry)
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_iterate  

pointerlmap_iterate(pointer)
Iterates through the map and returns the key to the next entry. If the iterator is at the end of the list this method will return null. The iteration can be aborted early with the procedure lmap_abortIteration.
Parameter:
pointer   constMap pointer
Return value:
pointerPointer to the map entry (key) or *null if there are no more entries
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_remove  

voidlmap_remove(pointer, pointer, unsigned)
Removes an entry from the map. No action will be taken if the key does not exist in the map.
Parameter:
pointer   constMap pointer
pointer   constPointer to the key
numeric (unsigned) (10)   constKey length (in byte)
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

lmap_size  

integerlmap_size(pointer)
Returns the number of entries in the map.
Parameter:
pointer   constMap pointer
Return value:
numeric (integer) (10)Number of entries in the map
Exported.
Author:
Mihael Schmidt
Date:
01.06.2008

sendEscapeMessage  

voidsendEscapeMessage(integer)
Sends an escape message with the specified id.
Parameter:
numeric (integer) (10)   constMessage id
Author:
Mihael Schmidt
Date:
23.03.2008