please Dont stepback,by seeing the length of my mail.I would reaaly appreciate if anyone could help me in this regard.
I have a Buffer class called SimpleBuffer.It was a code I took from some one else .I went through the code,But I couldnt find how the writing into the buffer is achieved.I asked a few people,but none could give me a clear answer.Is there anyone who could tell me this.
Iam sending some files as attached & Iam explaining the workflow below.
I just would like to tell u how it looks:
(These files iam mentioning here are in the attachment).
I have a buffer class(Buffer.h)- BufferSize -10000.
It also has a (Bufferallocator.h) class where memory is allocated.
A Simplebuffer class (SimpleBuffer.h)
I went through the code & the flow goes like as it is numbered:
[1]In C_RdiMapDocument.cpp there is a call - m_rdiDocument->createNgElement( this );
[2]It goes to C_RdiMapDocument::createNgElement( RdiTProcess* process ) in C_RdiMapDocument.cpp.
[3] Then in the BufferAllocator
< NgDocData< SimpleBuffer >
, SimpleBuffer
> bufAlloc( simpleBuffer );
It goes to the buffallocator and produes the object & the protected (B& m_buffer) in the bufferallocator becomes the simplebuffer.
[4]In the next call // Create the NG document object.
m_ngDocumentData = new ( bufAlloc.allocate( 1 ) )This part (a) go to [A] down..
NgDocData< SimpleBuffer >( simpleBuffer ); This part (b) go to [B] down..
[A]
goes to this in Bufferallocator,& the m_buffer is now the simplebuffer ,it calls the allocate bytes of the simplebuffer.
pointer allocate(size_type _N, const void* p = NULL)
throw (DocGenEx)
{
return reinterpret_cast<pointer>(m_buffer.allocateBytes(_N * sizeof(T)));-What is "T" here.
}
m_pfree can be considered to be a read ptr to the buffer, as it incremets whenever bytes are allocated.
max_size(); in the simpleBuffer checks the remaining space in the buffer.
[B]
Goes to the [NgDocData< SimpleBuffer >( simpleBuffer )] Constructor
Where "B" is the simpleBuffer,
m_ngSubDocDataList is a list declared in NgDocData.h file.
This call to constructor goes to the bufferallocator & simplebuffer classes & allocate bytes.
There are other classes & lists which are members of the classes whch Iam not mentioning here.There also same thing happens like this .only the object created changes.
for(NgDocData<B>::const_iterator it = ngDocData.m_ngSubDocDataList.begin();
it != ngDocData.m_ngSubDocDataList.end(); it++)
out << **it;
}
THIS much i wrote to let u understand the situation.Only the parts I told u are relevant(the other parts of the code is not important in this scenario)
Hope,ur not tired after reading all thse stuff...
So In brief:
The SimpleBuffer is filled with an NgDocData object.I have a ptr to this object,by which Iam outputting the things to the screen.
[1]My question is how the object gets written into the buffer.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.