version 1.4.4.1, 2013/06/03 22:35:13
|
version 1.5, 2013/01/14 12:05:39
|
|
|
// | // |
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// |
// | // |
// This code implements part of PEP#348 - The CMPI infrastructure using SCMO |
|
// (Single Chunk Memory Objects). |
|
// The design document can be found on the OpenPegasus website openpegasus.org |
|
// at https://collaboration.opengroup.org/pegasus/pp/documents/21210/PEP_348.pdf |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
|
|
// Returns the index position at which the instance was inserted in the | // Returns the index position at which the instance was inserted in the |
// instance resolver table. | // instance resolver table. |
Uint32 SCMOStreamer::_appendToInstResolverTable( | Uint32 SCMOStreamer::_appendToInstResolverTable( |
SCMOInstance& inst, |
const SCMOInstance& inst, |
Uint32 idx) | Uint32 idx) |
{ | { |
SCMOResolutionTable tableEntry; |
SCMOResolutionTable tableEntry = { (Uint64)(void*)&inst, idx}; |
tableEntry.scmbptr.scmoInst = &inst; |
|
tableEntry.index = idx; |
|
|
|
_instResolverTable.append(tableEntry); | _instResolverTable.append(tableEntry); |
| |
// The number of elements in the array minus 1 is the index position | // The number of elements in the array minus 1 is the index position |
|
|
| |
| |
// Now build a new entry for the class resolution table | // Now build a new entry for the class resolution table |
SCMOResolutionTable tableEntry; |
SCMOResolutionTable tableEntry = {(Uint64)(void*)inst.inst.hdr, clsIdx}; |
tableEntry.scmbptr.scmbMain = inst.inst.hdr; |
|
tableEntry.index = clsIdx; |
|
_clsResolverTable.append(tableEntry); | _clsResolverTable.append(tableEntry); |
| |
// The number of elements in the array minus 1 is the index position | // The number of elements in the array minus 1 is the index position |
|
|
{ | { |
fprintf(stderr,"\t[%2d] I = %llx - cls = %2lld\n", | fprintf(stderr,"\t[%2d] I = %llx - cls = %2lld\n", |
x, | x, |
_clsResolverTable[x].scmbptr.uint64, |
_clsResolverTable[x].scmbptr, |
_clsResolverTable[x].index); | _clsResolverTable[x].index); |
} | } |
| |
|
|
{ | { |
fprintf(stderr,"\t[%2d] R = %llx - I = %2lld\n", | fprintf(stderr,"\t[%2d] R = %llx - I = %2lld\n", |
x, | x, |
_instResolverTable[x].scmbptr.uint64, |
_instResolverTable[x].scmbptr, |
_instResolverTable[x].index); | _instResolverTable[x].index); |
} | } |
fprintf(stderr,"=====================================================\n"); | fprintf(stderr,"=====================================================\n"); |
|
|
for (Uint32 x=0; x < numInst; x++) | for (Uint32 x=0; x < numInst; x++) |
{ | { |
// Calculate the in-use size of the SCMOInstance data | // Calculate the in-use size of the SCMOInstance data |
SCMBInstance_Main* instPtr = instArray[x].scmbptr.scmbMain; |
SCMBInstance_Main* instPtr = (SCMBInstance_Main*)instArray[x].scmbptr; |
Uint64 size = instPtr->header.totalSize - instPtr->header.freeBytes; | Uint64 size = instPtr->header.totalSize - instPtr->header.freeBytes; |
_buf.putUint64(size); | _buf.putUint64(size); |
| |
|
|
for (Uint32 i=0; i < numExtRefs; i++) | for (Uint32 i=0; i < numExtRefs; i++) |
{ | { |
Uint32 extRefPos = extRefArray[extRefIndex].index; | Uint32 extRefPos = extRefArray[extRefIndex].index; |
SCMOInstance* extRefPtr = instArray[extRefPos].scmbptr.scmoInst; |
SCMOInstance* extRefPtr = |
|
(SCMOInstance*)instArray[extRefPos].scmbptr; |
scmoInstPtr->putExtRef(i,extRefPtr); | scmoInstPtr->putExtRef(i,extRefPtr); |
| |
// Mark instance as already consumed | // Mark instance as already consumed |
instArray[extRefPos].scmbptr.uint64 = 0; |
instArray[extRefPos].scmbptr = 0; |
| |
extRefIndex++; | extRefIndex++; |
} | } |
} | } |
| |
instArray[x].scmbptr.scmoInst = scmoInstPtr; |
instArray[x].scmbptr = (Uint64)(void*)scmoInstPtr; |
| |
#ifdef PEGASUS_DEBUG | #ifdef PEGASUS_DEBUG |
_clsResolverTable.append(instArray[x]); | _clsResolverTable.append(instArray[x]); |
|
|
// Append all non-referenced instances to output array | // Append all non-referenced instances to output array |
for (Uint32 x=0; x < numInst; x++) | for (Uint32 x=0; x < numInst; x++) |
{ | { |
if (0 != instArray[x].scmbptr.scmoInst) |
if (instArray[x].scmbptr) |
{ | { |
_scmoInstances.append(*(instArray[x].scmbptr.scmoInst)); |
_scmoInstances.append(*((SCMOInstance*)instArray[x].scmbptr)); |
delete instArray[x].scmbptr.scmoInst; |
delete (SCMOInstance*)instArray[x].scmbptr; |
} | } |
} | } |
delete [] instArray; | delete [] instArray; |