OpenFAM Reference Implementation

openfam::fam::fam_list_options

Get the list of names for pre-defined names in the FAM library.

Synopsis

const char **fam_list_options(void);

Description

This method can be used to retrieve the names of global variables used within OpenFAM or set using the options argument to fam_initialize(). The list is implementation specific.

Input Arguments

None.

Return Values

A null terminated list of names that can be used to retrieve option values.

Example

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fam/fam.h>
#include <fam/fam_exception.h>
using namespace openfam;
using namespace std;

int main(void) {
	fam *myFam = new fam();
	Fam_Options *fm = (Fam_Options*)malloc(sizeof(Fam_Options));
	memset((void *)fm, 0, sizeof(Fam_Options));
	
	// assume that no specific options are needed by the implementation
	try {
		myFam->fam_initialize("myApplication", fm);
		printf("FAM initialized\n");
	} catch (Fam_Exception& e) {
		printf("FAM Initialization failed: %s\n", e.fam_error_msg());
		myFam->fam_abort(-1); // abort the program
		return -1;
	}
	
	const char **optionName = myFam->fam_list_options();
	while(*optionName != NULL){     // while we have more names
		printf("%s\n", *optionName);    // print the name
		optionName++;
	}
	myFam->fam_finalize("myApplication");
	printf("FAM finalized\n");
}