started on documentation and changes to misc as a result

This commit is contained in:
Marty Kraimer
2010-12-02 15:28:09 -05:00
parent fdfd11c755
commit 358923d064
46 changed files with 4515 additions and 1113 deletions

3358
documentation/pvDataCpp.html Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -23,6 +23,7 @@ INC += timer.h
LIBSRCS += byteBuffer.cpp
LIBSRCS += bitSet.cpp
LIBSRCS += requester.cpp
LIBSRCS += serializeHelper.cpp
LIBSRCS += showConstructDestruct.cpp
LIBSRCS += linkedListVoid.cpp

View File

@@ -12,10 +12,6 @@
//#include "serialize.h"
namespace epics { namespace pvData {
// TODO !!!
typedef unsigned long long uint64;
typedef std::string * StringBuilder;
/**
* This class implements a vector of bits that grows as needed. Each
* component of the bit set has a {@code bool} value. The

View File

@@ -9,6 +9,7 @@
#include <cstddef>
#include <string>
#include <cstdio>
#include <stdexcept>
#include <memory>
#include <vector>
@@ -56,13 +57,17 @@ static void init()
Event::~Event() {
epicsEventDestroy(id);
id = 0;
Lock xx(globalMutex);
totalDestruct++;
}
Event::Event(EventInitialState initial)
: id(epicsEventCreate((initial==eventEmpty)?epicsEventEmpty : epicsEventFull))
Event::Event(bool full)
: id(epicsEventCreate(full?epicsEventFull : epicsEventEmpty))
{
init();
Lock xx(globalMutex);
totalConstruct++;
}
@@ -74,23 +79,27 @@ ConstructDestructCallback *Event::getConstructDestructCallback()
void Event::signal()
{
if(id==0) throw std::logic_error(String("event was deleted"));
epicsEventSignal(id);
}
bool Event::wait ()
{
if(id==0) throw std::logic_error(String("event was deleted"));
epicsEventWaitStatus status = epicsEventWait(id);
return status==epicsEventWaitOK ? true : false;
}
bool Event::wait ( double timeOut )
{
if(id==0) throw std::logic_error(String("event was deleted"));
epicsEventWaitStatus status = epicsEventWaitWithTimeout(id,timeOut);
return status==epicsEventWaitOK ? true : false;
}
bool Event::tryWait ()
{
if(id==0) throw std::logic_error(String("event was deleted"));
epicsEventWaitStatus status = epicsEventTryWait(id);
return status==epicsEventWaitOK ? true : false;
}

View File

@@ -16,22 +16,10 @@
namespace epics { namespace pvData {
enum EventWaitStatus {
eventWaitOK,
eventWaitTimeout,
eventWaitError
};
enum EventInitialState {
eventEmpty,
eventFull
};
class Event : private NoDefaultMethods {
public:
explicit Event(bool = false);
~Event();
Event(EventInitialState initial);
static ConstructDestructCallback *getConstructDestructCallback();
void signal();
bool wait (); /* blocks until full */

View File

@@ -81,14 +81,13 @@ ConstructDestructCallback *Executor::getConstructDestructCallback()
return pConstructDestructCallback;
}
class ExecutorPvt : public RunnableReady {
class ExecutorPvt : public Runnable{
public:
ExecutorPvt(String threadName,ThreadPriority priority);
~ExecutorPvt();
ExecutorNode * createNode(Command *command);
void execute(ExecutorNode *node);
void destroy();
virtual void run(ThreadReady *threadReady);
virtual void run();
private:
ExecutorList *executorList;
ExecutorList *runList;
@@ -102,37 +101,39 @@ private:
ExecutorPvt::ExecutorPvt(String threadName,ThreadPriority priority)
: executorList(new ExecutorList()),
runList(new ExecutorList()),
moreWork(new Event(eventEmpty)),
stopped(new Event(eventEmpty)),
moreWork(new Event(false)),
stopped(new Event(false)),
mutex(Mutex()),
alive(true),
thread(new Thread(threadName,priority,this))
{
thread->start();
}
{}
ExecutorPvt::~ExecutorPvt()
{
{
Lock xx(&mutex);
alive = false;
}
moreWork->signal();
{
Lock xx(&mutex);
stopped->wait();
}
ExecutorListNode *node;
while((node=executorList->removeHead())!=0) {
delete node->getObject();
}
delete thread;
delete stopped;
delete moreWork;
delete runList;
delete executorList;
delete thread;
}
void ExecutorPvt::run(ThreadReady *threadReady)
void ExecutorPvt::run()
{
bool firstTime = true;
while(alive) {
ExecutorListNode * executorListNode = 0;
if(firstTime) {
firstTime = false;
threadReady->ready();
}
while(alive && runList->isEmpty()) {
moreWork->wait();
}
@@ -164,20 +165,6 @@ void ExecutorPvt::execute(ExecutorNode *node)
if(isEmpty) moreWork->signal();
}
void ExecutorPvt::destroy()
{
{
Lock xx(&mutex);
alive = false;
}
moreWork->signal();
{
Lock xx(&mutex);
stopped->wait();
}
delete this;
}
Executor::Executor(String threadName,ThreadPriority priority)
: pImpl(new ExecutorPvt(threadName,priority))
{
@@ -187,23 +174,14 @@ Executor::Executor(String threadName,ThreadPriority priority)
}
Executor::~Executor() {
delete pImpl;
Lock xx(globalMutex);
totalDestruct++;
}
Executor *Executor::create(String threadName,ThreadPriority priority)
{
return new Executor(threadName,priority);
}
ExecutorNode * Executor::createNode(Command*command)
{return pImpl->createNode(command);}
void Executor::execute(ExecutorNode *node) {pImpl->execute(node);}
void Executor::destroy() {
pImpl->destroy();
delete this;
}
}}

View File

@@ -24,14 +24,12 @@ public:
class Executor : private NoDefaultMethods {
public:
static ConstructDestructCallback *getConstructDestructCallback();
static Executor *create(String threadName,ThreadPriority priority);
ExecutorNode * createNode(Command *command);
void execute(ExecutorNode *node);
void destroy();
private:
Executor(String threadName,ThreadPriority priority);
~Executor();
static ConstructDestructCallback *getConstructDestructCallback();
ExecutorNode * createNode(Command *command);
void execute(ExecutorNode *node);
private:
class ExecutorPvt *pImpl;
};

View File

@@ -17,8 +17,9 @@ class LinkedListNode : private LinkedListVoidNode {
public:
LinkedListNode(T *object) : LinkedListVoidNode(object){}
~LinkedListNode() {}
T *getObject() { return (T *)LinkedListVoidNode::getObject();}
T *getObject() { return static_cast<T *>(LinkedListVoidNode::getObject());}
bool isOnList() {return LinkedListVoidNode::isOnList();}
friend class LinkedList<T>;
};
template <typename T>
@@ -29,49 +30,51 @@ public:
int getLength() {return LinkedListVoid::getLength();}
void addTail(LinkedListNode<T> *listNode)
{
LinkedListVoid::addTail((LinkedListVoidNode *)listNode);
LinkedListVoid::addTail(static_cast<LinkedListVoidNode *>(listNode));
}
void addHead(LinkedListNode<T> *listNode)
{
LinkedListVoid::addHead((LinkedListVoidNode *)listNode);
LinkedListVoid::addHead(static_cast<LinkedListVoidNode *>(listNode));
}
void insertAfter(LinkedListNode<T> *listNode,
LinkedListNode<T> *addNode)
{
LinkedListVoid::insertAfter(
(LinkedListVoidNode *)listNode,(LinkedListVoidNode *)addNode);
static_cast<LinkedListVoidNode *>(listNode),
static_cast<LinkedListVoidNode *>(addNode));
}
void insertBefore(LinkedListNode<T> *listNode,
LinkedListNode<T> *addNode)
{
LinkedListVoid::insertBefore((LinkedListVoidNode *)listNode,
(LinkedListVoidNode *)addNode);
LinkedListVoid::insertBefore(
static_cast<LinkedListVoidNode *>(listNode),
static_cast<LinkedListVoidNode *>(addNode));
}
LinkedListNode<T> *removeTail(){
return (LinkedListNode<T>*)LinkedListVoid::removeTail();
return static_cast<LinkedListNode<T> *>(LinkedListVoid::removeTail());
}
LinkedListNode<T> *removeHead(){
return (LinkedListNode<T>*)LinkedListVoid::removeHead();
return static_cast<LinkedListNode<T> *>(LinkedListVoid::removeHead());
}
void remove(LinkedListNode<T> *listNode){
LinkedListVoid::remove((LinkedListVoidNode *)listNode);
LinkedListVoid::remove(static_cast<LinkedListVoidNode *>(listNode));
}
void remove(T *object){
LinkedListVoid::remove(object);
}
LinkedListNode<T> *getHead(){
return (LinkedListNode<T>*)LinkedListVoid::getHead();
return static_cast<LinkedListNode<T> *>(LinkedListVoid::getHead());
}
LinkedListNode<T> *getTail(){
return (LinkedListNode<T>*)LinkedListVoid::getTail();
return static_cast<LinkedListNode<T> *>(LinkedListVoid::getTail());
}
LinkedListNode<T> *getNext(LinkedListNode<T> *listNode){
return (LinkedListNode<T>*)LinkedListVoid::getNext(
(LinkedListVoidNode *)listNode);
return static_cast<LinkedListNode<T> *>(LinkedListVoid::getNext(
static_cast<LinkedListVoidNode *>(listNode)));
}
LinkedListNode<T> *getPrev(LinkedListNode<T> *listNode){
return (LinkedListNode<T>*)LinkedListVoid::getPrev(
(LinkedListVoidNode *)listNode);
return static_cast<LinkedListNode<T> *>(LinkedListVoid::getPrev(
static_cast<LinkedListVoidNode *>(listNode)));
}
bool isEmpty() { return LinkedListVoid::isEmpty();}
bool contains(T *object) { return LinkedListVoid::contains(object);}

View File

@@ -69,7 +69,7 @@ static void initPvt()
LinkedListVoidNode::LinkedListVoidNode(void *object)
: object(object),before(0),after(0)
: object(object),before(0),after(0),linkedListVoid(0)
{
initPvt();
Lock xx(globalMutex);
@@ -138,6 +138,7 @@ void LinkedListVoid::addTail(LinkedListVoidNode *node)
if(node->before!=0 || node->after!=0) {
throw std::logic_error(alreadyOnList);
}
node->linkedListVoid = this;
node->before = head->before;
node->after = head;
head->before->after = node;
@@ -150,6 +151,7 @@ void LinkedListVoid::addHead(LinkedListVoidNode *node)
if(node->before!=0 || node->after!=0) {
throw std::logic_error(alreadyOnList);
}
node->linkedListVoid = this;
node->after = head->after;
node->before = head;
head->after->before = node;
@@ -168,6 +170,10 @@ void LinkedListVoid::insertAfter(LinkedListVoidNode *node,
if(newNode->before!=0 || newNode->after!=0) {
throw std::logic_error(alreadyOnList);
}
if(node->linkedListVoid!=this) {
throw std::logic_error(String("node not on this list"));
}
newNode->linkedListVoid = this;
newNode->after = existingNode->after;
newNode->before = existingNode;
existingNode->after->before = newNode;
@@ -186,6 +192,10 @@ void LinkedListVoid::insertBefore(LinkedListVoidNode *node,
if(newNode->before!=0 || newNode->after!=0) {
throw std::logic_error(alreadyOnList);
}
if(node->linkedListVoid!=this) {
throw std::logic_error(String("node not on this list"));
}
newNode->linkedListVoid = this;
newNode->after = existingNode;
newNode->before = existingNode->before;
existingNode->before->after = newNode;
@@ -209,12 +219,15 @@ LinkedListVoidNode *LinkedListVoid::removeHead()
return node;
}
void LinkedListVoid::remove(LinkedListVoidNode *listNode)
void LinkedListVoid::remove(LinkedListVoidNode *node)
{
LinkedListVoidNode *node = listNode;
if(node->before==0 || node->after==0) {
throw std::logic_error(String("listNode not on list"));
throw std::logic_error(String("node not on list"));
}
if(node->linkedListVoid!=this) {
throw std::logic_error(String("node not on this list"));
}
node->linkedListVoid = 0;
LinkedListVoidNode *prev = node->before;
LinkedListVoidNode *next = node->after;
node->after = node->before = 0;
@@ -233,6 +246,7 @@ void LinkedListVoid::remove(void * object)
}
node = getNext(node);
}
throw std::logic_error(String("object not on this list"));
}
LinkedListVoidNode *LinkedListVoid::getHead()
@@ -249,12 +263,18 @@ LinkedListVoidNode *LinkedListVoid::getTail()
LinkedListVoidNode *LinkedListVoid::getNext(LinkedListVoidNode *listNode)
{
if(listNode->linkedListVoid!=this) {
throw std::logic_error(String("node not on this list"));
}
if(listNode->after==head) return 0;
return listNode->after;
}
LinkedListVoidNode *LinkedListVoid::getPrev(LinkedListVoidNode *listNode)
{
if(listNode->linkedListVoid!=this) {
throw std::logic_error(String("node not on this list"));
}
if(listNode->before==head) return 0;
return listNode->before;
}

View File

@@ -28,6 +28,7 @@ private:
void *object;
LinkedListVoidNode *before;
LinkedListVoidNode *after;
LinkedListVoid *linkedListVoid;
// do not implement the following
LinkedListVoidNode(const LinkedListVoidNode&);
LinkedListVoidNode & operator=(const LinkedListVoidNode&);

View File

@@ -14,25 +14,25 @@
namespace epics { namespace pvData {
class Mutex {
public:
Mutex() : id(epicsMutexMustCreate()){}
~Mutex() { epicsMutexDestroy(id) ;};
void lock(){epicsMutexMustLock(id);}\
void unlock(){epicsMutexUnlock(id);}
private:
epicsMutexId id;
};
class Mutex {
public:
Mutex() : id(epicsMutexMustCreate()){}
~Mutex() { epicsMutexDestroy(id) ;}
void lock(){epicsMutexMustLock(id);}
void unlock(){epicsMutexUnlock(id);}
private:
epicsMutexId id;
};
class Lock : private NoDefaultMethods {
public:
explicit Lock(Mutex *pm)
: mutexPtr(pm)
{mutexPtr->lock();}
~Lock(){mutexPtr->unlock();}
private:
Mutex *mutexPtr;
};
class Lock : private NoDefaultMethods {
public:
explicit Lock(Mutex *pm)
: mutexPtr(pm)
{mutexPtr->lock();}
~Lock(){mutexPtr->unlock();}
private:
Mutex *mutexPtr;
};
}}
#endif /* LOCK_H */

View File

@@ -10,16 +10,16 @@
namespace epics { namespace pvData {
typedef signed char int8;
typedef short int16;
typedef int int32;
typedef long long int64;
typedef unsigned int uint32;
typedef unsigned long long uint64;
typedef signed char int8;
typedef short int16;
typedef int int32;
typedef long long int64;
typedef unsigned int uint32;
typedef unsigned long long uint64;
typedef std::string String;
typedef std::string * StringBuilder;
typedef String* StringArray;
typedef std::string String;
typedef std::string * StringBuilder;
typedef String* StringArray;
}}
#endif /* PVTYPE_H */

View File

@@ -0,0 +1,20 @@
/* requester.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <string>
#include "requester.h"
namespace epics { namespace pvData {
static std::string typeName[] = {
String("info"),
String("warning"),
String("error"),
String("fatalError")
};
StringArray messageTypeName = typeName;
}}

View File

@@ -7,24 +7,22 @@
#include <string>
#ifndef REQUESTER_H
#define REQUESTER_H
#include "pvIntrospect.h"
#include "pvType.h"
namespace epics { namespace pvData {
class Requester;
enum MessageType {
infoMessage,warningMessage,errorMessage,fatalErrorMessage
};
class Requester;
static std::string messageTypeName[] = {
"info","warning","error","fatalError"
};
class Requester {
public:
virtual String getRequesterName() = 0;
virtual void message(String message,MessageType messageType) = 0;
};
enum MessageType {
infoMessage,warningMessage,errorMessage,fatalErrorMessage
};
extern StringArray messageTypeName;
class Requester {
public:
virtual String getRequesterName() = 0;
virtual void message(String message,MessageType messageType) = 0;
};
}}
#endif /* REQUESTER_H */

View File

@@ -9,6 +9,7 @@
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <stdexcept>
#include "noDefaultMethods.h"
#include "lock.h"
@@ -62,6 +63,7 @@ ShowConstructDestruct::ShowConstructDestruct() {}
void ShowConstructDestruct::constuctDestructTotals(FILE *fd)
{
getShowConstructDestruct(); // make it initialize
Lock xx(globalMutex);
ListNode *node = list->getHead();
while(node!=0) {
@@ -80,8 +82,33 @@ void ShowConstructDestruct::constuctDestructTotals(FILE *fd)
void ShowConstructDestruct::registerCallback(ConstructDestructCallback *callback)
{
static ConstructDestructCallback *listCallback = 0;
static ConstructDestructCallback *listNodeCallback = 0;
Lock xx(globalMutex);
ListNode *listNode = new ListNode(callback);
ListNode *listNode = 0;
if(list==0) {
if(callback->getConstructName().compare("linkedListNode")==0) {
listNodeCallback = callback;
} else if(callback->getConstructName().compare("linkedList")==0) {
listCallback = callback;
} else {
throw std::logic_error(String("ShowConstructDestruct::registerCallback"));
}
return;
}
if(listCallback!=0) {
if(listNodeCallback==0) {
throw std::logic_error(String(
"ShowConstructDestruct::registerCallback expected listNodeCallback!=0"));
}
listNode = new ListNode(listNodeCallback);
list->addTail(listNode);
listNode = new ListNode(listCallback);
list->addTail(listNode);
listCallback = 0;
listNodeCallback = 0;
}
listNode = new ListNode(callback);
list->addTail(listNode);
}
@@ -91,9 +118,9 @@ ShowConstructDestruct * getShowConstructDestruct()
Lock xx(&mutex);
if(pShowConstructDestruct==0) {
globalMutex = new Mutex();
list = new List();
pShowConstructDestruct = new ShowConstructDestruct();
}
list = new List();
}
return pShowConstructDestruct;
}

View File

@@ -40,8 +40,8 @@ private:
class ShowConstructDestruct : private NoDefaultMethods {
public:
static void constuctDestructTotals(FILE *fd);
static void registerCallback(ConstructDestructCallback *callback);
void constuctDestructTotals(FILE *fd);
void registerCallback(ConstructDestructCallback *callback);
private:
ShowConstructDestruct();
friend ShowConstructDestruct* getShowConstructDestruct();

View File

@@ -9,6 +9,7 @@
#include <cstddef>
#include <string>
#include <cstdio>
#include <stdexcept>
#include <epicsThread.h>
#include <epicsEvent.h>
@@ -48,9 +49,7 @@ typedef LinkedList<ThreadListElement> ThreadList;
static volatile int64 totalConstruct = 0;
static volatile int64 totalDestruct = 0;
static Mutex *globalMutex = 0;
static void addThread(Thread *thread);
static void removeThread(Thread *thread);
static ThreadList *list;
static ThreadList *threadList;
static int64 getTotalConstruct()
{
@@ -72,7 +71,7 @@ static void init()
Lock xx(&mutex);
if(globalMutex==0) {
globalMutex = new Mutex();
list = new ThreadList();
threadList = new ThreadList();
pConstructDestructCallback = new ConstructDestructCallback(
String("thread"),
getTotalConstruct,getTotalDestruct,0);
@@ -96,38 +95,37 @@ int ThreadPriorityFunc::getEpicsPriority(ThreadPriority threadPriority) {
extern "C" void myFunc ( void * pPvt );
class Runnable : public ThreadReady {
class ThreadPvt {
public:
Runnable(Thread *thread,String name,
ThreadPriority priority, RunnableReady *runnable);
virtual ~Runnable();
Thread *start();
ThreadPvt(Thread *thread,String name,
ThreadPriority priority, Runnable*runnable);
virtual ~ThreadPvt();
void ready();
public: // only used within this source module
Thread *thread;
String name;
ThreadPriority priority;
RunnableReady *runnable;
Event waitStart;
Runnable *runnable;
bool isReady;
ThreadListElement *threadListElement;
Event *waitDone;
epicsThreadId id;
};
extern "C" void myFunc ( void * pPvt )
{
Runnable *runnable = (Runnable *)pPvt;
runnable->waitStart.signal();
addThread(runnable->thread);
runnable->runnable->run(runnable);
removeThread(runnable->thread);
ThreadPvt *threadPvt = (ThreadPvt *)pPvt;
threadPvt->runnable->run();
threadPvt->waitDone->signal();
}
Runnable::Runnable(Thread *thread,String name,
ThreadPriority priority, RunnableReady *runnable)
ThreadPvt::ThreadPvt(Thread *thread,String name,
ThreadPriority priority, Runnable *runnable)
: thread(thread),name(name),priority(priority),
runnable(runnable),
waitStart(eventEmpty),
isReady(false),
threadListElement(new ThreadListElement(thread)),
waitDone(new Event()),
id(epicsThreadCreate(
name.c_str(),
epicsPriority[priority],
@@ -136,32 +134,35 @@ Runnable::Runnable(Thread *thread,String name,
{
init();
Lock xx(globalMutex);
threadList->addTail(threadListElement->node);
totalConstruct++;
}
Runnable::~Runnable()
ThreadPvt::~ThreadPvt()
{
bool result = waitDone->wait(2.0);
if(!result) {
throw std::logic_error(String("delete thread but run did not return"));
String message("destroy thread ");
message += thread->getName();
message += " but run did not return";
throw std::logic_error(message);
}
if(!threadListElement->node->isOnList()) {
String message("destroy thread ");
message += thread->getName();
message += " is not on threadlist";
throw std::logic_error(message);
}
threadList->remove(threadListElement->node);
delete waitDone;
delete threadListElement;
Lock xx(globalMutex);
totalDestruct++;
}
Thread * Runnable::start()
{
if(!waitStart.wait(10.0)) {
fprintf(stderr,"thread %s did not call ready\n",thread->getName().c_str());
}
return thread;
}
void Runnable::ready()
{
waitStart.signal();
}
Thread::Thread(String name,ThreadPriority priority,RunnableReady *runnableReady)
: pImpl(new Runnable(this,name,priority,runnableReady))
Thread::Thread(String name,ThreadPriority priority,Runnable *runnable)
: pImpl(new ThreadPvt(this,name,priority,runnable))
{
}
@@ -176,12 +177,6 @@ ConstructDestructCallback *Thread::getConstructDestructCallback()
return pConstructDestructCallback;
}
void Thread::start()
{
pImpl->start();
}
void Thread::sleep(double seconds)
{
epicsThreadSleep(seconds);;
@@ -201,38 +196,15 @@ void Thread::showThreads(StringBuilder buf)
{
init();
Lock xx(globalMutex);
ThreadListNode *node = list->getHead();
ThreadListNode *node = threadList->getHead();
while(node!=0) {
Thread *thread = node->getObject()->thread;
*buf += thread->getName();
*buf += " ";
*buf += threadPriorityNames[thread->getPriority()];
*buf += "\n";
node = list->getNext(node);
node = threadList->getNext(node);
}
}
void addThread(Thread *thread)
{
Lock xx(globalMutex);
ThreadListElement *element = new ThreadListElement(thread);
list->addTail(element->node);
}
void removeThread(Thread *thread)
{
Lock xx(globalMutex);
ThreadListNode *node = list->getHead();
while(node!=0) {
if(node->getObject()->thread==thread) {
list->remove(node);
delete node;
return;
}
node = list->getNext(node);
}
fprintf(stderr,"removeThread but thread %s did not in list\n",
thread->getName().c_str());
}
}}

View File

@@ -8,6 +8,7 @@
#define THREAD_H
#include "noDefaultMethods.h"
#include "pvType.h"
#include "showConstructDestruct.h"
namespace epics { namespace pvData {
@@ -27,32 +28,25 @@ public:
static int getEpicsPriority(ThreadPriority threadPriority);
};
class ThreadReady {
class Runnable{
public:
virtual void ready() = 0;
};
class RunnableReady {
public:
virtual void run(ThreadReady *threadReady) = 0;
virtual void run() = 0;
};
class Thread;
class Thread : private NoDefaultMethods {
public:
Thread(String name,ThreadPriority priority,RunnableReady *runnableReady);
Thread(String name,ThreadPriority priority,Runnable *runnable);
~Thread();
static ConstructDestructCallback *getConstructDestructCallback();
void start();
String getName();
ThreadPriority getPriority();
static void showThreads(StringBuilder buf);
static void sleep(double seconds);
private:
class Runnable *pImpl;
friend class Runnable;
class ThreadPvt *pImpl;
friend class ThreadPvt;
};
}}

View File

@@ -24,8 +24,44 @@ int64 posixEpochAtEpicsEpoch = POSIX_TIME_AT_EPICS_EPOCH;
TimeStamp::TimeStamp(int64 secondsPastEpoch,int32 nanoSeconds)
: secondsPastEpoch(secondsPastEpoch),nanoSeconds(nanoSeconds)
{}
{
normalize();
}
void TimeStamp::normalize()
{
if(nanoSeconds>=0 && nanoSeconds<nanoSecPerSec) return;
while(nanoSeconds>=nanoSecPerSec) {
nanoSeconds -= nanoSecPerSec;
secondsPastEpoch++;
}
while(nanoSeconds<0) {
nanoSeconds += nanoSecPerSec;
secondsPastEpoch--;
}
}
void TimeStamp::fromTime_t(const time_t & tt)
{
epicsTimeStamp epicsTime;
epicsTimeFromTime_t(&epicsTime,tt);
secondsPastEpoch = epicsTime.secPastEpoch + posixEpochAtEpicsEpoch;
nanoSeconds = epicsTime.nsec;
}
void TimeStamp::toTime_t(time_t &tt) const
{
epicsTimeStamp epicsTime;
epicsTime.secPastEpoch = secondsPastEpoch-posixEpochAtEpicsEpoch;
epicsTime.nsec = nanoSeconds;
epicsTimeToTime_t(&tt,&epicsTime);
}
void TimeStamp::put(int64 milliseconds)
{
secondsPastEpoch = milliseconds/1000;
nanoSeconds = (milliseconds%1000)*1000000;
}
void TimeStamp::getCurrent()
{
@@ -144,12 +180,4 @@ int64 TimeStamp::getMilliseconds()
return secondsPastEpoch*1000 + nanoSeconds/1000000;
}
void TimeStamp::put(int64 milliseconds)
{
secondsPastEpoch = milliseconds/1000;
nanoSeconds = (milliseconds%1000)*1000000;
}
}}

View File

@@ -6,6 +6,7 @@
*/
#ifndef TIMESTAMP_H
#define TIMESTAMP_H
#include <ctime>
#include "epicsTime.h"
#include "pvType.h"
@@ -20,10 +21,12 @@ class TimeStamp {
public:
TimeStamp()
:secondsPastEpoch(0),nanoSeconds(0) {}
TimeStamp(int64 secondsPastEpoch,int32 nanoSeconds = 0);
//default constructors and destructor are OK
//This class should not be extended
TimeStamp(int64 secondsPastEpoch,int32 nanoSeconds = 0);
TimeStamp(epicsTimeStamp &epics);
void normalize();
void fromTime_t(const time_t &);
void toTime_t(time_t &) const;
int64 getSecondsPastEpoch() const {return secondsPastEpoch;}
int64 getEpicsSecondsPastEpoch() const {
return secondsPastEpoch - posixEpochAtEpicsEpoch;
@@ -32,7 +35,9 @@ public:
void put(int64 secondsPastEpoch,int32 nanoSeconds = 0) {
this->secondsPastEpoch = secondsPastEpoch;
this->nanoSeconds = nanoSeconds;
normalize();
}
void put(int64 milliseconds);
void getCurrent();
double toSeconds() const ;
bool operator==(TimeStamp const &) const;
@@ -46,10 +51,7 @@ public:
TimeStamp & operator-=(int64 seconds);
TimeStamp & operator+=(double seconds);
TimeStamp & operator-=(double seconds);
// milliseconds since epoch
int64 getMilliseconds();
void put(int64 milliseconds);
int64 getMilliseconds(); // milliseconds since epoch
private:
static int64 diffInt(TimeStamp const &left,TimeStamp const &right );
int64 secondsPastEpoch;

View File

@@ -87,14 +87,14 @@ ConstructDestructCallback * Timer::getConstructDestructCallback()
class TimerNodePvt;
typedef LinkedListNode<TimerNodePvt> ListNode;
typedef LinkedList<TimerNodePvt> List;
typedef LinkedListNode<TimerNodePvt> TimerListNode;
typedef LinkedList<TimerNodePvt> TimerList;
class TimerNodePvt {
public:
TimerNode *timerNode;
TimerCallback *callback;
ListNode *listNode;
TimerListNode *timerListNode;
TimeStamp timeToRun;
TimerPvt *timerPvt;
double period;
@@ -104,65 +104,63 @@ public:
TimerNodePvt::TimerNodePvt(TimerNode *timerNode,TimerCallback *callback)
: timerNode(timerNode),callback(callback),
listNode(new ListNode(this)),timeToRun(TimeStamp()),
timerListNode(new TimerListNode(this)),timeToRun(TimeStamp()),
timerPvt(0), period(0.0)
{}
TimerNodePvt::~TimerNodePvt()
{
delete listNode;
delete timerListNode;
}
struct TimerPvt : public RunnableReady {
struct TimerPvt : public Runnable{
public:
TimerPvt(String threadName,ThreadPriority priority);
~TimerPvt();
virtual void run(ThreadReady *threadReady);
virtual void run();
public: // only used by this source module
List *list;
TimerList *timerList;
Mutex mutex;
Event *waitForWork;
Event *waitForDone;
Thread *thread;
volatile bool alive;
Thread *thread;
};
TimerPvt::TimerPvt(String threadName,ThreadPriority priority)
: list(new List()),
: timerList(new TimerList()),
mutex(Mutex()),
waitForWork(new Event(eventEmpty)),
waitForDone(new Event(eventEmpty)),
thread(new Thread(threadName,priority,this)),
alive(true)
{
thread->start();
}
waitForWork(new Event(false)),
waitForDone(new Event(false)),
alive(true),
thread(new Thread(threadName,priority,this))
{}
TimerPvt::~TimerPvt()
{
delete thread;
delete waitForDone;
delete waitForWork;
delete list;
delete timerList;
}
static void addElement(TimerPvt *timer,TimerNodePvt *node)
{
List *list = timer->list;
ListNode *nextNode = list->getHead();
TimerList *timerList = timer->timerList;
TimerListNode *nextNode = timerList->getHead();
if(nextNode==0) {
list->addTail(node->listNode);
timerList->addTail(node->timerListNode);
return;
}
while(true) {
TimerNodePvt *listNode = nextNode->getObject();
if((node->timeToRun)<(listNode->timeToRun)) {
list->insertBefore(listNode->listNode,node->listNode);
TimerNodePvt *timerListNode = nextNode->getObject();
if((node->timeToRun)<(timerListNode->timeToRun)) {
timerList->insertBefore(timerListNode->timerListNode,node->timerListNode);
return;
}
nextNode = list->getNext(listNode->listNode);
nextNode = timerList->getNext(timerListNode->timerListNode);
if(nextNode==0) {
list->addTail(node->listNode);
timerList->addTail(node->timerListNode);
return;
}
}
@@ -177,31 +175,22 @@ TimerNode::TimerNode(TimerCallback *callback)
totalNodeConstruct++;
}
TimerNode *TimerNode::create(TimerCallback *callback)
{
return new TimerNode(callback);
}
TimerNode::~TimerNode()
{
cancel();
delete pImpl;
Lock xx(globalMutex);
totalNodeDestruct++;
}
void TimerNode::destroy()
{
cancel();
delete this;
}
void TimerNode::cancel()
{
TimerPvt *timerPvt = pImpl->timerPvt;
if(timerPvt==0) return;
Lock xx(&timerPvt->mutex);
if(pImpl->timerPvt==0) return;
pImpl->timerPvt->list->remove(pImpl);
pImpl->timerPvt->timerList->remove(pImpl);
pImpl->timerPvt = 0;
}
@@ -210,13 +199,12 @@ bool TimerNode::isScheduled()
TimerPvt *pvt = pImpl->timerPvt;
if(pvt==0) return false;
Lock xx(&pvt->mutex);
return pImpl->listNode->isOnList();
return pImpl->timerListNode->isOnList();
}
void TimerPvt::run(ThreadReady *threadReady)
void TimerPvt::run()
{
threadReady->ready();
TimeStamp currentTime;
while(alive) {
currentTime.getCurrent();
@@ -225,25 +213,25 @@ void TimerPvt::run(ThreadReady *threadReady)
TimerNodePvt *nodeToCall = 0;
{
Lock xx(&mutex);
ListNode *listNode = list->getHead();
if(listNode!=0) {
TimerNodePvt *timerNodePvt = listNode->getObject();
TimerListNode *timerListNode = timerList->getHead();
if(timerListNode!=0) {
TimerNodePvt *timerNodePvt = timerListNode->getObject();
timeToRun = &timerNodePvt->timeToRun;
double diff = TimeStamp::diff(
*timeToRun,currentTime);
if(diff<=0.0) {
nodeToCall = timerNodePvt;
list->removeHead();
timerList->removeHead();
period = timerNodePvt->period;
if(period>0) {
if(period>0.0) {
timerNodePvt->timeToRun += period;
addElement(this,timerNodePvt);
} else {
timerNodePvt->timerPvt = 0;
}
listNode = list->getHead();
if(listNode!=0) {
timerNodePvt = listNode->getObject();
timerListNode = timerList->getHead();
if(timerListNode!=0) {
timerNodePvt = timerListNode->getObject();
timeToRun = &timerNodePvt->timeToRun;
} else {
timeToRun = 0;
@@ -273,31 +261,21 @@ Timer::Timer(String threadName, ThreadPriority priority)
totalTimerConstruct++;
}
Timer * Timer::create(String threadName, ThreadPriority priority)
{
return new Timer(threadName,priority);
}
Timer::~Timer() {
delete pImpl;
Lock xx(globalMutex);
totalTimerDestruct++;
}
void Timer::destroy()
{
{
Lock xx(&pImpl->mutex);
pImpl->alive = false;
pImpl->waitForWork->signal();
pImpl->waitForDone->wait();
}
List *list = pImpl->list;
ListNode *node = 0;
while((node = list->removeHead())!=0) {
pImpl->waitForWork->signal();
pImpl->waitForDone->wait();
TimerList *timerList = pImpl->timerList;
TimerListNode *node = 0;
while((node = timerList->removeHead())!=0) {
node->getObject()->callback->timerStopped();
}
delete this;
delete pImpl;
Lock xx(globalMutex);
totalTimerDestruct++;
}
void Timer::scheduleAfterDelay(TimerNode *timerNode,double delay)
@@ -307,7 +285,7 @@ void Timer::scheduleAfterDelay(TimerNode *timerNode,double delay)
void Timer::schedulePeriodic(TimerNode *timerNode,double delay,double period)
{
TimerNodePvt *timerNodePvt = timerNode->pImpl;
if(timerNodePvt->listNode->isOnList()) {
if(timerNodePvt->timerListNode->isOnList()) {
throw std::logic_error(String("already queued"));
}
if(!pImpl->alive) {
@@ -323,7 +301,7 @@ void Timer::schedulePeriodic(TimerNode *timerNode,double delay,double period)
Lock xx(&pImpl->mutex);
timerNodePvt->timerPvt = pImpl;
addElement(pImpl,timerNodePvt);
TimerNodePvt *first = pImpl->list->getHead()->getObject();
TimerNodePvt *first = pImpl->timerList->getHead()->getObject();
if(first==timerNodePvt) isFirst = true;
}
if(isFirst) pImpl->waitForWork->signal();

View File

@@ -27,28 +27,24 @@ public:
class TimerNode : private NoDefaultMethods {
public:
TimerNode(TimerCallback *timerCallback);
~TimerNode();
static ConstructDestructCallback *getConstructDestructCallback();
static TimerNode *create(TimerCallback *timerCallback);
void destroy();
void cancel();
bool isScheduled();
private:
TimerNode(TimerCallback *timerCallback);
~TimerNode();
class TimerNodePvt *pImpl;
friend class Timer;
};
class Timer : private NoDefaultMethods {
public:
Timer(String threadName, ThreadPriority priority);
~Timer();
static ConstructDestructCallback *getConstructDestructCallback();
static Timer * create(String threadName, ThreadPriority priority);
void destroy();
void scheduleAfterDelay(TimerNode *timerNode,double delay);
void schedulePeriodic(TimerNode *timerNode,double delay,double period);
private:
Timer(String threadName, ThreadPriority priority);
~Timer();
class TimerPvt *pImpl;
friend class TimerNode;
};

View File

@@ -352,7 +352,7 @@ static void testTimeLocked(FILE *auxFd) {
}
typedef std::list<Basic *> stdList;
static void testArrayListTime(FILE *auxFd) {
static void testStdListTime(FILE *auxFd) {
TimeStamp startTime;
TimeStamp endTime;
int numNodes = 1000;
@@ -362,7 +362,7 @@ static void testArrayListTime(FILE *auxFd) {
for(int i=0; i<numNodes; i++) {
basics[i] = new Basic(i);
}
fprintf(auxFd,"\nTime ArrayList test\n");
fprintf(auxFd,"\nTime std::list test\n");
int ntimes = 1000;
startTime.getCurrent();
for(int i=0; i<ntimes; i++) {
@@ -385,7 +385,7 @@ static void testArrayListTime(FILE *auxFd) {
for(int i=0; i<numNodes; i++) delete basics[i];
}
static void testArrayListTimeLocked(FILE *auxFd) {
static void testStdListTimeLocked(FILE *auxFd) {
TimeStamp startTime;
TimeStamp endTime;
int numNodes = 1000;
@@ -396,7 +396,7 @@ static void testArrayListTimeLocked(FILE *auxFd) {
for(int i=0; i<numNodes; i++) {
basics[i] = new Basic(i);
}
fprintf(auxFd,"\nTime ArrayList test locked\n");
fprintf(auxFd,"\nTime std::list test locked\n");
int ntimes = 1000;
startTime.getCurrent();
for(int i=0; i<ntimes; i++) {
@@ -444,8 +444,8 @@ int main(int argc, char *argv[]) {
testOrderedQueue(fd);
testTime(auxFd);
testTimeLocked(auxFd);
testArrayListTime(auxFd);
testArrayListTimeLocked(auxFd);
testStdListTime(auxFd);
testStdListTimeLocked(auxFd);
getShowConstructDestruct()->constuctDestructTotals(fd);
return (0);
}

View File

@@ -43,7 +43,7 @@ private:
Basic::Basic(Executor *executor)
: executor(executor),
executorNode(executor->createNode(this)),
wait(new Event(eventEmpty))
wait(new Event())
{
}
@@ -55,7 +55,7 @@ void Basic::run()
{
executor->execute(executorNode);
bool result = wait->wait();
if(result==false) printf("basic::run wait returned true\n");
if(result==false) printf("basic::run wait returned false\n");
}
void Basic::command()
@@ -65,14 +65,14 @@ void Basic::command()
static void testBasic(FILE *fd) {
Executor *executor = Executor::create(String("basic"),middlePriority);
Executor *executor = new Executor(String("basic"),middlePriority);
Basic *basic = new Basic(executor);
basic->run();
delete basic;
String buf("");
Thread::showThreads(&buf);
fprintf(fd,"threads\n%s\n",buf.c_str());
executor->destroy();
delete executor;
}
class MyFunc : public TimeFunctionRequester {
@@ -89,7 +89,7 @@ private:
};
static void testThreadContext(FILE *fd,FILE *auxFd) {
Executor *executor = Executor::create(String("basic"),middlePriority);
Executor *executor = new Executor(String("basic"),middlePriority);
Basic *basic = new Basic(executor);
MyFunc myFunc(basic);
TimeFunction timeFunction(&myFunc);
@@ -97,7 +97,7 @@ static void testThreadContext(FILE *fd,FILE *auxFd) {
perCall *= 1e6;
fprintf(auxFd,"time per call %f microseconds\n",perCall);
delete basic;
executor->destroy();
delete executor;
}
int main(int argc, char *argv[]) {

View File

@@ -14,7 +14,9 @@
#include <cstdlib>
#include <cstddef>
#include <string>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <list>
#include <epicsAssert.h>
@@ -32,6 +34,30 @@ void testTimeStamp(FILE *fd,FILE *auxfd)
current.getSecondsPastEpoch(),
current.getNanoSeconds(),
current.getMilliseconds());
time_t tt;
current.toTime_t(tt);
struct tm ctm;
memcpy(&ctm,localtime(&tt),sizeof(struct tm));
fprintf(auxfd,
"%4.4d.%2.2d.%2.2d %2.2d:%2.2d:%2.2d %d nanoSeconds isDst %s\n",
ctm.tm_year+1900,ctm.tm_mon + 1,ctm.tm_mday,
ctm.tm_hour,ctm.tm_min,ctm.tm_sec,
current.getNanoSeconds(),
(ctm.tm_isdst==0) ? "false" : "true");
tt = time(&tt);
current.fromTime_t(tt);
fprintf(auxfd,"fromTime_t\ncurrent %lli %i milliSec %lli\n",
current.getSecondsPastEpoch(),
current.getNanoSeconds(),
current.getMilliseconds());
current.toTime_t(tt);
memcpy(&ctm,localtime(&tt),sizeof(struct tm));
fprintf(auxfd,
"%4.4d.%2.2d.%2.2d %2.2d:%2.2d:%2.2d %d nanoSeconds isDst %s\n",
ctm.tm_year+1900,ctm.tm_mon + 1,ctm.tm_mday,
ctm.tm_hour,ctm.tm_min,ctm.tm_sec,
current.getNanoSeconds(),
(ctm.tm_isdst==0) ? "false" : "true");
TimeStamp right;
TimeStamp left;
right.put(current.getSecondsPastEpoch(),current.getNanoSeconds());

View File

@@ -33,12 +33,12 @@ class MyCallback : public TimerCallback {
public:
MyCallback(String name,FILE *fd,FILE *auxfd,Event *wait)
: name(name),fd(fd),auxfd(auxfd),wait(wait),
timerNode(TimerNode::create(this)),timeStamp(TimeStamp())
timerNode(new TimerNode(this)),timeStamp(TimeStamp())
{
}
~MyCallback()
{
timerNode->destroy();
delete timerNode;
}
virtual void callback()
{
@@ -64,9 +64,9 @@ static void testBasic(FILE *fd, FILE *auxfd)
{
String one("one");
String two("two");
Event *eventOne = new Event(eventEmpty);
Event *eventTwo = new Event(eventEmpty);
Timer *timer = Timer::create(String("timer"),middlePriority);
Event *eventOne = new Event();
Event *eventTwo = new Event();
Timer *timer = new Timer(String("timer"),middlePriority);
MyCallback *callbackOne = new MyCallback(
one,fd,auxfd,eventOne);
MyCallback *callbackTwo = new MyCallback(
@@ -83,11 +83,11 @@ static void testBasic(FILE *fd, FILE *auxfd)
diff = TimeStamp::diff(
callbackTwo->getTimeStamp(),currentTimeStamp);
fprintf(auxfd,"two requested %f diff %f seconds\n",twoDelay,diff);
timer->destroy();
delete callbackOne;
delete timer;
delete callbackTwo;
delete eventOne;
delete callbackOne;
delete eventTwo;
delete eventOne;
}
int main(int argc, char *argv[]) {

View File

@@ -1,15 +0,0 @@
TOP=../..
include $(TOP)/configure/CONFIG
INC += pvIntrospect.h
INC += bitSet.h
INC += requester.h
INC += byteBuffer.h
INC += serialize.h
INC += pvData.h
include $(TOP)/configure/RULES
#----------------------------------------
# ADD RULES AFTER THIS LINE

View File

@@ -13,76 +13,76 @@
namespace epics { namespace pvData {
class Convert : NoDefaultMethods {
public:
Convert();
~Convert();
void getFullName(StringBuilder buf,PVField *pvField);
bool equals(PVField *a,PVField *b);
void getString(StringBuilder buf,PVField * pvField,int indentLevel);
void getString(StringBuilder buf,PVField *pvField);
void fromString(PVScalar *pv, String from);
int fromString(PVScalarArray *pv, String from);
int fromStringArray(PVScalarArray *pv, int offset, int length,
StringArray from, int fromOffset);
int toStringArray(PVScalarArray *pv, int offset, int length,
StringArray to, int toOffset);
bool isCopyCompatible(FieldConstPtr from, FieldConstPtr to);
void copy(PVField *from,PVField *to);
bool isCopyScalarCompatible(
ScalarConstPtr from, ScalarConstPtr to);
void copyScalar(PVScalar *from, PVScalar *to);
bool isCopyScalarArrayCompatible(ScalarArrayConstPtr from,
ScalarArrayConstPtr to);
int copyScalarArray(PVScalarArray *from, int offset,
PVScalarArray *to, int toOffset, int length);
bool isCopyStructureCompatible(
StructureConstPtr from, StructureConstPtr to);
void copyStructure(PVStructure *from, PVStructure *to);
bool isCopyStructureArrayCompatible(
StructureArrayConstPtr from, StructureArrayConstPtr to);
void copyStructureArray(
PVStructureArray *from, PVStructureArray *to);
int8 toByte(PVScalar *pv);
int16 toShort(PVScalar *pv);
int32 toInt(PVScalar *pv);
int64 toLong(PVScalar *pv);
float toFloat(PVScalar *pv);
double toDouble(PVScalar *pv);
void fromByte(PVScalar *pv,int8 from);
void fromShort(PVScalar *pv,int16 from);
void fromInt(PVScalar *pv, int32 from);
void fromLong(PVScalar *pv, int64 from);
void fromFloat(PVScalar* pv, float from);
void fromDouble(PVScalar *pv, double from);
int toByteArray(PVScalarArray *pv, int offset, int length,
ByteArray to, int toOffset);
int toShortArray(PVScalarArray *pv, int offset, int length,
ShortArray to, int toOffset);
int toIntArray(PVScalarArray *pv, int offset, int length,
IntArray to, int toOffset);
int toLongArray(PVScalarArray *pv, int offset, int length,
LongArray to, int toOffset);
int toFloatArray(PVScalarArray *pv, int offset, int length,
FloatArray to, int toOffset);
int toDoubleArray(PVScalarArray *pv, int offset, int length,
DoubleArray to, int toOffset);
int fromByteArray(PVScalarArray *pv, int offset, int length,
ByteArray from, int fromOffset);
int fromShortArray(PVScalarArray *pv, int offset, int length,
ShortArray from, int fromOffset);
int fromIntArray(PVScalarArray *pv, int offset, int length,
IntArray from, int fromOffset);
int fromLongArray(PVScalarArray *pv, int offset, int length,
LongArray from, int fromOffset);
int fromFloatArray(PVScalarArray *pv, int offset, int length,
FloatArray from, int fromOffset);
int fromDoubleArray(PVScalarArray *pv, int offset, int length,
DoubleArray from, int fromOffset);
void newLine(StringBuilder buf, int indentLevel);
};
class Convert : NoDefaultMethods {
public:
Convert();
~Convert();
void getFullName(StringBuilder buf,PVField *pvField);
bool equals(PVField *a,PVField *b);
void getString(StringBuilder buf,PVField * pvField,int indentLevel);
void getString(StringBuilder buf,PVField *pvField);
void fromString(PVScalar *pv, String from);
int fromString(PVScalarArray *pv, String from);
int fromStringArray(PVScalarArray *pv, int offset, int length,
StringArray from, int fromOffset);
int toStringArray(PVScalarArray *pv, int offset, int length,
StringArray to, int toOffset);
bool isCopyCompatible(FieldConstPtr from, FieldConstPtr to);
void copy(PVField *from,PVField *to);
bool isCopyScalarCompatible(
ScalarConstPtr from, ScalarConstPtr to);
void copyScalar(PVScalar *from, PVScalar *to);
bool isCopyScalarArrayCompatible(ScalarArrayConstPtr from,
ScalarArrayConstPtr to);
int copyScalarArray(PVScalarArray *from, int offset,
PVScalarArray *to, int toOffset, int length);
bool isCopyStructureCompatible(
StructureConstPtr from, StructureConstPtr to);
void copyStructure(PVStructure *from, PVStructure *to);
bool isCopyStructureArrayCompatible(
StructureArrayConstPtr from, StructureArrayConstPtr to);
void copyStructureArray(
PVStructureArray *from, PVStructureArray *to);
int8 toByte(PVScalar *pv);
int16 toShort(PVScalar *pv);
int32 toInt(PVScalar *pv);
int64 toLong(PVScalar *pv);
float toFloat(PVScalar *pv);
double toDouble(PVScalar *pv);
void fromByte(PVScalar *pv,int8 from);
void fromShort(PVScalar *pv,int16 from);
void fromInt(PVScalar *pv, int32 from);
void fromLong(PVScalar *pv, int64 from);
void fromFloat(PVScalar* pv, float from);
void fromDouble(PVScalar *pv, double from);
int toByteArray(PVScalarArray *pv, int offset, int length,
ByteArray to, int toOffset);
int toShortArray(PVScalarArray *pv, int offset, int length,
ShortArray to, int toOffset);
int toIntArray(PVScalarArray *pv, int offset, int length,
IntArray to, int toOffset);
int toLongArray(PVScalarArray *pv, int offset, int length,
LongArray to, int toOffset);
int toFloatArray(PVScalarArray *pv, int offset, int length,
FloatArray to, int toOffset);
int toDoubleArray(PVScalarArray *pv, int offset, int length,
DoubleArray to, int toOffset);
int fromByteArray(PVScalarArray *pv, int offset, int length,
ByteArray from, int fromOffset);
int fromShortArray(PVScalarArray *pv, int offset, int length,
ShortArray from, int fromOffset);
int fromIntArray(PVScalarArray *pv, int offset, int length,
IntArray from, int fromOffset);
int fromLongArray(PVScalarArray *pv, int offset, int length,
LongArray from, int fromOffset);
int fromFloatArray(PVScalarArray *pv, int offset, int length,
FloatArray from, int fromOffset);
int fromDoubleArray(PVScalarArray *pv, int offset, int length,
DoubleArray from, int fromOffset);
void newLine(StringBuilder buf, int indentLevel);
};
extern Convert * getConvert();
extern Convert * getConvert();
}}
#endif /* CONVERT_H */

View File

@@ -17,510 +17,510 @@
#include "showConstructDestruct.h"
namespace epics { namespace pvData {
class PVAuxInfo;
class PostHandler;
class PVAuxInfo;
class PostHandler;
class PVField;
class PVScalar;
class PVBoolean;
class PVByte;
class PVShort;
class PVInt;
class PVLong;
class PVFloat;
class PVDouble;
class PVString;
class PVField;
class PVScalar;
class PVBoolean;
class PVByte;
class PVShort;
class PVInt;
class PVLong;
class PVFloat;
class PVDouble;
class PVString;
class PVScalarArray;
class PVBooleanArray;
class PVByteArray;
class PVShortArray;
class PVIntArray;
class PVLongArray;
class PVFloatArray;
class PVDoubleArray;
class PVStringArray;
class PVScalarArray;
class PVBooleanArray;
class PVByteArray;
class PVShortArray;
class PVIntArray;
class PVLongArray;
class PVFloatArray;
class PVDoubleArray;
class PVStringArray;
class PVStructure;
class PVStructureArray;
class PVStructure;
class PVStructureArray;
typedef std::map<String,PVScalar * > PVScalarMap;
typedef PVScalarMap::const_iterator PVScalarMapIter;
typedef PVStructure * PVStructurePtr;
typedef PVStructurePtr* PVStructurePtrArray;
typedef PVField* PVFieldPtr;
typedef PVFieldPtr * PVFieldPtrArray;
typedef bool * BooleanArray;
typedef int8 * ByteArray;
typedef int16 * ShortArray;
typedef int32 * IntArray;
typedef int64 * LongArray;
typedef float * FloatArray;
typedef double * DoubleArray;
typedef String * StringArray;
typedef std::map<String,PVScalar * > PVScalarMap;
typedef PVScalarMap::const_iterator PVScalarMapIter;
typedef PVStructure * PVStructurePtr;
typedef PVStructurePtr* PVStructurePtrArray;
typedef PVField* PVFieldPtr;
typedef PVFieldPtr * PVFieldPtrArray;
typedef bool * BooleanArray;
typedef int8 * ByteArray;
typedef int16 * ShortArray;
typedef int32 * IntArray;
typedef int64 * LongArray;
typedef float * FloatArray;
typedef double * DoubleArray;
//typedef String * StringArray; alreadt defined in pvType.h
class PVAuxInfo : private NoDefaultMethods {
public:
PVAuxInfo(PVField *pvField);
~PVAuxInfo();
static ConstructDestructCallback *getConstructDestructCallback();
PVField * getPVField();
PVScalar * createInfo(String key,ScalarType scalarType);
PVScalarMap getInfos();
PVScalar * getInfo(String key);
void toString(StringBuilder buf);
void toString(StringBuilder buf,int indentLevel);
private:
class PVAuxInfoPvt *pImpl;
friend class PVDataCreate;
};
class PVAuxInfo : private NoDefaultMethods {
public:
PVAuxInfo(PVField *pvField);
~PVAuxInfo();
static ConstructDestructCallback *getConstructDestructCallback();
PVField * getPVField();
PVScalar * createInfo(String key,ScalarType scalarType);
PVScalarMap getInfos();
PVScalar * getInfo(String key);
void toString(StringBuilder buf);
void toString(StringBuilder buf,int indentLevel);
private:
class PVAuxInfoPvt *pImpl;
friend class PVDataCreate;
};
class PostHandler {
public:
virtual void postPut() = 0;
};
class PostHandler {
public:
virtual void postPut() = 0;
};
class PVField
: public Requester,
public Serializable,
private NoDefaultMethods
{
public:
virtual ~PVField();
static ConstructDestructCallback *getConstructDestructCallback();
String getRequesterName() ;
virtual void message(String message,MessageType messageType) ;
virtual void setRequester(Requester *prequester);
int getFieldOffset() ;
int getNextFieldOffset() ;
int getNumberFields() ;
PVAuxInfo * getPVAuxInfo();
bool isImmutable() ;
void setImmutable();
FieldConstPtr getField() ;
PVStructure * getParent() ;
void replacePVField(PVField * newPVField);
void renameField(String newName);
void postPut() ;
void setPostHandler(PostHandler *postHandler);
virtual void toString(StringBuilder buf) ;
virtual void toString(StringBuilder buf,int indentLevel) ;
virtual bool operator==(PVField &pv) = 0;
virtual bool operator!=(PVField &pv) = 0;
protected:
PVField(PVStructure *parent,FieldConstPtr field);
void replaceStructure(PVStructure *pvStructure);
private:
class PVFieldPvt *pImpl;
static void computeOffset(PVField *pvField);
static void computeOffset(PVField *pvField,int offset);
friend class PVDataCreate;
};
class PVField
: public Requester,
public Serializable,
private NoDefaultMethods
{
public:
virtual ~PVField();
static ConstructDestructCallback *getConstructDestructCallback();
String getRequesterName() ;
virtual void message(String message,MessageType messageType) ;
virtual void setRequester(Requester *prequester);
int getFieldOffset() ;
int getNextFieldOffset() ;
int getNumberFields() ;
PVAuxInfo * getPVAuxInfo();
bool isImmutable() ;
void setImmutable();
FieldConstPtr getField() ;
PVStructure * getParent() ;
void replacePVField(PVField * newPVField);
void renameField(String newName);
void postPut() ;
void setPostHandler(PostHandler *postHandler);
virtual void toString(StringBuilder buf) ;
virtual void toString(StringBuilder buf,int indentLevel) ;
virtual bool operator==(PVField &pv) = 0;
virtual bool operator!=(PVField &pv) = 0;
protected:
PVField(PVStructure *parent,FieldConstPtr field);
void replaceStructure(PVStructure *pvStructure);
private:
class PVFieldPvt *pImpl;
static void computeOffset(PVField *pvField);
static void computeOffset(PVField *pvField,int offset);
friend class PVDataCreate;
};
class PVScalar : public PVField {
public:
virtual ~PVScalar();
ScalarConstPtr getScalar() ;
protected:
PVScalar(PVStructure *parent,ScalarConstPtr scalar);
};
class PVScalar : public PVField {
public:
virtual ~PVScalar();
ScalarConstPtr getScalar() ;
protected:
PVScalar(PVStructure *parent,ScalarConstPtr scalar);
};
class PVArray : public PVField, public SerializableArray {
public:
virtual ~PVArray();
int getLength() ;
void setLength(int length);
int getCapacity() ;
bool isCapacityMutable() ;
void setCapacityMutable(bool isMutable);
virtual void setCapacity(int capacity) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) = 0;
protected:
PVArray(PVStructure *parent,FieldConstPtr field);
void setCapacityLength(int capacity,int length);
private:
class PVArrayPvt * pImpl;
};
class PVArray : public PVField, public SerializableArray {
public:
virtual ~PVArray();
int getLength() ;
void setLength(int length);
int getCapacity() ;
bool isCapacityMutable() ;
void setCapacityMutable(bool isMutable);
virtual void setCapacity(int capacity) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) = 0;
protected:
PVArray(PVStructure *parent,FieldConstPtr field);
void setCapacityLength(int capacity,int length);
private:
class PVArrayPvt * pImpl;
};
class PVScalarArray : public PVArray {
public:
virtual ~PVScalarArray();
ScalarArrayConstPtr getScalarArray() ;
virtual void setCapacity(int capacity) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) = 0;
protected:
PVScalarArray(PVStructure *parent,ScalarArrayConstPtr scalarArray);
private:
};
class PVScalarArray : public PVArray {
public:
virtual ~PVScalarArray();
ScalarArrayConstPtr getScalarArray() ;
virtual void setCapacity(int capacity) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) = 0;
protected:
PVScalarArray(PVStructure *parent,ScalarArrayConstPtr scalarArray);
private:
};
class StructureArrayData {
public:
PVStructurePtrArray data;
int offset;
};
class StructureArrayData {
public:
PVStructurePtrArray data;
int offset;
};
class PVStructureArray : public PVArray {
public:
virtual ~PVStructureArray();
virtual StructureArrayConstPtr getStructureArray() = 0;
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length,
StructureArrayData *data) = 0;
virtual int put(int offset,int length,
PVStructurePtrArray from, int fromOffset) = 0;
virtual void shareData( PVStructurePtrArray value,int capacity,int length) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) = 0 ;
virtual void deserialize(ByteBuffer *buffer,
DeserializableControl *pflusher) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) = 0;
protected:
PVStructureArray(PVStructure *parent,
StructureArrayConstPtr structureArray);
private:
};
class PVStructure : public PVField,public BitSetSerializable {
public:
virtual ~PVStructure();
StructureConstPtr getStructure();
PVFieldPtrArray getPVFields();
PVField *getSubField(String fieldName);
PVField *getSubField(int fieldOffset);
void appendPVField(PVField *pvField);
void appendPVFields(int numberFields,PVFieldPtrArray pvFields);
void removePVField(String fieldName);
PVBoolean *getBooleanField(String fieldName);
PVByte *getByteField(String fieldName);
PVShort *getShortField(String fieldName);
PVInt *getIntField(String fieldName);
PVLong *getLongField(String fieldName);
PVFloat *getFloatField(String fieldName);
PVDouble *getDoubleField(String fieldName);
PVString *getStringField(String fieldName);
PVStructure *getStructureField(String fieldName);
PVScalarArray *getScalarArrayField(
String fieldName,ScalarType elementType);
PVStructureArray *getStructureArrayField(String fieldName);
String getExtendsStructureName();
bool putExtendsStructureName(
String extendsStructureName);
virtual bool operator==(PVField &pv) ;
virtual bool operator!=(PVField &pv) ;
virtual void serialize(
ByteBuffer *pbuffer,SerializableControl *pflusher) ;
virtual void deserialize(
ByteBuffer *pbuffer,DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) ;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher,BitSet *pbitSet) ;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl*pflusher,BitSet *pbitSet);
protected:
PVStructure(PVStructure *parent,StructureConstPtr structure);
private:
class PVStructurePvt * pImpl;
};
class PVBoolean : public PVScalar {
public:
virtual ~PVBoolean();
virtual bool get() = 0;
virtual void put(bool value) = 0;
protected:
PVBoolean(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class PVByte : public PVScalar {
public:
virtual ~PVByte();
virtual int8 get() = 0;
virtual void put(int8 value) = 0;
protected:
PVByte(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class PVShort : public PVScalar {
public:
virtual ~PVShort();
virtual int16 get() = 0;
virtual void put(int16 value) = 0;
protected:
PVShort(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class PVInt : public PVScalar{
public:
virtual ~PVInt();
virtual int32 get() = 0;
virtual void put(int32 value) = 0;
protected:
PVInt(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class PVLong : public PVScalar {
public:
virtual ~PVLong();
virtual int64 get() = 0;
virtual void put(int64 value) = 0;
protected:
PVLong(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class PVFloat : public PVScalar {
public:
virtual ~PVFloat();
virtual float get() = 0;
virtual void put(float value) = 0;
protected:
PVFloat(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class PVDouble : public PVScalar {
public:
virtual ~PVDouble();
virtual double get() = 0;
virtual void put(double value) = 0;
protected:
PVDouble(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class PVString : public PVScalar {
public:
virtual ~PVString();
virtual String get() = 0;
virtual void put(String value) = 0;
protected:
PVString(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class BooleanArrayData {
public:
BooleanArray data;
int offset;
};
class PVBooleanArray : public PVScalarArray {
public:
virtual ~PVBooleanArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, BooleanArrayData *data) = 0;
virtual int put(int offset,int length, BooleanArray from, int fromOffset) = 0;
virtual void shareData(BooleanArray value,int capacity,int length) = 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher) = 0;
protected:
PVBooleanArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class PVStructureArray : public PVArray {
public:
virtual ~PVStructureArray();
virtual StructureArrayConstPtr getStructureArray() = 0;
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length,
StructureArrayData *data) = 0;
virtual int put(int offset,int length,
PVStructurePtrArray from, int fromOffset) = 0;
virtual void shareData( PVStructurePtrArray value,int capacity,int length) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) = 0 ;
virtual void deserialize(ByteBuffer *buffer,
DeserializableControl *pflusher) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) = 0;
protected:
PVStructureArray(PVStructure *parent,
StructureArrayConstPtr structureArray);
private:
};
class ByteArrayData {
public:
ByteArray data;
int offset;
};
class PVStructure : public PVField,public BitSetSerializable {
public:
virtual ~PVStructure();
StructureConstPtr getStructure();
PVFieldPtrArray getPVFields();
PVField *getSubField(String fieldName);
PVField *getSubField(int fieldOffset);
void appendPVField(PVField *pvField);
void appendPVFields(int numberFields,PVFieldPtrArray pvFields);
void removePVField(String fieldName);
PVBoolean *getBooleanField(String fieldName);
PVByte *getByteField(String fieldName);
PVShort *getShortField(String fieldName);
PVInt *getIntField(String fieldName);
PVLong *getLongField(String fieldName);
PVFloat *getFloatField(String fieldName);
PVDouble *getDoubleField(String fieldName);
PVString *getStringField(String fieldName);
PVStructure *getStructureField(String fieldName);
PVScalarArray *getScalarArrayField(
String fieldName,ScalarType elementType);
PVStructureArray *getStructureArrayField(String fieldName);
String getExtendsStructureName();
bool putExtendsStructureName(
String extendsStructureName);
virtual bool operator==(PVField &pv) ;
virtual bool operator!=(PVField &pv) ;
virtual void serialize(
ByteBuffer *pbuffer,SerializableControl *pflusher) ;
virtual void deserialize(
ByteBuffer *pbuffer,DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) ;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher,BitSet *pbitSet) ;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl*pflusher,BitSet *pbitSet);
protected:
PVStructure(PVStructure *parent,StructureConstPtr structure);
private:
class PVStructurePvt * pImpl;
};
class PVByteArray : public PVScalarArray {
public:
virtual ~PVByteArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, ByteArrayData *data) = 0;
virtual int put(int offset,int length, ByteArray from, int fromOffset) = 0;
virtual void shareData(ByteArray value,int capacity,int length) = 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher) = 0;
protected:
PVByteArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class PVBoolean : public PVScalar {
public:
virtual ~PVBoolean();
virtual bool get() = 0;
virtual void put(bool value) = 0;
protected:
PVBoolean(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class ShortArrayData {
public:
ShortArray data;
int offset;
};
class PVByte : public PVScalar {
public:
virtual ~PVByte();
virtual int8 get() = 0;
virtual void put(int8 value) = 0;
protected:
PVByte(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class PVShortArray : public PVScalarArray {
public:
virtual ~PVShortArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, ShortArrayData *data) = 0;
virtual int put(int offset,int length, ShortArray from, int fromOffset) = 0;
virtual void shareData(ShortArray value,int capacity,int length) = 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher) = 0;
protected:
PVShortArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class PVShort : public PVScalar {
public:
virtual ~PVShort();
virtual int16 get() = 0;
virtual void put(int16 value) = 0;
protected:
PVShort(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class IntArrayData {
public:
IntArray data;
int offset;
};
class PVInt : public PVScalar{
public:
virtual ~PVInt();
virtual int32 get() = 0;
virtual void put(int32 value) = 0;
protected:
PVInt(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class PVIntArray : public PVScalarArray {
public:
virtual ~PVIntArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, IntArrayData *data) = 0;
virtual int put(int offset,int length, IntArray from, int fromOffset)= 0;
virtual void shareData(IntArray value,int capacity,int length)= 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher)= 0;
protected:
PVIntArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class PVLong : public PVScalar {
public:
virtual ~PVLong();
virtual int64 get() = 0;
virtual void put(int64 value) = 0;
protected:
PVLong(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class LongArrayData {
public:
LongArray data;
int offset;
};
class PVFloat : public PVScalar {
public:
virtual ~PVFloat();
virtual float get() = 0;
virtual void put(float value) = 0;
protected:
PVFloat(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class PVLongArray : public PVScalarArray {
public:
virtual ~PVLongArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, LongArrayData *data) = 0;
virtual int put(int offset,int length, LongArray from, int fromOffset)= 0;
virtual void shareData(LongArray value,int capacity,int length)= 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher)= 0;
protected:
PVLongArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class PVDouble : public PVScalar {
public:
virtual ~PVDouble();
virtual double get() = 0;
virtual void put(double value) = 0;
protected:
PVDouble(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class PVString : public PVScalar {
public:
virtual ~PVString();
virtual String get() = 0;
virtual void put(String value) = 0;
protected:
PVString(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
private:
};
class BooleanArrayData {
public:
BooleanArray data;
int offset;
};
class PVBooleanArray : public PVScalarArray {
public:
virtual ~PVBooleanArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, BooleanArrayData *data) = 0;
virtual int put(int offset,int length, BooleanArray from, int fromOffset) = 0;
virtual void shareData(BooleanArray value,int capacity,int length) = 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher) = 0;
protected:
PVBooleanArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class FloatArrayData {
public:
FloatArray data;
int offset;
};
class ByteArrayData {
public:
ByteArray data;
int offset;
};
class PVFloatArray : public PVScalarArray {
public:
virtual ~PVFloatArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, FloatArrayData *data) = 0;
virtual int put(int offset,int length, FloatArray from, int fromOffset)= 0;
virtual void shareData(FloatArray value,int capacity,int length)= 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher)= 0;
protected:
PVFloatArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class PVByteArray : public PVScalarArray {
public:
virtual ~PVByteArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, ByteArrayData *data) = 0;
virtual int put(int offset,int length, ByteArray from, int fromOffset) = 0;
virtual void shareData(ByteArray value,int capacity,int length) = 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher) = 0;
protected:
PVByteArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class ShortArrayData {
public:
ShortArray data;
int offset;
};
class PVShortArray : public PVScalarArray {
public:
virtual ~PVShortArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, ShortArrayData *data) = 0;
virtual int put(int offset,int length, ShortArray from, int fromOffset) = 0;
virtual void shareData(ShortArray value,int capacity,int length) = 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher) = 0;
protected:
PVShortArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class IntArrayData {
public:
IntArray data;
int offset;
};
class PVIntArray : public PVScalarArray {
public:
virtual ~PVIntArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, IntArrayData *data) = 0;
virtual int put(int offset,int length, IntArray from, int fromOffset)= 0;
virtual void shareData(IntArray value,int capacity,int length)= 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher)= 0;
protected:
PVIntArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class LongArrayData {
public:
LongArray data;
int offset;
};
class PVLongArray : public PVScalarArray {
public:
virtual ~PVLongArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, LongArrayData *data) = 0;
virtual int put(int offset,int length, LongArray from, int fromOffset)= 0;
virtual void shareData(LongArray value,int capacity,int length)= 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher)= 0;
protected:
PVLongArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class DoubleArrayData {
public:
DoubleArrayData(){}
~DoubleArrayData(){};
DoubleArray data;
int offset;
};
class FloatArrayData {
public:
FloatArray data;
int offset;
};
class PVDoubleArray : public PVScalarArray {
public:
virtual ~PVDoubleArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, DoubleArrayData *data) = 0;
virtual int put(int offset,int length, DoubleArray from, int fromOffset) = 0;
virtual void shareData(DoubleArray value,int capacity,int length) = 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher) = 0;
protected:
PVDoubleArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class PVFloatArray : public PVScalarArray {
public:
virtual ~PVFloatArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, FloatArrayData *data) = 0;
virtual int put(int offset,int length, FloatArray from, int fromOffset)= 0;
virtual void shareData(FloatArray value,int capacity,int length)= 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher)= 0;
protected:
PVFloatArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class StringArrayData {
public:
StringArray data;
int offset;
};
class DoubleArrayData {
public:
DoubleArrayData(){}
~DoubleArrayData(){};
DoubleArray data;
int offset;
};
class PVStringArray : public PVScalarArray {
public:
virtual ~PVStringArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, StringArrayData *data) = 0;
virtual int put(int offset,int length, StringArray from, int fromOffset)= 0;
virtual void shareData(StringArray value,int capacity,int length)= 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher)= 0;
protected:
PVStringArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class PVDoubleArray : public PVScalarArray {
public:
virtual ~PVDoubleArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, DoubleArrayData *data) = 0;
virtual int put(int offset,int length, DoubleArray from, int fromOffset) = 0;
virtual void shareData(DoubleArray value,int capacity,int length) = 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher) = 0;
protected:
PVDoubleArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class PVDataCreate {
public:
PVField *createPVField(PVStructure *parent,
FieldConstPtr field);
PVField *createPVField(PVStructure *parent,
String fieldName,PVField * fieldToClone);
PVScalar *createPVScalar(PVStructure *parent,ScalarConstPtr scalar);
PVScalar *createPVScalar(PVStructure *parent,
String fieldName,ScalarType scalarType);
PVScalar *createPVScalar(PVStructure *parent,
String fieldName,PVScalar * scalarToClone);
PVScalarArray *createPVScalarArray(PVStructure *parent,
ScalarArrayConstPtr scalarArray);
PVScalarArray *createPVScalarArray(PVStructure *parent,
String fieldName,ScalarType elementType);
PVScalarArray *createPVScalarArray(PVStructure *parent,
String fieldName,PVScalarArray * scalarArrayToClone);
PVStructureArray *createPVStructureArray(PVStructure *parent,
StructureArrayConstPtr structureArray);
PVStructure *createPVStructure(PVStructure *parent,
StructureConstPtr structure);
PVStructure *createPVStructure(PVStructure *parent,
String fieldName,int numberFields,FieldConstPtrArray fields);
PVStructure *createPVStructure(PVStructure *parent,
String fieldName,PVStructure *structToClone);
protected:
PVDataCreate();
friend PVDataCreate * getPVDataCreate();
};
extern PVDataCreate * getPVDataCreate();
class StringArrayData {
public:
StringArray data;
int offset;
};
class PVStringArray : public PVScalarArray {
public:
virtual ~PVStringArray();
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, StringArrayData *data) = 0;
virtual int put(int offset,int length, StringArray from, int fromOffset)= 0;
virtual void shareData(StringArray value,int capacity,int length)= 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher)= 0;
protected:
PVStringArray(PVStructure *parent,ScalarArrayConstPtr scalar);
private:
};
class PVDataCreate {
public:
PVField *createPVField(PVStructure *parent,
FieldConstPtr field);
PVField *createPVField(PVStructure *parent,
String fieldName,PVField * fieldToClone);
PVScalar *createPVScalar(PVStructure *parent,ScalarConstPtr scalar);
PVScalar *createPVScalar(PVStructure *parent,
String fieldName,ScalarType scalarType);
PVScalar *createPVScalar(PVStructure *parent,
String fieldName,PVScalar * scalarToClone);
PVScalarArray *createPVScalarArray(PVStructure *parent,
ScalarArrayConstPtr scalarArray);
PVScalarArray *createPVScalarArray(PVStructure *parent,
String fieldName,ScalarType elementType);
PVScalarArray *createPVScalarArray(PVStructure *parent,
String fieldName,PVScalarArray * scalarArrayToClone);
PVStructureArray *createPVStructureArray(PVStructure *parent,
StructureArrayConstPtr structureArray);
PVStructure *createPVStructure(PVStructure *parent,
StructureConstPtr structure);
PVStructure *createPVStructure(PVStructure *parent,
String fieldName,int numberFields,FieldConstPtrArray fields);
PVStructure *createPVStructure(PVStructure *parent,
String fieldName,PVStructure *structToClone);
protected:
PVDataCreate();
friend PVDataCreate * getPVDataCreate();
};
extern PVDataCreate * getPVDataCreate();
}}
#endif /* PVDATA_H */

View File

@@ -13,137 +13,137 @@
#include "showConstructDestruct.h"
namespace epics { namespace pvData {
class Field;
class Scalar;
class ScalarArray;
class Structure;
class StructureArray;
class Field;
class Scalar;
class ScalarArray;
class Structure;
class StructureArray;
typedef Field const * FieldConstPtr;
typedef FieldConstPtr * FieldConstPtrArray;
typedef Scalar const * ScalarConstPtr;
typedef ScalarArray const * ScalarArrayConstPtr;
typedef Structure const * StructureConstPtr;
typedef StructureArray const * StructureArrayConstPtr;
typedef Field const * FieldConstPtr;
typedef FieldConstPtr * FieldConstPtrArray;
typedef Scalar const * ScalarConstPtr;
typedef ScalarArray const * ScalarArrayConstPtr;
typedef Structure const * StructureConstPtr;
typedef StructureArray const * StructureArrayConstPtr;
enum Type {
scalar,
scalarArray,
structure,
structureArray
};
enum Type {
scalar,
scalarArray,
structure,
structureArray
};
class TypeFunc {
public:
static void toString(StringBuilder buf,const Type type);
};
class TypeFunc {
public:
static void toString(StringBuilder buf,const Type type);
};
enum ScalarType {
pvBoolean,
pvByte,
pvShort,
pvInt,
pvLong,
pvFloat,
pvDouble,
pvString
};
enum ScalarType {
pvBoolean,
pvByte,
pvShort,
pvInt,
pvLong,
pvFloat,
pvDouble,
pvString
};
class ScalarTypeFunc {
public:
static bool isInteger(ScalarType type);
static bool isNumeric(ScalarType type);
static bool isPrimitive(ScalarType type);
static ScalarType getScalarType(String value);
static void toString(StringBuilder buf,ScalarType scalarType);
};
class ScalarTypeFunc {
public:
static bool isInteger(ScalarType type);
static bool isNumeric(ScalarType type);
static bool isPrimitive(ScalarType type);
static ScalarType getScalarType(String value);
static void toString(StringBuilder buf,ScalarType scalarType);
};
class Field : private NoDefaultMethods {
public:
virtual ~Field();
Field(String fieldName,Type type);
static ConstructDestructCallback *getConstructDestructCallback();
int getReferenceCount() const;
String getFieldName() const;
Type getType() const;
virtual void toString(StringBuilder buf) const{toString(buf,0);}
virtual void toString(StringBuilder buf,int indentLevel) const;
private:
class FieldPvt *pImpl;
void incReferenceCount() const;
void decReferenceCount() const;
friend class StructureArray;
friend class Structure;
friend class PVFieldPvt;
friend class StandardField;
friend class BasePVStructureArray;
};
class Field : private NoDefaultMethods {
public:
virtual ~Field();
Field(String fieldName,Type type);
static ConstructDestructCallback *getConstructDestructCallback();
int getReferenceCount() const;
String getFieldName() const;
Type getType() const;
virtual void toString(StringBuilder buf) const{toString(buf,0);}
virtual void toString(StringBuilder buf,int indentLevel) const;
private:
class FieldPvt *pImpl;
void incReferenceCount() const;
void decReferenceCount() const;
friend class StructureArray;
friend class Structure;
friend class PVFieldPvt;
friend class StandardField;
friend class BasePVStructureArray;
};
class Scalar : public Field{
public:
Scalar(String fieldName,ScalarType scalarType);
virtual ~Scalar();
ScalarType getScalarType() const {return scalarType;}
virtual void toString(StringBuilder buf) const{toString(buf,0);}
virtual void toString(StringBuilder buf,int indentLevel) const;
private:
ScalarType scalarType;
};
class Scalar : public Field{
public:
Scalar(String fieldName,ScalarType scalarType);
virtual ~Scalar();
ScalarType getScalarType() const {return scalarType;}
virtual void toString(StringBuilder buf) const{toString(buf,0);}
virtual void toString(StringBuilder buf,int indentLevel) const;
private:
ScalarType scalarType;
};
class ScalarArray : public Field{
public:
ScalarArray(String fieldName,ScalarType scalarType);
virtual ~ScalarArray();
ScalarType getElementType() const {return elementType;}
virtual void toString(StringBuilder buf) const{toString(buf,0);}
virtual void toString(StringBuilder buf,int indentLevel) const;
private:
ScalarType elementType;
};
class ScalarArray : public Field{
public:
ScalarArray(String fieldName,ScalarType scalarType);
virtual ~ScalarArray();
ScalarType getElementType() const {return elementType;}
virtual void toString(StringBuilder buf) const{toString(buf,0);}
virtual void toString(StringBuilder buf,int indentLevel) const;
private:
ScalarType elementType;
};
class StructureArray : public Field{
public:
StructureArray(String fieldName,StructureConstPtr structure);
virtual ~StructureArray();
StructureConstPtr getStructure() const {return pstructure;}
virtual void toString(StringBuilder buf) const{toString(buf,0);}
virtual void toString(StringBuilder buf,int indentLevel) const;
private:
StructureConstPtr pstructure;
};
class StructureArray : public Field{
public:
StructureArray(String fieldName,StructureConstPtr structure);
virtual ~StructureArray();
StructureConstPtr getStructure() const {return pstructure;}
virtual void toString(StringBuilder buf) const{toString(buf,0);}
virtual void toString(StringBuilder buf,int indentLevel) const;
private:
StructureConstPtr pstructure;
};
class Structure : public Field {
public:
Structure(String fieldName, int numberFields,FieldConstPtrArray fields);
virtual ~Structure();
int getNumberFields() const {return numberFields;}
FieldConstPtr getField(String fieldName) const;
int getFieldIndex(String fieldName) const;
FieldConstPtrArray getFields() const {return fields;}
virtual void toString(StringBuilder buf) const{toString(buf,0);}
virtual void toString(StringBuilder buf,int indentLevel) const;
private:
int numberFields;
FieldConstPtrArray fields;
};
class Structure : public Field {
public:
Structure(String fieldName, int numberFields,FieldConstPtrArray fields);
virtual ~Structure();
int getNumberFields() const {return numberFields;}
FieldConstPtr getField(String fieldName) const;
int getFieldIndex(String fieldName) const;
FieldConstPtrArray getFields() const {return fields;}
virtual void toString(StringBuilder buf) const{toString(buf,0);}
virtual void toString(StringBuilder buf,int indentLevel) const;
private:
int numberFields;
FieldConstPtrArray fields;
};
class FieldCreate : NoDefaultMethods {
public:
FieldConstPtr create(String fieldName,FieldConstPtr field) const;
ScalarConstPtr createScalar(String fieldName,ScalarType scalarType) const;
ScalarArrayConstPtr createScalarArray(String fieldName,
ScalarType elementType) const;
StructureConstPtr createStructure (String fieldName,
int numberFields,FieldConstPtrArray fields) const;
StructureArrayConstPtr createStructureArray(String fieldName,
StructureConstPtr structure) const;
private:
FieldCreate();
friend FieldCreate * getFieldCreate();
};
class FieldCreate : NoDefaultMethods {
public:
FieldConstPtr create(String fieldName,FieldConstPtr field) const;
ScalarConstPtr createScalar(String fieldName,ScalarType scalarType) const;
ScalarArrayConstPtr createScalarArray(String fieldName,
ScalarType elementType) const;
StructureConstPtr createStructure (String fieldName,
int numberFields,FieldConstPtrArray fields) const;
StructureArrayConstPtr createStructureArray(String fieldName,
StructureConstPtr structure) const;
private:
FieldCreate();
friend FieldCreate * getFieldCreate();
};
extern FieldCreate * getFieldCreate();
extern FieldCreate * getFieldCreate();
}}
#endif /* PVINTROSPECT_H */

View File

@@ -12,57 +12,57 @@
namespace epics { namespace pvData {
class StandardField : private NoDefaultMethods {
public:
StandardField();
~StandardField();
ScalarConstPtr scalar(String fieldName,ScalarType type);
StructureConstPtr scalar(String fieldName,
ScalarType type,String properties);
ScalarArrayConstPtr scalarArray(String fieldName,
ScalarType elementType);
StructureConstPtr scalarArray(String fieldName,
ScalarType elementType, String properties);
StructureArrayConstPtr structureArray(String fieldName,
StructureConstPtr structure);
StructureConstPtr structureArray(String fieldName,
StructureConstPtr structure,String properties);
StructureConstPtr structure(String fieldName,
int numFields,FieldConstPtrArray fields);
StructureConstPtr enumerated(String fieldName,
StringArray choices);
StructureConstPtr enumerated(String fieldName,
StringArray choices, String properties);
ScalarConstPtr scalarValue(ScalarType type);
StructureConstPtr scalarValue(ScalarType type,String properties);
ScalarArrayConstPtr scalarArrayValue(ScalarType elementType);
StructureConstPtr scalarArrayValue(ScalarType elementType,
String properties);
StructureArrayConstPtr structureArrayValue(StructureConstPtr structure);
StructureConstPtr structureArrayValue(StructureConstPtr structure,
String properties);
StructureConstPtr structureValue(
int numFields,FieldConstPtrArray fields);
StructureConstPtr enumeratedValue(StringArray choices);
StructureConstPtr enumeratedValue(StringArray choices,
String properties);
StructureConstPtr alarm();
StructureConstPtr timeStamp();
StructureConstPtr display();
StructureConstPtr control();
StructureConstPtr booleanAlarm();
StructureConstPtr byteAlarm();
StructureConstPtr shortAlarm();
StructureConstPtr intAlarm();
StructureConstPtr longAlarm();
StructureConstPtr floatAlarm();
StructureConstPtr doubleAlarm();
StructureConstPtr enumeratedAlarm();
private:
static void init();
};
class StandardField : private NoDefaultMethods {
public:
StandardField();
~StandardField();
ScalarConstPtr scalar(String fieldName,ScalarType type);
StructureConstPtr scalar(String fieldName,
ScalarType type,String properties);
ScalarArrayConstPtr scalarArray(String fieldName,
ScalarType elementType);
StructureConstPtr scalarArray(String fieldName,
ScalarType elementType, String properties);
StructureArrayConstPtr structureArray(String fieldName,
StructureConstPtr structure);
StructureConstPtr structureArray(String fieldName,
StructureConstPtr structure,String properties);
StructureConstPtr structure(String fieldName,
int numFields,FieldConstPtrArray fields);
StructureConstPtr enumerated(String fieldName,
StringArray choices);
StructureConstPtr enumerated(String fieldName,
StringArray choices, String properties);
ScalarConstPtr scalarValue(ScalarType type);
StructureConstPtr scalarValue(ScalarType type,String properties);
ScalarArrayConstPtr scalarArrayValue(ScalarType elementType);
StructureConstPtr scalarArrayValue(ScalarType elementType,
String properties);
StructureArrayConstPtr structureArrayValue(StructureConstPtr structure);
StructureConstPtr structureArrayValue(StructureConstPtr structure,
String properties);
StructureConstPtr structureValue(
int numFields,FieldConstPtrArray fields);
StructureConstPtr enumeratedValue(StringArray choices);
StructureConstPtr enumeratedValue(StringArray choices,
String properties);
StructureConstPtr alarm();
StructureConstPtr timeStamp();
StructureConstPtr display();
StructureConstPtr control();
StructureConstPtr booleanAlarm();
StructureConstPtr byteAlarm();
StructureConstPtr shortAlarm();
StructureConstPtr intAlarm();
StructureConstPtr longAlarm();
StructureConstPtr floatAlarm();
StructureConstPtr doubleAlarm();
StructureConstPtr enumeratedAlarm();
private:
static void init();
};
extern StandardField * getStandardField();
extern StandardField * getStandardField();
}}
#endif /* STANDARDFIELD_H */

View File

@@ -13,54 +13,54 @@
namespace epics { namespace pvData {
class StandardPVField : private NoDefaultMethods {
public:
StandardPVField();
~StandardPVField();
PVScalar * scalar(PVStructure *parent,String fieldName,ScalarType type);
PVStructure * scalar(PVStructure *parent,
String fieldName,ScalarType type,String properties);
PVScalarArray * scalarArray(PVStructure *parent,
String fieldName,ScalarType elementType);
PVStructure * scalarArray(PVStructure *parent,
String fieldName,ScalarType elementType, String properties);
PVStructureArray * structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure);
PVStructure* structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure,String properties);
PVStructure * enumerated(PVStructure *parent,
String fieldName,StringArray choices);
PVStructure * enumerated(PVStructure *parent,
String fieldName,StringArray choices, String properties);
PVScalar * scalarValue(PVStructure *parent,ScalarType type);
PVStructure * scalarValue(PVStructure *parent,
ScalarType type,String properties);
PVScalarArray * scalarArrayValue(PVStructure *parent,ScalarType elementType);
PVStructure * scalarArrayValue(PVStructure *parent,
ScalarType elementType, String properties);
PVStructureArray * structureArrayValue(PVStructure *parent,
StructureConstPtr structure);
PVStructure * structureArrayValue(PVStructure *parent,
StructureConstPtr structure,String properties);
PVStructure * enumeratedValue(PVStructure *parent,StringArray choices);
PVStructure * enumeratedValue(PVStructure *parent,
StringArray choices, String properties);
PVStructure * alarm(PVStructure *parent);
PVStructure * timeStamp(PVStructure *parent);
PVStructure * display(PVStructure *parent);
PVStructure * control(PVStructure *parent);
PVStructure * booleanAlarm(PVStructure *parent);
PVStructure * byteAlarm(PVStructure *parent);
PVStructure * shortAlarm(PVStructure *parent);
PVStructure * intAlarm(PVStructure *parent);
PVStructure * longAlarm(PVStructure *parent);
PVStructure * floatAlarm(PVStructure *parent);
PVStructure * doubleAlarm(PVStructure *parent);
PVStructure * enumeratedAlarm(PVStructure *parent);
PVStructure * powerSupply(PVStructure *parent);
};
class StandardPVField : private NoDefaultMethods {
public:
StandardPVField();
~StandardPVField();
PVScalar * scalar(PVStructure *parent,String fieldName,ScalarType type);
PVStructure * scalar(PVStructure *parent,
String fieldName,ScalarType type,String properties);
PVScalarArray * scalarArray(PVStructure *parent,
String fieldName,ScalarType elementType);
PVStructure * scalarArray(PVStructure *parent,
String fieldName,ScalarType elementType, String properties);
PVStructureArray * structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure);
PVStructure* structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure,String properties);
PVStructure * enumerated(PVStructure *parent,
String fieldName,StringArray choices);
PVStructure * enumerated(PVStructure *parent,
String fieldName,StringArray choices, String properties);
PVScalar * scalarValue(PVStructure *parent,ScalarType type);
PVStructure * scalarValue(PVStructure *parent,
ScalarType type,String properties);
PVScalarArray * scalarArrayValue(PVStructure *parent,ScalarType elementType);
PVStructure * scalarArrayValue(PVStructure *parent,
ScalarType elementType, String properties);
PVStructureArray * structureArrayValue(PVStructure *parent,
StructureConstPtr structure);
PVStructure * structureArrayValue(PVStructure *parent,
StructureConstPtr structure,String properties);
PVStructure * enumeratedValue(PVStructure *parent,StringArray choices);
PVStructure * enumeratedValue(PVStructure *parent,
StringArray choices, String properties);
PVStructure * alarm(PVStructure *parent);
PVStructure * timeStamp(PVStructure *parent);
PVStructure * display(PVStructure *parent);
PVStructure * control(PVStructure *parent);
PVStructure * booleanAlarm(PVStructure *parent);
PVStructure * byteAlarm(PVStructure *parent);
PVStructure * shortAlarm(PVStructure *parent);
PVStructure * intAlarm(PVStructure *parent);
PVStructure * longAlarm(PVStructure *parent);
PVStructure * floatAlarm(PVStructure *parent);
PVStructure * doubleAlarm(PVStructure *parent);
PVStructure * enumeratedAlarm(PVStructure *parent);
PVStructure * powerSupply(PVStructure *parent);
};
extern StandardPVField * getStandardPVField();
extern StandardPVField * getStandardPVField();
}}
#endif /* STANDARDPVFIELD_H */

View File

@@ -77,5 +77,7 @@ structure value
structure timeStamp
long secondsPastEpoch
int nanoSeconds
linkedListNode: totalConstruct 5 totalDestruct 0
linkedList: totalConstruct 1 totalDestruct 0
field: totalConstruct 156 totalDestruct 63 totalReference 93
pvField: totalConstruct 55 totalDestruct 55

View File

@@ -77,5 +77,7 @@ structure value
structure timeStamp
long secondsPastEpoch
int nanoSeconds
linkedListNode: totalConstruct 5 totalDestruct 0
linkedList: totalConstruct 1 totalDestruct 0
field: totalConstruct 156 totalDestruct 63 totalReference 93
pvField: totalConstruct 55 totalDestruct 55

View File

@@ -1,20 +1,20 @@
Time test
diff 25.093909 milliSeconds
time per iteration 25.093909 microseconds
time per addTail/removeHead 0.012547 microseconds
diff 30.073240 milliSeconds
time per iteration 30.073240 microseconds
time per addTail/removeHead 0.015037 microseconds
Time test locked
diff 176.854724 milliSeconds
time per iteration 176.854724 microseconds
time per addTail/removeHead 0.088427 microseconds
diff 188.396252 milliSeconds
time per iteration 188.396252 microseconds
time per addTail/removeHead 0.094198 microseconds
Time ArrayList test
diff 651.776054 milliSeconds
time per iteration 651.776054 microseconds
time per addTail/removeHead 0.325888 microseconds
Time std::list test
diff 656.937507 milliSeconds
time per iteration 656.937507 microseconds
time per addTail/removeHead 0.328469 microseconds
Time ArrayList test locked
diff 808.411295 milliSeconds
time per iteration 808.411295 microseconds
time per addTail/removeHead 0.404206 microseconds
Time std::list test locked
diff 814.306906 milliSeconds
time per iteration 814.306906 microseconds
time per addTail/removeHead 0.407153 microseconds

View File

@@ -33,6 +33,8 @@ units offset 11 next 12 number 1
limit offset 12 next 15 number 3
low offset 13 next 14 number 1
high offset 14 next 15 number 1
linkedListNode: totalConstruct 6 totalDestruct 0
linkedList: totalConstruct 1 totalDestruct 0
field: totalConstruct 111 totalDestruct 18 totalReference 93
pvField: totalConstruct 17 totalDestruct 17
pvAuxInfo: totalConstruct 1 totalDestruct 1

View File

@@ -33,6 +33,8 @@ units offset 11 next 12 number 1
limit offset 12 next 15 number 3
low offset 13 next 14 number 1
high offset 14 next 15 number 1
linkedListNode: totalConstruct 6 totalDestruct 0
linkedList: totalConstruct 1 totalDestruct 0
field: totalConstruct 111 totalDestruct 18 totalReference 93
pvField: totalConstruct 17 totalDestruct 17
pvAuxInfo: totalConstruct 1 totalDestruct 1

View File

@@ -281,5 +281,7 @@ structure string
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
linkedListNode: totalConstruct 5 totalDestruct 0
linkedList: totalConstruct 1 totalDestruct 0
field: totalConstruct 388 totalDestruct 295 totalReference 93
pvField: totalConstruct 279 totalDestruct 279

View File

@@ -281,5 +281,7 @@ structure string
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
linkedListNode: totalConstruct 5 totalDestruct 0
linkedList: totalConstruct 1 totalDestruct 0
field: totalConstruct 388 totalDestruct 295 totalReference 93
pvField: totalConstruct 279 totalDestruct 279

View File

@@ -56,5 +56,7 @@ structure powerSupply
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
linkedListNode: totalConstruct 5 totalDestruct 0
linkedList: totalConstruct 1 totalDestruct 0
field: totalConstruct 153 totalDestruct 60 totalReference 93
pvField: totalConstruct 56 totalDestruct 56

View File

@@ -56,5 +56,7 @@ structure powerSupply
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
linkedListNode: totalConstruct 5 totalDestruct 0
linkedList: totalConstruct 1 totalDestruct 0
field: totalConstruct 153 totalDestruct 60 totalReference 93
pvField: totalConstruct 56 totalDestruct 56

View File

@@ -1 +1 @@
time per call 23.580658 microseconds
time per call 33.872702 microseconds

View File

@@ -1 +1,5 @@
current 1290516873 809711508 milliSec 1290516873809
current 1291321593 147449761 milliSec 1291321593147
2010.12.02 15:26:33 147449761 nanoSeconds isDst false
fromTime_t
current 1291321593 0 milliSec 1291321593000
2010.12.02 15:26:33 0 nanoSeconds isDst false

View File

@@ -1,3 +1,5 @@
linkedListNode: totalConstruct 20 totalDestruct 12
linkedList: totalConstruct 5 totalDestruct 3
event: totalConstruct 15 totalDestruct 15
thread: totalConstruct 3 totalDestruct 3
timerNode: totalConstruct 6 totalDestruct 6

View File

@@ -1,6 +1,6 @@
one requested 0.400000 diff 0.400214 seconds
two requested 0.200000 diff 0.200183 seconds
one requested 0.200000 diff 0.200328 seconds
two requested 0.400000 diff 0.400277 seconds
one requested 0.000000 diff 0.000038 seconds
two requested 0.000000 diff 0.000060 seconds
one requested 0.400000 diff 0.400275 seconds
two requested 0.200000 diff 0.200137 seconds
one requested 0.200000 diff 0.200168 seconds
two requested 0.400000 diff 0.400172 seconds
one requested 0.000000 diff 0.000026 seconds
two requested 0.000000 diff 0.000082 seconds

View File

@@ -1,3 +1,5 @@
linkedListNode: totalConstruct 20 totalDestruct 12
linkedList: totalConstruct 5 totalDestruct 3
event: totalConstruct 15 totalDestruct 15
thread: totalConstruct 3 totalDestruct 3
timerNode: totalConstruct 6 totalDestruct 6