segConfig.c File Reference

Functions used to read configuration files for SEGRec. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "segCommon.h"
#include "segStdLib.h"
#include "segConfig.h"

Functions

static char * allocString (char *cStr)
 Allocate memory space for the given string, and copy the string to the space.
static void setDefaultConfig (SEG_CONFIG *configData)
 Set default values to configuration parameters in structure segConfig.
void segFreeConfig (SEG_CONFIG *configData)
 Free memory space for a structure variable with configuration parameters.
int segReadConfig (SEG_CONFIG **configData, char *cFile)
 Read a configuration file of the given file name.


Detailed Description

Functions used to read configuration files for SEGRec.

Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Date:
01 Feb 2007, 26 Jun 2007 (documented)
Note:
A big change from SEGVit ver.3.x is that every configuration parameter is defined as a member of structure segConfig (SEG_CONFIG). Thereby one can add new parameters, without changing the interface of functions influenced.
Revision

Function Documentation

static char * allocString ( char *  cStr  )  [static]

Allocate memory space for the given string, and copy the string to the space.

Parameters:
[in] cStr String to be stored in the allocated memory
Return values:
NULL Memory allocation error
otherwise Pointer to the allocated memory space

void segFreeConfig ( SEG_CONFIG configData  ) 

Free memory space for a structure variable with configuration parameters.

Parameters:
[in] configData Structure variable containing configuration parameters
Returns:
No return value
Author:
Yoshinori Shiga @ CVSSP, University of Surrey

int segReadConfig ( SEG_CONFIG **  configData,
char *  cFile 
)

Read a configuration file of the given file name.

The function reads values of different parameters written in the configuration file.

Parameters:
[in,out] configData Structure variable containing configuration parameters
[in] cFile Name of the configuration file
Return values:
ERROR_ALLOC Memory allocation error
ERROR_FOPEN Opening the configuration file failed
RTN_ERROR Illegal configuration was found
otherwise Number of configuration parameters loaded
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function internally calls setDefaultConfig(), allocString() and logProb().
See also:
setDefaultConfig(), allocString() and logProb()

static void setDefaultConfig ( SEG_CONFIG configData  )  [static]

Set default values to configuration parameters in structure segConfig.

Parameters:
[in,out] configData Structure variable containing configuration parameters
Returns:
No return value


Generated on Sun Aug 5 02:40:40 2007 for SEGRec Version 1.0 by  doxygen 1.5.1