Exemplo n.º 1
0
bool CSubsystem::mapSubsystemElements(string& strError)
{
    // Default mapping context
    _contextStack.push(CMappingContext(_contextMappingKeyArray.size()));

    // Map all instantiated subelements in subsystem
    uint32_t uiNbChildren = getNbChildren();
    uint32_t uiChild;

    for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {

        CInstanceConfigurableElement* pInstanceConfigurableChildElement = static_cast<CInstanceConfigurableElement*>(getChild(uiChild));

        if (!pInstanceConfigurableChildElement->map(*this, strError)) {

            return false;
        }
    }
    return true;
}
bool CInstanceConfigurableElement::map(IMapper& mapper, std::string& strError)
{
    bool bHasMappingData = getTypeElement()->hasMappingData();
    bool bKeepDiving = true;

    // Begin
    if (bHasMappingData && !mapper.mapBegin(this, bKeepDiving, strError)) {

        return false;
    }

    // Go on through children?
    if (bKeepDiving) {

        // Map children
        size_t uiNbChildren = getNbChildren();
        size_t uiChild;

        for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {

            CInstanceConfigurableElement* pInstanceConfigurableChildElement =
                    static_cast<CInstanceConfigurableElement*>(getChild(uiChild));

            if (!pInstanceConfigurableChildElement->map(mapper, strError)) {

                return false;
            }
        }
    }

    // End
    if (bHasMappingData) {

        mapper.mapEnd();
    }
    return true;
}