diff --git a/pvDataApp/factory/PVField.cpp b/pvDataApp/factory/PVField.cpp index 8729cac..546f883 100644 --- a/pvDataApp/factory/PVField.cpp +++ b/pvDataApp/factory/PVField.cpp @@ -150,7 +150,7 @@ bool PVField::renameField(String newName) int index = structure->getFieldIndex(newName); if(index>=0) return false; } - Field::Ptr field(const_pointer_cast(pImpl->field)); + Field::shared_pointer field(const_pointer_cast(pImpl->field)); field->renameField(newName); return true; } diff --git a/pvDataApp/factory/PVStructure.cpp b/pvDataApp/factory/PVStructure.cpp index 07bb81c..9f466ed 100644 --- a/pvDataApp/factory/PVStructure.cpp +++ b/pvDataApp/factory/PVStructure.cpp @@ -129,7 +129,7 @@ namespace epics { namespace pvData { void PVStructure::appendPVField(PVFieldPtr pvField) { - Structure::Ptr structure = const_pointer_cast(getStructure()); + Structure::shared_pointer structure = const_pointer_cast(getStructure()); structure->appendField(pvField->getField()); int origLength = pImpl->numberFields; PVFieldPtrArray oldPVFields = pImpl->pvFields; @@ -149,7 +149,7 @@ namespace epics { namespace pvData { if (numberNewFields<0) throw std::logic_error("Number of fields must be >=0"); - Structure::Ptr structure = const_pointer_cast(getStructure()); + Structure::shared_pointer structure = const_pointer_cast(getStructure()); FieldConstPtr fields[numberNewFields]; for(int i=0; igetField(); structure->appendFields(numberNewFields,fields); diff --git a/pvDataApp/misc/bitSet.h b/pvDataApp/misc/bitSet.h index 89f0af0..ccb7478 100644 --- a/pvDataApp/misc/bitSet.h +++ b/pvDataApp/misc/bitSet.h @@ -8,8 +8,8 @@ #define BITSET_H #include #include -#include "factory.h" -#include "serialize.h" +#include +#include namespace epics { namespace pvData { @@ -38,6 +38,8 @@ namespace epics { namespace pvData { */ class BitSet : public Serializable { public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; /** * Creates a new bit set. All bits are initially {@code false}. diff --git a/pvDataApp/misc/requester.h b/pvDataApp/misc/requester.h index 5c0ffaf..89b2872 100644 --- a/pvDataApp/misc/requester.h +++ b/pvDataApp/misc/requester.h @@ -8,6 +8,8 @@ #ifndef REQUESTER_H #define REQUESTER_H #include "pvType.h" +#include "sharedPtr.h" + namespace epics { namespace pvData { class Requester; @@ -20,6 +22,9 @@ extern StringArray messageTypeName; class Requester { public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; + virtual ~Requester(){} virtual String getRequesterName() = 0; virtual void message(String message,MessageType messageType) = 0; diff --git a/pvDataApp/misc/status.cpp b/pvDataApp/misc/status.cpp index ad41847..61a341d 100644 --- a/pvDataApp/misc/status.cpp +++ b/pvDataApp/misc/status.cpp @@ -18,12 +18,12 @@ Status Status::OK; //PVDATA_REFCOUNT_MONITOR_DEFINE(status); Status::Status() : - m_type(STATUSTYPE_OK) + m_type(STATUSTYPE_OK), m_message(m_emptyString), m_stackDump(m_emptyString) { } Status::Status(StatusType type, String message) : - m_type(type), m_message(message) + m_type(type), m_message(message), m_stackDump(m_emptyString) { if (type == STATUSTYPE_OK) throw std::invalid_argument("type == STATUSTYPE_OK"); diff --git a/pvDataApp/misc/timer.h b/pvDataApp/misc/timer.h index 09d9c6e..4049c92 100644 --- a/pvDataApp/misc/timer.h +++ b/pvDataApp/misc/timer.h @@ -16,6 +16,7 @@ #include "pvType.h" #include "thread.h" #include "noDefaultMethods.h" +#include "sharedPtr.h" namespace epics { namespace pvData { @@ -42,6 +43,9 @@ private: class Timer : private NoDefaultMethods { public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; + Timer(String threadName, ThreadPriority priority); ~Timer(); void scheduleAfterDelay(TimerNode &timerNode,double delay); diff --git a/pvDataApp/monitor/monitor.h b/pvDataApp/monitor/monitor.h index 5454329..b7ea238 100644 --- a/pvDataApp/monitor/monitor.h +++ b/pvDataApp/monitor/monitor.h @@ -9,39 +9,98 @@ #include #include -#include #include +#include +#include namespace epics { namespace pvData { -class MonitorElement { -public: - MonitorElement(){} - virtual ~MonitorElement(){} - virtual PVStructure* getPVStructure() = 0; - virtual BitSet* getChangedBitSet() = 0; - virtual BitSet* getOverrunBitSet() = 0; -}; + /** + * Class instance representing monitor element. + * @author mrk + */ + class MonitorElement { + public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; -class Monitor : public virtual Destroyable{ - public: - Monitor(){} - virtual ~Monitor(){} - virtual Status start() = 0; - virtual Status stop() = 0; - virtual MonitorElement* poll() = 0; - virtual void release(MonitorElement* monitorElement) = 0; -}; + /** + * 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 shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; -class MonitorRequester : public virtual Requester { - public: - MonitorRequester() {} - virtual ~MonitorRequester() {} - virtual void monitorConnect( - const Status &status, Monitor* monitor, StructureConstPtr structure) = 0; - virtual void monitorEvent(Monitor* monitor) = 0; - virtual void unlisten(Monitor* monitor) = 0; -}; + /** + * 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::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 shared_pointer; + typedef std::tr1::shared_ptr 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::shared_pointer& 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::shared_pointer& monitor) = 0; + /** + * The data source is no longer available. + * @param monitor The monitor. + */ + virtual void unlisten(Monitor::shared_pointer& monitor) = 0; + }; }} #endif /* MONITOR_H */ diff --git a/pvDataApp/pv/pvData.h b/pvDataApp/pv/pvData.h index a613a85..76c5c77 100644 --- a/pvDataApp/pv/pvData.h +++ b/pvDataApp/pv/pvData.h @@ -62,6 +62,9 @@ class PVField private NoDefaultMethods { public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; + virtual ~PVField(); String getRequesterName() ; virtual void message(String message,MessageType messageType) ; @@ -95,6 +98,9 @@ private: class PVScalar : public PVField { public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; + virtual ~PVScalar(); ScalarConstPtr getScalar() ; protected: @@ -104,6 +110,9 @@ protected: template class PVScalarValue : public PVScalar { public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; + typedef T value_type; typedef T* pointer; typedef const T* const_pointer; @@ -137,6 +146,9 @@ protected: class PVArray : public PVField, public SerializableArray { public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; + virtual ~PVArray(); int getLength() const; void setLength(int length); @@ -155,6 +167,9 @@ private: template class PVArrayData { public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; + typedef T value_type; typedef T* pointer; typedef const T* const_pointer; @@ -166,6 +181,9 @@ public: class PVScalarArray : public PVArray { public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; + virtual ~PVScalarArray(); ScalarArrayConstPtr getScalarArray() ; @@ -178,6 +196,9 @@ typedef PVArrayData StructureArrayData; class PVStructureArray : public PVArray { public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; + virtual ~PVStructureArray() {} virtual StructureArrayConstPtr getStructureArray() = 0; virtual int append(int number) = 0; @@ -198,6 +219,9 @@ private: class PVStructure : public PVField,public BitSetSerializable { public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; + virtual ~PVStructure(); StructureConstPtr getStructure(); PVFieldPtrArray getPVFields(); @@ -241,6 +265,9 @@ private: template class PVValueArray : public PVScalarArray { public: + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; + typedef T value_type; typedef T* pointer; typedef const T* const_pointer; diff --git a/pvDataApp/pv/pvIntrospect.h b/pvDataApp/pv/pvIntrospect.h index 55741b7..8fc7586 100644 --- a/pvDataApp/pv/pvIntrospect.h +++ b/pvDataApp/pv/pvIntrospect.h @@ -61,8 +61,8 @@ namespace ScalarTypeFunc { class Field : public std::tr1::enable_shared_from_this { public: - typedef std::tr1::shared_ptr Ptr; - typedef std::tr1::shared_ptr ConstPtr; + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; String getFieldName() const{return m_fieldName;} Type getType() const{return m_type;} @@ -89,8 +89,8 @@ private: class Scalar : public Field{ public: - typedef std::tr1::shared_ptr Ptr; - typedef std::tr1::shared_ptr ConstPtr; + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; typedef Scalar& reference; typedef const Scalar& const_reference; @@ -107,8 +107,8 @@ private: class ScalarArray : public Field{ public: - typedef std::tr1::shared_ptr Ptr; - typedef std::tr1::shared_ptr ConstPtr; + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; typedef ScalarArray& reference; typedef const ScalarArray& const_reference; @@ -125,8 +125,8 @@ private: class StructureArray : public Field{ public: - typedef std::tr1::shared_ptr Ptr; - typedef std::tr1::shared_ptr ConstPtr; + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; typedef StructureArray& reference; typedef const StructureArray& const_reference; @@ -144,8 +144,8 @@ private: class Structure : public Field { public: - typedef std::tr1::shared_ptr Ptr; - typedef std::tr1::shared_ptr ConstPtr; + typedef std::tr1::shared_ptr shared_pointer; + typedef std::tr1::shared_ptr const_shared_pointer; typedef Structure& reference; typedef const Structure& const_reference;