RSS Git Download  Clone
Raw Blame History
/*******************************************************************************
 *	Gen.h		TMS State Table Generator
 *			T.Barnaby,	BEAM Ltd,	2007-03-15
 *******************************************************************************
 */

#ifndef Gen_h
#define Gen_h	1

#include <BError.h>
#include <BFile.h>
#include <BNameValue.h>
#include <SigGen.h>
#include <TmsLib.h>

typedef BNameValue<BString>	NameValue;

class NameValueList : public BNameValueList<BString> {
public:
	BString		getValue(BString name);
	void		setValue(BString name, BString value);
};

/// State/Phase table generation class
class Gen {
public:
				Gen(BString name);
	virtual			~Gen();
	
	virtual BString		name();				///< Gets the CycleType name
	virtual BString		info();				///< Returns information on the cycleType
	virtual BError		init(NameValueList& params);	///< Initialises the generation with a set of parameters
	virtual void		close();			///< Closes the generator
	virtual BError		run();				///< Runs the generator
	virtual BError		output();			///< Outputs the results

protected:
	virtual void		outputPhaseDelay();		///< Outputs the phase delay section
	virtual void		outputState(int num, Tms::TmsState state, int lo1Harmonic, int bunchSet1, int lo2Harmonic, int bunchSet2, int capture);	///< Generates the main state/phase tables
	
	BString			oname;				///< The CycleType name
	BString			oinfo;				///< Information on this cycle type
	NameValueList		oparams;			///< The list of name/value parameters
	NameValueList		ooutput;			///< The output parameter list
	BFile			ofile;				///< The file to output results to
	
	BString			ofileName;			///< The output file name
	double			osampleRate;			///< The sample rate
	double			ofref;				///< The FREF frequency
	int			ophaseTableFile;		///< Flag to generate a phase table ASCII file
	int			ouseMsbFref;			///< Flag to use the PhaseTable address MSB as the FREF local reference
	int			opllInitialFrequencyDelay;	///< The PLL initial frequency load delay in ms
};

class GenBeam1 : public Gen {
public:
			GenBeam1();

	BError		run();
};

class GenBeam2 : public Gen {
public:
			GenBeam2();

	BError		run();
};

class GenBeam3 : public Gen {
public:
			GenBeam3();

	BError		run();
};

class GenTest1 : public Gen {
public:
			GenTest1();

	BError		run();
};

BList<Gen*>&	genInit();

#endif