added shared_pointer typedefs, monitor.h IF changed to used shared_pointers
This commit is contained in:
@@ -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<Field>(pImpl->field));
|
||||
Field::shared_pointer field(const_pointer_cast<Field>(pImpl->field));
|
||||
field->renameField(newName);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace epics { namespace pvData {
|
||||
|
||||
void PVStructure::appendPVField(PVFieldPtr pvField)
|
||||
{
|
||||
Structure::Ptr structure = const_pointer_cast<Structure>(getStructure());
|
||||
Structure::shared_pointer structure = const_pointer_cast<Structure>(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<Structure>(getStructure());
|
||||
Structure::shared_pointer structure = const_pointer_cast<Structure>(getStructure());
|
||||
FieldConstPtr fields[numberNewFields];
|
||||
for(int i=0; i<numberNewFields; i++) fields[i] = pvFields[i]->getField();
|
||||
structure->appendFields(numberNewFields,fields);
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#define BITSET_H
|
||||
#include <stdexcept>
|
||||
#include <pvType.h>
|
||||
#include "factory.h"
|
||||
#include "serialize.h"
|
||||
#include <serialize.h>
|
||||
#include <sharedPtr.h>
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
@@ -38,6 +38,8 @@ namespace epics { namespace pvData {
|
||||
*/
|
||||
class BitSet : public Serializable {
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<BitSet> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const BitSet> const_shared_pointer;
|
||||
|
||||
/**
|
||||
* Creates a new bit set. All bits are initially {@code false}.
|
||||
|
||||
@@ -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<Requester> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const Requester> const_shared_pointer;
|
||||
|
||||
virtual ~Requester(){}
|
||||
virtual String getRequesterName() = 0;
|
||||
virtual void message(String message,MessageType messageType) = 0;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<Timer> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const Timer> const_shared_pointer;
|
||||
|
||||
Timer(String threadName, ThreadPriority priority);
|
||||
~Timer();
|
||||
void scheduleAfterDelay(TimerNode &timerNode,double delay);
|
||||
|
||||
@@ -9,39 +9,98 @@
|
||||
|
||||
#include <status.h>
|
||||
#include <destroyable.h>
|
||||
#include <sharedPtr.h>
|
||||
#include <pvData.h>
|
||||
#include <sharedPtr.h>
|
||||
#include <bitSet.h>
|
||||
|
||||
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<MonitorElement> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const MonitorElement> 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<Monitor> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const Monitor> 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<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::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 */
|
||||
|
||||
@@ -62,6 +62,9 @@ class PVField
|
||||
private NoDefaultMethods
|
||||
{
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<PVField> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const PVField> 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<PVScalar> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const PVScalar> const_shared_pointer;
|
||||
|
||||
virtual ~PVScalar();
|
||||
ScalarConstPtr getScalar() ;
|
||||
protected:
|
||||
@@ -104,6 +110,9 @@ protected:
|
||||
template<typename T>
|
||||
class PVScalarValue : public PVScalar {
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<PVScalarValue> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const PVScalarValue> 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<PVArray> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const PVArray> const_shared_pointer;
|
||||
|
||||
virtual ~PVArray();
|
||||
int getLength() const;
|
||||
void setLength(int length);
|
||||
@@ -155,6 +167,9 @@ private:
|
||||
template<typename T>
|
||||
class PVArrayData {
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<PVArrayData> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const PVArrayData> 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<PVScalarArray> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const PVScalarArray> const_shared_pointer;
|
||||
|
||||
virtual ~PVScalarArray();
|
||||
ScalarArrayConstPtr getScalarArray() ;
|
||||
|
||||
@@ -178,6 +196,9 @@ typedef PVArrayData<PVStructurePtr> StructureArrayData;
|
||||
|
||||
class PVStructureArray : public PVArray {
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<PVStructureArray> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const PVStructureArray> 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<PVStructure> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const PVStructure> const_shared_pointer;
|
||||
|
||||
virtual ~PVStructure();
|
||||
StructureConstPtr getStructure();
|
||||
PVFieldPtrArray getPVFields();
|
||||
@@ -241,6 +265,9 @@ private:
|
||||
template<typename T>
|
||||
class PVValueArray : public PVScalarArray {
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<PVValueArray> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const PVValueArray> const_shared_pointer;
|
||||
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace ScalarTypeFunc {
|
||||
|
||||
class Field : public std::tr1::enable_shared_from_this<Field> {
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<Field> Ptr;
|
||||
typedef std::tr1::shared_ptr<const Field> ConstPtr;
|
||||
typedef std::tr1::shared_ptr<Field> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const Field> 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<Scalar> Ptr;
|
||||
typedef std::tr1::shared_ptr<const Scalar> ConstPtr;
|
||||
typedef std::tr1::shared_ptr<Scalar> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const Scalar> 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<ScalarArray> Ptr;
|
||||
typedef std::tr1::shared_ptr<const ScalarArray> ConstPtr;
|
||||
typedef std::tr1::shared_ptr<ScalarArray> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const ScalarArray> 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<StructureArray> Ptr;
|
||||
typedef std::tr1::shared_ptr<const StructureArray> ConstPtr;
|
||||
typedef std::tr1::shared_ptr<StructureArray> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const StructureArray> 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<Structure> Ptr;
|
||||
typedef std::tr1::shared_ptr<const Structure> ConstPtr;
|
||||
typedef std::tr1::shared_ptr<Structure> shared_pointer;
|
||||
typedef std::tr1::shared_ptr<const Structure> const_shared_pointer;
|
||||
typedef Structure& reference;
|
||||
typedef const Structure& const_reference;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user