20 mBaseNodeName(baseNodeName)
30 mGetFunctions[nodeName] = getValueFunction;
31 mSetFunctions[nodeName] = setValueFunction;
35 void PatientStorage::duringSavePatientSlot(QDomElement& node)
38 QDomElement baseNode = root.
descend(mBaseNodeName).
node().toElement();
39 this->addXml(baseNode);
42 void PatientStorage::duringLoadPatientSlot(QDomElement& node)
45 QDomElement baseNode = root.
descend(mBaseNodeName).
node().toElement();
46 if (!baseNode.isNull())
47 this->parseXml(baseNode);
50 void PatientStorage::addXml(QDomNode& parentNode)
52 QDomDocument doc = parentNode.ownerDocument();
54 std::map<QString, boost::function<QString()> >::iterator iter;
55 for(iter = mGetFunctions.begin(); iter != mGetFunctions.end(); ++iter)
57 QDomElement newDataNode = doc.createElement(iter->first);
58 newDataNode.appendChild(doc.createTextNode(iter->second()));
59 parentNode.appendChild(newDataNode);
63 void PatientStorage::parseXml(QDomNode& dataNode)
65 std::map<QString, boost::function<void(QString value)> >::iterator iter;
66 for(iter = mSetFunctions.begin(); iter != mSetFunctions.end(); ++iter)
68 QString nodeValue = dataNode.namedItem(iter->first).toElement().text();
69 iter->second(nodeValue);
void isLoading(QDomElement &root)
emitted while loading a session. Xml storage is available, getRootFolder() is set to loaded value...
XMLNodeAdder descend(QString path)
void isLoadingSecond(QDomElement &root)
Emitted after the isLoading signal, to allow for structures that must be loaded after core structures...
PatientStorage(SessionStorageServicePtr sessionStorageService, QString baseNodeName, bool delayedLoad=false)
void storeVariable(QString nodeName, boost::function< QString()> getValueFunction, boost::function< void(QString)> setValueFunction)
storeVariable Store a variable in the patient file
XMLNodeParser descend(QString path)
void isSaving(QDomElement &root)
xml storage is available
boost::shared_ptr< class SessionStorageService > SessionStorageServicePtr
Namespace for all CustusX production code.