From 3a00b879ee85f630476ba6c1e11a947ef2c289b4 Mon Sep 17 00:00:00 2001
From: Marty Kraimer
Date: Fri, 15 Apr 2011 14:21:55 -0400
Subject: [PATCH] Added a new method to PVDataCreate that allows a PVStructure
to be created from a PVField array where the elements have a null parent.
PVField::message was changed to pass the message to the top level field
adding the field name at each level.
---
documentation/pvDataCpp.html | 67 ++++++++++----------
pvDataApp/factory/PVDataCreateFactory.cpp | 15 ++++-
pvDataApp/factory/PVField.cpp | 42 ++++++++++---
pvDataApp/factory/PVStructure.cpp | 34 ++++++++++
pvDataApp/monitor/monitorQueue.cpp | 1 -
pvDataApp/pv/pvData.h | 7 +++
test/testBaseException | 61 ++++++++++--------
test/testBaseExceptionDiff | 75 +++++++++++++++++++++++
test/testLinkedListAux | 24 ++++----
test/testPVData | 25 +++++++-
test/testPVDataGold | 25 +++++++-
test/testPropertyAux | 2 +-
test/testQueue | 5 +-
test/testQueueGold | 5 +-
test/testThread | 13 ++--
test/testThreadAux | 2 +-
test/testThreadGold | 13 ++--
test/testTimeStampAux | 8 +--
test/testTimer | 7 +--
test/testTimerAux | 12 ++--
test/testTimerGold | 7 +--
testApp/pv/Makefile | 4 ++
testApp/pv/temp.cpp | 44 ++++++++-----
testApp/pv/testPVData.cpp | 17 +++++
24 files changed, 375 insertions(+), 140 deletions(-)
diff --git a/documentation/pvDataCpp.html b/documentation/pvDataCpp.html
index baf7a71..a411c2e 100644
--- a/documentation/pvDataCpp.html
+++ b/documentation/pvDataCpp.html
@@ -9,7 +9,7 @@
EPICS pvDataCPP
-2011.02.18
+2011.04.14
TODO
@@ -23,9 +23,9 @@
+
Preface
@@ -373,8 +374,8 @@ an existing EPICS IOC.
This is a local Channel implementation that privides support for
attaching to pvIOC records.
-
+
Introduction
@@ -1239,6 +1240,7 @@ public:
virtual bool operator!=(PVField &pv) = 0;
protected:
PVField(PVStructure *parent,FieldConstPtr field);
+ void setParent(PVStructure *parent);
private:
};
@@ -1259,7 +1261,7 @@ are:
style="font-family: courier;">PVDataCreate
setRequester
Sets a requester to be called when message or getRequesterName are
- called.
+ called. This is only legal for the top level PVField.
getFieldOffset
Get offset of the PVField field within top level structure. Every field
within the PVStructure has a unique offset. The top level structure has
@@ -1797,6 +1799,7 @@ public:
DeserializableControl*pflusher,BitSet *pbitSet);
protected:
PVStructure(PVStructure *parent,StructureConstPtr structure);
+ PVStructure(PVStructure *parent,StructureConstPtr structure,PVFieldPtrArray pvFields);
private:
class PVStructurePvt * pImpl;
};
@@ -1968,6 +1971,8 @@ public:
StructureConstPtr structure);
PVStructure *createPVStructure(PVStructure *parent,
String fieldName,int numberFields,FieldConstPtrArray fields);
+ PVStructure *createPVStructure(PVStructure *parent,
+ String fieldName,int numberFields,PVFieldPtrArray pvFields);
PVStructure *createPVStructure(PVStructure *parent,
String fieldName,PVStructure *structToClone);
protected:
@@ -2013,8 +2018,10 @@ extern PVDataCreate * getPVDataCreate();
createPVStructure
Create an instance of a PVStructure. Four methods are provided. The
first method uses a previously created structure introspection interface.
- The second uses a Field array to initialize the sub-fields. The third
- initializes the subfields by cloning the fields contained in
+ The second uses a Field array to initialize the sub-fields. For the third
+ the PVField array is the subfields for the PVStructure. The parent of
+ each PVField array element is set to the PVStructure being created. The
+ forth initializes the subfields by cloning the fields contained in
structToClone. The newly created sub-fields will have the same values and
auxInfos as the original. If structToClone is null then the new structure
is initialized to have 0 sub-fields. WARNING If theStructureConstPtr
@@ -3399,8 +3406,7 @@ public:
LinkedListNode<T> *getNext(LinkedListNode<T> &listNode);
LinkedListNode<T> *getPrev(LinkedListNode<T> &listNode);
bool isEmpty();
-};
-
+};
LinkedListNode has the methods:
@@ -3725,8 +3731,7 @@ public:
void show(std::ostream&);
};
-static inline CDRNode* getNode(CDRNodeInstance *inst);
-
+static inline CDRNode* getNode(CDRNodeInstance *inst);
Status
@@ -3758,8 +3763,7 @@ static inline CDRNode* getNode(CDRNodeInstance *inst);
void toString(StringBuilder buffer, int indentLevel = 0) const;
void serialize(ByteBuffer *buffer, SerializableControl *flusher) const;
void serialize(ByteBuffer *buffer, SerializableControl *flusher) const;
-};
-
+};
The Status methods are:
@@ -4049,6 +4053,7 @@ public:
queue->releaseUsed(element);
}
+
pvMisc
diff --git a/pvDataApp/factory/PVDataCreateFactory.cpp b/pvDataApp/factory/PVDataCreateFactory.cpp
index 61b1ab6..86e5295 100644
--- a/pvDataApp/factory/PVDataCreateFactory.cpp
+++ b/pvDataApp/factory/PVDataCreateFactory.cpp
@@ -579,6 +579,19 @@ PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
return new BasePVStructure(parent,structure);
}
+PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
+ String fieldName,int numberFields,PVFieldPtrArray pvFields)
+{
+ FieldConstPtrArray fields = new FieldConstPtr[numberFields];
+ for(int i=0; igetField();
+ }
+ StructureConstPtr structure = fieldCreate->createStructure(
+ fieldName,numberFields,fields);
+ PVStructure *pvStructure = new BasePVStructure(parent,structure,pvFields);
+ return pvStructure;
+}
+
PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
String fieldName,PVStructure *structToClone)
{
@@ -599,7 +612,7 @@ PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
return pvStructure;
}
- PVDataCreate * getPVDataCreate() {
+PVDataCreate * getPVDataCreate() {
static Mutex mutex;
Lock xx(mutex);
diff --git a/pvDataApp/factory/PVField.cpp b/pvDataApp/factory/PVField.cpp
index c7b66a9..9a65123 100644
--- a/pvDataApp/factory/PVField.cpp
+++ b/pvDataApp/factory/PVField.cpp
@@ -68,26 +68,43 @@ String PVField::getRequesterName()
return none;
}
-void PVField::message(String message,MessageType messageType)
+void PVField::message(String fieldName,String message,MessageType messageType)
{
+ if(pImpl->parent!=0) {
+ String parentName = pImpl->parent->getField()->getFieldName();
+ if(parentName.length()>0) {
+ fieldName = parentName + "." + fieldName;
+ }
+ pImpl->parent->message(fieldName,message,messageType);
+ return;
+ }
if(pImpl->requester) {
- pImpl->requester->message(message,messageType);
+ String mess = fieldName + " " + message;
+ pImpl->requester->message(mess,messageType);
} else {
printf("%s %s %s\n",
messageTypeName[messageType].c_str(),
- pImpl->field->getFieldName().c_str(),
+ fieldName.c_str(),
message.c_str());
}
}
-void PVField::setRequester(Requester *prequester)
+
+void PVField::message(String message,MessageType messageType)
{
- static String requesterPresent =
- "Logic Error. requester is already present";
- if(pImpl->requester==0) {
- pImpl->requester = prequester;
- return;
+ PVField::message(pImpl->field->getFieldName(),message,messageType);
+}
+void PVField::setRequester(Requester *requester)
+{
+ if(pImpl->parent!=0) {
+ throw std::logic_error(String(
+ "PVField::setRequester only legal for top level structure"));
}
- throw std::logic_error(requesterPresent);
+ if(pImpl->requester!=0) {
+ if(pImpl->requester==requester) return;
+ throw std::logic_error(String(
+ "PVField::setRequester requester is already present"));
+ }
+ pImpl->requester = requester;
}
int PVField::getFieldOffset()
@@ -152,6 +169,11 @@ void PVField::setPostHandler(PostHandler *postHandler)
pImpl->postHandler = postHandler;
}
+void PVField::setParent(PVStructure * parent)
+{
+ pImpl->parent = parent;
+}
+
void PVField::toString(StringBuilder buf) {toString(buf,0);}
void PVField::toString(StringBuilder buf,int indentLevel)
diff --git a/pvDataApp/factory/PVStructure.cpp b/pvDataApp/factory/PVStructure.cpp
index 6026559..2fc1479 100644
--- a/pvDataApp/factory/PVStructure.cpp
+++ b/pvDataApp/factory/PVStructure.cpp
@@ -76,6 +76,34 @@ namespace epics { namespace pvData {
}
}
+ PVStructure::PVStructure(PVStructure *parent,StructureConstPtr structurePtr,
+ PVFieldPtrArray pvFields
+ )
+ : PVField(parent,structurePtr),pImpl(new PVStructurePvt())
+ {
+ int numberFields = structurePtr->getNumberFields();
+ pImpl->numberFields = numberFields;
+ pImpl->pvFields = pvFields;
+ for(int i=0; isetParent(parent);
+ if(pvField->getField()->getType()==structure) {
+ PVStructure *subStructure = static_cast(pvField);
+ PVFieldPtr *subFields = subStructure->getPVFields();
+ int numberFields = subStructure->getStructure()->getNumberFields();
+ for(int i=0; i(subFields[i]);
+ setParentPvt(subField,subStructure);
+ }
+ }
+ }
+
PVStructure::~PVStructure()
{
delete pImpl;
@@ -554,6 +582,8 @@ namespace epics { namespace pvData {
class BasePVStructure : public PVStructure {
public:
BasePVStructure(PVStructure *parent,StructureConstPtr structure);
+ BasePVStructure(PVStructure *parent,StructureConstPtr structure,
+ PVFieldPtrArray pvFields);
~BasePVStructure();
private:
};
@@ -561,6 +591,10 @@ namespace epics { namespace pvData {
BasePVStructure::BasePVStructure(PVStructure *parent,StructureConstPtr structure)
: PVStructure(parent,structure) {}
+ BasePVStructure::BasePVStructure(PVStructure *parent,StructureConstPtr structure,
+ PVFieldPtrArray pvFields)
+ : PVStructure(parent,structure,pvFields) {}
+
BasePVStructure::~BasePVStructure() {}
}}
diff --git a/pvDataApp/monitor/monitorQueue.cpp b/pvDataApp/monitor/monitorQueue.cpp
index ef53c56..720f47b 100644
--- a/pvDataApp/monitor/monitorQueue.cpp
+++ b/pvDataApp/monitor/monitorQueue.cpp
@@ -124,7 +124,6 @@ MonitorElement * MonitorQueue::getFree()
void MonitorQueue::setUsed(MonitorElement * element)
{
MonitorElementImpl *temp = static_cast(element);
- MonitorQueueElement *queueElement = temp->getQueueElement();
queue->setUsed(temp->getQueueElement());
}
diff --git a/pvDataApp/pv/pvData.h b/pvDataApp/pv/pvData.h
index 8f5aaff..bfc5ed9 100644
--- a/pvDataApp/pv/pvData.h
+++ b/pvDataApp/pv/pvData.h
@@ -83,11 +83,14 @@ public:
virtual bool operator!=(PVField &pv) = 0;
protected:
PVField(PVStructure *parent,FieldConstPtr field);
+ void setParent(PVStructure * parent);
private:
+ void message(String fieldName,String message,MessageType messageType);
class PVFieldPvt *pImpl;
static void computeOffset(PVField *pvField);
static void computeOffset(PVField *pvField,int offset);
friend class PVDataCreate;
+ friend class PVStructure;
};
class PVScalar : public PVField {
@@ -230,7 +233,9 @@ public:
DeserializableControl*pflusher,BitSet *pbitSet);
protected:
PVStructure(PVStructure *parent,StructureConstPtr structure);
+ PVStructure(PVStructure *parent,StructureConstPtr structure,PVFieldPtrArray pvFields);
private:
+ void setParentPvt(PVField *pvField,PVStructure *parent);
class PVStructurePvt * pImpl;
};
@@ -300,6 +305,8 @@ public:
StructureConstPtr structure);
PVStructure *createPVStructure(PVStructure *parent,
String fieldName,int numberFields,FieldConstPtrArray fields);
+ PVStructure *createPVStructure(PVStructure *parent,
+ String fieldName,int numberFields,PVFieldPtrArray pvFields);
PVStructure *createPVStructure(PVStructure *parent,
String fieldName,PVStructure *structToClone);
protected:
diff --git a/test/testBaseException b/test/testBaseException
index 3c7ad61..0aee447 100644
--- a/test/testBaseException
+++ b/test/testBaseException
@@ -1,37 +1,46 @@
+
+
+There is a logic_error
+
+On line 68 of ../testBaseException.cpp
+../bin/linux-x86/testBaseException[0x80497b9]
+../bin/linux-x86/testBaseException[0x8049a54]
+/lib/libc.so.6(__libc_start_main+0xe6)[0x3ede36]
+../bin/linux-x86/testBaseException[0x80490e1]
+To translate run 'addr2line -e execname 0xXXXXXXX ...'
+ Note: Must be compiled with debug symbols
+
+
+There is another logic_error
+
+On line 75 of ../testBaseException.cpp
+../bin/linux-x86/testBaseException() [0x8049cec]
+../bin/linux-x86/testBaseException() [0x8049923]
+../bin/linux-x86/testBaseException() [0x8049a54]
+/lib/libc.so.6(__libc_start_main+0xe6) [0x3ede36]
+../bin/linux-x86/testBaseException() [0x80490e1]
+
testBaseException...
all is OK
- at ../testBaseException.cpp:48
- ../bin/linux-x86/testBaseException
- ../bin/linux-x86/testBaseException
- /lib/libc.so.6: __libc_start_main()+0xe6
- ../bin/linux-x86/testBaseException
+On line 48 of ../testBaseException.cpp
+../bin/linux-x86/testBaseException() [0x8049581]
+../bin/linux-x86/testBaseException() [0x8049a5c]
+/lib/libc.so.6(__libc_start_main+0xe6) [0x3ede36]
+../bin/linux-x86/testBaseException() [0x80490e1]
+
exception 2
- at ../testBaseException.cpp:57
- ../bin/linux-x86/testBaseException
- ../bin/linux-x86/testBaseException
- ../bin/linux-x86/testBaseException
- /lib/libc.so.6: __libc_start_main()+0xe6
- ../bin/linux-x86/testBaseException
-exception 1
- at ../testBaseException.cpp:40
- ../bin/linux-x86/testBaseException
- ../bin/linux-x86/testBaseException
- ../bin/linux-x86/testBaseException
- ../bin/linux-x86/testBaseException
- /lib/libc.so.6: __libc_start_main()+0xe6
- ../bin/linux-x86/testBaseException
-the root cause
- at ../testBaseException.cpp:31
- ../bin/linux-x86/testBaseException
- ../bin/linux-x86/testBaseException
- ../bin/linux-x86/testBaseException
- /lib/libc.so.6: __libc_start_main()+0xe6
- ../bin/linux-x86/testBaseException
+On line 57 of ../testBaseException.cpp
+../bin/linux-x86/testBaseException() [0x80491ec]
+../bin/linux-x86/testBaseException() [0x80496f9]
+../bin/linux-x86/testBaseException() [0x8049a5c]
+/lib/libc.so.6(__libc_start_main+0xe6) [0x3ede36]
+../bin/linux-x86/testBaseException() [0x80490e1]
+
PASSED
diff --git a/test/testBaseExceptionDiff b/test/testBaseExceptionDiff
index e69de29..c316223 100644
--- a/test/testBaseExceptionDiff
+++ b/test/testBaseExceptionDiff
@@ -0,0 +1,75 @@
+--- testBaseExceptionGold 2011-02-10 04:39:30.000000000 -0500
++++ testBaseException 2011-04-15 14:18:40.000000000 -0400
+@@ -1,37 +1,46 @@
++
++
++There is a logic_error
++
++On line 68 of ../testBaseException.cpp
++../bin/linux-x86/testBaseException[0x80497b9]
++../bin/linux-x86/testBaseException[0x8049a54]
++/lib/libc.so.6(__libc_start_main+0xe6)[0x3ede36]
++../bin/linux-x86/testBaseException[0x80490e1]
++To translate run 'addr2line -e execname 0xXXXXXXX ...'
++ Note: Must be compiled with debug symbols
++
++
++There is another logic_error
++
++On line 75 of ../testBaseException.cpp
++../bin/linux-x86/testBaseException() [0x8049cec]
++../bin/linux-x86/testBaseException() [0x8049923]
++../bin/linux-x86/testBaseException() [0x8049a54]
++/lib/libc.so.6(__libc_start_main+0xe6) [0x3ede36]
++../bin/linux-x86/testBaseException() [0x80490e1]
++
+ testBaseException...
+
+ all is OK
+- at ../testBaseException.cpp:48
+- ../bin/linux-x86/testBaseException
+- ../bin/linux-x86/testBaseException
+- /lib/libc.so.6: __libc_start_main()+0xe6
+- ../bin/linux-x86/testBaseException
++On line 48 of ../testBaseException.cpp
++../bin/linux-x86/testBaseException() [0x8049581]
++../bin/linux-x86/testBaseException() [0x8049a5c]
++/lib/libc.so.6(__libc_start_main+0xe6) [0x3ede36]
++../bin/linux-x86/testBaseException() [0x80490e1]
++
+
+
+
+
+ exception 2
+- at ../testBaseException.cpp:57
+- ../bin/linux-x86/testBaseException
+- ../bin/linux-x86/testBaseException
+- ../bin/linux-x86/testBaseException
+- /lib/libc.so.6: __libc_start_main()+0xe6
+- ../bin/linux-x86/testBaseException
+-exception 1
+- at ../testBaseException.cpp:40
+- ../bin/linux-x86/testBaseException
+- ../bin/linux-x86/testBaseException
+- ../bin/linux-x86/testBaseException
+- ../bin/linux-x86/testBaseException
+- /lib/libc.so.6: __libc_start_main()+0xe6
+- ../bin/linux-x86/testBaseException
+-the root cause
+- at ../testBaseException.cpp:31
+- ../bin/linux-x86/testBaseException
+- ../bin/linux-x86/testBaseException
+- ../bin/linux-x86/testBaseException
+- /lib/libc.so.6: __libc_start_main()+0xe6
+- ../bin/linux-x86/testBaseException
++On line 57 of ../testBaseException.cpp
++../bin/linux-x86/testBaseException() [0x80491ec]
++../bin/linux-x86/testBaseException() [0x80496f9]
++../bin/linux-x86/testBaseException() [0x8049a5c]
++/lib/libc.so.6(__libc_start_main+0xe6) [0x3ede36]
++../bin/linux-x86/testBaseException() [0x80490e1]
++
+
+
+ PASSED
diff --git a/test/testLinkedListAux b/test/testLinkedListAux
index 62299e5..7acb844 100644
--- a/test/testLinkedListAux
+++ b/test/testLinkedListAux
@@ -1,20 +1,20 @@
Time test
-diff 24.890191 milliSeconds
-time per iteration 24.890191 microseconds
-time per addTail/removeHead 0.012445 microseconds
+diff 29.094910 milliSeconds
+time per iteration 29.094910 microseconds
+time per addTail/removeHead 0.014547 microseconds
Time test locked
-diff 188.108610 milliSeconds
-time per iteration 188.108610 microseconds
-time per addTail/removeHead 0.094054 microseconds
+diff 205.944899 milliSeconds
+time per iteration 205.944899 microseconds
+time per addTail/removeHead 0.102972 microseconds
Time std::list test
-diff 668.831984 milliSeconds
-time per iteration 668.831984 microseconds
-time per addTail/removeHead 0.334416 microseconds
+diff 656.960080 milliSeconds
+time per iteration 656.960080 microseconds
+time per addTail/removeHead 0.328480 microseconds
Time std::list test locked
-diff 780.392611 milliSeconds
-time per iteration 780.392611 microseconds
-time per addTail/removeHead 0.390196 microseconds
+diff 824.135585 milliSeconds
+time per iteration 824.135585 microseconds
+time per addTail/removeHead 0.412068 microseconds
diff --git a/test/testPVData b/test/testPVData
index 2012514..f6f79ca 100644
--- a/test/testPVData
+++ b/test/testPVData
@@ -1,5 +1,26 @@
structure request
string fieldList value,timeStamp
+structure top
+ structure value
+ double value 0
+ alarm alarm
+ int severity 0
+ string message
+ timeStamp timeStamp
+ long secondsPastEpoch 0
+ int nanoSeconds 0
+ structure valueAlarm
+ boolean active false
+ double lowAlarmLimit 0
+ double lowWarningLimit 0
+ double highWarningLimit 0
+ double highAlarmLimit 0
+ int lowAlarmSeverity 0
+ int lowWarningSeverity 0
+ int highWarningSeverity 0
+ int highAlarmSeverity 0
+ double hystersis 0
+ string extra
testScalar
boolean boolean true
@@ -283,5 +304,5 @@ structure string
timeStamp timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
-pvField: totalConstruct 281 totalDestruct 281
-field: totalConstruct 135 totalDestruct 135
+pvField: totalConstruct 302 totalDestruct 302
+field: totalConstruct 139 totalDestruct 139
diff --git a/test/testPVDataGold b/test/testPVDataGold
index 2012514..f6f79ca 100644
--- a/test/testPVDataGold
+++ b/test/testPVDataGold
@@ -1,5 +1,26 @@
structure request
string fieldList value,timeStamp
+structure top
+ structure value
+ double value 0
+ alarm alarm
+ int severity 0
+ string message
+ timeStamp timeStamp
+ long secondsPastEpoch 0
+ int nanoSeconds 0
+ structure valueAlarm
+ boolean active false
+ double lowAlarmLimit 0
+ double lowWarningLimit 0
+ double highWarningLimit 0
+ double highAlarmLimit 0
+ int lowAlarmSeverity 0
+ int lowWarningSeverity 0
+ int highWarningSeverity 0
+ int highAlarmSeverity 0
+ double hystersis 0
+ string extra
testScalar
boolean boolean true
@@ -283,5 +304,5 @@ structure string
timeStamp timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
-pvField: totalConstruct 281 totalDestruct 281
-field: totalConstruct 135 totalDestruct 135
+pvField: totalConstruct 302 totalDestruct 302
+field: totalConstruct 139 totalDestruct 139
diff --git a/test/testPropertyAux b/test/testPropertyAux
index 94793b6..e795d2b 100644
--- a/test/testPropertyAux
+++ b/test/testPropertyAux
@@ -1 +1 @@
-2011.02.10 04:50:12 195472034 nanoSeconds isDst false
+2011.04.15 14:18:47 873020611 nanoSeconds isDst true
diff --git a/test/testQueue b/test/testQueue
index a0a4f7d..64cff31 100644
--- a/test/testQueue
+++ b/test/testQueue
@@ -1,6 +1,3 @@
-thread: totalConstruct 1 totalDestruct 1
-LinkedList: totalConstruct 1 totalDestruct 1
-LinkedListNode: totalConstruct 2 totalDestruct 2
-event: totalConstruct 5 totalDestruct 5
+event: totalConstruct 4 totalDestruct 4
queue: totalConstruct 1 totalDestruct 1
queueElement: totalConstruct 5 totalDestruct 5
diff --git a/test/testQueueGold b/test/testQueueGold
index a0a4f7d..64cff31 100644
--- a/test/testQueueGold
+++ b/test/testQueueGold
@@ -1,6 +1,3 @@
-thread: totalConstruct 1 totalDestruct 1
-LinkedList: totalConstruct 1 totalDestruct 1
-LinkedListNode: totalConstruct 2 totalDestruct 2
-event: totalConstruct 5 totalDestruct 5
+event: totalConstruct 4 totalDestruct 4
queue: totalConstruct 1 totalDestruct 1
queueElement: totalConstruct 5 totalDestruct 5
diff --git a/test/testThread b/test/testThread
index 6e11a67..19de205 100644
--- a/test/testThread
+++ b/test/testThread
@@ -1,8 +1,9 @@
-threads
-basic middle
-
+Action waiting
+main1 true
+Action is false
+Action1 true
+Action is true
executor: totalConstruct 2 totalDestruct 2
-thread: totalConstruct 2 totalDestruct 2
+LinkedList: totalConstruct 4 totalDestruct 4
+LinkedListNode: totalConstruct 12 totalDestruct 12
event: totalConstruct 8 totalDestruct 8
-LinkedList: totalConstruct 5 totalDestruct 5
-LinkedListNode: totalConstruct 15 totalDestruct 15
diff --git a/test/testThreadAux b/test/testThreadAux
index 8b993dd..b619547 100644
--- a/test/testThreadAux
+++ b/test/testThreadAux
@@ -1 +1 @@
-time per call 41.431581 microseconds
+time per call 0.007050 microseconds
diff --git a/test/testThreadGold b/test/testThreadGold
index 6e11a67..19de205 100644
--- a/test/testThreadGold
+++ b/test/testThreadGold
@@ -1,8 +1,9 @@
-threads
-basic middle
-
+Action waiting
+main1 true
+Action is false
+Action1 true
+Action is true
executor: totalConstruct 2 totalDestruct 2
-thread: totalConstruct 2 totalDestruct 2
+LinkedList: totalConstruct 4 totalDestruct 4
+LinkedListNode: totalConstruct 12 totalDestruct 12
event: totalConstruct 8 totalDestruct 8
-LinkedList: totalConstruct 5 totalDestruct 5
-LinkedListNode: totalConstruct 15 totalDestruct 15
diff --git a/test/testTimeStampAux b/test/testTimeStampAux
index 8085ac6..fef5c8a 100644
--- a/test/testTimeStampAux
+++ b/test/testTimeStampAux
@@ -1,5 +1,5 @@
-current 1296556183 151053711 milliSec 1296556183151
-2011.02.01 05:29:43 151053711 nanoSeconds isDst false
+current 1302891526 884416778 milliSec 1302891526884
+2011.04.15 14:18:46 884416778 nanoSeconds isDst true
fromTime_t
-current 1296556183 0 milliSec 1296556183000
-2011.02.01 05:29:43 0 nanoSeconds isDst false
+current 1302891526 0 milliSec 1302891526000
+2011.04.15 14:18:46 0 nanoSeconds isDst true
diff --git a/test/testTimer b/test/testTimer
index 9a0dd56..27df488 100644
--- a/test/testTimer
+++ b/test/testTimer
@@ -1,6 +1,5 @@
timerNode: totalConstruct 6 totalDestruct 6
timer: totalConstruct 3 totalDestruct 3
-thread: totalConstruct 3 totalDestruct 3
-LinkedList: totalConstruct 4 totalDestruct 4
-LinkedListNode: totalConstruct 13 totalDestruct 13
-event: totalConstruct 15 totalDestruct 15
+LinkedList: totalConstruct 3 totalDestruct 3
+LinkedListNode: totalConstruct 9 totalDestruct 9
+event: totalConstruct 12 totalDestruct 12
diff --git a/test/testTimerAux b/test/testTimerAux
index 3ac1383..657c6f8 100644
--- a/test/testTimerAux
+++ b/test/testTimerAux
@@ -1,6 +1,6 @@
-one requested 0.400000 diff 0.400276 seconds
-two requested 0.200000 diff 0.200325 seconds
-one requested 0.200000 diff 0.200255 seconds
-two requested 0.400000 diff 0.400288 seconds
-one requested 0.000000 diff 0.000027 seconds
-two requested 0.000000 diff 0.000087 seconds
+one requested 0.400000 diff 0.400361 seconds
+two requested 0.200000 diff 0.200302 seconds
+one requested 0.200000 diff 0.200290 seconds
+two requested 0.400000 diff 0.400346 seconds
+one requested 0.000000 diff 0.000041 seconds
+two requested 0.000000 diff 0.000060 seconds
diff --git a/test/testTimerGold b/test/testTimerGold
index 9a0dd56..27df488 100644
--- a/test/testTimerGold
+++ b/test/testTimerGold
@@ -1,6 +1,5 @@
timerNode: totalConstruct 6 totalDestruct 6
timer: totalConstruct 3 totalDestruct 3
-thread: totalConstruct 3 totalDestruct 3
-LinkedList: totalConstruct 4 totalDestruct 4
-LinkedListNode: totalConstruct 13 totalDestruct 13
-event: totalConstruct 15 totalDestruct 15
+LinkedList: totalConstruct 3 totalDestruct 3
+LinkedListNode: totalConstruct 9 totalDestruct 9
+event: totalConstruct 12 totalDestruct 12
diff --git a/testApp/pv/Makefile b/testApp/pv/Makefile
index 7eadc20..b1d5bd9 100644
--- a/testApp/pv/Makefile
+++ b/testApp/pv/Makefile
@@ -2,6 +2,10 @@ TOP=../..
include $(TOP)/configure/CONFIG
+#PROD_HOST += temp
+#temp_SRCS += temp.cpp
+#temp_LIBS += pvData Com
+
PROD_HOST += testPVAppend
testPVAppend_SRCS += testPVAppend.cpp
testPVAppend_LIBS += pvData Com
diff --git a/testApp/pv/temp.cpp b/testApp/pv/temp.cpp
index d2552bd..cb9cc62 100644
--- a/testApp/pv/temp.cpp
+++ b/testApp/pv/temp.cpp
@@ -13,7 +13,9 @@
#include
#include
+#include
+#include "requester.h"
#include "pvIntrospect.h"
#include "pvData.h"
#include "convert.h"
@@ -33,21 +35,31 @@ static String alarmTimeStamp("alarm,timeStamp");
static String alarmTimeStampValueAlarm("alarm,timeStamp,valueAlarm");
static String allProperties("alarm,timeStamp,display,control,valueAlarm");
-static void temp()
+
+static void testAppendMore(FILE * fd)
{
- int32 slow = 0xffffffff;
- int32 shigh = 1;
- int64 stemp = slow;
- int64 sresult = slow&0xffffffff;
- stemp = shigh;
- sresult += stemp<<32;
- printf("signed %lld\n",sresult);
- uint32 ulow = 0xffffffff;
- uint32 uhigh = 1;
- uint64 uresult = ulow;
- uint64 utemp = uhigh;
- uresult += utemp<<32;
- printf("unsigned %lld\n",uresult);
+ PVStructure* pvStructure = pvDataCreate->createPVStructure(
+ 0,"top", 0);
+ PVStructure* pvChild1 = pvDataCreate->createPVStructure(
+ pvStructure, "child1", 0);
+ PVString *pvStringField = static_cast(
+ pvDataCreate->createPVScalar(pvChild1,"value", pvString));
+ pvStringField->put("bla");
+ pvChild1->appendPVField(pvStringField);
+ pvStructure->appendPVField(pvChild1);
+ PVStructure* pvChild2 = pvDataCreate->createPVStructure(
+ pvStructure, "child2", 0);
+ pvStringField = static_cast(
+ pvDataCreate->createPVScalar(pvChild2,"value", pvString));
+ pvStringField->put("bla");
+ pvChild2->appendPVField(pvStringField);
+ pvStructure->appendPVField(pvChild2);
+ builder.clear();
+ pvStructure->toString(&builder);
+ fprintf(fd,"%s\n",builder.c_str());
+ PVField *pvField = pvStructure->getSubField(String("child1.value"));
+ pvField->message(String("test message"),infoMessage);
+ delete pvStructure;
}
int main(int argc,char *argv[])
@@ -63,7 +75,9 @@ int main(int argc,char *argv[])
standardField = getStandardField();
standardPVField = getStandardPVField();
convert = getConvert();
- temp();
+ testAppendMore(fd);
+ epicsExitCallAtExits();
+ CDRMonitor::get().show(fd);
return(0);
}
diff --git a/testApp/pv/testPVData.cpp b/testApp/pv/testPVData.cpp
index d2321a8..8ff9ca8 100644
--- a/testApp/pv/testPVData.cpp
+++ b/testApp/pv/testPVData.cpp
@@ -50,6 +50,22 @@ static void testAppend(FILE * fd)
delete pvParent;
}
+static void testCreatePVStructure(FILE * fd)
+{
+ PVStructure * pv0 = standardPVField->scalarValue(
+ 0,pvDouble,alarmTimeStampValueAlarm);
+ PVScalar *pv1 = standardPVField->scalar(0,String("extra"),pvString);
+ PVFieldPtr *pvFields = new PVFieldPtr[2];
+ pvFields[0] = pv0;
+ pvFields[1] = pv1;
+ PVStructure *pvParent = pvDataCreate->createPVStructure(
+ 0,String("top"),2,pvFields);
+ builder.clear();
+ pvParent->toString(&builder);
+ fprintf(fd,"%s\n",builder.c_str());
+ delete pvParent;
+}
+
static void testPVScalarCommon(FILE * fd,String fieldName,ScalarType stype)
{
PVScalar *pvScalar = standardPVField->scalar(0,fieldName,stype);
@@ -281,6 +297,7 @@ int main(int argc,char *argv[])
standardPVField = getStandardPVField();
convert = getConvert();
testAppend(fd);
+ testCreatePVStructure(fd);
testPVScalar(fd);
testScalarArray(fd);
epicsExitCallAtExits();