Boost logo

Boost :

From: Craig Henderson (cdm.henderson_at_[hidden])
Date: 2002-10-09 15:14:39


I have a generic (wrt data) class to manage and provide access to a memory
mapped file on Windows using the Win32 API and with gcc (on cygwin) using
the POSIX functions mmap() and munmap(). The POSIX should recompile to other
platforms with gcc without modification. Is there any interest in adding
such a class to the Boost library? I think it would be a nice complimentary
class for the filesystem library.

I attach a synopsis for reference. It uses two new preprocessor definitions;
BOOST_HAS_WIN32_MMAP and BOOST_HAS_POSIX_MMAP which must currently be
defined before including the header. These will obviously need to move into
the config library.

Regards
-- Craig

begin 666 mapmem.hpp
M+R\@*$,I($-O<'ER:6=H="!#<F%I9R!(96YD97)S;VX@,C P,@T*+R\@(" @
M(" @(" @(" @("!C9&TN:&5N9&5R<V]N0'9I<F=I;BYN970-"B\O#0HO+R!0
M97)M:7-S:6]N('1O('5S92P_at_8V]P>2P@;6]D:69Y+"!D:7-T<FEB=71E(&%N
M9"!S96QL('1H:7,@<V]F='=A<F4-"B\O(&%N9"!I=',@9&]C=6UE;G1A=&EO
M;B!F;W(@86YY('!U<G!O<V4@:7,@:&5R96)Y(&=R86YT960@=VET:&]U="!F
M964L#0HO+R!P<F]V:61E9"!T:&%T('1H92!A8F]V92!C;W!Y<FEG:'0@;F]T
M:6-E(&%P<&5A<G,@:6X_at_86QL(&-O<&EE<R!A;F0-"B\O('1H870_at_8F]T:"!T
M:&%T(&-O<'ER:6=H="!N;W1I8V4_at_86YD('1H:7,@<&5R;6ES<VEO;B!N;W1I
M8V4_at_87!P96%R#0HO+R!I;B!S=7!P;W)T:6YG(&1O8W5M96YT871I;VXN("!4
M:&4_at_875T:&]R(&UA:V5S(&YO(')E<')E<V5N=&%T:6]N<PT*+R\@86)O=70@
M=&AE('-U:71A8FEL:71Y(&]F('1H:7,@<V]F='=A<F4_at_9F]R(&%N>2!P=7)P
M;W-E+B @270@:7,-"B\O('!R;W9I9&5D(")A<R!I<R(@=VET:&]U="!E>'!R
M97-S(&]R(&EM<&QI960@=V%R<F%N='DN#0H-"FYA;65S<&%C92!B;V]S="![
M#0H-"B @("!N86UE<W!A8V4@;65M;W)Y7VUA<'!E9%]F:6QE('L-"@T*(" @
M("-I9B!D969I;F5D*$)/3U-47TA!4U]724XS,E]-34%0*0T*(" @(" @("!T
M>7!E9&5F($A!3D1,12!M96UM87!?9FEL93L-"B @(" @(" @='EP961E9B!$
M5T]21" @<')O=&5C=&EO;CL-"B @(" @(" @='EP961E9B!S=')U8W0-"B @
M(" @(" @>PT*(" @(" @(" @(" @1%=/4D0@(" @(" @(" @(" @(" @(&%C
M8V5S<SL-"B @(" @(" @(" @($Q04T5#55))5%E?05144DE"551%4R!S96-U
M<FET>3L-"B @(" @(" @?2 @(&9L86=S7V]R7W-E8W5R:71Y.PT*(" @(" @
M("!T>7!E9&5F('-T<G5C= T*(" @(" @("![#0H@(" @(" @(" @("!S=')U
M8W0-"B @(" @(" @(" @('L-"B @(" @(" @(" @(" @("!$5T]21"!H:2P@
M;&\[#0H@(" @(" @(" @("!](&UA<#L-"B @(" @(" @(" @(%-)6D5?5"!V
M:65W.PT*(" @(" @("!](&UA>%]L96X[#0H@(" @(" @('1Y<&5D968@<W1R
M=6-T#0H@(" @(" @('L-"B @(" @(" @(" @($173U)$(&AI+"!L;SL-"B @
M(" @(" @?2!O9F9S970[#0H@(" @(" @("-D969I;F4_at_0D]/4U1?34U!4%])
M3E9!3$E$7TA!3D1,12!)3E9!3$E$7TA!3D1,15]604Q510T*(" @("-E;&EF
M(&1E9FEN960H0D]/4U1?2$%37U!/4TE87TU-05 I#0H@(" @(" @('1Y<&5D
M968@:6YT(&UE;6UA<%]F:6QE.PT*(" @(" @("!T>7!E9&5F(&EN="!P<F]T
M96-T:6]N.PT*(" @(" @("!T>7!E9&5F(&EN="!F;&%G<U]O<E]S96-U<FET
M>3L-"B @(" @(" @='EP961E9B!I;G0@;6%X7VQE;CL-"B @(" @(" @='EP
M961E9B!I;G0@;V9F<V5T.PT*#0H@(" @(" @("-D969I;F4_at_0D]/4U1?34U!
M4%])3E9!3$E$7TA!3D1,12 M,0T*(" @("-E;F1I9_at_T*#0H@(" @?2 @("\O
M(&YA;65S<&%C92!M96UO<GE?;6%P<&5D7V9I;&4-"@T*(" @('1E;7!L871E
M(#QT>7!E;F%M92!4/@T*(" @(&-L87-S(&UE;6]R>5]M87!P961?9FEL90T*
M(" @('L-"B @(" @('!U8FQI8SH-"B @(" @(" @='EP961E9B!E;G5M('L@
M<F5A9&]N;'DL(')E861W<FET92!](&]P96Y?86-C97-S.PT*#0H@(" @("!P
M<FEV871E._at_T*(" @(" @("!4("IP=')?.PT*#0HC:68_at_9&5F:6YE9"A"3T]3
M5%](05-?5TE.,S)?34U!4"D-"B @(" @(" @<W1R=6-T#0H@(" @(" @('L-
M"B @(" @(" @(" @(&UE;6]R>5]M87!P961?9FEL93HZ;65M;6%P7V9I;&4@
M9FEL95]M87!P:6YG7VAA;F1L95\[#0H@(" @(" @('T_at_9&5T86EL7SL-"B @
M(" @(" @1%=/4D0_at_97)R7SL-"B-E;&EF(&1E9FEN960H0D]/4U1?2$%37U!/
M4TE87TU-05 I#0H@(" @(" @('-T<G5C= T*(" @(" @("![#0H@(" @(" @
M(" @("!I;G0@;&5N.PT*(" @(" @("!](&1E=&%I;%\[#0H@(" @(" @(&EN
M="!E<G)?.PT*(V5N9&EF#0H-"B @(" @('!U8FQI8SH-"B @(" @(" @;65M
M;W)Y7VUA<'!E9%]F:6QE*"D[#0H@(" @(" @(&UE;6]R>5]M87!P961?9FEL
M92AM96UO<GE?;6%P<&5D7V9I;&4Z.FUE;6UA<%]F:6QE("9H86YD;&4L(&]P
M96Y?86-C97-S(&%C8V5S<RD[#0H@(" @(" @('YM96UO<GE?;6%P<&5D7V9I
M;&4H*3L-"@T*(" @(" @("!B;V]L(&UA<%]R96%D;VYL>2AM96UO<GE?;6%P
M<&5D7V9I;&4Z.FUE;6UA<%]F:6QE("9H86YD;&4I.PT*(" @(" @("!B;V]L
M(&UA<%]R96%D=W)I=&4H;65M;W)Y7VUA<'!E9%]F:6QE.CIM96UM87!?9FEL
M92 F:&%N9&QE*3L-"@T*(" @(" @(" O+R!T:&ES(&ES(&5X<&]S960@<'5B
M;&EC;'D_at_9F]R(&-O;7!L971E;F5S<RP_at_8G5T(&ES#0H@(" @(" @("\O('5N
M;&EK96QY('1O(&)E('5S960_at_8GD@=&AE(&QI8G)A<GD@=7-E<@T*(" @(" @
M("!B;V]L(&UA<"AM96UO<GE?;6%P<&5D7V9I;&4Z.FUE;6UA<%]F:6QE(" @
M(" @(" @)FAA;F1L92P-"B @(" @(" @(" @(" @(" @;65M;W)Y7VUA<'!E
M9%]F:6QE.CIP<F]T96-T:6]N(" @(" @(" @("9P<F]T+ T*(" @(" @(" @
M(" @(" @("!M96UO<GE?;6%P<&5D7V9I;&4Z.F9L86=S7V]R7W-E8W5R:71Y
M(" @)F9O<RP-"B @(" @(" @(" @(" @(" @;65M;W)Y7VUA<'!E9%]F:6QE
M.CIM87A?;&5N(" @(" @(" @(" @("9L96XL#0H@(" @(" @(" @(" @(" @
M(&UE;6]R>5]M87!P961?9FEL93HZ;V9F<V5T(" @(" @(" @(" @(" F;V9F
M*3L-"@T*(" @(" @(" O+R!R96QE87-E('1H92!M87!P:6YG#0H@(" @(" @
M(&)O;VP@<F5L96%S92AV;VED*3L-"@T*(" @(" @(" O+R!I<R!T:&4@;V)J
M96-T(&UA<'!E9"!T;R!A(&9I;&4_#0H@(" @(" @(&)O;VP@:7-?;6%P<&5D
M*'9O:60I(&-O;G-T('L@<F5T=7)N("AP=')?("$](# I.R!]#0H-"B @(" @
M(" @+R\@9&%T82!A8V-E<W-I8FEL:71Y#0H@(" @(" @(%0@(" @(" @*F=E
M="AV;VED*2 @(" @(" @>R!R971U<FX@<'1R7SL@?0T*(" @(" @("!C;VYS
M="!4("IG970H=F]I9"D_at_8V]N<W0@('L@<F5T=7)N('!T<E\[('T-"B @("!]
?.PT*#0I](" @+R\@;F%M97-P86-E(&)O;W-T#0H-"@``
`
end


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk