Hi there !

in the osgIntropsection framework, we use getCompatibleConstructor(...) or
getCompatibleMethod(...), etc... to get a function considering the
parameters offered. But it this process do the framework take into account
the possible implicit parameter constructions ?

I tried to check the sources, and as far as I understand, everything would
happen in the function if it was the case (for example for the implicit
convertion of a "const char*" object to "std::string"):

bool Reflection::accum_conv_path(const Type& source, const Type& dest,
ConverterList& conv, std::vector<const Type* > &chain, CastType castType)
{
    // break unwanted loops
    if (std::find(chain.begin(), chain.end(), &source) != chain.end())
        return false;

    // store the type being processed to avoid loops
    chain.push_back(&source);

    // search a converter from "source"
    StaticData::ConverterMapMap::const_iterator i =
getOrCreateStaticData().convmap.find(&source);
    if (i == getOrCreateStaticData().convmap.end())
        return false;

    // search a converter to "dest"
    const StaticData::ConverterMap& cmap = i->second;
    StaticData::ConverterMap::const_iterator j = cmap.find(&dest);
    if (j != cmap.end() && (j->second->getCastType() == castType))
    {
        conv.push_back(j->second);
        return true;
    }

    // search a undirect converter from "source" to ... to "dest"
    for (j=cmap.begin(); j!=cmap.end(); ++j)
    {
        if ((j->second->getCastType() == castType) &&
accum_conv_path(*j->first, dest, conv, chain, castType))
        {
            conv.push_front(j->second);
            return true;
        }
    }

    return false;
}

... but I can't see anything concerning the type constructors here, so I
guess that to call a function you need to pass the exact type of parameter
needed (with an exception for the derived classes, and inheritance system),
for example:

with the function void myfunc(std::string arg1, osg::Node* obj)

the reflection framework would find a compatible method with the arguments :
{ std::string("test") , and osg::Group* myGroup } but it won't find
anything  with the pair { "test", osg::Node* myNode }... Am I wrong ??

regards,

Manu.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to