work on doxygen
This commit is contained in:
@@ -18,7 +18,12 @@
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/**
|
||||
* Class to create pvRequest structures to pass to pvAccess Channel methods.
|
||||
* @brief Create pvRequest structure for Channel methods.
|
||||
*
|
||||
* Many methods of the Channel class of pvAccess have an
|
||||
* argument <b>PVStructurePtr const * pvRequest</b>.
|
||||
* This class provides a method that creates a valid pvRequest.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass CreateRequest {
|
||||
public:
|
||||
|
||||
@@ -25,7 +25,8 @@ class PVCopyTraverseMasterCallback;
|
||||
typedef std::tr1::shared_ptr<PVCopyTraverseMasterCallback> PVCopyTraverseMasterCallbackPtr;
|
||||
|
||||
/**
|
||||
* Callback for traversing master structure
|
||||
* @brief Callback for traversing master structure
|
||||
*
|
||||
* Must be implemented by code that creates pvCopy.
|
||||
*/
|
||||
class epicsShareClass PVCopyTraverseMasterCallback
|
||||
@@ -53,6 +54,8 @@ typedef std::tr1::shared_ptr<CopyStructureNode> CopyStructureNodePtr;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Support for subset of fields in a pvStructure.
|
||||
*
|
||||
* Class that manages one or more PVStructures that holds an arbitrary subset of the fields
|
||||
* in another PVStructure called master.
|
||||
*/
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace epics { namespace pvData {
|
||||
typedef std::tr1::shared_ptr<BitSet> BitSetPtr;
|
||||
|
||||
/**
|
||||
* @brief A vector of bits.
|
||||
*
|
||||
* This class implements a vector of bits that grows as needed. Each
|
||||
* component of the bit set has a {@code bool} value. The
|
||||
* bits of a {@code BitSet} are indexed by nonnegative integers.
|
||||
|
||||
@@ -188,7 +188,8 @@ inline double swap(double val)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This class implements {@code Bytebuffer} that is like the {@code java.nio.ByteBuffer}.
|
||||
* @brief This class implements a Bytebuffer that is like the java.nio.ByteBuffer.
|
||||
*
|
||||
* <p>A {@code BitSet} is not safe for multithreaded use without
|
||||
* external synchronization.
|
||||
*
|
||||
|
||||
@@ -18,7 +18,8 @@ namespace epics { namespace pvData {
|
||||
|
||||
|
||||
/**
|
||||
* Instance declaring destroy method.
|
||||
* @brief Instance declaring destroy method.
|
||||
*
|
||||
* @author mse
|
||||
*/
|
||||
class epicsShareClass Destroyable {
|
||||
|
||||
@@ -202,13 +202,26 @@ do { \
|
||||
#define THROW_EXCEPTION2(E,A) do{throw (E)(A);}while(0)
|
||||
|
||||
#endif // THROW_EXCEPTION_COMPAT
|
||||
|
||||
/**
|
||||
* @brief Base for pvData exceptions.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass BaseException : public std::logic_error {
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
explicit BaseException(const std::string msg) : std::logic_error(msg) {}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~BaseException() throw(){};
|
||||
|
||||
/**
|
||||
*
|
||||
* Reason for excepton.
|
||||
*/
|
||||
virtual const char* what() const throw();
|
||||
|
||||
private:
|
||||
|
||||
@@ -35,14 +35,41 @@ namespace epics { namespace pvData {
|
||||
class Event;
|
||||
typedef std::tr1::shared_ptr<Event> EventPtr;
|
||||
|
||||
/**
|
||||
* @brief C++ wrapper for epicsEvent from EPICS base.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass Event {
|
||||
public:
|
||||
POINTER_DEFINITIONS(Event);
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
explicit Event(bool = false);
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~Event();
|
||||
/**
|
||||
* Signal the event i.e. ensures that the next or current call to wait completes.
|
||||
*/
|
||||
void signal();
|
||||
/**
|
||||
* wait
|
||||
* @return (false,true) if (some error, event signaled).
|
||||
* The next wait or tryWait will clear signal.
|
||||
*/
|
||||
bool wait (); /* blocks until full */
|
||||
/**
|
||||
* wait for up to timeOut seconds.
|
||||
* @param timeOut max number of seconds to wait
|
||||
* @return (false, true) if (timeout or error, event signaled).
|
||||
*/
|
||||
bool wait ( double timeOut ); /* false if empty at time out */
|
||||
/**
|
||||
* See if a signal has been called.
|
||||
* @return (false, true) if (timeout or error, event signaled).
|
||||
*/
|
||||
bool tryWait (); /* false if empty */
|
||||
private:
|
||||
epicsEventId id;
|
||||
|
||||
@@ -27,22 +27,56 @@ class Executor;
|
||||
typedef std::tr1::shared_ptr<Command> CommandPtr;
|
||||
typedef std::tr1::shared_ptr<Executor> ExecutorPtr;
|
||||
|
||||
/**
|
||||
* @brief A command to be called by Executor
|
||||
*
|
||||
*/
|
||||
class epicsShareClass Command {
|
||||
public:
|
||||
POINTER_DEFINITIONS(Command);
|
||||
/**
|
||||
*
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~Command(){}
|
||||
/**
|
||||
*
|
||||
* The command that is executed.
|
||||
*/
|
||||
virtual void command() = 0;
|
||||
private:
|
||||
CommandPtr next;
|
||||
friend class Executor;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A class that executes commands.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass Executor : public Runnable{
|
||||
public:
|
||||
POINTER_DEFINITIONS(Executor);
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param threadName name for the executor thread.
|
||||
* @param priority The thread priority.
|
||||
*/
|
||||
Executor(std::string const & threadName,ThreadPriority priority);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~Executor();
|
||||
void execute(CommandPtr const &node);
|
||||
/**
|
||||
*
|
||||
* Request to execute a command.
|
||||
* @param command A shared pointer to the command instance.
|
||||
*/
|
||||
void execute(CommandPtr const &command);
|
||||
/**
|
||||
*
|
||||
* The thread run method.
|
||||
*/
|
||||
virtual void run();
|
||||
private:
|
||||
CommandPtr head;
|
||||
|
||||
@@ -38,12 +38,30 @@ namespace epics { namespace pvData {
|
||||
|
||||
typedef epicsMutex Mutex;
|
||||
|
||||
/**
|
||||
* @brief A lock for multithreading
|
||||
*
|
||||
* This is based on item 14 of
|
||||
* * Effective C++, Third Edition, Scott Meyers
|
||||
*/
|
||||
class epicsShareClass Lock : private NoDefaultMethods {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* @param m The mutex for the facility being locked.
|
||||
*/
|
||||
explicit Lock(Mutex &m)
|
||||
: mutexPtr(m), locked(true)
|
||||
{ mutexPtr.lock();}
|
||||
/**
|
||||
* Destructor
|
||||
* Note that destructor does an automatic unlock.
|
||||
*/
|
||||
~Lock(){unlock();}
|
||||
/**
|
||||
* Take the lock
|
||||
* Recursive locks are supported but each lock must be matched with an unlock.
|
||||
*/
|
||||
void lock()
|
||||
{
|
||||
if(!locked)
|
||||
@@ -52,6 +70,9 @@ public:
|
||||
locked = true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* release the lock.
|
||||
*/
|
||||
void unlock()
|
||||
{
|
||||
if(locked)
|
||||
@@ -60,6 +81,10 @@ public:
|
||||
locked=false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* If lock is not held take the lock.
|
||||
* @return (false,true) if caller (does not have, has) the lock.
|
||||
*/
|
||||
bool tryLock()
|
||||
{
|
||||
if(locked) return true;
|
||||
@@ -69,6 +94,10 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* See if caller has the lock,
|
||||
* @return (false,true) if caller (does not have, has) the lock.
|
||||
*/
|
||||
bool ownsLock() const{return locked;}
|
||||
private:
|
||||
Mutex &mutexPtr;
|
||||
|
||||
@@ -28,10 +28,26 @@ typedef std::tr1::shared_ptr<MessageNode> MessageNodePtr;
|
||||
typedef std::vector<MessageNodePtr> MessageNodePtrArray;
|
||||
typedef std::tr1::shared_ptr<MessageQueue> MessageQueuePtr;
|
||||
|
||||
/**
|
||||
* @brief A node that can be put on a MessageQueue.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass MessageNode {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
MessageNode();
|
||||
/**
|
||||
*
|
||||
* Get the message value.
|
||||
* @return The message value.
|
||||
*/
|
||||
std::string getMessage() const;
|
||||
/**
|
||||
* Get the message type.
|
||||
* @return The message type which is defined in Requester.
|
||||
*/
|
||||
MessageType getMessageType() const;
|
||||
private:
|
||||
std::string message;
|
||||
@@ -39,19 +55,65 @@ private:
|
||||
friend class MessageQueue;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A bounded queue for messages.
|
||||
*
|
||||
*
|
||||
*/
|
||||
class epicsShareClass MessageQueue : public Queue<MessageNode> {
|
||||
public:
|
||||
POINTER_DEFINITIONS(MessageQueue);
|
||||
/**
|
||||
* Factory method to create a MessageQueue.
|
||||
* @param size The number of MessageNodes in the queue.
|
||||
* @return shared_ptr to MessageQueue.
|
||||
*/
|
||||
static MessageQueuePtr create(int size);
|
||||
/**
|
||||
* Constructor
|
||||
* @param nodeArray an array of shared_ptr to MessageNodes,
|
||||
*/
|
||||
MessageQueue(MessageNodePtrArray &nodeArray);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~MessageQueue();
|
||||
/**
|
||||
* get the next MessageNode of the queue.
|
||||
* @return A shared_ptr to the MessageNode.
|
||||
* This will be a null pointer if queue is empty.
|
||||
* If get is successful then release for this MessageNode
|
||||
* must be called before another get can be issued.
|
||||
*/
|
||||
MessageNodePtr &get();
|
||||
// must call release before next get
|
||||
/**
|
||||
* Release the MessageNode that was returned by the previous call to get.
|
||||
*/
|
||||
void release();
|
||||
// return (false,true) if message (was not, was) put into queue
|
||||
/**
|
||||
*
|
||||
* put a message into the message queue
|
||||
* @param message The message string.
|
||||
* @param messageType The message type as defined in Requester,
|
||||
* @param replaceLast If true and queue is full then replace.
|
||||
* @return (false,true) if a message (was not, was) put in queiue.
|
||||
*/
|
||||
bool put(std::string message,MessageType messageType,bool replaceLast);
|
||||
/**
|
||||
* Is queue empty?
|
||||
* @return (false,true) if (is not, is) empty.
|
||||
*/
|
||||
bool isEmpty() ;
|
||||
/**
|
||||
* Is queue full?
|
||||
* @return (false,true) if (is not, is) full.
|
||||
*/
|
||||
bool isFull() ;
|
||||
/**
|
||||
*
|
||||
* Clear number of times queue was overrun and return the number
|
||||
* of times the queue was overrun.
|
||||
*/
|
||||
int getClearOverrun();
|
||||
private:
|
||||
MessageNodePtr nullNode;
|
||||
|
||||
@@ -17,17 +17,26 @@ namespace epics { namespace pvData {
|
||||
* Effective C++, Third Edition, Scott Meyers
|
||||
*/
|
||||
|
||||
|
||||
class epicsShareClass NoDefaultMethods {
|
||||
protected:
|
||||
// allow by derived objects
|
||||
/**
|
||||
* @brief Base class for not allowing default methods.
|
||||
*
|
||||
* Note that copy constructor a copy methods are declared private.
|
||||
*/
|
||||
class epicsShareClass NoDefaultMethods {
|
||||
protected:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
NoDefaultMethods(){};
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~NoDefaultMethods(){}
|
||||
private:
|
||||
// do not implment
|
||||
NoDefaultMethods(const NoDefaultMethods&);
|
||||
NoDefaultMethods & operator=(const NoDefaultMethods &);
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
#endif /* NO_DEFAULT_METHODS_H */
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/**
|
||||
* @brief Template class for a bounded queue.
|
||||
*
|
||||
* An instance can make a queueElement be any class desired
|
||||
* but must create a std::vector of shared_ptr to queueElements.
|
||||
*/
|
||||
template <typename T>
|
||||
class Queue
|
||||
{
|
||||
@@ -25,15 +31,58 @@ public:
|
||||
POINTER_DEFINITIONS(Queue);
|
||||
typedef std::tr1::shared_ptr<T> queueElementPtr;
|
||||
typedef std::vector<queueElementPtr> queueElementPtrArray;
|
||||
Queue(queueElementPtrArray &);
|
||||
/**
|
||||
* Constructor
|
||||
* @param elementArray The vector of shared_ptr to queue elements.
|
||||
*/
|
||||
Queue(queueElementPtrArray & elementArray);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~Queue();
|
||||
/**
|
||||
* Clear the queue.
|
||||
*/
|
||||
void clear();
|
||||
/**
|
||||
* get the capacity of the queue, i. e. number of queue elements,
|
||||
* @return The capacity.
|
||||
*/
|
||||
int capacity();
|
||||
/**
|
||||
* Get the number of free elements in the queue.
|
||||
* @return The number.
|
||||
*/
|
||||
int getNumberFree();
|
||||
/**
|
||||
* Get the number of used elements in the queue.
|
||||
* This is the number that have been setUsed but not released.
|
||||
* @return The number.
|
||||
*/
|
||||
int getNumberUsed();
|
||||
/**
|
||||
* Get the next free element.
|
||||
* @return a shared_ptr to the queue element.
|
||||
* This is null if queue was full.
|
||||
*/
|
||||
queueElementPtr & getFree();
|
||||
/**
|
||||
* Set the element returned by getFree as used.
|
||||
* Until this is called getUsed will not return it.
|
||||
* @param element The element. It must be the element returned
|
||||
* by the most recent call to getUsed.
|
||||
*/
|
||||
void setUsed(queueElementPtr const &element);
|
||||
/**
|
||||
* Get the oldest used element;
|
||||
* @return a shared_ptr to the queue element.
|
||||
* This is null if no used element is available.`
|
||||
*/
|
||||
queueElementPtr & getUsed();
|
||||
/**
|
||||
* Release the element obtained by the most recent call to getUsed.
|
||||
* @param element The element.
|
||||
*/
|
||||
void releaseUsed(queueElementPtr const &element);
|
||||
private:
|
||||
queueElementPtr nullElement;
|
||||
|
||||
@@ -28,11 +28,43 @@ enum MessageType {
|
||||
|
||||
epicsShareExtern std::string getMessageTypeName(MessageType messageType);
|
||||
|
||||
/**
|
||||
* @brief Callback class for passing messages to a requester.
|
||||
*
|
||||
* This is used by many other classes and also extended by other classes.
|
||||
* The request is passed a message and a messageType.
|
||||
* A message is just a string and a messageType is:
|
||||
@code
|
||||
enum MessageType {
|
||||
infoMessage,warningMessage,errorMessage,fatalErrorMessage
|
||||
};
|
||||
@endcode
|
||||
*
|
||||
*/
|
||||
|
||||
class epicsShareClass Requester {
|
||||
public:
|
||||
POINTER_DEFINITIONS(Requester);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~Requester(){}
|
||||
/**
|
||||
* The requester must have a name.
|
||||
* @return The requester's name.
|
||||
*/
|
||||
virtual std::string getRequesterName() = 0;
|
||||
/**
|
||||
*
|
||||
* A message for the requester.
|
||||
* @param message The message.
|
||||
* @param messageType The type of message:
|
||||
@code
|
||||
enum MessageType {
|
||||
infoMessage,warningMessage,errorMessage,fatalErrorMessage
|
||||
};
|
||||
@endcode
|
||||
*/
|
||||
virtual void message(std::string const & message,MessageType messageType) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -25,52 +25,185 @@ namespace epics { namespace pvData {
|
||||
class BitSet;
|
||||
class Field;
|
||||
|
||||
/**
|
||||
* @brief Callback class for serialization.
|
||||
*
|
||||
* This must be provided by code that calls serialize.
|
||||
*/
|
||||
class epicsShareClass SerializableControl {
|
||||
public:
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~SerializableControl(){}
|
||||
/**
|
||||
* Done with this buffer. Flush it.
|
||||
*/
|
||||
virtual void flushSerializeBuffer() =0;
|
||||
/**
|
||||
* Make sure buffer has at least size bytes remaining.
|
||||
* If not flush existing buffer and provide a new one.
|
||||
* @param size The number of bytes.
|
||||
*/
|
||||
virtual void ensureBuffer(std::size_t size) =0;
|
||||
/**
|
||||
* Add pad bytes to buffer.
|
||||
* @param alignment allignment required.
|
||||
*/
|
||||
virtual void alignBuffer(std::size_t alignment) =0;
|
||||
virtual bool directSerialize(ByteBuffer *existingBuffer, const char* toSerialize,
|
||||
std::size_t elementCount, std::size_t elementSize) = 0;
|
||||
virtual void cachedSerialize(std::tr1::shared_ptr<const Field> const & field, ByteBuffer* buffer) = 0;
|
||||
/**
|
||||
* method for serializing array data.
|
||||
* This should only be used for arrays of primitive types.
|
||||
* i. e. boolean,byte,...,double.
|
||||
* It can not be called for string, structure, or union arrays.
|
||||
* @param existingBuffer the existing buffer from the caller.
|
||||
* @param toSerialize location of data to be put into buffer.
|
||||
* @param elementCount number of elements.
|
||||
* @param elementSize element size.
|
||||
*/
|
||||
virtual bool directSerialize(
|
||||
ByteBuffer *existingBuffer,
|
||||
const char* toSerialize,
|
||||
std::size_t elementCount,
|
||||
std::size_t elementSize) = 0;
|
||||
/**
|
||||
* serialize via cache
|
||||
* @param field instance to be serialized
|
||||
* @param buffer buffer to be serialized to
|
||||
*/
|
||||
virtual void cachedSerialize(
|
||||
std::tr1::shared_ptr<const Field> const & field,
|
||||
ByteBuffer* buffer) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Callback class for deserialization.
|
||||
*
|
||||
* This must be provided by code that calls deserialize.
|
||||
*/
|
||||
class epicsShareClass DeserializableControl {
|
||||
public:
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~DeserializableControl(){}
|
||||
/**
|
||||
* Helper method.
|
||||
* Ensures specified size of bytes, provides it if necessary.
|
||||
* @param size The number of bytes.
|
||||
*/
|
||||
virtual void ensureData(std::size_t size) =0;
|
||||
/**
|
||||
* Align buffer.
|
||||
* Note that this takes care only current buffer alignment.
|
||||
* If streaming protocol is used,
|
||||
* care must be taken that entire stream is aligned.
|
||||
* @param alignment size in bytes, must be power of two.
|
||||
*/
|
||||
virtual void alignData(std::size_t alignment) =0;
|
||||
virtual bool directDeserialize(ByteBuffer *existingBuffer, char* deserializeTo,
|
||||
std::size_t elementCount, std::size_t elementSize) = 0;
|
||||
virtual std::tr1::shared_ptr<const Field> cachedDeserialize(ByteBuffer* buffer) = 0;
|
||||
/**
|
||||
* method for deserializing array data.
|
||||
* This should only be used for arrays of primitive types.
|
||||
* i. e. boolean,byte,...,double.
|
||||
* It can not be called for string, structure, or union arrays.
|
||||
* @param existingBuffer the existing buffer from the caller.
|
||||
* @param deserializeTo location of data.
|
||||
* @param elementCount number of elements.
|
||||
* @param elementSize element size.
|
||||
*/
|
||||
virtual bool directDeserialize(
|
||||
ByteBuffer *existingBuffer,
|
||||
char* deserializeTo,
|
||||
std::size_t elementCount,
|
||||
std::size_t elementSize) = 0;
|
||||
/**
|
||||
* deserialize via cache
|
||||
* @param field instance to be deserialized
|
||||
* @param buffer buffer to be deserialized from
|
||||
*/
|
||||
virtual std::tr1::shared_ptr<const Field> cachedDeserialize(
|
||||
ByteBuffer* buffer) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Base class for serialization.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass Serializable {
|
||||
public:
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~Serializable(){}
|
||||
/**
|
||||
* Serialize field into given buffer.
|
||||
* @param buffer serialization buffer.
|
||||
* @param flusher flush interface.
|
||||
*/
|
||||
virtual void serialize(ByteBuffer *buffer,
|
||||
SerializableControl *flusher) const = 0;
|
||||
/**
|
||||
* Deserialize buffer.
|
||||
* @param buffer serialization buffer.
|
||||
* @param flusher deserialization control.
|
||||
*/
|
||||
virtual void deserialize(ByteBuffer *buffer,
|
||||
DeserializableControl *flusher) = 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Class for serializing bitSets.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass BitSetSerializable {
|
||||
public:
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~BitSetSerializable(){}
|
||||
/**
|
||||
* Serialize field into given buffer.
|
||||
* @param buffer serialization buffer.
|
||||
* @param flusher flush interface.
|
||||
* ¶m bitSet The bitSet to serialize.
|
||||
*/
|
||||
virtual void serialize(ByteBuffer *buffer,
|
||||
SerializableControl *flusher,BitSet *bitSet) const = 0;
|
||||
/**
|
||||
* Deserialize buffer.
|
||||
* @param buffer serialization buffer.
|
||||
* @param flusher deserialization control.
|
||||
* ¶m bitSet The bitSet to deserialize.
|
||||
*/
|
||||
virtual void deserialize(ByteBuffer *buffer,
|
||||
DeserializableControl *flusher,BitSet *bitSet) = 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Class for serializing arrays.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass SerializableArray : public virtual Serializable {
|
||||
public:
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~SerializableArray(){}
|
||||
using Serializable::serialize;
|
||||
virtual void serialize(ByteBuffer *buffer,
|
||||
SerializableControl *flusher, std::size_t offset, std::size_t count) const = 0;
|
||||
/**
|
||||
* Serialize field into given buffer.
|
||||
* @param buffer serialization buffer.
|
||||
* @param flusher flush interface.
|
||||
* ¶m offset offset in elements.
|
||||
* @param count number of elements
|
||||
*/
|
||||
virtual void serialize(
|
||||
ByteBuffer *buffer,
|
||||
SerializableControl *flusher,
|
||||
std::size_t offset,
|
||||
std::size_t count) const = 0;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
namespace epics {
|
||||
namespace pvData {
|
||||
|
||||
/**
|
||||
* @brief Serialization helper.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass SerializeHelper : public NoDefaultMethods {
|
||||
public:
|
||||
|
||||
|
||||
@@ -527,9 +527,12 @@ public:
|
||||
|
||||
};
|
||||
|
||||
//! Specialization for storing untyped pointers
|
||||
//! Does not allow access or iteration of contents
|
||||
//! other than as void* or const void*
|
||||
/**
|
||||
* @brief Specialization for storing untyped pointers.
|
||||
*
|
||||
* Does not allow access or iteration of contents
|
||||
* other than as void* or const void*
|
||||
*/
|
||||
template<typename E>
|
||||
class shared_vector<E, typename meta::is_void<E>::type >
|
||||
: public detail::shared_vector_base<E>
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/**
|
||||
* Status.
|
||||
* @brief Status.
|
||||
*
|
||||
* This is a class for returning status to clients.
|
||||
* @author mse
|
||||
*/
|
||||
class epicsShareClass Status : public epics::pvData::Serializable {
|
||||
|
||||
@@ -47,9 +47,28 @@ typedef std::tr1::shared_ptr<epicsThread> EpicsThreadPtr;
|
||||
|
||||
typedef epicsThreadRunable Runnable;
|
||||
|
||||
/**
|
||||
* @brief C++ wrapper for epicsThread from EPICS base.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass Thread : public epicsThread, private NoDefaultMethods {
|
||||
public:
|
||||
|
||||
/**
|
||||
*
|
||||
* Constructor
|
||||
* @param name thread name.
|
||||
* @param priority priority is one of:
|
||||
@code
|
||||
enum ThreadPriority {
|
||||
lowestPriority, lowerPriority, lowPriority,
|
||||
middlePriority,
|
||||
highPriority, higherPriority, highestPriority
|
||||
};
|
||||
@endcode
|
||||
* @param runnable this is a c function
|
||||
* @param stkcls stack size as specified by epicsThreadStackSizeClass
|
||||
*/
|
||||
Thread(std::string name,
|
||||
ThreadPriority priority,
|
||||
Runnable *runnable,
|
||||
@@ -62,6 +81,21 @@ public:
|
||||
this->start();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Constructor
|
||||
* @param runnable this is a c function
|
||||
* @name thread name.
|
||||
* @param stkcls stack size as specified by epicsThreadStackSizeClass
|
||||
* @param priority priority is one of:
|
||||
@code
|
||||
enum ThreadPriority {
|
||||
lowestPriority, lowerPriority, lowPriority,
|
||||
middlePriority,
|
||||
highPriority, higherPriority, highestPriority
|
||||
};
|
||||
@endcode
|
||||
*/
|
||||
Thread(Runnable &runnable,
|
||||
std::string name,
|
||||
unsigned int stksize,
|
||||
@@ -74,6 +108,9 @@ public:
|
||||
this->start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~Thread()
|
||||
{
|
||||
this->exitWait();
|
||||
|
||||
@@ -21,19 +21,46 @@ class TimeFunction;
|
||||
typedef std::tr1::shared_ptr<TimeFunctionRequester> TimeFunctionRequesterPtr;
|
||||
typedef std::tr1::shared_ptr<TimeFunction> TimeFunctionPtr;
|
||||
|
||||
/**
|
||||
* @brief Class that must be implemented by timeFunction requester.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass TimeFunctionRequester {
|
||||
public:
|
||||
POINTER_DEFINITIONS(TimeFunctionRequester);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~TimeFunctionRequester(){}
|
||||
/**
|
||||
* function to be timed.
|
||||
* It will get called multiple times.
|
||||
*/
|
||||
virtual void function() = 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Class for measuring time it takes to execute a function.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass TimeFunction {
|
||||
public:
|
||||
POINTER_DEFINITIONS(TimeFunction);
|
||||
/**
|
||||
* Constructor
|
||||
* @param requester The class that has a function method.
|
||||
*/
|
||||
TimeFunction(TimeFunctionRequesterPtr const & requester);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~TimeFunction();
|
||||
/**
|
||||
* Time the function.
|
||||
* @return the time in seconds to execute the function.
|
||||
* Note that the function may be called many times.
|
||||
*/
|
||||
double timeCall();
|
||||
private:
|
||||
TimeFunctionRequesterPtr requester;
|
||||
|
||||
@@ -32,12 +32,28 @@ class Timer;
|
||||
typedef std::tr1::shared_ptr<TimerCallback> TimerCallbackPtr;
|
||||
typedef std::tr1::shared_ptr<Timer> TimerPtr;
|
||||
|
||||
/**
|
||||
* @brief Class that must be implemented by code that makes Timer requests.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass TimerCallback {
|
||||
public:
|
||||
POINTER_DEFINITIONS(TimerCallback);
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
TimerCallback();
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~TimerCallback(){}
|
||||
/**
|
||||
* The method that is called when a timer expires.
|
||||
*/
|
||||
virtual void callback() = 0;
|
||||
/**
|
||||
* The timer has stopped.
|
||||
*/
|
||||
virtual void timerStopped() = 0;
|
||||
private:
|
||||
TimerCallbackPtr next;
|
||||
@@ -47,22 +63,60 @@ private:
|
||||
friend class Timer;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Support for delayed or periodic callback execution.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass Timer : public Runnable {
|
||||
public:
|
||||
POINTER_DEFINITIONS(Timer);
|
||||
/**
|
||||
* Contructor
|
||||
* @param threadName name for the timer thread.
|
||||
* @param priority thread priority
|
||||
*/
|
||||
Timer(std::string threadName, ThreadPriority priority);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~Timer();
|
||||
/**
|
||||
* The thead run method. This is called automatically.
|
||||
*/
|
||||
virtual void run();
|
||||
/**
|
||||
* schedule a callback after a delay.
|
||||
* @param timerCallback the timerCallback instance.
|
||||
* @param delay number of seconds before calling callback.
|
||||
*/
|
||||
void scheduleAfterDelay(
|
||||
TimerCallbackPtr const &timerCallback,
|
||||
double delay);
|
||||
/**
|
||||
* schedule a periodic callback.`
|
||||
* @param timerCallback the timerCallback instance.
|
||||
* @param delay number of seconds before first callback.
|
||||
* @param period time in seconds between each callback.
|
||||
*/
|
||||
void schedulePeriodic(
|
||||
TimerCallbackPtr const &timerCallback,
|
||||
double delay,
|
||||
double period);
|
||||
/**
|
||||
* cancel a callback.
|
||||
* @param timerCallback the timerCallback to cancel.
|
||||
*/
|
||||
void cancel(TimerCallbackPtr const &timerCallback);
|
||||
/**
|
||||
* Is the callback scheduled to be called?
|
||||
* @param timerCallback the timerCallback.
|
||||
* @return (false,true) if (not, is) scheduled.
|
||||
*/
|
||||
bool isScheduled(TimerCallbackPtr const &timerCallback);
|
||||
|
||||
/**
|
||||
* show the elements in the timer queue.
|
||||
* @parm o The output stream for the output
|
||||
*/
|
||||
void dump(std::ostream& o);
|
||||
|
||||
private:
|
||||
|
||||
@@ -30,6 +30,8 @@ typedef std::tr1::shared_ptr<Monitor> MonitorPtr;
|
||||
|
||||
|
||||
/**
|
||||
* @brief An element for a monitorQueue.
|
||||
*
|
||||
* Class instance representing monitor element.
|
||||
* @author mrk
|
||||
*/
|
||||
@@ -48,7 +50,9 @@ class epicsShareClass MonitorElement {
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for Monitor.
|
||||
* @brief Monitor changes to fields of a pvStructure.
|
||||
*
|
||||
* This is used by pvAccess to implement monitors.
|
||||
* @author mrk
|
||||
*/
|
||||
class epicsShareClass Monitor : public Destroyable{
|
||||
@@ -80,6 +84,8 @@ class epicsShareClass Monitor : public Destroyable{
|
||||
|
||||
|
||||
/**
|
||||
* @brief Callback implemented by monitor clients.
|
||||
*
|
||||
* Requester for ChannelMonitor.
|
||||
* @author mrk
|
||||
*/
|
||||
|
||||
@@ -20,28 +20,21 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/**
|
||||
* typedef for a pointer to a MonitorPlugin
|
||||
*/
|
||||
class MonitorPlugin;
|
||||
typedef std::tr1::shared_ptr<MonitorPlugin> MonitorPluginPtr;
|
||||
|
||||
|
||||
/**
|
||||
* typedef for a pointer to a MonitorPluginCreator
|
||||
*/
|
||||
class MonitorPluginCreator;
|
||||
typedef std::tr1::shared_ptr<MonitorPluginCreator> MonitorPluginCreatorPtr;
|
||||
|
||||
|
||||
/**
|
||||
* typedef for a pointer to a MonitorPluginManager
|
||||
*/
|
||||
class MonitorPluginManager;
|
||||
typedef std::tr1::shared_ptr<MonitorPluginManager> MonitorPluginManagerPtr;
|
||||
|
||||
|
||||
/** A plugin for raising monitors;
|
||||
/**
|
||||
* @brief A plugin for raising monitors;
|
||||
*
|
||||
* This is for use by pvAccess servers that support monitors.
|
||||
* Since the interface has only a dependence on pvData it
|
||||
* can be used for other purposes.
|
||||
@@ -100,7 +93,9 @@ public:
|
||||
virtual void endGroupPut() {};
|
||||
};
|
||||
|
||||
/** A class that creates a plugin.
|
||||
/**
|
||||
* @brief A class that creates a plugin.
|
||||
*
|
||||
* Normlly a plugin is created for a single client.
|
||||
*/
|
||||
class epicsShareClass MonitorPluginCreator
|
||||
@@ -130,6 +125,8 @@ public:
|
||||
|
||||
|
||||
/**
|
||||
* @brief Manager for plugins.
|
||||
*
|
||||
* This manages a set of monitor plugins.
|
||||
* @author mrk
|
||||
*/
|
||||
|
||||
@@ -18,37 +18,129 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/** @brief enum definition of AlarmSeverity
|
||||
*
|
||||
* AlarmSeverity is:
|
||||
@code
|
||||
enum AlarmSeverity {
|
||||
noAlarm,minorAlarm,majorAlarm,invalidAlarm,undefinedAlarm
|
||||
};
|
||||
@endcode
|
||||
*
|
||||
*/
|
||||
enum AlarmSeverity {
|
||||
noAlarm,minorAlarm,majorAlarm,invalidAlarm,undefinedAlarm
|
||||
};
|
||||
|
||||
/** @brief enum definition of AlarmStatus
|
||||
*
|
||||
* AlarmStatus is:
|
||||
@code
|
||||
enum AlarmStatus {
|
||||
noStatus,deviceStatus,driverStatus,recordStatus,
|
||||
dbStatus,confStatus,undefinedStatus,clientStatus
|
||||
};
|
||||
@endcode
|
||||
*
|
||||
*/
|
||||
enum AlarmStatus {
|
||||
noStatus,deviceStatus,driverStatus,recordStatus,
|
||||
dbStatus,confStatus,undefinedStatus,clientStatus
|
||||
};
|
||||
|
||||
|
||||
/** @brief methods for AlarmSeverity
|
||||
*
|
||||
*/
|
||||
class epicsShareClass AlarmSeverityFunc {
|
||||
public:
|
||||
/**
|
||||
* Get the severity.
|
||||
* @param value Get the alarm severity corresponding to the integer value.
|
||||
* @return The severity.
|
||||
* @throw if severity value is out of range.
|
||||
*/
|
||||
static AlarmSeverity getSeverity(int value);
|
||||
/**
|
||||
* Get the array of severity names.
|
||||
* @return The array of severity names.
|
||||
*/
|
||||
static StringArrayPtr getSeverityNames();
|
||||
};
|
||||
|
||||
/** @brief methods for AlarmStatus
|
||||
*
|
||||
*/
|
||||
class epicsShareClass AlarmStatusFunc {
|
||||
public:
|
||||
/**
|
||||
* Get the status.
|
||||
* @param value Get the alarm status corresponding to the integer value.
|
||||
* @return The status.
|
||||
* @throw if status value is out of range.
|
||||
*/
|
||||
static AlarmStatus getStatus(int value);
|
||||
/**
|
||||
* Get the array of status names.
|
||||
* @return The array of status names.
|
||||
*/
|
||||
static StringArrayPtr getStatusNames();
|
||||
};
|
||||
|
||||
/** @brief Methods for manipulating alarm.
|
||||
*
|
||||
* An alarm structure has the following fields:
|
||||
@code
|
||||
structure
|
||||
int severity
|
||||
int status
|
||||
string message
|
||||
@endcode
|
||||
* This is a class that holds values corresponding to the fields in
|
||||
* an alarm structure.
|
||||
* It is meant to be used together with pvAlarm
|
||||
* which allows values to be copied between an alarm structure
|
||||
* and this class.
|
||||
* This class should not be extended.
|
||||
*/
|
||||
class epicsShareClass Alarm {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Alarm() : severity(0),status(0), message(std::string("")) {}
|
||||
//default constructors and destructor are OK
|
||||
/**
|
||||
* get the current message.
|
||||
* @return The message.
|
||||
*/
|
||||
std::string getMessage() const {return message;}
|
||||
/**
|
||||
* set the current message.
|
||||
* @param value The new message value.
|
||||
*/
|
||||
void setMessage(std::string const &value) {message = value;}
|
||||
/**
|
||||
* get the current severity.
|
||||
* @return The severity.
|
||||
*/
|
||||
AlarmSeverity getSeverity() const;
|
||||
/**
|
||||
* set the current severity.
|
||||
* @param value The new severity.
|
||||
* @throw if severity value is out of range.
|
||||
*/
|
||||
void setSeverity(AlarmSeverity value) {severity = value;}
|
||||
/**
|
||||
* get the current status.
|
||||
* @return The status.
|
||||
*/
|
||||
AlarmStatus getStatus() const;
|
||||
/**
|
||||
* set the current status.
|
||||
* @param value The new status.
|
||||
* @throw if status value is out of range.
|
||||
*/
|
||||
void setStatus(AlarmStatus value) { status = value;}
|
||||
private:
|
||||
int32 severity;
|
||||
|
||||
@@ -14,15 +14,58 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/** @brief Methods for a control structure.
|
||||
*
|
||||
* An control structure has the following fields:
|
||||
@code
|
||||
structure
|
||||
double limitLow
|
||||
double limitHigh
|
||||
double minStep
|
||||
@endcode
|
||||
* This is a class that holds values corresponding to the fields in
|
||||
* a control structure.
|
||||
* It is meant to be used together with pvControl
|
||||
* which allows values to be copied between an control structure
|
||||
* and this class.
|
||||
* This class should not be extended.
|
||||
*/
|
||||
class epicsShareClass Control {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Control() : low(0.0), high(0.0), minStep(0.0) {}
|
||||
//default constructors and destructor are OK
|
||||
/**
|
||||
* get limitLow
|
||||
* @return the current value.
|
||||
*/
|
||||
double getLow() const {return low;}
|
||||
/**
|
||||
* get limitHigh
|
||||
* @return the current value.
|
||||
*/
|
||||
double getHigh() const {return high;}
|
||||
/**
|
||||
* get minStep
|
||||
* @return the current value.
|
||||
*/
|
||||
double getMinStep() const {return minStep;}
|
||||
/**
|
||||
* set limitLow
|
||||
* @param value The new value.
|
||||
*/
|
||||
void setLow(double value) {low = value;}
|
||||
/**
|
||||
* set limitHigh
|
||||
* @param value The new value.
|
||||
*/
|
||||
void setHigh(double value) {high = value;}
|
||||
/**
|
||||
* set minStep
|
||||
* @param value The new value.
|
||||
*/
|
||||
void setMinStep(double value) {minStep = value;}
|
||||
private:
|
||||
double low;
|
||||
|
||||
@@ -19,21 +19,83 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/** @brief Methods for a display structure.
|
||||
*
|
||||
* An display structure has the following fields:
|
||||
@code
|
||||
structure
|
||||
double limitLow
|
||||
double limitHigh
|
||||
string description
|
||||
string format
|
||||
string units
|
||||
@endcode
|
||||
* This is a class that holds values corresponding to the fields in
|
||||
* a display structure.
|
||||
* It is meant to be used together with pvDisplay
|
||||
* which allows values to be copied between an display structure
|
||||
* and this class.
|
||||
* This class should not be extended.
|
||||
*/
|
||||
class epicsShareClass Display {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Display()
|
||||
: description(std::string("")),format(std::string("")),units(std::string("")),
|
||||
low(0.0),high(0.0) {}
|
||||
//default constructors and destructor are OK
|
||||
/**
|
||||
* Get the current value of limitLow.
|
||||
* @return The current value.
|
||||
*/
|
||||
double getLow() const {return low;}
|
||||
/**
|
||||
* Get the current value of limitHigh.
|
||||
* @return The current value.
|
||||
*/
|
||||
double getHigh() const{ return high;}
|
||||
/**
|
||||
* Set limitLow to a new value.
|
||||
* @param value The value.
|
||||
*/
|
||||
void setLow(double value){low = value;}
|
||||
/**
|
||||
* Set limitHigh to a new value.
|
||||
* @param value The value.
|
||||
*/
|
||||
void setHigh(double value){high = value;}
|
||||
/**
|
||||
* Get the current value of description.
|
||||
* @return The current value.
|
||||
*/
|
||||
std::string getDescription() const {return description;}
|
||||
/**
|
||||
* Set description to a new value.
|
||||
* @param value The value.
|
||||
*/
|
||||
void setDescription(std::string const & value) {description = value;}
|
||||
/**
|
||||
* Get the current value of format.
|
||||
* @return The current value.
|
||||
*/
|
||||
std::string getFormat() const {return format;}
|
||||
/**
|
||||
* Set format to a new value.
|
||||
* @param value The value.
|
||||
* The rules for a valid syntax has not been specified.
|
||||
*/
|
||||
void setFormat(std::string const & value) {format = value;}
|
||||
/**
|
||||
* Get the current value of units.
|
||||
* @return The current value.
|
||||
*/
|
||||
std::string getUnits() const {return units;}
|
||||
/**
|
||||
* Set units to a new value.
|
||||
* @param value The value.
|
||||
*/
|
||||
void setUnits(std::string const & value) {units = value;}
|
||||
private:
|
||||
std::string description;
|
||||
|
||||
@@ -20,18 +20,65 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/** @brief Methods for accessing an alarm structure.
|
||||
*
|
||||
* An alarm structure has the following fields:
|
||||
@code
|
||||
structure
|
||||
int severity
|
||||
int status
|
||||
string message
|
||||
@endcode
|
||||
* This class can be attached to an alarm structure field of any
|
||||
* PVData object.
|
||||
* The methods provide access to the fields in the attached structure,
|
||||
* via an instance of class Alarm.
|
||||
* This class should not be extended.
|
||||
*/
|
||||
class epicsShareClass PVAlarm {
|
||||
public:
|
||||
/**
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
PVAlarm() {}
|
||||
//default constructors and destructor are OK
|
||||
//returns (false,true) if pvField(isNot, is valid enumerated structure
|
||||
//returns (false,true) if pvField(is not, is) a valid alarm structure
|
||||
//An automatic detach is issued if already attached.
|
||||
/*
|
||||
* Attach to a field of a PVData object.
|
||||
* @param pvField The pvField.
|
||||
* @return (false,true) if the pvField (is not, is) an alarm structure.
|
||||
*/
|
||||
/*
|
||||
* Attach to a field of a PVData object.
|
||||
* @param pvField The pvField.
|
||||
* @return (false,true) if the pvField (is not, is) an alarm structure.
|
||||
*/
|
||||
bool attach(PVFieldPtr const & pvField);
|
||||
/**
|
||||
* Detach for pvField.
|
||||
*/
|
||||
void detach();
|
||||
/**
|
||||
* Is the PVAlarm attached to a pvField?
|
||||
* @return (false,true) (is not,is) attached to a pvField.
|
||||
*/
|
||||
bool isAttached();
|
||||
// each of the following throws logic_error is not attached to PVField
|
||||
// set returns false if field is immutable
|
||||
/**
|
||||
* copy the alarm structure values to Alarm
|
||||
* @param alarm An instance of class Alarm
|
||||
* @throw If not attached to a pvField.
|
||||
*/
|
||||
void get(Alarm & alarm) const;
|
||||
/**
|
||||
* copy the values from Alarm to the alarm structure.
|
||||
* @param alarm An instance of class Alarm
|
||||
* @return (false,true) if pvField (immutable, muttable)
|
||||
* @throw If not attached to a pvField.
|
||||
*/
|
||||
bool set(Alarm const & alarm);
|
||||
private:
|
||||
PVIntPtr pvSeverity;
|
||||
|
||||
@@ -17,18 +17,60 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/** @brief Methods for accessing an control structure.
|
||||
*
|
||||
* An control structure has the following fields:
|
||||
@code
|
||||
structure
|
||||
double limitLow
|
||||
double limitHigh
|
||||
double minStep
|
||||
@endcode
|
||||
* This class can be attached to an control structure field of any
|
||||
* PVData object.
|
||||
* The methods provide access to the fields in the attached structure,
|
||||
* via an instance of class Control.
|
||||
* This class should not be extended.
|
||||
*/
|
||||
class epicsShareClass PVControl {
|
||||
public:
|
||||
/**
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
PVControl(){}
|
||||
//default constructors and destructor are OK
|
||||
//returns (false,true) if pvField(isNot, is valid enumerated structure
|
||||
//returns (false,true) if pvField(is not, is) a valid control structure
|
||||
//An automatic detach is issued if already attached.
|
||||
/*
|
||||
* Attach to a field of a PVData object.
|
||||
* @param pvField The pvField.
|
||||
* @return (false,true) if the pvField (is not, is) an control structure.
|
||||
*/
|
||||
bool attach(PVFieldPtr const & pvField);
|
||||
/**
|
||||
* Detach for pvField.
|
||||
*/
|
||||
void detach();
|
||||
/**
|
||||
* Is the PVControl attached to a pvField?
|
||||
* @return (false,true) (is not,is) attached to a pvField.
|
||||
*/
|
||||
bool isAttached();
|
||||
// each of the following throws logic_error is not attached to PVField
|
||||
// each of the following throws logic_error if not attached to PVField
|
||||
// set returns false if field is immutable
|
||||
void get(Control &) const;
|
||||
/**
|
||||
* copy the control structure values to Control
|
||||
* @param control An instance of class Control
|
||||
* @throw If not attached to a pvField.
|
||||
*/
|
||||
void get(Control & control) const;
|
||||
/**
|
||||
* copy the values from Control to the control structure.
|
||||
* @param control An instance of class Control
|
||||
* @return (false,true) if pvField (immutable, muttable)
|
||||
* @throw If not attached to a pvField.
|
||||
*/
|
||||
bool set(Control const & control);
|
||||
private:
|
||||
PVDoublePtr pvLow;
|
||||
|
||||
@@ -20,17 +20,61 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/** @brief Methods for accessing an display structure.
|
||||
*
|
||||
* A display structure has the following fields:
|
||||
@code
|
||||
structure
|
||||
double limitLow
|
||||
double limitHigh
|
||||
string description
|
||||
string format
|
||||
string units
|
||||
@endcode
|
||||
* This class can be attached to a display structure field of any
|
||||
* PVData object.
|
||||
* The methods provide access to the fields in the attached structure,
|
||||
* via an instance of class Display.
|
||||
* This class should not be extended.
|
||||
*/
|
||||
class epicsShareClass PVDisplay {
|
||||
public:
|
||||
/**
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
PVDisplay() {}
|
||||
//default constructors and destructor are OK
|
||||
//An automatic detach is issued if already attached.
|
||||
/*
|
||||
* Attach to a field of a PVData object.
|
||||
* @param pvField The pvField.
|
||||
* @return (false,true) if the pvField (is not, is) an display structure.
|
||||
*/
|
||||
bool attach(PVFieldPtr const & pvField);
|
||||
/**
|
||||
* Detach for pvField.
|
||||
*/
|
||||
void detach();
|
||||
/**
|
||||
* Is the PVDisplay attached to a pvField?
|
||||
* @return (false,true) (is not,is) attached to a pvField.
|
||||
*/
|
||||
bool isAttached();
|
||||
// each of the following throws logic_error is not attached to PVField
|
||||
// each of the following throws logic_error if not attached to PVField
|
||||
// a set returns false if field is immutable
|
||||
void get(Display &) const;
|
||||
/**
|
||||
* copy the display structure values to Display
|
||||
* @param display An instance of class Display
|
||||
* @throw If not attached to a pvField.
|
||||
*/
|
||||
void get(Display & display) const;
|
||||
/**
|
||||
* copy the values from Display to the display structure.
|
||||
* @param display An instance of class Display
|
||||
* @return (false,true) if pvField (immutable, muttable)
|
||||
* @throw If not attached to a pvField.
|
||||
*/
|
||||
bool set(Display const & display);
|
||||
private:
|
||||
static std::string noDisplayFound;
|
||||
|
||||
@@ -74,8 +74,12 @@ string PVEnumerated::getChoice()
|
||||
if(pvIndex.get()==NULL ) {
|
||||
throw std::logic_error(notAttached);
|
||||
}
|
||||
int index = pvIndex->get();
|
||||
size_t index = pvIndex->get();
|
||||
const PVStringArray::const_svector& data(pvChoices->view());
|
||||
if(index<0 || index>=data.size()) {
|
||||
string nullString;
|
||||
return nullString;
|
||||
}
|
||||
return data[index];
|
||||
}
|
||||
|
||||
|
||||
@@ -19,24 +19,89 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/** @brief Methods for accessing an enumerated structure.
|
||||
*
|
||||
* An enumerated structure has the following fields:
|
||||
@code
|
||||
structure
|
||||
int index
|
||||
string[] choices
|
||||
@endcode
|
||||
* This class can be attached to an enumerated structure field of any
|
||||
* PVData object.
|
||||
* The methods provide access to the fields in the attached structure.
|
||||
* This class should not be extended.
|
||||
*/
|
||||
class epicsShareClass PVEnumerated {
|
||||
public:
|
||||
/*
|
||||
* Constructor.
|
||||
*/
|
||||
PVEnumerated() {}
|
||||
//default constructors and destructor are OK
|
||||
//This class should not be extended
|
||||
//returns (false,true) if pvField(isNot, is valid enumerated structure
|
||||
//returns (false,true) if pvField(is not, is) a valid enumerated structure
|
||||
//An automatic detach is issued if already attached.
|
||||
/*
|
||||
* Attach to a field of a PVData object.
|
||||
* @param pvField The pvField.
|
||||
* @return (false,true) if the pvField (is not, is) an enumerated structure.
|
||||
*/
|
||||
bool attach(PVFieldPtr const & pvField);
|
||||
/**
|
||||
* Detach for pvField.
|
||||
*/
|
||||
void detach();
|
||||
/**
|
||||
* Is the PVEnumerated attached to a pvField?
|
||||
* @return (false,true) (is not,is) attached to a pvField.
|
||||
*/
|
||||
bool isAttached();
|
||||
// each of the following throws logic_error is not attached to PVField
|
||||
// a set returns false if field is immutable
|
||||
/**
|
||||
* Set the index.
|
||||
* @param index The new index.
|
||||
* @throw if not attached.
|
||||
* The index will be changed even if it is out of range of size of choices.
|
||||
*/
|
||||
bool setIndex(int32 index);
|
||||
/**
|
||||
* Get the index.
|
||||
* @return The current index.
|
||||
* @throw if not attached.
|
||||
*/
|
||||
int32 getIndex();
|
||||
/**
|
||||
* Get the choice corresponding to current index.
|
||||
* @return The choice. If index is out of range a null string is returned.
|
||||
* @throw if not attached.
|
||||
*/
|
||||
std::string getChoice();
|
||||
/**
|
||||
* Can choices be changed?
|
||||
* @return (false,true) if choices (can not, can) be changed.
|
||||
* @throw if not attached.
|
||||
*/
|
||||
bool choicesMutable();
|
||||
/**
|
||||
* Get the choices.
|
||||
* @return The current index.
|
||||
* @throw if not attached.
|
||||
*/
|
||||
inline PVStringArray::const_svector getChoices(){return pvChoices->view();}
|
||||
/**
|
||||
* Get the size of the choices array.
|
||||
* @return The size.
|
||||
* @throw if not attached.
|
||||
*/
|
||||
int32 getNumberChoices();
|
||||
/**
|
||||
* Get the choices.
|
||||
* @param choics The new value for choices.`
|
||||
* @return (false,true) if choices (was not was) replaced.
|
||||
* @throw if not attached.
|
||||
*/
|
||||
bool setChoices(const StringArray & choices);
|
||||
private:
|
||||
static std::string notFound;
|
||||
|
||||
@@ -21,19 +21,61 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/** @brief Methods for accessing a timeStamp structure.
|
||||
*
|
||||
* A timeStamp structure has the following fields:
|
||||
@code
|
||||
structure
|
||||
long secondsPastEpoch
|
||||
int nanoseconds
|
||||
int userTag
|
||||
@endcode
|
||||
* This class can be attached to a timeStamp structure field of any
|
||||
* PVData object.
|
||||
* The methods provide access to the fields in the attached structure,
|
||||
* via an instance of class TimeStamp.
|
||||
* This class should not be extended.
|
||||
*/
|
||||
class epicsShareClass PVTimeStamp {
|
||||
public:
|
||||
/**
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
PVTimeStamp(){}
|
||||
//default constructors and destructor are OK
|
||||
//This class should not be extended
|
||||
|
||||
//returns (false,true) if pvField(isNot, is valid timeStamp structure
|
||||
//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);
|
||||
/**
|
||||
* Detach for pvField.
|
||||
*/
|
||||
void detach();
|
||||
/**
|
||||
* Is the PVTimeStamp attached to a pvField?
|
||||
* @return (false,true) (is not,is) attached to a pvField.
|
||||
*/
|
||||
bool isAttached();
|
||||
// following throw logic_error is not attached to PVField
|
||||
// a set returns false if field is immutable
|
||||
void get(TimeStamp &) const;
|
||||
// following throw logic_error if not attached to PVField
|
||||
// set returns false if field is immutable
|
||||
/**
|
||||
* copy the timeStamp structure values to TimeStamp
|
||||
* @param timeStamp An instance of class TimeStamp
|
||||
* @throw If not attached to a pvField.
|
||||
*/
|
||||
void get(TimeStamp & timeStamp) const;
|
||||
/**
|
||||
* copy the values from TimeStamp to the timeStamp structure.
|
||||
* @param timeStamp An instance of class TimeStamp
|
||||
* @return (false,true) if pvField (immutable, muttable)
|
||||
* @throw If not attached to a pvField.
|
||||
*/
|
||||
bool set(TimeStamp const & timeStamp);
|
||||
private:
|
||||
static std::string noTimeStamp;
|
||||
|
||||
@@ -35,43 +35,158 @@ epicsShareExtern int32 microSecPerSec;
|
||||
epicsShareExtern int32 nanoSecPerSec;
|
||||
epicsShareExtern int64 posixEpochAtEpicsEpoch;
|
||||
|
||||
/** @brief Methods for manipulating timeStamp.
|
||||
*
|
||||
* A timeStamp structure has the following fields:
|
||||
@code
|
||||
structure
|
||||
long secondsPastEpoch
|
||||
int nanoseconds
|
||||
int userTag
|
||||
@endcode
|
||||
* This is a class that holds values corresponding to the fields in
|
||||
* a timeStamp structure.
|
||||
* It is meant to be used together with pvTimeStamp
|
||||
* which allows values to be copied between an timeStamp structure
|
||||
* and this class.
|
||||
* This class should not be extended.
|
||||
*/
|
||||
class epicsShareClass TimeStamp {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
TimeStamp()
|
||||
:secondsPastEpoch(0), nanoseconds(0), userTag(0) {}
|
||||
/**
|
||||
* Constructor
|
||||
* @param secondsPastEpoch seconds since 1970 UTC
|
||||
* @param nanoseconds nanoseconds since secondsPastEpoch
|
||||
* @param userTag application specific
|
||||
*/
|
||||
TimeStamp(int64 secondsPastEpoch,int32 nanoseconds = 0,int32 userTag = 0);
|
||||
//default constructors and destructor are OK
|
||||
//This class should not be extended
|
||||
/**
|
||||
* adjust secondsPastEpoch and nanoseconds so that
|
||||
* 0 <= nanoseconds < nanoSecPerSec
|
||||
*/
|
||||
void normalize();
|
||||
void fromTime_t(const time_t &);
|
||||
void toTime_t(time_t &) const;
|
||||
/**
|
||||
* Set timeStamp from standard C time
|
||||
* @param time time as returned by std::time
|
||||
*/
|
||||
void fromTime_t(const time_t & time);
|
||||
/**
|
||||
* Set time from timeStamp
|
||||
* @param time time as defined by std::time
|
||||
*/
|
||||
void toTime_t(time_t &time) const;
|
||||
/**
|
||||
* Get secondsPastEpoch.
|
||||
* @return The secondsPastEpoch.
|
||||
*/
|
||||
int64 getSecondsPastEpoch() const {return secondsPastEpoch;}
|
||||
/**
|
||||
* Get secondsPastEpoch for EPICS V3.
|
||||
* This is seconds since 1990 UTC.
|
||||
* @return The epics V3 secondsPastEpoch.
|
||||
*/
|
||||
int64 getEpicsSecondsPastEpoch() const {
|
||||
return secondsPastEpoch - posixEpochAtEpicsEpoch;
|
||||
}
|
||||
/**
|
||||
* Get nanoseconds.
|
||||
* @return nanoseconds withing timeStamp.
|
||||
*/
|
||||
int32 getNanoseconds() const {return nanoseconds;}
|
||||
/**
|
||||
* Get userTag.
|
||||
* @return userTag.
|
||||
*/
|
||||
int32 getUserTag() const {return userTag;}
|
||||
/**
|
||||
* Set userTag.
|
||||
* @param useTag application specific.
|
||||
*/
|
||||
void setUserTag(int userTag) {this->userTag = userTag;}
|
||||
/**
|
||||
* Set time fields in timeStamp.
|
||||
* Result will be normalized.
|
||||
* @param secondsPastEpoch seconds part of timeStamp.
|
||||
* @param nanoseconds nanoseconds part of timeStamp.
|
||||
*/
|
||||
void put(int64 secondsPastEpoch,int32 nanoseconds = 0) {
|
||||
this->secondsPastEpoch = secondsPastEpoch;
|
||||
this->nanoseconds = nanoseconds;
|
||||
normalize();
|
||||
}
|
||||
/**
|
||||
* Set time fields in timeStamp.
|
||||
* @param milliseconds The number of milliseconds since the epoch.
|
||||
*/
|
||||
void put(int64 milliseconds);
|
||||
/**
|
||||
* Set the timeStamp to the current time.
|
||||
*/
|
||||
void getCurrent();
|
||||
/**
|
||||
* Convert the timeStamp to a double value that is seconds past epoch.
|
||||
* @return seconds past 1970 UTC
|
||||
*/
|
||||
double toSeconds() const ;
|
||||
/**
|
||||
* Standard C++ operator.
|
||||
*/
|
||||
bool operator==(TimeStamp const &) const;
|
||||
/**
|
||||
* Standard C++ operator.
|
||||
*/
|
||||
bool operator!=(TimeStamp const &) const;
|
||||
/**
|
||||
* Standard C++ operator.
|
||||
*/
|
||||
bool operator<=(TimeStamp const &) const;
|
||||
/**
|
||||
* Standard C++ operator.
|
||||
*/
|
||||
bool operator< (TimeStamp const &) const;
|
||||
/**
|
||||
* Standard C++ operator.
|
||||
*/
|
||||
bool operator>=(TimeStamp const &) const;
|
||||
/**
|
||||
* Standard C++ operator.
|
||||
*/
|
||||
bool operator> (TimeStamp const &) const;
|
||||
/**
|
||||
* Return a-b as a double value with units of seconds.
|
||||
* @param a first timeStamp
|
||||
* @param n second timeStamp
|
||||
* @return time difference in seconds.
|
||||
*/
|
||||
static double diff(TimeStamp const & a,TimeStamp const & b);
|
||||
/**
|
||||
* Standard C++ operator.
|
||||
*/
|
||||
TimeStamp & operator+=(int64 seconds);
|
||||
/**
|
||||
* Standard C++ operator.
|
||||
*/
|
||||
TimeStamp & operator-=(int64 seconds);
|
||||
/**
|
||||
* Standard C++ operator.
|
||||
*/
|
||||
TimeStamp & operator+=(double seconds);
|
||||
/**
|
||||
* Standard C++ operator.
|
||||
*/
|
||||
TimeStamp & operator-=(double seconds);
|
||||
int64 getMilliseconds(); // milliseconds since epoch
|
||||
/**
|
||||
* Get number of milliseconds past epoch.
|
||||
* @return milliseconds past epoch.
|
||||
*/
|
||||
int64 getMilliseconds();
|
||||
private:
|
||||
static int64 diffInt(TimeStamp const &left,TimeStamp const &right );
|
||||
int64 secondsPastEpoch;
|
||||
|
||||
@@ -55,7 +55,13 @@ static inline bool operator!=(const BoundedString& a, const BoundedString& b)
|
||||
{return !(a==b);}
|
||||
|
||||
|
||||
|
||||
class Convert;
|
||||
typedef std::tr1::shared_ptr<Convert> ConvertPtr;
|
||||
|
||||
/**
|
||||
* @brief Conversion and Copy facility for pvData.
|
||||
*
|
||||
* Convert between numeric types, convert any field to a string,
|
||||
* or convert from a string to a scalar field.
|
||||
* <p>Numeric conversions are between scalar numeric types or between arrays of
|
||||
@@ -74,16 +80,12 @@ static inline bool operator!=(const BoundedString& a, const BoundedString& b)
|
||||
* A scalar field is a numeric field or pvBoolean or pvString.</p>
|
||||
* <p>All from methods put data into a PVField, e.g. from means where the PVField gets it's data.</p>
|
||||
*/
|
||||
|
||||
class Convert;
|
||||
typedef std::tr1::shared_ptr<Convert> ConvertPtr;
|
||||
|
||||
class epicsShareClass Convert {
|
||||
public:
|
||||
static ConvertPtr getConvert();
|
||||
/**
|
||||
* Get the full fieldName for the pvField.
|
||||
* @param builder The builder that will have the result.
|
||||
* @param buf The string that will have the result.
|
||||
* @param pvField The pvField.
|
||||
*/
|
||||
void getFullName(std::string *buf,PVFieldPtr const & pvField)
|
||||
@@ -94,8 +96,8 @@ public:
|
||||
/**
|
||||
* Do fields have the same definition.
|
||||
*
|
||||
* @param First field
|
||||
* @param Second field
|
||||
* @param a First field
|
||||
* @param b Second field
|
||||
* @return (false, true) if the fields (are not, are) the same.
|
||||
*/
|
||||
inline bool equals(PVFieldPtr const &a,PVFieldPtr const &b)
|
||||
@@ -106,8 +108,8 @@ public:
|
||||
/**
|
||||
* Do fields have the same definition.
|
||||
*
|
||||
* @param First field
|
||||
* @param Second field
|
||||
* @param a First field
|
||||
* @param b Second field
|
||||
* @return (false, true) if the fields (are not, are) the same.
|
||||
*/
|
||||
inline bool equals(PVField &a,PVField &b)
|
||||
@@ -117,42 +119,26 @@ public:
|
||||
|
||||
/**
|
||||
* Convert a PVField to a string.
|
||||
* @param buf buffer for the result
|
||||
* @param pv a PVField to convert to a string.
|
||||
* If a PVField is a structure or array be prepared for a very long string.
|
||||
* @param indentLevel indentation level
|
||||
*/
|
||||
inline void getString(std::string *buf,PVFieldPtr const & pvField,int indentLevel)
|
||||
{getString(buf, pvField.get(), indentLevel);}
|
||||
/**
|
||||
* Convert a PVField to a string.
|
||||
* param buf buffer for the result
|
||||
* @param pv The PVField to convert to a string.
|
||||
* If the PVField is a structure or array be prepared for a very long string.
|
||||
* @param buf string that will hold pvField converted to a string,
|
||||
* @param pvField The PVField to convert to a string.
|
||||
*/
|
||||
inline void getString(std::string * buf,PVFieldPtr const & pvField)
|
||||
{getString(buf, pvField.get(), 0);}
|
||||
/**
|
||||
* Convert a PVField to a string.
|
||||
* @param buf buffer for the result
|
||||
* @param pv a PVField to convert to a string.
|
||||
* If a PVField is a structure or array be prepared for a very long string.
|
||||
* @param buf string that will hold pvField converted to a string,
|
||||
* @param pvField The PVField to convert to a string.
|
||||
* @param indentLevel indentation level
|
||||
*/
|
||||
void getString(std::string * buf,PVField const * pvField,int indentLevel);
|
||||
/**
|
||||
* Convert a PVField to a string.
|
||||
* param buf buffer for the result
|
||||
* @param pv The PVField to convert to a string.
|
||||
* If the PVField is a structure or array be prepared for a very long string.
|
||||
*/
|
||||
inline void getString(std::string * buf,PVField const * pvField)
|
||||
{getString(buf, pvField, 0);}
|
||||
/**
|
||||
* Convert from an array of std::string to a PVScalar
|
||||
* Convert from an array of std::string to a PVStructure
|
||||
* @param pv The PV.
|
||||
* @param from The array of std::string value to convert and put into a PV.
|
||||
* @param fromStartIndex The first element if the array of strings.
|
||||
* @return The total number of fields that have been changed.
|
||||
* @throws std::logic_error if the array of std::string does not have a valid values.
|
||||
*/
|
||||
std::size_t fromString(
|
||||
|
||||
@@ -122,7 +122,8 @@ class PVDataCreate;
|
||||
typedef std::tr1::shared_ptr<PVDataCreate> PVDataCreatePtr;
|
||||
|
||||
/**
|
||||
* This class is implemented by code that calls setPostHander
|
||||
* @brief This class is implemented by code that calls setPostHander
|
||||
*
|
||||
*/
|
||||
class epicsShareClass PostHandler
|
||||
{
|
||||
@@ -139,7 +140,8 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* PVField is the base class for each PVData field.
|
||||
* @brief PVField is the base class for each PVData field.
|
||||
*
|
||||
* Each PVData field has an interface that extends PVField.
|
||||
*/
|
||||
class epicsShareClass PVField
|
||||
@@ -256,7 +258,8 @@ private:
|
||||
epicsShareExtern std::ostream& operator<<(std::ostream& o, const PVField& f);
|
||||
|
||||
/**
|
||||
* PVScalar is the base class for each scalar field.
|
||||
* @brief PVScalar is the base class for each scalar field.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass PVScalar : public PVField {
|
||||
// friend our child class(s) so that it
|
||||
@@ -322,7 +325,8 @@ protected:
|
||||
};
|
||||
|
||||
/**
|
||||
* Class that holds the data for each posssible scalar type.
|
||||
* @brief Class that holds the data for each posssible scalar type.
|
||||
*
|
||||
*/
|
||||
template<typename T>
|
||||
class epicsShareClass PVScalarValue : public PVScalar {
|
||||
@@ -437,7 +441,8 @@ typedef std::tr1::shared_ptr<PVFloat> PVFloatPtr;
|
||||
typedef std::tr1::shared_ptr<PVDouble> PVDoublePtr;
|
||||
|
||||
/**
|
||||
* PVString is special case, since it implements SerializableArray
|
||||
* @brief PVString is special case, since it implements SerializableArray
|
||||
*
|
||||
*/
|
||||
class epicsShareClass PVString : public PVScalarValue<std::string>, SerializableArray {
|
||||
public:
|
||||
@@ -453,7 +458,11 @@ typedef std::tr1::shared_ptr<PVString> PVStringPtr;
|
||||
|
||||
|
||||
/**
|
||||
* PVArray is the base class for all array types, i.e. the scalarArray types and structureArray.
|
||||
* @brief PVArray is the base class for all array types.
|
||||
*
|
||||
* The array types are unionArray, strucrtureArray and scalarArray.
|
||||
* There is a scalarArray type for each scalarType.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass PVArray : public PVField, public SerializableArray {
|
||||
public:
|
||||
@@ -520,9 +529,9 @@ private:
|
||||
|
||||
epicsShareExtern std::ostream& operator<<(format::array_at_internal const& manip, const PVArray& array);
|
||||
|
||||
|
||||
/**
|
||||
* Base class for a scalarArray.
|
||||
* @brief Base class for a scalarArray.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass PVScalarArray : public PVArray {
|
||||
public:
|
||||
@@ -604,6 +613,10 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Data interface for a structure,
|
||||
*
|
||||
*/
|
||||
class epicsShareClass PVStructure : public PVField, public BitSetSerializable
|
||||
{
|
||||
public:
|
||||
@@ -665,84 +678,84 @@ public:
|
||||
|
||||
/**
|
||||
* Get a boolean field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVBooleanPtr getBooleanField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get a byte field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVBytePtr getByteField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get a short field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVShortPtr getShortField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get a int field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVIntPtr getIntField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get a long field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVLongPtr getLongField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get an unsigned byte field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVUBytePtr getUByteField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get an unsigned short field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVUShortPtr getUShortField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get an unsigned int field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVUIntPtr getUIntField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get an unsigned long field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVULongPtr getULongField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get a float field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVFloatPtr getFloatField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get a double field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVDoublePtr getDoubleField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get a string field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
@@ -750,21 +763,21 @@ public:
|
||||
|
||||
/**
|
||||
* Get a structure field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVStructurePtr getStructureField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get a union field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVUnionPtr getUnionField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get a scalarArray field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @param elementType The element type.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
@@ -773,14 +786,14 @@ public:
|
||||
std::string const &fieldName,ScalarType elementType) ;
|
||||
/**
|
||||
* Get a structureArray field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVStructureArrayPtr getStructureArrayField(std::string const &fieldName) ;
|
||||
/**
|
||||
* Get a unionArray field with the specified name.
|
||||
* No longer needed. Use templete version of getSubField
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
@@ -857,7 +870,10 @@ private:
|
||||
|
||||
|
||||
/**
|
||||
* PVUnion has a single subfield which has a type specified by a union introspection interface.
|
||||
* @brief PVUnion has a single subfield.
|
||||
*
|
||||
* The type for the subfield is specified by a union introspection interface.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass PVUnion : public PVField
|
||||
{
|
||||
@@ -1064,6 +1080,13 @@ namespace detail {
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* @brief template class for all extensions of PVArray.
|
||||
*
|
||||
* The direct extensions are pvBooleanArray, pvByteArray, ..., pvStringArray.
|
||||
* There are specializations for PVStringArray, PVStructureArray, and PVUnionArray.
|
||||
*
|
||||
*/
|
||||
template<typename T>
|
||||
class epicsShareClass PVValueArray : public detail::PVVectorStorage<T,PVScalarArray> {
|
||||
typedef detail::PVVectorStorage<T,PVScalarArray> base_t;
|
||||
@@ -1085,6 +1108,9 @@ public:
|
||||
*/
|
||||
virtual ~PVValueArray() {}
|
||||
|
||||
/**
|
||||
* Get introspection interface.
|
||||
*/
|
||||
virtual ArrayConstPtr getArray() const
|
||||
{
|
||||
return std::tr1::static_pointer_cast<const Array>(this->getField());
|
||||
@@ -1129,7 +1155,8 @@ protected:
|
||||
|
||||
|
||||
/**
|
||||
* Data class for a structureArray
|
||||
* @brief Data class for a structureArray
|
||||
*
|
||||
*/
|
||||
template<>
|
||||
class epicsShareClass PVValueArray<PVStructurePtr> : public detail::PVVectorStorage<PVStructurePtr,PVArray>
|
||||
@@ -1225,7 +1252,8 @@ private:
|
||||
|
||||
|
||||
/**
|
||||
* Data class for a unionArray
|
||||
* @brief Data class for a unionArray
|
||||
*
|
||||
*/
|
||||
template<>
|
||||
class epicsShareClass PVValueArray<PVUnionPtr> : public detail::PVVectorStorage<PVUnionPtr,PVArray>
|
||||
@@ -1359,7 +1387,8 @@ typedef PVValueArray<std::string> PVStringArray;
|
||||
typedef std::tr1::shared_ptr<PVStringArray> PVStringArrayPtr;
|
||||
|
||||
/**
|
||||
* This is a singlton class for creating data instances.
|
||||
* @brief This is a singlton class for creating data instances.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass PVDataCreate {
|
||||
public:
|
||||
@@ -1537,3 +1566,9 @@ epicsShareExtern PVDataCreatePtr getPVDataCreate();
|
||||
|
||||
}}
|
||||
#endif /* PVDATA_H */
|
||||
|
||||
/** @page Overview Documentation
|
||||
*
|
||||
* <a href = "pvDataCPP.html">pvData.html</a>
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -163,7 +163,8 @@ enum Type {
|
||||
};
|
||||
|
||||
/**
|
||||
* Convenience functions for Type.
|
||||
* @brief Convenience functions for Type.
|
||||
*
|
||||
*/
|
||||
namespace TypeFunc {
|
||||
/**
|
||||
@@ -234,7 +235,8 @@ enum ScalarType {
|
||||
#define MAX_SCALAR_TYPE pvString
|
||||
|
||||
/**
|
||||
* Convenience functions for ScalarType.
|
||||
* @brief Convenience functions for ScalarType.
|
||||
*
|
||||
*/
|
||||
namespace ScalarTypeFunc {
|
||||
/**
|
||||
@@ -283,7 +285,8 @@ epicsShareExtern std::ostream& operator<<(std::ostream& o, const ScalarType& sca
|
||||
|
||||
|
||||
/**
|
||||
* This class implements introspection object for field.
|
||||
* @brief This class implements introspection object for field.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass Field :
|
||||
virtual public Serializable,
|
||||
@@ -335,7 +338,8 @@ epicsShareExtern std::ostream& operator<<(std::ostream& o, const Field& field);
|
||||
|
||||
|
||||
/**
|
||||
* This class implements introspection object for Scalar.
|
||||
* @brief This class implements introspection object for Scalar.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass Scalar : public Field{
|
||||
public:
|
||||
@@ -372,7 +376,8 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* This class implements introspection object for BoundedString.
|
||||
* @brief This class implements introspection object for BoundedString.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass BoundedString : public Scalar{
|
||||
public:
|
||||
@@ -398,7 +403,8 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* This class implements introspection object for Array.
|
||||
* @brief This class implements introspection object for Array.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass Array : public Field{
|
||||
public:
|
||||
@@ -433,14 +439,9 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This class implements introspection object for scalar array.
|
||||
* @brief This class implements introspection object for scalar array.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass ScalarArray : public Array{
|
||||
public:
|
||||
@@ -484,7 +485,8 @@ private:
|
||||
|
||||
|
||||
/**
|
||||
* This class implements introspection object for bounded scalar array.
|
||||
* @brief This class implements introspection object for bounded scalar array.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass BoundedScalarArray : public ScalarArray{
|
||||
public:
|
||||
@@ -518,7 +520,8 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* This class implements introspection object for bounded scalar array.
|
||||
* @brief This class implements introspection object for bounded scalar array.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass FixedScalarArray : public ScalarArray{
|
||||
public:
|
||||
@@ -551,12 +554,9 @@ private:
|
||||
friend class FieldCreate;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This class implements introspection object for a structureArray
|
||||
* @brief This class implements introspection object for a structureArray
|
||||
*
|
||||
*/
|
||||
class epicsShareClass StructureArray : public Array{
|
||||
public:
|
||||
@@ -597,7 +597,8 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* This class implements introspection object for a unionArray
|
||||
* @brief This class implements introspection object for a unionArray
|
||||
*
|
||||
*/
|
||||
class epicsShareClass UnionArray : public Array{
|
||||
public:
|
||||
@@ -638,7 +639,8 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* This class implements introspection object for a structure.
|
||||
* @brief This class implements introspection object for a structure.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass Structure : public Field {
|
||||
public:
|
||||
@@ -719,7 +721,8 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* This class implements introspection object for a union.
|
||||
* @brief This class implements introspection object for a union.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass Union : public Field {
|
||||
public:
|
||||
@@ -817,7 +820,8 @@ class FieldBuilder;
|
||||
typedef std::tr1::shared_ptr<FieldBuilder> FieldBuilderPtr;
|
||||
|
||||
/**
|
||||
* Interface for in-line creating of introspection interfaces.
|
||||
* @brief Interface for in-line creating of introspection interfaces.
|
||||
*
|
||||
* One instance can be used to create multiple {@code Field} instances.
|
||||
* An instance of this object must not be used concurrently (an object has a state).
|
||||
* @author mse
|
||||
@@ -981,7 +985,8 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* This is a singleton class for creating introspection interfaces.
|
||||
* @brief This is a singleton class for creating introspection interfaces.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass FieldCreate {
|
||||
public:
|
||||
@@ -1179,14 +1184,26 @@ OP(pvDouble, double)
|
||||
OP(pvString, std::string)
|
||||
#undef OP
|
||||
|
||||
/**
|
||||
* @brief Hash a Scalar
|
||||
*
|
||||
*/
|
||||
struct ScalarHashFunction {
|
||||
size_t operator() (const Scalar& scalar) const { return scalar.getScalarType(); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Hash a ScalarArray
|
||||
*
|
||||
*/
|
||||
struct ScalarArrayHashFunction {
|
||||
size_t operator() (const ScalarArray& scalarArray) const { return 0x10 | scalarArray.getElementType(); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Hash a Structure
|
||||
*
|
||||
*/
|
||||
struct StructureHashFunction {
|
||||
size_t operator() (const Structure& /*structure*/) const { return 0; }
|
||||
// TODO hash
|
||||
@@ -1194,6 +1211,10 @@ struct StructureHashFunction {
|
||||
// return PRIME * Arrays.hashCode(fieldNames) + Arrays.hashCode(fields);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Hash a StructureArray
|
||||
*
|
||||
*/
|
||||
struct StructureArrayHashFunction {
|
||||
size_t operator() (const StructureArray& structureArray) const { StructureHashFunction shf; return (0x10 | shf(*(structureArray.getStructure()))); }
|
||||
};
|
||||
|
||||
@@ -25,7 +25,8 @@ class StandardField;
|
||||
typedef std::tr1::shared_ptr<StandardField> StandardFieldPtr;
|
||||
|
||||
/**
|
||||
* Standard Fields is a class or creating or sharing Field objects for standard fields.
|
||||
* @brief Standard Fields is a class or creating or sharing Field objects for standard fields.
|
||||
*
|
||||
* For each type of standard object two methods are defined:s
|
||||
* one with no properties and with properties
|
||||
* The property field is a comma separated string of property names of the following:
|
||||
|
||||
@@ -25,7 +25,8 @@ class StandardPVField;
|
||||
typedef std::tr1::shared_ptr<StandardPVField> StandardPVFieldPtr;
|
||||
|
||||
/**
|
||||
* StandardPVField is a class or creating standard data fields.
|
||||
* @brief StandardPVField is a class or creating standard data fields.
|
||||
*
|
||||
* Like class StandardField it has two forms of the methods which create a fields:
|
||||
* one without properties and one with properties.
|
||||
* The properties are some combination of alarm, timeStamp, control, display, and valueAlarm.
|
||||
|
||||
@@ -18,8 +18,20 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/**
|
||||
* @brief Compress a bitSet.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass BitSetUtil : private NoDefaultMethods {
|
||||
public:
|
||||
/**
|
||||
* compress the bitSet for a pvStructure.
|
||||
* In all subfields of a structure have been modified then
|
||||
* the bit for the structure is set and all the subfield bits
|
||||
* are cleared.
|
||||
* @param bitSet this must be a valid bitSet for pvStructure.
|
||||
* @param pvStructure the structure.
|
||||
*/
|
||||
static bool compress(BitSetPtr const &bitSet,PVStructurePtr const &pvStructure);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user