<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>In a BON 2 interpreter, I have written a stand-along
function that takes as a parameter a BON::FCO:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font><font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>void</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> writeNEDFCOPropertyAssn(<font
color=blue><span style='color:blue'>const</span></font> BON::FCO &fco, <font
color=blue><span style='color:blue'>const</span></font> std::string
&indent, std::ostringstream &out);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>There are many places in the interpreter when I can call it
and pass it an actual BON::FCO:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>std::set<Node>
nodes(<font color=blue><span style='color:blue'>this</span></font>->getNode());<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> std::set<Node>::const_iterator
npos(nodes.begin());<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:.5in'><font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>for</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>( ; npos != nodes.end();
++npos)<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>{<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> std::ostringstream
nodeParams;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> writeNEDFCOPropertyAssn(node,
"\t\t\t\t", nodeParams)<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> ...<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>}</span></font><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>However, inside the definition of a method of one of my –Impl
classes, I need to call this stand-along function and basically pass it the “this”
pointer. Except “this” is an Impl object and not a BON object:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>writeNEDFCOPropertyAssn(<font
color=blue><span style='color:blue'>this</span></font>, "\t\t",
nodeParams); <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Except…</span></font><font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>this</span></font><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'> is not a BON::FCO. It’s a BON::FCOImpl. But
the function will do the exact same thing anyway, so I don’t want to have
to write it twice just because in one case I’m passing in a wrapper and
in another case I’m passing in the implementation object.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>How do I get a wrapped version of an Impl object on demand
without messing up the reference counting mechanism?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
</div>
</body>
</html>