// configuration.cpp: implementation of the InstrumentCfg class.
//
//////////////////////////////////////////////////////////////////////
#include "instrumentcfg.h"
#include "instrument.h"
#include "const.h"
#include "debug.h"

#ifdef _WIN32_
#define ERROR -1
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

InstrumentCfg::InstrumentCfg()
{
}

InstrumentCfg::~InstrumentCfg()
{
}

void InstrumentCfg::initialize(const char *cfgfile)
{
	ConfigItemWrapper item;	
	char name[80];


	if(cfgfile == NULL){
		sprintf(name, "%s.cfg",Instrument::id());
		_configFile.initialize(name);
	}
	else 
		_configFile.initialize(cfgfile);
}

MBool InstrumentCfg::searchForConfigItem(const char * name, ConfigItemWrapper &item)
{
	return(_configFile.searchForItem(name, item));
}
void InstrumentCfg::replaceConfigItem(const ConfigItemWrapper item)
{
	_configFile.replaceItem(item);
}

void InstrumentCfg::saveConfigItems(CallbackObject *)
{
	_configFile.write();
}

MBool InstrumentCfg::createCfgItem(const char *name, const char *argvs)
{
	return _configFile.createCfgItem(name, argvs);

}
