GDA DAFIdentifiers CResourceID swapReverse const GDA DAFIdentifiers CR

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
GDA::DAFIdentifiers::CResourceID
swapReverse(const GDA::DAFIdentifiers::CResourceID &crid)
{
union {
GDA::DAFIdentifiers::ULongLong cf[2];
uint32_t a[4];
uint16_t b[8];
uint8_t c[16];
} _;
_.cf[0] = crid.container;
_.cf[1] = crid.fragment;
std::swap ( _.a[0], _.a[1] ); // container
std::swap ( _.b[0], _.b[1] ); // container
std::reverse(&_.c[8], &_.c[16]); // fragment
GDA::DAFIdentifiers::CResourceID result;
result.container = _.cf[0];
result.fragment = _.cf[1];
return result;
}
QString
toOID(const GDA::DAFIdentifiers::CResourceID& id )
{
GDA::DAFIdentifiers::CResourceID result = swapReverse(id);
return Utils::toCIMID(result);
}