Program Listing for File pvTimeStamp.h

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

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

#include <string>
#include <stdexcept>

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

#include <shareLib.h>

namespace epics { namespace pvData {

class epicsShareClass PVTimeStamp {
public:
    PVTimeStamp(){}
    //default constructors and destructor are OK
    //This class should not be extended

    //returns (false,true) if pvField(is not, is) a valid timeStamp structure
    /*
     * Attach to a field of a PVData object.
     * @param pvField The pvField.
     * @return (false,true) if the pvField (is not, is) an timeStamp structure.
     */
    bool attach(PVFieldPtr const & pvField);
    void detach();
    bool isAttached();
    // following throw logic_error if not attached to PVField
    // set returns false if field is immutable
    void get(TimeStamp & timeStamp) const;
    bool set(TimeStamp const & timeStamp);
private:
    static std::string noTimeStamp;
    static std::string notAttached;
    PVLongPtr pvSecs;
    PVLongPtr pvUserTag;
    PVIntPtr pvNano;
};

}}
#endif  /* PVTIMESTAMP_H */