[gme-users] getting a BON object from an implementation object

Zoltan Molnar zolmol at isis.vanderbilt.edu
Fri May 12 10:37:38 CDT 2006


Did you try this:
 
void g( BON::FCO& par)
{
    // ...
}
 
void f( BON::FCOImpl* impl)
{
    g( BON::FCO( impl));
}
 
I saw that there is a constructor like: FCO( FCOImpl *).
Zoli

-----Original Message-----
From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Matthew
J. Emerson
Sent: Thursday, May 11, 2006 5:55 PM
To: gme-users
Subject: [gme-users] getting a BON object from an implementation object



In a BON 2 interpreter, I have written a stand-along function that takes
as a parameter a BON::FCO:

 

            void writeNEDFCOPropertyAssn(const BON::FCO &fco, const
std::string &indent, std::ostringstream &out);

 

There are many places in the interpreter when I can call it and pass it
an actual BON::FCO:

 

            std::set<Node> nodes(this->getNode());

      std::set<Node>::const_iterator npos(nodes.begin());

for( ; npos != nodes.end(); ++npos)

{

            std::ostringstream nodeParams;

      writeNEDFCOPropertyAssn(node, "\t\t\t\t", nodeParams)

      ...

}

 

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:

 

            writeNEDFCOPropertyAssn(this, "\t\t", nodeParams); 

 

Except...this 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.

 

How do I get a wrapped version of an Impl object on demand without
messing up the reference counting mechanism?

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20060512/7494abe5/attachment.htm


More information about the gme-users mailing list