Hi everyone,
I have the follwing function:
template<class T>
void SubmitData(const QString& name, const SCVitalSignInformation& vsi, const T& data)
{
Triple<SCVitalSignInformation,
QByteArray, int>
*& p
= m_map
[name
];
if(p == NULL)
{
p
= new Triple<SCVitalSignInformation,
QByteArray, int>;
}
p->first = vsi;
stream << data;
++(p->third);
}
template<class T>
void SubmitData(const QString& name, const SCVitalSignInformation& vsi, const T& data)
{
Triple<SCVitalSignInformation, QByteArray, int>*& p = m_map[name];
if(p == NULL)
{
p = new Triple<SCVitalSignInformation, QByteArray, int>;
}
p->first = vsi;
QByteArray & buffer = p->second;
QDataStream stream(&buffer, QIODevice::ReadWrite);
stream << data;
++(p->third);
}
To copy to clipboard, switch view to plain text mode
I checked it with the debugger and recognized, that the VitalSignInformation and the int are changed, but the buffer remains unchanged, although i write to it with operator<<...
Triple is just a little class similar to std::pair (but with 3 elements)
And m_map is this:
std::map<QString, Triple<SCVitalSignInformation, QByteArray, int>* > m_map;
(I'm not using QMap/QHash as it does not have a swap memberfunction in the current qt-version.)
I think the problem occurs either because I use QDataStream and/or QByteArray in a wrong way, or I did just some dumb mistake^^
It would be nice if you can help me!
Thanks in advance!
P.S.:
The operator<< is overloaded for the types I use as T of course.
Bookmarks