예제 #1
0
QOSGWidgetFactory::FieldEditorCF
QOSGWidgetFactory::getFieldEditor(const FieldType &fType,
                                  const Char8     *fName )
{
    UInt32 fTypeId = fType.getId(          );
    UInt64 index   = getIndex   (0, fTypeId);

    return getFieldEditor(index, fName, fType.getCardinality());
}
예제 #2
0
void
QOSGWidgetFactory::registerFieldEditor(const FieldType     &fType,
                                       const Char8         *fName,
                                             FieldEditorCF  cFunc )
{
    UInt32 fTypeId  = fType.getId(          );
    UInt64 index    = getIndex   (0, fTypeId);

    registerFieldEditor(index, fName, cFunc);
}
void FieldConnectorFactoryBase::registerConnector(
    const FieldType           &oSrcType,
    const FieldType           &oDstType,
    BasicFieldConnector *pSrcToDst,
    BasicFieldConnector *pDstToSrc)
{
    // src -> dst
    {
        EntryMapConstIt srcIt = mConnectorMap.find(oSrcType.getId());

        if(srcIt != mConnectorMap.end())
        {
            ConnectorMapConstIt dstIt =
                srcIt->second->find(oDstType.getId());

            if(dstIt != srcIt->second->end())
            {
                fprintf(stderr,
                        "error conversion already registered for %s -> %s\n",
                        oSrcType.getCName(),
                        oDstType.getCName());

                delete pSrcToDst;
            }
            else
            {
                (*(srcIt->second))[oDstType.getId()] = pSrcToDst;
            }
        }
        else
        {
            ConnectorMap *tmpMap = new ConnectorMap;

            (*tmpMap)[oDstType.getId()] = pSrcToDst;

            mConnectorMap[oSrcType.getId()] = tmpMap;
        }
    }

    // src -> dst
    {
        EntryMapConstIt dstIt = mConnectorMap.find(oDstType.getId());

        if(dstIt != mConnectorMap.end())
        {
            ConnectorMapConstIt srcIt =
                dstIt->second->find(oSrcType.getId());

            if(srcIt != dstIt->second->end())
            {
                fprintf(stderr,
                        "error conversion already registered for %s -> %s\n",
                        oDstType.getCName(),
                        oSrcType.getCName());

                delete pDstToSrc;
            }
            else
            {
                (*(dstIt->second))[oSrcType.getId()] = pDstToSrc;
            }
        }
        else
        {
            ConnectorMap *tmpMap = new ConnectorMap;

            (*tmpMap)[oSrcType.getId()] = pDstToSrc;

            mConnectorMap[oDstType.getId()] = tmpMap;
        }
    }
}