ZOO-Project: service.c File Reference
ZOO-Project
service.c File Reference
#include "service.h"
#include <ctime>
#include <chrono>

Functions

void _dumpMap (map *pmMap)
 Dump a map on stderr. More...
 
void dumpMap (map *pmMap)
 Dump a map on stderr, see _dumpMap() More...
 
void dumpMapToFile (map *pmMap, FILE *pfFile)
 Dump a map to a file. More...
 
void dumpMaps (maps *pmMap)
 Dump a maps on stderr, see dumpMap(). More...
 
void _dumpMapsToFile (maps *pmsMaps, FILE *psFile, int iLimit)
 Dump a maps to a file, see dumpMapToFile(). More...
 
void dumpMapsToFile (maps *pmsMaps, char *pcaFilePath, int iLimit)
 Dump a maps to a file, see _dumpMapsToFile(). More...
 
iotypecreateIoType ()
 Create a new iotype*. More...
 
mapcreateMap (const char *pccName, const char *pccValue)
 Create a new map. More...
 
mapscreateMaps (const char *pccName)
 Create a new maps with the given name. More...
 
int count (map *pmMap)
 Count number of map in a map. More...
 
int maps_length (maps *pmMap)
 Count number of maps in a maps. More...
 
bool hasKey (map *pmMap, const char *pccKey)
 Verify if a key exist in a map. More...
 
mapsgetMaps (maps *pmsMaps, const char *pccKey)
 Access a specific maps. More...
 
mapgetMap (map *pmMap, const char *pccKey)
 Access a specific map. More...
 
mapgetLastMap (map *pmMap)
 Access the last map. More...
 
mapgetMapFromMaps (maps *pmMap, const char *pccKey, const char *pccSubkey)
 Access a specific map from a maps. More...
 
void freeMap (map **pmMap)
 Free allocated memory of a map. More...
 
void freeMaps (maps **pmMap)
 Free allocated memory of a maps. More...
 
bool hasElement (elements *peElem, const char *pccKey)
 Verify if an elements contains a name equal to the given key. More...
 
elementsgetElements (elements *peElem, const char *pccKey)
 Access a specific elements named key. More...
 
void freeIOType (iotype **piotIO)
 Free allocated memory of an iotype. More...
 
void freeElements (elements **peElem)
 Free allocated memory of an elements. More...
 
servicecreateService ()
 Allocate memory for a service. More...
 
void freeService (service **psService)
 Free allocated memory of a service. More...
 
void addToMap (map *pMap, const char *pccName, const char *pccValue)
 Add key value pair to an existing map. More...
 
void addIntToMap (map *pMap, const char *pccName, const int iValue)
 Add a key and an integer value to an existing map. More...
 
mapaddToMapWithSize (map *pMap, const char *pccName, const char *pccValue, int iSize)
 Add a key and a binary value to an existing map. More...
 
void addMapToMap (map **pmMapOut, map *pmMapIn)
 Add a map at the end of another map. More...
 
void addMapToIoType (iotype **piotType, map *pmMap)
 Add a map to iotype. More...
 
mapgetMapOrFill (map **ppmMap, const char *pccKey, const char *pccValue)
 Access a specific map or set its value. More...
 
bool contains (map *pmMap, map *pmSearch)
 Verify if a map is contained in another map. More...
 
iotypegetIoTypeFromElement (elements *peElem, char *pcName, map *pcValues)
 Access a specific iotype from an elements. More...
 
void loadMapBinary (map **ppmOut, map *pmIn, int iPos)
 Load binary values from a map (in) and add them to another map (out) More...
 
void loadMapBinaries (map **ppmOut, map *pmIn)
 Load binary values from a map (in) and add them to another map (out). More...
 
mapsdupMaps (maps **ppmsOut)
 Duplicate a Maps. More...
 
void addMapsToMaps (maps **ppmsOut, maps *pmIn)
 Add a maps at the end of another maps. More...
 
mapgetMapArray (map *pmMap, const char *pccKey, int iIndex)
 Access a specific map array element. More...
 
void setMapArray (map *pmMap, const char *pccKey, int iIndex, const char *pccValue)
 Add a key value in a MapArray for a specific index. More...
 
void addIntToMapArray (map *pmMap, const char *pccName, int iIndex, const int icValue)
 Add a key and an integer value to an existing map array. More...
 
mapgetMapType (map *pmMap)
 Access the map "type". More...
 
int addMapsArrayToMaps (maps **pmsOut, maps *pmsIn, char *pcType)
 Add a Maps containing a MapArray to a Maps. More...
 
void setMapInMaps (maps *pmsMaps, const char *pccKey, const char *pccSubkey, const char *pccValue)
 Set a key value pair to a map contained in a Maps. More...
 
elementscreateEmptyElements ()
 Create an empty elements. More...
 
elementscreateElements (const char *pcName)
 Create a named elements. More...
 
void setElementsName (elements **ppeElem, char *pcName)
 Set the name of an elements. More...
 
void dumpElements (elements *peElem)
 Dump an elements on stderr. More...
 
void dumpElementsAsYAML (elements *peElem, int iLevel)
 Dump an elements on stderr using the YAML syntaxe. More...
 
elementsdupElements (elements *peElem)
 Duplicate an elements. More...
 
void addToElements (elements **ppeElem, elements *peELem)
 Add an elements to another elements. More...
 
void setServiceName (service **ppsServ, char *pcName)
 Set the name of a service. More...
 
void dumpService (service *psServ)
 Dump a service on stderr. More...
 
void dumpServiceAsYAML (service *psServ)
 Dump a service on stderr using the YAML syntaxe. More...
 
servicedupService (service *psServ)
 Duplicate a service. More...
 
void dumpRegistry (registry *prReg)
 Print the registry on stderr. More...
 
bool addServiceToRegistry (registry **prReg, char *pcName, service *psContent)
 Add a service to the registry. More...
 
void freeRegistry (registry **prReg)
 Free memory allocated for the registry. More...
 
servicegetServiceFromRegistry (registry *prReg, char *pcLevel, char *pcName)
 Access a service in the registry. More...
 
void inheritMap (map **ppmOut, map *pmIn)
 Apply inheritance to an out map from a reference in map. More...
 
void inheritIOType (iotype **ppiotOut, iotype *piotIn)
 Apply inheritance to an out iotype from a reference in iotype. More...
 
void inheritElements (elements **ppeOut, elements *peIn)
 Apply inheritance to an out elements from a reference in elements. More...
 
void inheritance (registry *prReg, service **psServ)
 Apply inheritance to a service based on a registry. More...
 
void mapsToCharXXX (maps *pmsMap, char ***pppcValues)
 Convert a maps to a char*** (only used for Fortran support) More...
 
void charxxxToMaps (char ***pppcValues, maps **ppmsMaps)
 Convert a char*** to a maps (only used for Fortran support) More...
 
bool nonempty (map *pmMap)
 Verify that a map has a value. More...
 
bool hasvalue (maps *pmsSource, const char *pccNode, const char *pccKey, map **ppmKvp)
 Verify that a particular map value exists in a maps data structure, and obtain that value. More...
 
void setErrorMessage (maps *&pmsaConf, const char *pccService, WPSException weExc, const char *pccMessage)
 
void logMessage (const char *pccSource, const char *pccFunction, int iLne, const char *pccFile, const char *pccMessage)
 Print debug message. More...
 
char * allocateMapValue (map *pmNode, size_t sNumBytes)
 

Function Documentation

void _dumpMap ( map pmMap)

Dump a map on stderr.

Parameters
pmMapthe map to dump
void _dumpMapsToFile ( maps pmsMaps,
FILE *  psFile,
int  iLimit 
)

Dump a maps to a file, see dumpMapToFile().

Parameters
pmsMapsthe map to dump
psFilethe the file pointer to store the map
iLimitthe number of maps to print (0 for no limit)
void addIntToMap ( map pMap,
const char *  pccName,
const int  iValue 
)

Add a key and an integer value to an existing map.

Parameters
pMapthe map to add the KVP
pccNamethe key to add
iValuethe corresponding value to add
void addIntToMapArray ( map pmMap,
const char *  pccName,
int  iIndex,
const int  icValue 
)

Add a key and an integer value to an existing map array.

Parameters
pmMapthe map to add the KVP
pccNamethe key to add
iIndexthe index of the MapArray
icValuethe corresponding value to add
int addMapsArrayToMaps ( maps **  pmsOut,
maps pmsIn,
char *  pcType 
)

Add a Maps containing a MapArray to a Maps.

See also
getMapType
Parameters
pmsOutthe maps
pmsInthe maps
pcTypethe map "type"
Returns
void addMapsToMaps ( maps **  ppmsOut,
maps pmIn 
)

Add a maps at the end of another maps.

See also
addMapToMap, dupMaps, getMaps
Parameters
ppmsOutthe maps to add mi
pmInthe maps to add to mo
void addMapToIoType ( iotype **  piotType,
map pmMap 
)

Add a map to iotype.

Parameters
piotTypethe iotype to add the map
pmMapthe map to add to io
void addMapToMap ( map **  pmMapOut,
map pmMapIn 
)

Add a map at the end of another map.

Parameters
pmMapOutthe map to add pmMapIn to
pmMapInthe map to add to pmMapOut
bool addServiceToRegistry ( registry **  prReg,
char *  pcName,
service psContent 
)

Add a service to the registry.

Parameters
prRegthe resgitry to add the service
pcNamethe registry name to update
psContentthe service to add
void addToElements ( elements **  ppeElem,
elements peELem 
)

Add an elements to another elements.

See also
dupElements
Parameters
ppeElemthe elements to add the e
peELemthe elements to be added to m
void addToMap ( map pMap,
const char *  pccName,
const char *  pccValue 
)

Add key value pair to an existing map.

Parameters
pMapthe map to add the KVP
pccNamethe key to add
pccValuethe corresponding value to add
map* addToMapWithSize ( map pMap,
const char *  pccName,
const char *  pccValue,
int  iSize 
)

Add a key and a binary value to an existing map.

Parameters
pMapthe map to add the KVP
pccNamethe key to add
pccValuethe corresponding value to add
iSizethe size of the given value
Returns
a pointer to the updated map m
char* allocateMapValue ( map pmNode,
size_t  sNumBytes 
)
void charxxxToMaps ( char ***  pppcValues,
maps **  ppmsMaps 
)

Convert a char*** to a maps (only used for Fortran support)

Parameters
pppcValuesthe array to convert
ppmsMapsthe resulting maps
bool contains ( map pmMap,
map pmSearch 
)

Verify if a map is contained in another map.

Parameters
pmMapthe map to search for i
pmSearchthe map to search in m
Returns
true if i was found in m, false in other case
int count ( map pmMap)

Count number of map in a map.

Parameters
pmMapthe map to count
Returns
number of map in a map
elements* createElements ( const char *  pcName)

Create a named elements.

Parameters
pcNamethe elements name
Returns
a pointer to the allocated elements
elements* createEmptyElements ( )

Create an empty elements.

Returns
a pointer to the allocated elements
iotype* createIoType ( )

Create a new iotype*.

Returns
a pointer to the allocated iotype
map* createMap ( const char *  pccName,
const char *  pccValue 
)

Create a new map.

Parameters
pccNamethe key to add to the map
pccValuethe corresponding value to add to the map
Returns
a pointer to the allocated map
maps* createMaps ( const char *  pccName)

Create a new maps with the given name.

Parameters
pccNameof the maps
Returns
the allocated map
service* createService ( )

Allocate memory for a service.

Require to call free after calling this function.

Returns
the service
void dumpElements ( elements peElem)

Dump an elements on stderr.

Parameters
peElemthe elements to dump
void dumpElementsAsYAML ( elements peElem,
int  iLevel 
)

Dump an elements on stderr using the YAML syntaxe.

Parameters
peElemthe elements to dump
iLevelthe current level
void dumpMap ( map pmMap)

Dump a map on stderr, see _dumpMap()

Parameters
pmMapthe map to dump
void dumpMaps ( maps pmMap)

Dump a maps on stderr, see dumpMap().

Parameters
pmMapthe map to dump
void dumpMapsToFile ( maps pmsMaps,
char *  pcaFilePath,
int  iLimit 
)

Dump a maps to a file, see _dumpMapsToFile().

Parameters
pmsMapsthe map to dump
pcaFilePaththe the file pointer to store the map
iLimitthe number of maps to print (0 for no limit)
void dumpMapToFile ( map pmMap,
FILE *  pfFile 
)

Dump a map to a file.

Parameters
pmMapthe map to dump to file
pfFilethe file pointer to store the map
void dumpRegistry ( registry prReg)

Print the registry on stderr.

Parameters
prRegthe registry
void dumpService ( service psServ)

Dump a service on stderr.

Parameters
psServthe service to dump
void dumpServiceAsYAML ( service psServ)

Dump a service on stderr using the YAML syntaxe.

Parameters
psServthe service to dump
elements* dupElements ( elements peElem)

Duplicate an elements.

Parameters
peElemthe elements to clone
Returns
the allocated elements containing a copy of the elements e
maps* dupMaps ( maps **  ppmsOut)

Duplicate a Maps.

Parameters
ppmsOutthe maps to clone
Returns
the allocated maps containing a copy of the mo maps
service* dupService ( service psServ)

Duplicate a service.

Parameters
psServthe service to clone
Returns
the allocated service containing a copy of the serfvice s
void freeElements ( elements **  peElem)

Free allocated memory of an elements.

Require to call free on e after calling this function.

Parameters
peElemthe iotype to free
void freeIOType ( iotype **  piotIO)

Free allocated memory of an iotype.

Require to call free on i after calling this function.

Parameters
piotIOthe iotype to free
void freeMap ( map **  pmMap)

Free allocated memory of a map.

Require to call free on mo after calling this function.

Parameters
pmMapthe map to free
void freeMaps ( maps **  pmMap)

Free allocated memory of a maps.

Require to call free on mo after calling this function.

Parameters
pmMapthe maps to free
void freeRegistry ( registry **  prReg)

Free memory allocated for the registry.

Parameters
prRegthe registry
void freeService ( service **  psService)

Free allocated memory of a service.

Require to be invoked for every createService call.

Parameters
psServicethe service to free
elements* getElements ( elements peElem,
const char *  pccKey 
)

Access a specific elements named key.

Parameters
peElemthe elements to search
pccKeythe elements name to search
Returns
a pointer to the specific element if found, NULL in other case.
iotype* getIoTypeFromElement ( elements peElem,
char *  pcName,
map pcValues 
)

Access a specific iotype from an elements.

Parameters
peElemthe elements to search for the name
pcNamethe name to search in the elements e
pcValuesthe map to verify it was contained in the defaults or supported content of the elements e
Returns
a pointer on the iotype found or NULL if not found
map* getLastMap ( map pmMap)

Access the last map.

Parameters
pmMapthe map to search for the lastest map
Returns
a pointer on the lastest map found or NULL if not found
map* getMap ( map pmMap,
const char *  pccKey 
)

Access a specific map.

Parameters
pmMapthe map to search for the key
pccKeythe key to search in the map
Returns
a pointer on the map found or NULL if not found
map* getMapArray ( map pmMap,
const char *  pccKey,
int  iIndex 
)

Access a specific map array element.

Parameters
pmMapthe map to search for the key
pccKeythe key to search in the map
iIndexof the MapArray
Returns
a pointer on the map found or NULL if not found
map* getMapFromMaps ( maps pmMap,
const char *  pccKey,
const char *  pccSubkey 
)

Access a specific map from a maps.

Parameters
pmMapthe maps to search for the key
pccKeythe key to search in the maps
pccSubkeythe key to search in the map (found for the key, if any)
Returns
a pointer on the map found or NULL if not found
map* getMapOrFill ( map **  ppmMap,
const char *  pccKey,
const char *  pccValue 
)

Access a specific map or set its value.

Parameters
ppmMapthe map to search for the key
pccKeythe key to search/add in the map
pccValuethe value to add if the key does not exist
Returns
a pointer on the map found or NULL if not found
maps* getMaps ( maps pmsMaps,
const char *  pccKey 
)

Access a specific maps.

Parameters
pmMapthe maps to search for the key
pccKeythe key to search in the maps
Returns
a pointer on the maps found or NULL if not found
map* getMapType ( map pmMap)

Access the map "type".

Parameters
pmMapthe map
Returns
a pointer on the map for mimeType/dataType/CRS if found, NULL in other case
service* getServiceFromRegistry ( registry prReg,
char *  pcLevel,
char *  pcName 
)

Access a service in the registry.

Parameters
prRegthe registry
pcLevelthe regitry to search ("concept", "generic" or "implementation")
pcNamethe service name
Returns
the service pointer if a corresponding service was found or NULL
bool hasElement ( elements peElem,
const char *  pccKey 
)

Verify if an elements contains a name equal to the given key.

Parameters
peElemthe elements to search for the key
pccKeythe elements name to search
Returns
true if the elements contains the name, false in other cases.
bool hasKey ( map pmMap,
const char *  pccKey 
)

Verify if a key exist in a map.

Parameters
pmMapthe map to search for the key
pccKeythe key to search in the map
Returns
true if the key wwas found, false in other case
bool hasvalue ( maps pmsSource,
const char *  pccNode,
const char *  pccKey,
map **  ppmKvp 
)

Verify that a particular map value exists in a maps data structure, and obtain that value.

Parameters
pmsSourcepointer to maps structure
pccNodename of maps node to search
pccKeyname of map node to find
ppmKvpaddress to the map* if it exists, otherwise NULL
Returns
true if map has a value or false if value is missing/NULL
Note
The map assigned to kvp is owned by the source maps
void inheritance ( registry prReg,
service **  psServ 
)

Apply inheritance to a service based on a registry.

Parameters
prRegthe registry storing profiles hierarchy
psServthe service to update depending on its inheritance
void inheritElements ( elements **  ppeOut,
elements peIn 
)

Apply inheritance to an out elements from a reference in elements.

Parameters
ppeOutthe elements to update
peInthe reference elements (containing inherited properties)
void inheritIOType ( iotype **  ppiotOut,
iotype piotIn 
)

Apply inheritance to an out iotype from a reference in iotype.

Parameters
ppiotOutthe iotype to update
piotInthe reference iotype (containing inherited properties)
void inheritMap ( map **  ppmOut,
map pmIn 
)

Apply inheritance to an out map from a reference in map.

Parameters
ppmOutthe map to update
pmInthe reference map (containing inherited properties)
void loadMapBinaries ( map **  ppmOut,
map pmIn 
)

Load binary values from a map (in) and add them to another map (out).

This function will take care of MapArray.

See also
loadMapBinary
Parameters
ppmOutthe map to add binaries values
pmInthe map containing the binary values to add ti out
void loadMapBinary ( map **  ppmOut,
map pmIn,
int  iPos 
)

Load binary values from a map (in) and add them to another map (out)

Parameters
pmOutthe map to add binaries values
pmInthe map containing the binary values to add ti out
iPosindex of the binary in an array (in case of "MapArray")
void logMessage ( const char *  pccSource,
const char *  pccFunction,
int  iLne,
const char *  pccFile,
const char *  pccMessage 
)

Print debug message.

Parameters
pccSourcethe file invoking the function
pccFunctionthe function calling for logMessage
iLinethe line number
pccFilethe file to log informations
pccMessagethe message to be print
int maps_length ( maps pmMap)

Count number of maps in a maps.

Parameters
pmMapthe maps to count
Returns
number of maps in a maps
void mapsToCharXXX ( maps pmsMap,
char ***  pppcValues 
)

Convert a maps to a char*** (only used for Fortran support)

Parameters
pmsMapthe maps to convert
pppcValuesthe resulting array
bool nonempty ( map pmMap)

Verify that a map has a value.

Parameters
pmMappointer to map that should be checked
Returns
true if map has a value or false if value is missing/empty/NULL
void setElementsName ( elements **  ppeElem,
char *  pcName 
)

Set the name of an elements.

Parameters
peElemthe elements to modify
pcNamethe elements name
Returns
a pointer to the allocated elements
void setErrorMessage ( maps *&  pmsaConf,
const char *  pccService,
WPSException  weExc,
const char *  pccMessage 
)
void setMapArray ( map pmMap,
const char *  pccKey,
int  iIndex,
const char *  pccValue 
)

Add a key value in a MapArray for a specific index.

Parameters
pmMapthe map to search for the key
pccKeythe key to search in the map
iIndexthe index of the MapArray
pccValuethe value to set in the MapArray
Returns
a pointer on the map found or NULL if not found
void setMapInMaps ( maps pmsMaps,
const char *  pccKey,
const char *  pccSubkey,
const char *  pccValue 
)

Set a key value pair to a map contained in a Maps.

Parameters
pmsMapsthe maps
pccKeythe maps name
pccSubkeythe map name included in the maps corresponding to key
pccValuethe corresponding value to add in the map
void setServiceName ( service **  ppsServ,
char *  pcName 
)

Set the name of a service.

Parameters
ppsServthe service
pcNamethe service name

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png