Home » U++ Library support » U++ Core » PROPOSAL: small / usefull Stream iface extension
PROPOSAL: small / usefull Stream iface extension [message #27952] |
Wed, 11 August 2010 23:39 |
|
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
hi all,
when implementing own, nontrivial protocols using stream, one sometimes (like i am now) in trouble, needing to access the underlying buffer directly, without always triggering a complete copy.. and also beeing able to skip read/write things.
thus here some very small but usefull functions. it would be really cool to have them there. otherwise please comment why not and how could i circumvent this need, without copying over and over.. (imagine having to put packets there that have some data, over which to calculate crc..etc).
Stream.h:85
byte * Base() { return buffer; }
byte * Head() { return ptr; }
void SkipRead(dword size = 1) { ptr += min((dword)(uintptr_t)(rdlim - ptr), size); }
void SkipWrite(dword size = 1){ ptr += min((dword)(uintptr_t)(wrlim - ptr), size); }
Head is the most important for me..
SkipRead makes sense as well (ignoring stuff, without need of dummy-copying just to advance ptr)
SkipWrite is kind of just for symetrical completeness, but might be usefull somewhere..
[Updated on: Wed, 11 August 2010 23:47] Report message to a moderator
|
|
|
|
|
PROPOSAL: small / usefull Stream iface extension
By: kohait00 on Wed, 11 August 2010 23:39
|
|
|
Re: PROPOSAL: small / usefull Stream iface extension
By: kohait00 on Thu, 12 August 2010 00:14
|
|
|
Re: PROPOSAL: small / usefull Stream iface extension
By: kohait00 on Thu, 12 August 2010 08:36
|
|
|
Re: PROPOSAL: small / usefull Stream iface extension
By: mirek on Fri, 13 August 2010 09:57
|
|
|
Re: PROPOSAL: small / usefull Stream iface extension
By: kohait00 on Fri, 13 August 2010 10:07
|
|
|
Re: PROPOSAL: small / usefull Stream iface extension
By: kohait00 on Fri, 13 August 2010 10:23
|
|
|
Re: PROPOSAL: small / usefull Stream iface extension
By: mirek on Fri, 13 August 2010 10:30
|
|
|
Re: PROPOSAL: small / usefull Stream iface extension
By: mirek on Fri, 13 August 2010 10:46
|
|
|
Re: PROPOSAL: small / usefull Stream iface extension
By: kohait00 on Fri, 13 August 2010 10:47
|
|
|
Re: PROPOSAL: small / usefull Stream iface extension
By: kohait00 on Fri, 13 August 2010 10:50
|
|
|
Re: PROPOSAL: small / usefull Stream iface extension
By: mirek on Fri, 13 August 2010 10:29
|
Goto Forum:
Current Time: Fri Nov 01 01:40:24 CET 2024
Total time taken to generate the page: 0.02009 seconds
|