musrWiz 0.1.0
Loading...
Searching...
No Matches
PAdmin Class Reference

The PAdmin class is the main administration class for musrWiz. More...

#include <PAdmin.h>

Inheritance diagram for PAdmin:

Public Member Functions

 PAdmin ()
 Constructor. Loads all configuration files.
 
 ~PAdmin ()
 Destructor.
 
bool IsValid ()
 Checks if the admin object was initialized successfully.
 
void dump (int tag)
 Dumps debug information to stdout.
 
QString getDefaultInstitute ()
 Returns the default institute name.
 
QString getDefaultInstrument ()
 Returns the default instrument name.
 
QString getDefaultFitType ()
 Returns the default fit type.
 
QStringList getInstituteList ()
 Returns a list of all available institute names.
 
QStringList getInstrumentList (QString institute)
 Returns a list of instruments for a given institute.
 
PInstrumentgetInstrument (QString institute, QString instrument)
 Returns a pointer to an instrument object.
 
int getTheoTemplateSize ()
 Returns the number of theory templates.
 
QVector< PTheoTemplategetTheoTemplates ()
 Returns all theory templates.
 
PTheoTemplate getTheoTemplate (int idx)
 Returns a theory template by index.
 
int getMusrfitFuncSize ()
 Returns the number of musrfit functions.
 
QVector< PMusrfitFuncgetMusrfitFunc ()
 Returns all musrfit functions.
 
PMusrfitFunc getMusrfitFunc (QString name)
 Returns a musrfit function by name or abbreviation.
 

Protected Member Functions

int addInstrument (QString institute, PInstrument instrument)
 Adds an instrument to an institute.
 

Private Member Functions

int loadMusrWizDefault (QString fln)
 Loads the musrWiz.xml default settings file.
 
int loadMusrfitFunc (QString fln)
 Loads the musrfit_funcs.xml file.
 
int loadInstrumentDef (QString path, QString fln)
 Loads an instrument definition XML file.
 

Private Attributes

bool fValid
 flag indicating successful initialization
 
PMusrWizDefault fDefault
 default wizard settings
 
QVector< PInstitutefInstitute
 list of institutes with their instruments
 
QVector< PTheoTemplatefTheoTemplate
 list of theory templates
 
QVector< PMusrfitFuncfMusrfitFunc
 list of musrfit functions
 

Friends

class PFuncXMLParser
 
class PInstrumentDefXMLParser
 
class PMusrWizDefaultXMLParser
 

Detailed Description

The PAdmin class is the main administration class for musrWiz.

This class serves as the central repository for all configuration data needed by the musrWiz application. It loads and manages:

  • Default wizard settings from musrWiz.xml
  • Musrfit function definitions and theory templates from musrfit_funcs.xml
  • Instrument definitions from instrument_def_*.xml files

The XML parser friend classes populate this class with data from the configuration files.

Constructor & Destructor Documentation

◆ PAdmin()

PAdmin::PAdmin ( )

Constructor. Loads all configuration files.

Attempts to load configuration files first from the local directory, then from $HOME/.musrfit/musrWiz/. If files don't exist, creates them from built-in resources.

Initializes that PAdmin object, and calls the XML parser which feeds the object variables.

◆ ~PAdmin()

PAdmin::~PAdmin ( )
inline

Destructor.

Member Function Documentation

◆ addInstrument()

int PAdmin::addInstrument ( QString institute,
PInstrument instrument )
protected

Adds an instrument to an institute.

PAdmin::addInstrument adds an instrument to an institute.

Parameters
instituteInstitute name. Creates the institute if it doesn't exist.
instrumentInstrument object to add.
Returns
0 on success.

Searches for the specified institute. If found, adds the instrument to it. If the institute doesn't exist, creates a new institute entry and adds the instrument to it.

Parameters
instituteInstitute name (e.g., "PSI").
instrumentInstrument object to add.
Returns
0 on success.

◆ dump()

void PAdmin::dump ( int tag)

Dumps debug information to stdout.

Parameters
tagDebug tag: 0=instrument defs, 1=musrfit funcs, 2=both, -1=none.

dump all the instrument defs to stdout. This routine is there for debug purposes only.

◆ getDefaultFitType()

QString PAdmin::getDefaultFitType ( )
inline

Returns the default fit type.

Returns
Default fit type string from musrWiz.xml.

◆ getDefaultInstitute()

QString PAdmin::getDefaultInstitute ( )
inline

Returns the default institute name.

Returns
Default institute name from musrWiz.xml.

◆ getDefaultInstrument()

QString PAdmin::getDefaultInstrument ( )
inline

Returns the default instrument name.

Returns
Default instrument name from musrWiz.xml.

◆ getInstituteList()

QStringList PAdmin::getInstituteList ( )

Returns a list of all available institute names.

PAdmin::getInstituteList returns a list of all available institute names.

Returns
QStringList containing all institute names.

Iterates through all loaded institutes and collects their names into a QStringList.

Returns
QStringList containing all institute names (e.g., "PSI", "TRIUMF", "ISIS", "J-PARC").

◆ getInstrument()

PInstrument * PAdmin::getInstrument ( QString institute,
QString instrument )

Returns a pointer to an instrument object.

PAdmin::getInstrument returns a pointer to an instrument object.

Parameters
instituteInstitute name.
instrumentInstrument name.
Returns
Pointer to PInstrument, or nullptr if not found.

Searches for the specified institute and instrument combination.

Parameters
instituteInstitute name (e.g., "PSI").
instrumentInstrument name (e.g., "HAL9500").
Returns
Pointer to the PInstrument object, or nullptr if not found.

◆ getInstrumentList()

QStringList PAdmin::getInstrumentList ( QString institute)

Returns a list of instruments for a given institute.

PAdmin::getInstrumentList returns a list of instruments for a given institute.

Parameters
instituteInstitute name to query.
Returns
QStringList containing all instrument names for the institute.

Searches for the specified institute and returns the names of all instruments associated with it.

Parameters
instituteInstitute name to query (e.g., "PSI").
Returns
QStringList containing instrument names, or empty list if institute not found.

◆ getMusrfitFunc() [1/2]

QVector< PMusrfitFunc > PAdmin::getMusrfitFunc ( )
inline

Returns all musrfit functions.

Returns
QVector containing all PMusrfitFunc objects.

◆ getMusrfitFunc() [2/2]

PMusrfitFunc PAdmin::getMusrfitFunc ( QString name)

Returns a musrfit function by name or abbreviation.

PAdmin::getMusrfitFunc returns a musrfit function by name or abbreviation.

Parameters
nameFunction name or abbreviation.
Returns
PMusrfitFunc matching the name, or default func if not found.

Searches the list of loaded musrfit functions for one matching the given name (either full name or abbreviation).

Parameters
nameFunction name (e.g., "simpleGss") or abbreviation (e.g., "sg").
Returns
PMusrfitFunc matching the name, or a default/empty function if not found.

◆ getMusrfitFuncSize()

int PAdmin::getMusrfitFuncSize ( )
inline

Returns the number of musrfit functions.

Returns
Number of musrfit functions.

◆ getTheoTemplate()

PTheoTemplate PAdmin::getTheoTemplate ( int idx)

Returns a theory template by index.

PAdmin::getTheoTemplate returns a theory template by index.

Parameters
idxIndex of the template.
Returns
PTheoTemplate at the given index, or empty template if out of range.
Parameters
idxIndex of the requested theory template.
Returns
PTheoTemplate at the given index, or an empty/default template if index is out of range.

◆ getTheoTemplates()

QVector< PTheoTemplate > PAdmin::getTheoTemplates ( )
inline

Returns all theory templates.

Returns
QVector containing all PTheoTemplate objects.

◆ getTheoTemplateSize()

int PAdmin::getTheoTemplateSize ( )
inline

Returns the number of theory templates.

Returns
Number of theory templates.

◆ IsValid()

bool PAdmin::IsValid ( )
inline

Checks if the admin object was initialized successfully.

Returns
true if all required configuration files were loaded, false otherwise.

◆ loadInstrumentDef()

int PAdmin::loadInstrumentDef ( QString path,
QString fln )
private

Loads an instrument definition XML file.

PAdmin::loadInstrumentDef loads an instrument definition XML file.

Parameters
pathDirectory path containing the file.
flnFilename of the instrument definition file.
Returns
0 on success, 1 on failure.

If the file doesn't exist at the specified path, copies the default from the built-in Qt resource system to $HOME/.musrfit/musrWiz/.

Parameters
pathDirectory path containing the file.
flnFilename of the instrument definition file (e.g., "instrument_def_psi.xml").
Returns
0 on success, 1 on failure.

◆ loadMusrfitFunc()

int PAdmin::loadMusrfitFunc ( QString fln)
private

Loads the musrfit_funcs.xml file.

PAdmin::loadMusrfitFunc loads the musrfit_funcs.xml file.

Parameters
flnPath to the file.
Returns
0 on success, 1 on failure.

If the file doesn't exist at the specified path, copies the default from the built-in Qt resource system to $HOME/.musrfit/musrWiz/.

Parameters
flnPath to the musrfit_funcs.xml file.
Returns
0 on success, 1 on failure.

◆ loadMusrWizDefault()

int PAdmin::loadMusrWizDefault ( QString fln)
private

Loads the musrWiz.xml default settings file.

PAdmin::loadMusrWizDefault loads the musrWiz.xml default settings file.

Parameters
flnPath to the file.
Returns
0 on success, 1 on failure.

If the file doesn't exist at the specified path, copies the default from the built-in Qt resource system to $HOME/.musrfit/musrWiz/.

Parameters
flnPath to the musrWiz.xml file.
Returns
0 on success, 1 on failure.

Friends And Related Symbol Documentation

◆ PFuncXMLParser

friend class PFuncXMLParser
friend

◆ PInstrumentDefXMLParser

friend class PInstrumentDefXMLParser
friend

◆ PMusrWizDefaultXMLParser

friend class PMusrWizDefaultXMLParser
friend

Member Data Documentation

◆ fDefault

PMusrWizDefault PAdmin::fDefault
private

default wizard settings

◆ fInstitute

QVector<PInstitute> PAdmin::fInstitute
private

list of institutes with their instruments

◆ fMusrfitFunc

QVector<PMusrfitFunc> PAdmin::fMusrfitFunc
private

list of musrfit functions

◆ fTheoTemplate

QVector<PTheoTemplate> PAdmin::fTheoTemplate
private

list of theory templates

◆ fValid

bool PAdmin::fValid
private

flag indicating successful initialization


The documentation for this class was generated from the following files: