src/CSLModels.cpp
// Try get ALL object handles, only returns anything if it is the complete list
Try get ALL object handles, only returns anything if it is the complete list
Try get ALL object handles only returns anything if it is the complete list
std::list<XPLMObjectRef> CSLModel::GetAllObjRefs ()
{
    if (bVertOfsReadFromFile) {
        bVertOfsReadFromFile = false;
        futVertOfs = std::async(std::launch::async,
                                &CSLModel::FetchVertOfsFromObjFile, this);
    }
    bool bFullyLoaded = true;
    std::list<XPLMObjectRef> l;
    for (CSLObj& obj: listObj)                  
    {
        if (obj.IsInvalid())                    
            return std::list<XPLMObjectRef>();  
        l.push_back(obj.GetAndLoadObj());       
        if (l.back() == NULL)                   
            bFullyLoaded = false;                in the end
    }
    if (futVertOfs.valid()) {                   
        if (futVertOfs.wait_for(std::chrono::seconds(0)) != std::future_status::ready)
            bFullyLoaded = false;               
        else
            vertOfs = futVertOfs.get();         
    }
    return bFullyLoaded ? l : std::list<XPLMObjectRef>();
}
std :: list < XPLMObjectRef > CSLModel :: GetAllObjRefs ( ) { if ( bVertOfsReadFromFile ) { bVertOfsReadFromFile = false ; futVertOfs = std :: async ( std :: launch :: async , & CSLModel :: FetchVertOfsFromObjFile , this ) ; } bool bFullyLoaded = true ; std :: list < XPLMObjectRef > l ; for ( CSLObj & obj : listObj ) { if ( obj . IsInvalid ( ) ) return std :: list < XPLMObjectRef > ( ) ; l . push_back ( obj . GetAndLoadObj ( ) ) ; if ( l . back ( ) == NULL ) bFullyLoaded = false ; } if ( futVertOfs . valid ( ) ) { if ( futVertOfs . wait_for ( std :: chrono :: seconds ( 0 ) ) != std :: future_status :: ready ) bFullyLoaded = false ; else vertOfs = futVertOfs . get ( ) ; } return bFullyLoaded ? l : std :: list < XPLMObjectRef > ( ) ; }
Try get ALL object handles, only returns anything if it is the complete list
Try get ALL object handles only returns anything if it is the complete list
// This loads the object, so we should make sure to have a VERT_OFFSET, too // span a job to read it from the object files // loop over all object // if any object is considered valid // return an empty list // load and save the handle // not (yet) loaded? // return an empty list in the end // Also check if our vertical offset is available now // we are waiting for a result // not yet available // avaiable, get it // return the complete list of handles if all was successful