void RemoteAspect::receiveNewType(Connection                &con,
                                  FieldContainerFactoryBase *fcFactory)
{
    UInt32      remoteTypeId = 0;
    UInt32      localTypeId  = 0;
    std::string typeName;

    con.getValue(remoteTypeId);
    con.getValue(typeName);

    FieldContainerType *fcType = fcFactory->findType(typeName.c_str());

    if(fcType != NULL)
    {
        localTypeId = fcType->getId();

        _localType[remoteTypeId] = localTypeId;
    }
    else
    {
        SWARNING << "Unrecognized remote type '" << typeName
                 << "' remote type id '" << remoteTypeId
                 << "'." << std::endl;
    }

#ifndef OSG_REMOTE_ASPECT_SILENT
    SLOG << "Receive NEWTYPE: type name '" << typeName
         << "' type id (r/l) '" << remoteTypeId
         << "/" << localTypeId << "'\n";
#endif
}
void OSGSceneFileType::registerEndNodeCallback(const FieldContainerType &type, 
                                               const Functor            &func)
{
    _endNodeFunctors.resize(type.getId() + 1, NULL);

    _endNodeFunctors[type.getId()] = func;
}
void MemoryConsumption::print(std::ostream &os, bool ignoreProto) const
{
    TypeMemMapConstIt tmIt  = _memMap.begin();
    TypeMemMapConstIt tmEnd = _memMap.end  ();

    SizeT         totalMem   = 0;
    UInt32        totalCount = 0;
    boost::format formatter("%|1$-25| [%|2$8|] Byte [%|3$8.0f|] kByte [%|4$4|]\n");

    for(; tmIt != tmEnd; ++tmIt)
    {
        FieldContainerType *fcType =
            FieldContainerFactory::the()->findType(tmIt->first);

        if(fcType == NULL)
            continue;

        if(ignoreProto && tmIt->second.second == 1)
            continue;

        os << formatter % fcType->getCName()
                        % tmIt->second.first
                        % (tmIt->second.first / 1024.f)
                        % tmIt->second.second;

        totalMem   += tmIt->second.first;
        totalCount += tmIt->second.second;
    }

    os << "--------------------------------------------\n";
    os << formatter % "Total"
                    % totalMem
                    % (totalMem / 1024.f)
                    % totalCount;
}
void TextureFieldContainerEditor::initMethod(InitPhase ePhase)
{
    Inherited::initMethod(ePhase);

    if(ePhase == TypeObject::SystemPost)
    {
        //Fill in all of the editable types
        UInt32 NumTypes(FieldContainerFactory::the()->getNumTypes());
        UInt32 FoundTypes(0);
        FieldContainerType* type;
        for(UInt32 i(0) ; FoundTypes<NumTypes; ++i)
        {
            type = FieldContainerFactory::the()->findType(i);
            if(type != NULL)
            {
                ++FoundTypes;
                if(type->isDerivedFrom(TextureBaseChunk::getClassType()))
                {
                    _EditableTypes.push_back(type);
                    FieldContainerEditorFactory::the()->setDefaultEditor(type,
                                                                         &getClassType());
                    FieldContainerEditorFactory::the()->setEditorType(type,
                                                                      &getClassType(),
                                                                      "Texture");
                }
            }
        }
    }
}
bool SharePtrGraphOp::traverse(Node *root)
{
    if(!_includeSet.empty() && !_excludeSet.empty())
    {
        FFATAL(("SharePtrGraphOp : Setting both the includes and excludes"
                "is not allowed!\n"));
        return false;
    }

    _typeMap   .clear();
    _shareCount.clear();

    _totalTime   = 0.0f;
    _compareTime = 0.0f;

    Time startTime = getSystemTime();

    shareFC(root);

    _totalTime = getSystemTime() - startTime;

    // DEBUG
    SINFO << "SharePtrGraphOp::traverse: _totalTime: " << _totalTime
          << " _compareTime: " << _compareTime << "\n";
    SINFO << "SharePtrGraphOp::traverse: Unique containers by type:\n";

    FCTypeMapIt tmIt  = _typeMap.begin();
    FCTypeMapIt tmEnd = _typeMap.end  ();

    for(; tmIt != tmEnd; ++tmIt)
    {
        UInt32              typeId = tmIt->first;
        FieldContainerType *fcType = FieldContainerFactory::the()->findType(typeId);

        SINFO << "TypeId [" << typeId << "] [" << (fcType != NULL ? fcType->getCName() : "")
              << "] -- [" << tmIt->second.size() << "]\n";
    }

    SINFO << "SharePtrGraphOp::traverse: Shared containers by type:\n";

    ShareCountIt scIt  = _shareCount.begin();
    ShareCountIt scEnd = _shareCount.end  ();

    for(; scIt != scEnd; ++scIt)
    {
        UInt32              typeId = scIt->first;
        FieldContainerType *fcType = FieldContainerFactory::the()->findType(typeId);

        SINFO << "TypeId [" << typeId << "] [" << (fcType != NULL ? fcType->getCName() : "")
              << "] -- [" << scIt->second << "]\n";
    }

    SINFO << std::flush;

    _typeMap   .clear();
    _shareCount.clear();

    return true;
}
void RemoteAspect::registerChanged(const FieldContainerType &type,
                                   const Functor &func)
{
    while(type.getId() >= _changedFunctors.size())
    {
        _changedFunctors.push_back(&_defaultChangedFunction);
    }

    _changedFunctors[type.getId()] = func;
}
void AdapterDrawAction::registerLeaveDefault (const FieldContainerType &type, 
						  const Action::Functor &func )
{
    if ( ! _defaultLeaveFunctors )
        _defaultLeaveFunctors = new vector<Action::Functor>;

    while(type.getId() >= _defaultLeaveFunctors->size())
    {
        _defaultLeaveFunctors->push_back( 
                osgFunctionFunctor2(&Action::_defaultLeaveFunction));
    }
    
    (*_defaultLeaveFunctors)[ type.getId() ] = func;
}
예제 #8
0
    static NewNodePtr create(void)
        {
            NewNodePtr fc;

#ifdef OSG_HAS_TEMPLATE_RETURNVALUES
            if(_type.getPrototype() != NullFC)
                fc = _type.getPrototype()->clone().dcast<NewNodePtr>();
#else
            if(_type.getPrototype() != NULL)
                _type.getPrototype()->clone().dcast(fc);
#endif

            return fc;
        }
void IntersectAction::registerLeaveDefault(const FieldContainerType &type, 
                                           const Action::Functor    &func)
{
    if(! _defaultLeaveFunctors)
    {
        _defaultLeaveFunctors = new FunctorStore;

        addPostFactoryExitFunction(&IntersectAction::terminateLeave);
    }

    while(type.getId() >= _defaultLeaveFunctors->size())
    {
        _defaultLeaveFunctors->push_back(
            &IntersectAction::_defaultLeaveFunction);
    }
    
    (*_defaultLeaveFunctors)[type.getId()] = func;
}
void
AnimBindAction::registerLeaveDefault(const FieldContainerType &type,
                                     const Action::Functor    &func )
{
    if(_defaultLeaveFunctors == NULL)
    {
        _defaultLeaveFunctors = new FunctorStore;

        addPostFactoryExitFunction(&AnimBindAction::terminateLeave);
    }

    if(type.getId() >= _defaultLeaveFunctors->size())
    {
        _defaultLeaveFunctors->resize(type.getId() + 1,
                                      &AnimBindAction::_defaultLeaveFunction);
    }

    (*_defaultLeaveFunctors)[type.getId()] = func;
}
예제 #11
0
void ShadingAction::registerLeaveDefault(const FieldContainerType &type, 
                                         const Action::Functor    &func)
{
    if(_vDefaultLeaveFunctors == NULL)
    {
        _vDefaultLeaveFunctors = new std::vector<Action::Functor>;
    }

    while(type.getId() >= _vDefaultLeaveFunctors->size())
    {
        _vDefaultLeaveFunctors->push_back( 
            osgTypedFunctionFunctor2CPtrRef<
                ResultE, 
                CNodePtr,
                Action *                   >(&Action::_defaultLeaveFunction));
    }
    
    (*_vDefaultLeaveFunctors)[type.getId()] = func;
}
예제 #12
0
QOSGWidgetFactory::FieldEditorCF
QOSGWidgetFactory::getFieldEditor(const FieldContainerType &fcType,
                                  const FieldType          &fType,
                                  const Char8              *fName    )
{
    UInt32           fcTypeId = fcType.getId(                 );
    UInt32           fTypeId  = fType .getId(                 );
    UInt64           index    = getIndex    (fcTypeId, fTypeId);

    return getFieldEditor(index, fName, fType.getCardinality());
}
void RenderAction::registerLeaveDefault(
    const FieldContainerType &type,
    const Action::Functor    &func)
{
    if(_vDefaultLeaveFunctors == NULL)
    {
        _vDefaultLeaveFunctors = new Action::FunctorStore;

        addPostFactoryExitFunction(&RenderAction::terminateLeave);
    }

    while(type.getId() >= _vDefaultLeaveFunctors->size())
    {
        _vDefaultLeaveFunctors->push_back(&Action::_defaultLeaveFunction);
    }

    FDEBUG_GV(("Register rendertrav leave for %s\n", type.getCName()));

    (*_vDefaultLeaveFunctors)[type.getId()] = func;
}
예제 #14
0
void
QOSGWidgetFactory::registerFieldEditor(const FieldContainerType &fcType,
                                       const FieldType          &fType,
                                       const Char8              *fName,
                                             FieldEditorCF       cFunc    )
{
    UInt32           fcTypeId = fcType.getId(                 );
    UInt32           fTypeId  = fType .getId(                 );
    UInt64           index    = getIndex    (fcTypeId, fTypeId);

    registerFieldEditor(index, fName, cFunc);
}
void DerivedFieldContainerTypeIterator::operator++ (void)
{
    _pCurrentType = NULL;
    
    ++_uiCurrentType;

    for(; _uiCurrentType < TypeFactory::the()->getNumTypes(); 
        ++_uiCurrentType)
    {
        FieldContainerType *pTestType = 
            FieldContainerFactory::the()->findType(_uiCurrentType);

        if(pTestType                        != NULL)
        {
            if(pTestType->isDerivedFrom(*_pRef) == true   )
            {
                _pCurrentType = pTestType;
                
                break;
            }
        }
    }
}
void SharePtrGraphOp::setExcludes(const std::string &excludes)
{
    _excludeSet.clear();

    // parse comma separated names.
    std::string::const_iterator nextComma;
    std::string::const_iterator curPos     = excludes.begin();

    while(curPos < excludes.end())
    {
        nextComma = std::find(curPos, excludes.end(), ',');
        // strip leading spaces
        curPos = std::find_if(curPos, nextComma,
                              std::not1(std::ptr_fun(isspace)));

        std::string typeName(curPos, nextComma);

        FieldContainerType *fcType =
            FieldContainerFactory::the()->findType(typeName.c_str());

        if(fcType != NULL)
        {
            _excludeSet.insert(fcType->getId());
        }
        else
        {
            SWARNING << "SharePtrGraphOp::setExcludes: Unrecognized type ["
                    << typeName << "]." << std::endl;
        }

        if(nextComma != excludes.end())
            ++nextComma;

        curPos = nextComma;
    }
}
예제 #17
0
//! conveniance function for finding a specific attachment in the volume kit
AttachmentPtr DVRVolume::findParameter(const FieldContainerType &type, 
                                             UInt16              binding)
{
    DVRAppearancePtr app = getAppearance();

    if(osgLog().getLogLevel() == LOG_DEBUG)
    {
        FDEBUG(("DVRVolume::findParameter: \n"));
        type.dump();
    }

    if(app != NullFC) 
        return app->findAttachment(type, binding);

    SWARNING << "DVRVolume::findParameter - NO such parameter " << std::endl;
   
    return NullFC;
}
예제 #18
0
bool FieldContainerFactory::initializePendingTypes(void)
{
    bool                returnValue = true;
    FieldContainerType *pType       = NULL;

    if(_bInitialized == false)
        return false;

    SINFO << "OSGFieldContainerFactory init pending types" << std::endl;

    if(_pUnitTypesStore != NULL)
    {
        if(_pMapLock != NULL)
            _pMapLock->aquire();

        UninitTypeStoreIt uninitIt = _pUnitTypesStore->begin();

        while(uninitIt != _pUnitTypesStore->end())
        {
            pType = *uninitIt;

            if(pType->isInitialized() == true)
            {
                uninitIt = _pUnitTypesStore->erase(uninitIt);

//                (*_pTypeIdMap  )[pType->getId()                 ] = pType;

                TypeIdMap::value_type val(pType->getId(), pType);

                _pTypeIdMap->insert(val);

                (*_pTypeNameMap)[IDStringLink(pType->getCName())] = pType;
            }
            else
            {
                if(pType->initialize() == true)
                {
                    uninitIt = _pUnitTypesStore->erase(uninitIt);

//                  (*_pTypeIdMap  )[pType->getId()                 ] = pType;

                    TypeIdMap::value_type val(pType->getId(), pType);
                    
                    _pTypeIdMap->insert(val);

                    (*_pTypeNameMap)[IDStringLink(pType->getCName())] = pType;
                }
                else
                {
                    returnValue = false;

                    uninitIt++;
                }
            }
        }

        if(_pMapLock != NULL)
            _pMapLock->release();

        PINFO << "("
                 << returnValue
                 << "|"
                 << _pUnitTypesStore->size()
                 << ")"
                 << std::endl;
    }

    return returnValue;
}
ComponentTransitPtr GenericFieldContainerEditor::createFCToolTip(const FieldContainerType &FCType)
{
    std::string FieldDoc(doxygenToPlainFormatting(FCType.getDocumentation()));

    //TypeName
    LabelRecPtr TypeLabel = Label::create();
    TypeLabel->setText(FCType.getName());
    TypeLabel->setAlignment(Vec2f(0.5f,0.5f));
    TypeLabel->setBackgrounds(NULL);

    //Separator
    SeparatorRecPtr MainSeparator = Separator::create();
    MainSeparator->setOrientation(Separator::HORIZONTAL_ORIENTATION);
    MainSeparator->setSeparatorSize(1.0f);
    MainSeparator->setPreferredSize(Vec2f(1.0f,5.0f));
    MainSeparator->setBackgrounds(NULL);

    //Inheritance Panel Layout
    //LabelRecPtr InheritanceLabel = Label::create();
    //InheritanceLabel->setText("Inheritance");

    //FlowLayoutRecPtr InheritancePanelLayout = FlowLayout::create();
    //InheritancePanelLayout->setOrientation(FlowLayout::VERTICAL_ORIENTATION);
    //InheritancePanelLayout->setVerticalGap(3.0f);
    //InheritancePanelLayout->setMajorAxisAlignment(0.0f);
    //InheritancePanelLayout->setMinorAxisAlignment(0.5f);
    //InheritancePanelLayout->setComponentAlignment(0.5f);

    ////Inheritance Panel
    //PanelRecPtr InheritancePanel = Panel::createEmpty();
    //InheritancePanel->setAllInsets(5.0f);
    //InheritancePanel->setLayout(InheritancePanelLayout);

    //const TypeBase *ParentType(&FCType);
    ////while()
    ////{
        ////ToolTipPanel->pushToChildren(DescriptionTextArea);
    ////}
    //LabelRecPtr TypeNameLabel = Label::create();
    //TypeNameLabel->setText(FCType.getName());
    //TypeNameLabel->setAlignment(Vec2f(0.5f,0.5f));

    //InheritancePanel->pushToChildren(TypeNameLabel);

    //Set the layout constraints
    BorderLayoutConstraintsRecPtr CenterConstraints = BorderLayoutConstraints::create();
    CenterConstraints->setRegion(BorderLayoutConstraints::BORDER_CENTER);

    //Description Panel
    LabelRecPtr DescriptionLabel = Label::create();
    DescriptionLabel->setText("Description:");
    DescriptionLabel->setBackgrounds(NULL);

    TextAreaRecPtr DescriptionTextArea = TextArea::create();
    DescriptionTextArea->setText(FieldDoc);
    DescriptionTextArea->setEditable(false);
    DescriptionTextArea->setBorders(NULL);
    DescriptionTextArea->setBackgrounds(NULL);
    DescriptionTextArea->setConstraints(CenterConstraints);

    //Description Panel
    PanelRecPtr DescriptionPanel = Panel::create();
    BorderLayoutRecPtr DescriptionPanelLayout = BorderLayout::create();
    DescriptionPanel->setAllInsets(5.0f);
    DescriptionPanel->setLayout(DescriptionPanelLayout);
    DescriptionPanel->pushToChildren(DescriptionTextArea);
    DescriptionPanel->setBackgrounds(NULL);


    //ToolTip Layout
    PanelRecPtr ToolTipPanel = Panel::createEmpty();

    SpringLayoutRecPtr MainLayout = SpringLayout::create();

    //TypeLabel    
    MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, TypeLabel, 5,
                              SpringLayoutConstraints::NORTH_EDGE, ToolTipPanel);
    MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, TypeLabel, -5,
                              SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
    MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, TypeLabel, 5,
                              SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);

    //MainSeparator    
    MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, MainSeparator, 1,
                              SpringLayoutConstraints::SOUTH_EDGE, TypeLabel);
    MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, MainSeparator, -15,
                              SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
    MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, MainSeparator, 15,
                              SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);

    ////InheritancePanel
    //MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, InheritanceLabel, 1,
                              //SpringLayoutConstraints::SOUTH_EDGE, MainSeparator);
    //MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, InheritanceLabel, 0,
                              //SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
    //MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, InheritanceLabel, 0,
                              //SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);

    ////InheritancePanel
    //MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, InheritancePanel, 1,
                              //SpringLayoutConstraints::SOUTH_EDGE, InheritanceLabel);
    //MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, InheritancePanel, 0,
                              //SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
    //MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, InheritancePanel, 0,
                              //SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);


    //DescriptionTextArea
    MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, DescriptionLabel, 1,
                              SpringLayoutConstraints::SOUTH_EDGE, MainSeparator);
    MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, DescriptionLabel, -5,
                              SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
    MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, DescriptionLabel, 5,
                              SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);

    //DescriptionTextArea
    MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, DescriptionPanel, 1,
                              SpringLayoutConstraints::SOUTH_EDGE, DescriptionLabel);
    MainLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, DescriptionPanel, -5,
                              SpringLayoutConstraints::SOUTH_EDGE, ToolTipPanel);
    MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, DescriptionPanel, -5,
                              SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
    MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, DescriptionPanel, 5,
                              SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);

    //ToolTip Panel

    Component* DefaultToolTip(LookAndFeelManager::the()->getLookAndFeel()->getDefaultToolTip());
    ToolTipPanel->setBorders(DefaultToolTip->getBorder());
    ToolTipPanel->setBackgrounds(DefaultToolTip->getBackground());
    ToolTipPanel->setForegrounds(DefaultToolTip->getForeground());
    ToolTipPanel->setLayout(MainLayout);
    ToolTipPanel->pushToChildren(TypeLabel);
    ToolTipPanel->pushToChildren(MainSeparator);
    //ToolTipPanel->pushToChildren(InheritanceLabel);
    //ToolTipPanel->pushToChildren(InheritancePanel);
    ToolTipPanel->pushToChildren(DescriptionLabel);
    ToolTipPanel->pushToChildren(DescriptionPanel);

    Real32 Height(100.0f + DescriptionTextArea->getLineHeight()
                  * (DescriptionTextArea->getText().size()/40));
    ToolTipPanel->setPreferredSize(Vec2f(300.0f,Height));

    return ComponentTransitPtr(ToolTipPanel);
}
void RemoteAspect::receiveCreated(Connection                &con,
                                  FieldContainerFactoryBase *fcFactory,
                                  FieldContainerVector      &newContainers)
{
    UInt32 remoteTypeId = 0;
    UInt32 localTypeId  = 0;
    UInt32 remoteId     = 0;

    con.getValue(remoteTypeId);
    con.getValue(remoteId);

    LocalTypeMapT::const_iterator  localTypeIt = _localType.find(remoteTypeId);
    FieldContainerType            *fcType      = NULL;
    FieldContainerUnrecPtr         fcPtr       = NULL;

    if(localTypeIt != _localType.end())
    {
        UInt64 fullRemoteId = getFullRemoteId(remoteId);

        if(_localFC.find(fullRemoteId) == _localFC.end())
        {
            localTypeId = localTypeIt->second;
            fcType      = fcFactory->findType(localTypeId);
            fcPtr       = fcType->createContainer();

            // remove this node, when aspect is removed
            _receivedFC.insert(fcPtr->getId());

            // local <-> remote mapping
            _localFC [fullRemoteId  ] = fcPtr->getId();
            _remoteFC[fcPtr->getId()] = fullRemoteId;

            callCreated(fcPtr);

            newContainers.push_back(fcPtr);

#ifndef OSG_REMOTE_ASPECT_SILENT
            SLOG << "Receive CREATED: type (r/l) '" << remoteTypeId
                 << "/" << localTypeId
                 << "' id (r/l) '" << remoteId << "/"
                 << (fcPtr  != NULL ? fcPtr->getId()     : 0)
                 << "' type name '"
                 << (fcType != NULL ? fcType->getName() : "")
                 << "'\n";
#endif
        }
        else
        {
            SWARNING << "Already created a local container ("
                     << _localFC[fullRemoteId] << ") for "
                     << "remote container id '" << remoteId
                     << "'" << std::endl;
        }
    }
    else
    {
        SWARNING << "Unknown (remote) type id '" << remoteTypeId
                 << "' for (remote) container id '" << remoteId
                 << "'" << std::endl;
    }
}
예제 #21
0
void FieldContainerFactory::writeSingleTypeFCD(      std::ostream       &out, 
                                               const FieldContainerType *t  )
{
    FieldContainerType *parent = t->getParent();

    out << "<FieldContainer"                          << std::endl;
    out << "\tname=\""       << t->getCName() << "\"" << std::endl;

    if(parent != NULL)
        out << "\tparent=\"" << parent->getCName() << "\"" << std::endl;
    
    out << "\tlibrary=\""
        << "???"
        << "\"" 
        << std::endl;
    out << "\tstructure=\"" 
        << ( t->isAbstract()?"abstract":"concrete" ) 
        << "\""
        << std::endl;

    // look for pointerfield types
           std::string s;
           Int32       pt        = 0;
    static const Char8 *pftypes[] = {"none", "single", "multi", "both"};

    s  = "SF";
    s += t->getCName();
    s += "Ptr";

    if(FieldFactory::the().getFieldType(s.c_str()) != NULL)
    {
        pt |= 1;
    }

    s  = "MF";
    s += t->getCName();
    s += "Ptr";
    
    if(FieldFactory::the().getFieldType(s.c_str()) != NULL)
    {
        pt |= 2;
    }

    out << "\tpointerfieldtypes=\"" << pftypes[pt] << "\"" << std::endl;
    out << ">"                                             << std::endl;

    // Print the fields in this FC, ignore the parents' fields
    // !!! This should start at 0, FIX ME

    for(UInt32 i  = parent ? parent->getNumFieldDescs() + 1 : 1;
               i <= t->getNumFieldDescs();
               i++)
    {
        const FieldDescription *f  = t->getFieldDescription(i);
              FieldType        *ft = NULL;

        ft = FieldFactory::the().getFieldType(f->getTypeId());

        out << "\t<Field"                             << std::endl;
        out << "\t\tname=\"" << f->getCName() << "\"" << std::endl;

        // Filter the SF/MF from the type
        const Char8 *c = ft->getCName();

        if (! strncmp(c, "SF", 2) || ! strncmp(c, "MF", 2))
        {
            c += 2;
        }

        out << "\t\ttype=\"" << c << "\"" << std::endl;

        out << "\t\tcardinality=\""
            << (ft->getCardinality() ? "multi" : "single")
            << "\"" << std::endl;

        out << "\t\tvisibility=\"" 
            << (f->isInternal() ? "internal" : "external")
            << "\"" 
            << std::endl;
        
        out << "\t>"        << std::endl;
        out << "\t</Field>" << std::endl;
    }

    out << "</FieldContainer>" << std::endl;
}