Exemplo n.º 1
0
boost::any OmnisTools::getAnyFromEXTFldVal(EXTfldval& val) {
    // Get column definition type
    ffttype fft;
    qshort fdp;
    val.getType( fft, &fdp );
    
    str255 colName;
    EXTqlist *listVal;
    EXTfldval colVal, colTitleVal;
    std::vector<ParamMap> listVector;
    boost::any ret;
    
    // Assign map based on definition
    switch (fft) {
        case fftCharacter:
            ret = getStringFromEXTFldVal(val);
            break;
        case fftInteger:
            ret = getIntFromEXTFldVal(val);
            break;
        case fftNumber:
            ret = getDoubleFromEXTFldVal(val);
            break;
        case fftBoolean:
            ret = getBoolFromEXTFldVal(val);
            break;
        case fftBinary:
            ret = getBinaryVectorFromEXTFldVal(val);
            break;
        case fftRow:
        case fftList:
            listVal = val.getList(qfalse);
            listVector.clear();
            for( qlong curRow = 1; curRow < listVal->rowCnt(); ++curRow ) {
                ParamMap row;
                for( qlong curCol = 1; curCol < listVal->colCnt(); ++curCol ) {
                    listVal->getCol(curCol, qfalse, colName);
                    colTitleVal.setChar(colName);
                    listVal->getColValRef(curRow, curCol, colVal, qfalse);
                    row[getStringFromEXTFldVal(colTitleVal)] = getAnyFromEXTFldVal(colVal);
                }
                listVector.push_back(row);
            }
            ret = listVector;
            break;
        default:
            LOG_DEBUG << "Unknown column type when converting parameters.";
            break;
    }
    
    return ret;
}
Exemplo n.º 2
0
bool OmnisTools::getParamsFromRow(tThreadData* pThreadData, EXTfldval& row, ParamMap& params) {
    
    if(getType(row).valType != fftRow && getType(row).valType != fftList) {
        return false;
    }
    
    // Convert row into more appropriate variables for parameters
    str255 colName;
    EXTfldval colVal, colTitleVal;
    EXTqlist rowData;
    row.getList(&rowData, qfalse);
    for( qshort col = 1; col <= rowData.colCnt(); ++col) {
        rowData.getCol(col, qfalse, colName);
        colTitleVal.setChar(colName);
        rowData.getColValRef(1, col, colVal, qfalse);
        
        params[getStringFromEXTFldVal(colTitleVal)] = getAnyFromEXTFldVal(colVal);
    }    
    
    return true;
}