Files
pvData/pvDataApp/monitor/monitor.h
2011-05-12 09:15:15 -04:00

111 lines
3.3 KiB
C++

/* monitor.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef MONITOR_H
#define MONITOR_H
#include <status.h>
#include <destroyable.h>
#include <pvData.h>
#include <sharedPtr.h>
#include <bitSet.h>
namespace epics { namespace pvData {
/**
* Class instance representing monitor element.
* @author mrk
*/
class MonitorElement {
public:
typedef std::tr1::shared_ptr<MonitorElement> shared_pointer;
typedef std::tr1::shared_ptr<const MonitorElement> const_shared_pointer;
/**
* Get the PVStructure.
* @return The PVStructure.
*/
virtual PVStructure::shared_pointer getPVStructure() = 0;
/**
* Get the bitSet showing which fields have changed.
* @return The bitSet.
*/
virtual BitSet::shared_pointer getChangedBitSet() = 0;
/**
* Get the bitSet showing which fields have been changed more than once.
* @return The bitSet.
*/
virtual BitSet::shared_pointer getOverrunBitSet() = 0;
};
/**
* Interface for Monitor.
* @author mrk
*/
class Monitor : public Destroyable, private NoDefaultMethods {
public:
typedef std::tr1::shared_ptr<Monitor> shared_pointer;
typedef std::tr1::shared_ptr<const Monitor> const_shared_pointer;
/**
* Start monitoring.
* @return completion status.
*/
virtual Status start() = 0;
/**
* Stop Monitoring.
* @return completion status.
*/
virtual Status stop() = 0;
/**
* If monitor has occurred return data.
* @return monitorElement for modified data.
* Must call get to determine if data is available.
*/
virtual MonitorElement::shared_pointer poll() = 0;
/**
* Release a MonitorElement that was returned by poll.
* @param monitorElement
*/
virtual void release(
MonitorElement::shared_pointer monitorElement) = 0;
};
/**
* Requester for ChannelMonitor.
* @author mrk
*/
class MonitorRequester : public virtual Requester {
public:
typedef std::tr1::shared_ptr<MonitorRequester> shared_pointer;
typedef std::tr1::shared_ptr<const MonitorRequester> const_shared_pointer;
/**
* The client and server have both completed the createMonitor request.
* @param status Completion status.
* @param monitor The monitor
* @param structure The structure defining the data.
*/
virtual void monitorConnect(const Status &status,
Monitor &monitor, StructureConstPtr structure) = 0;
/**
* A monitor event has occurred.
* The requester must call Monitor.poll to get data.
* @param monitor The monitor.
*/
virtual void monitorEvent(Monitor &monitor) = 0;
/**
* The data source is no longer available.
* @param monitor The monitor.
*/
virtual void unlisten(Monitor &monitor) = 0;
};
}}
#endif /* MONITOR_H */