//______________________________________________________________________________
shutterStructs::shutterObject * shutterInterface::getShutterObject( const std::string &name )
{
    if( entryExists( allShutterData, name ) )
        return &allShutterData[ name ];
    else
        return nullptr;
}
//______________________________________________________________________________
VELA_ENUM::SHUTTER_STATE shutterInterface::getShutterState( const  std::string &name )
{
    VELA_ENUM::SHUTTER_STATE r = VELA_ENUM::SHUTTER_STATE::SHUTTER_ERROR;
    if( entryExists( allShutterData, name ) )
        r = allShutterData[ name ].shutterState;
    return r;
}
//______________________________________________________________________________
double beamPositionMonitorInterface::getYFromPV( const std::string & bpmName )
{
    double r = UTL::DUMMY_DOUBLE;
    if( entryExists( bpmObj.dataObjects, bpmName ) )
        return bpmObj.dataObjects.at( bpmName ).yPV;
    else
        return r;
}
//______________________________________________________________________________
double beamPositionMonitorInterface::getQ( const std::string & bpmName )
{
    double r = UTL::DUMMY_DOUBLE;
    if( entryExists( bpmObj.dataObjects, bpmName ) && bpmObj.dataObjects.at( bpmName ).bpmRawData.q.size() != 0 )
        return bpmObj.dataObjects.at( bpmName ).bpmRawData.q.back();
    else
        return r;
}
//______________________________________________________________________________
std::vector< std::string > beamPositionMonitorInterface::getStrTimeStamps( const std::string & bpmName )
{
    std::vector< std::string > r;
    if( entryExists( bpmObj.dataObjects, bpmName ) && bpmObj.dataObjects.at( bpmName ).bpmRawData.strTimeStamps.size() != 0 )
        return bpmObj.dataObjects.at( bpmName ).bpmRawData.strTimeStamps;
    else
        return r;
}
//______________________________________________________________________________
long beamPositionMonitorInterface::getRD2( const std::string & bpmName )
{
    long r = UTL::DUMMY_LONG;
    if( entryExists( bpmObj.dataObjects, bpmName ) )
        return bpmObj.dataObjects.at( bpmName ).rd2;
    else
        return r;
}
//______________________________________________________________________________
std::vector< double > beamPositionMonitorInterface::getBPMQVec( const std::string & bpmName )
{
    std::vector< double > r;
    if( entryExists( bpmObj.dataObjects, bpmName ) && bpmObj.dataObjects.at( bpmName ).bpmRawData.q.size() != 0 )
        return bpmObj.dataObjects.at( bpmName ).bpmRawData.q;
    else
        return r;
}
//______________________________________________________________________________
long beamPositionMonitorInterface::getRA1( const std::string & bpmName )
{
    /// djs 10.11.15, i think this needs to be more like:
    long r = UTL::DUMMY_LONG;
    if( entryExists( bpmObj.dataObjects, bpmName ) )
        return bpmObj.dataObjects.at( bpmName ).ra1;
    else
        return r;
}
//______________________________________________________________________________
std::map< VELA_ENUM::ILOCK_NUMBER, VELA_ENUM::ILOCK_STATE > shutterInterface::getILockStates( const std::string & name )
{
    if( entryExists( allShutterData, name ) )
        return allShutterData[ name ].iLockStates;
    else
    {
        std::map< VELA_ENUM::ILOCK_NUMBER, VELA_ENUM::ILOCK_STATE > r = {{VELA_ENUM::ILOCK_NUMBER::ILOCK_ERR, VELA_ENUM::ILOCK_STATE::ILOCK_ERROR}};
        return r;
    }
}
//______________________________________________________________________________
std::map< VELA_ENUM::ILOCK_NUMBER, std::string  >  shutterInterface::getILockStatesStr( const std::string & name )
{
    std::map< VELA_ENUM::ILOCK_NUMBER, std::string  > r;

    if( entryExists( allShutterData, name ) )
        for( auto it : allShutterData[ name ].iLockStates )
            r[ it.first ] = ENUM_TO_STRING( it.second );
    else
        r[ VELA_ENUM::ILOCK_NUMBER::ILOCK_ERR ] = ENUM_TO_STRING( VELA_ENUM::ILOCK_STATE::ILOCK_ERROR );
    return r;
}
//______________________________________________________________________________
double beamPositionMonitorInterface::getXFromPV( const std::string & bpmName )
{
    /// The EPICS X/Y values (EBT-INJ-DIA-BPMC-[xx]:X / Y) neglect certain factors which
    /// should be considered to get an accurate value for x/y. This function returns the
    /// x value directly from EPICS. Use the function getX/Y for the calculated values.
    double r = UTL::DUMMY_DOUBLE;
    if( entryExists( bpmObj.dataObjects, bpmName ) )
        return bpmObj.dataObjects.at( bpmName ).xPV;
    else
        return r;
}
//______________________________________________________________________________
bool shutterInterface::isClosed( const std::string & name )
{
    bool ret = false;
    if(  entryExists( allShutterData, name ) )
        if( allShutterData[name].shutterState == VELA_ENUM::SHUTTER_STATE::SHUTTER_CLOSED )
            ret = true;
    if( ret )
        debugMessage( name, " is closed");
    else
        debugMessage( name, " is NOT closed");
    return ret;
}
示例#13
0
bool CacheManager::addEmptyEntry(const std::string& name) {
    if (entryExists(name)) {
        return false;
    }

    std::unique_ptr<CacheData> cd(new CacheData);
    cd->createEmpty(name, entry_counter_++);

    cache_map_[name] = std::move(cd);

    addDirectories(name);

    return true;
}
示例#14
0
bool CacheManager::addFileContents(const std::string& name,
                                   const std::string& path) {
    if (entryExists(name)) {
        return false;
    }

    std::unique_ptr<CacheData> cd(new CacheData);

    if (!cd->loadFromFile(name, entry_counter_++, path)) {
        return false;
    }

    cache_map_[name] = std::move(cd);

    addDirectories(name);

    return true;
}
示例#15
0
bool Database::entryExists(db_data data) {
	return entryExists(data.filePath);
}