41 mBaseNodeName(baseNodeName)
51 mGetFunctions[nodeName] = getValueFunction;
52 mSetFunctions[nodeName] = setValueFunction;
56 void PatientStorage::duringSavePatientSlot(QDomElement& node)
59 QDomElement baseNode = root.descend(mBaseNodeName).node().toElement();
60 this->addXml(baseNode);
63 void PatientStorage::duringLoadPatientSlot(QDomElement& node)
65 XMLNodeParser root(node);
66 QDomElement baseNode = root.descend(mBaseNodeName).node().toElement();
67 if (!baseNode.isNull())
68 this->parseXml(baseNode);
71 void PatientStorage::addXml(QDomNode& parentNode)
73 QDomDocument doc = parentNode.ownerDocument();
75 std::map<QString, boost::function<QString()> >::iterator iter;
76 for(iter = mGetFunctions.begin(); iter != mGetFunctions.end(); ++iter)
78 QDomElement newDataNode = doc.createElement(iter->first);
79 newDataNode.appendChild(doc.createTextNode(iter->second()));
80 parentNode.appendChild(newDataNode);
84 void PatientStorage::parseXml(QDomNode& dataNode)
86 std::map<QString, boost::function<void(QString value)> >::iterator iter;
87 for(iter = mSetFunctions.begin(); iter != mSetFunctions.end(); ++iter)
89 QString nodeValue = dataNode.namedItem(iter->first).toElement().text();
90 iter->second(nodeValue);
void isLoading(QDomElement &root)
emitted while loading a session. Xml storage is available, getRootFolder() is set to loaded value...
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
cxLogicManager_EXPORT SessionStorageServicePtr sessionStorageService()
void isSaving(QDomElement &root)
xml storage is available
boost::shared_ptr< class SessionStorageService > SessionStorageServicePtr