Program Listing for File pvAlarm.h

Return to documentation for file (src/property/pv/pvAlarm.h)

/* pvAlarm.h */
/*
 * Copyright information and license terms for this software can be
 * found in the file LICENSE that is included with the distribution
 */
#ifndef PVALARM_H
#define PVALARM_H

#include <string>

#include <pv/pvType.h>
#include <pv/alarm.h>
#include <pv/pvData.h>

#include <shareLib.h>

namespace epics { namespace pvData {

class epicsShareClass PVAlarm {
public:
    PVAlarm() {}
    //default constructors and destructor are OK
    //returns (false,true) if pvField(is not, is) a valid alarm structure
    //An automatic detach is issued if already attached.
    /*
     * Attach to a field of a PVData object.
     * @param pvField The pvField.
     * @return (false,true) if the pvField (is not, is) an alarm structure.
     */
    /*
     * Attach to a field of a PVData object.
     * @param pvField The pvField.
     * @return (false,true) if the pvField (is not, is) an alarm structure.
     */
    bool attach(PVFieldPtr const & pvField);
    void detach();
    bool isAttached();
    // each of the following throws logic_error is not attached to PVField
    // set returns false if field is immutable
    void get(Alarm & alarm) const;
    bool set(Alarm const & alarm);
private:
    PVIntPtr pvSeverity;
    PVIntPtr pvStatus;
    PVStringPtr pvMessage;
    static std::string noAlarmFound;
    static std::string notAttached;
};

}}
#endif  /* PVALARM_H */