A Hopf, Skip and a Jump
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ProfileManager Class Reference

profilemanager.h More...

#include <profilemanager.h>

Public Member Functions

 ProfileManager (std::string config=std::string("~/.config/hopfskipjump.xml"))
 Create a profile manager to save and restore properties of DetectorBanks. More...
 
 ~ProfileManager ()
 Destroy this profile manager, rewriting the configuration file if any new profiles have been added.
 
rapidxml::xml_node * exists (const std::string &name) const
 Determine whether the name profile exists in the database. More...
 
void saveProfile (const std::string &name, const std::string &profile)
 Save a serialised profile under a given name, possibly overwriting an existing profile. More...
 
std::string getProfile (const std::string &name) const
 Get an XML representation of a profile which can be used by fromXML() More...
 

Static Public Attributes

static const char protocol []
 Protocol version in use by this release. More...
 

Protected Member Functions

void deep_copy_names_values (rapidxml::xml_node<> &in, rapidxml::xml_node<> &out, rapidxml::xml_document<> &mem)
 Recursively clone a node and its values. More...
 

Protected Attributes

std::string configPath
 Path of the configuration file.
 
rapidxml::file * configXML
 Known configurations.
 
rapidxml::xml_document profiles
 XML doc of known configurations.
 
bool profilesModified
 Document tree has been modified.
 

Detailed Description

profilemanager.h

The ProfileManager class is responsible for reading and writing the XML-serialised description of a DetectorBank

Definition at line 16 of file profilemanager.h.

Constructor & Destructor Documentation

◆ ProfileManager()

ProfileManager::ProfileManager ( std::string  config = std::string("~/.config/hopfskipjump.xml"))

Create a profile manager to save and restore properties of DetectorBanks.

Parameters
configPath XML file where configurations are stored.

Member Function Documentation

◆ deep_copy_names_values()

void ProfileManager::deep_copy_names_values ( rapidxml::xml_node<> &  in,
rapidxml::xml_node<> &  out,
rapidxml::xml_document<> &  mem 
)
protected

Recursively clone a node and its values.

Parameters
inSource node
outTarget node
memDocument supplying the memory

◆ exists()

rapidxml::xml_node* ProfileManager::exists ( const std::string &  name) const

Determine whether the name profile exists in the database.

Parameters
nameName of the profile to find
Returns
The address of xml profile description or null if absent.

◆ getProfile()

std::string ProfileManager::getProfile ( const std::string &  name) const

Get an XML representation of a profile which can be used by fromXML()

Parameters
nameThe profile's name
Returns
A string of XML describing the profile
Exceptions
std::stringProfile 'name' not found.

◆ saveProfile()

void ProfileManager::saveProfile ( const std::string &  name,
const std::string &  profile 
)

Save a serialised profile under a given name, possibly overwriting an existing profile.

Parameters
nameName of the profile to create
profileText describing the new profile
Exceptions
std::stringThe XML root node of the profile to save wasn't <profile>

Member Data Documentation

◆ protocol

const char ProfileManager::protocol[]
static

Protocol version in use by this release.

The protocol version must agree with any file which the DetectorBank attemts to load.

Definition at line 34 of file profilemanager.h.


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