diff --git a/pvDataApp/Makefile b/pvDataApp/Makefile index 5d06118..e9b07ff 100644 --- a/pvDataApp/Makefile +++ b/pvDataApp/Makefile @@ -25,6 +25,8 @@ INC += timer.h INC += queueVoid.h INC += queue.h INC += messageQueue.h +INC += destroyable.h +INC += status.h LIBSRCS += byteBuffer.cpp LIBSRCS += bitSet.cpp @@ -106,6 +108,10 @@ SRC_DIRS += $(PVDATA)/pvMisc INC += bitSetUtil.h LIBSRCS += bitSetUtil.cpp +SRC_DIRS += $(PVDATA)/monitor +INC += monitor.h + + LIBRARY=pvData pvData_LIBS += Com diff --git a/pvDataApp/misc/destroyable.h b/pvDataApp/misc/destroyable.h new file mode 100644 index 0000000..e2a63a3 --- /dev/null +++ b/pvDataApp/misc/destroyable.h @@ -0,0 +1,25 @@ +/* destroyable.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 DESTROYABLE_H +#define DESTROYABLE_H +namespace epics { namespace pvData { + + + /** + * Instance declaring destroy method. + * @author mse + */ + class Destroyable { + public: + /** + * Destroy this instance. + */ + virtual void destroy() = 0; + }; + +}} +#endif /* DESTROYABLE_H */ diff --git a/pvDataApp/misc/status.h b/pvDataApp/misc/status.h new file mode 100644 index 0000000..6d2ca45 --- /dev/null +++ b/pvDataApp/misc/status.h @@ -0,0 +1,70 @@ +/* status.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 STATUS_H +#define STATUS_H + +#include "serialize.h" + +namespace epics { namespace pvData { + + /** + * Status type enum. + */ + enum StatusType { + /** Operation completed successfully. */ + OK, + /** Operation completed successfully, but there is a warning message. */ + WARNING, + /** Operation failed due to an error. */ + ERROR, + /** Operation failed due to an unexpected error. */ + FATAL + }; + + /** + * Status interface. + * @author mse + */ + class Status : public epics::pvData::Serializable { + public: + + /** + * Get status type. + * @return status type, non-null. + */ + virtual StatusType getType() = 0; + + /** + * Get error message describing an error. Required if error status. + * @return error message. + */ + virtual epics::pvData::String getMessage() = 0; + + /** + * Get stack dump where error (exception) happened. Optional. + * @return stack dump. + */ + virtual epics::pvData::String getStackDump() = 0; + + /** + * Convenient OK test. Same as (getType() == StatusType.OK). + * NOTE: this will return false on WARNING message although operation succeeded. + * To check if operation succeeded, use isSuccess. + * @return OK status. + * @see #isSuccess() + */ + virtual bool isOK() = 0; + + /** + * Check if operation succeeded. + * @return operation success status. + */ + virtual bool isSuccess() = 0; + }; + +}} +#endif /* STATUS_H */ diff --git a/pvDataApp/monitor/monitor.h b/pvDataApp/monitor/monitor.h new file mode 100644 index 0000000..d2fc0f6 --- /dev/null +++ b/pvDataApp/monitor/monitor.h @@ -0,0 +1,94 @@ +/* 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 +#include + +namespace epics { namespace pvData { + + /** + * Class instance representing monitor element. + * @author mrk + */ + class MonitorElement { + public: + /** + * Get the PVStructure. + * @return The PVStructure. + */ + virtual PVStructure* getPVStructure() = 0; + /** + * Get the bitSet showing which fields have changed. + * @return The bitSet. + */ + virtual BitSet* getChangedBitSet() = 0; + /** + * Get the bitSet showing which fields have been changed more than once. + * @return The bitSet. + */ + virtual BitSet* getOverrunBitSet() = 0; + }; + + + /** + * Interface for Monitor. + * @author mrk + */ + class Monitor : public Destroyable, private NoDefaultMethods { + public: + /** + * 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 on null if no monitors have occurred. + */ + virtual MonitorElement* poll() = 0; + /** + * Release a MonitorElement that was returned by poll. + * @param monitorElement + */ + virtual void release(MonitorElement* monitorElement) = 0; + }; + + + /** + * Requester for ChannelMonitor. + * @author mrk + */ + class MonitorRequester : public Requester { + public: + /** + * 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(Status* status, Monitor* monitor, Structure* 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 */