ChannelArray int to size_t

This commit is contained in:
Matej Sekoranja
2014-04-04 12:36:11 +02:00
parent 4405346384
commit d2fb05ddd8
8 changed files with 47 additions and 46 deletions
+8 -7
View File
@@ -1754,13 +1754,13 @@ void ChannelAccessIFTest::test_channelArray() {
array->replace(freeze(newdata));
succStatus = arrayReq->syncPut(false, 0, -1, getTimeoutSec());
succStatus = arrayReq->syncPut(false, 0, 0, getTimeoutSec());
if (!succStatus) {
testFail("%s: an array syncPut failed (2) ", CURRENT_FUNCTION);
return;
}
succStatus = arrayReq->syncGet(false, 0, -1, getTimeoutSec());
succStatus = arrayReq->syncGet(false, 0, 0, getTimeoutSec());
if (!succStatus) {
testFail("%s: an array syncGet failed (3) ", CURRENT_FUNCTION);
return;
@@ -1800,13 +1800,13 @@ void ChannelAccessIFTest::test_channelArray() {
//testOk(data1[2] == 2.2 , "%s: check 2: %f", CURRENT_FUNCTION, data1[2]);
succStatus = arrayReq->syncSetLength(false, 3, -1, getTimeoutSec());
succStatus = arrayReq->syncSetLength(false, 3, 0, getTimeoutSec());
if (!succStatus) {
testFail("%s: an array setLength failed ", CURRENT_FUNCTION);
return;
}
succStatus = arrayReq->syncGet(false, 0, -1, getTimeoutSec());
succStatus = arrayReq->syncGet(false, 0, 0, getTimeoutSec());
if (!succStatus) {
testFail("%s: an array syncGet failed (7) ", CURRENT_FUNCTION);
return;
@@ -1821,14 +1821,15 @@ void ChannelAccessIFTest::test_channelArray() {
testOk(data2[1] == 2.2 , "%s: 2.check 1: %f", CURRENT_FUNCTION, data2[1]);
testOk(data2[2] == 3.3, "%s: 2.check 2: %f", CURRENT_FUNCTION, data2[2]);
size_t currentLength = 3;
size_t newCap = 2;
succStatus = arrayReq->syncSetLength(false, -1, newCap, getTimeoutSec());
succStatus = arrayReq->syncSetLength(false, currentLength, newCap, getTimeoutSec());
if (!succStatus) {
testFail("%s: an array setLength failed (2) ", CURRENT_FUNCTION);
return;
}
succStatus = arrayReq->syncGet(false, 0, -1, getTimeoutSec());
succStatus = arrayReq->syncGet(false, 0, 0, getTimeoutSec());
if (!succStatus) {
testFail("%s: an array syncGet failed (8) ", CURRENT_FUNCTION);
return;
@@ -1850,7 +1851,7 @@ void ChannelAccessIFTest::test_channelArray() {
return;
}
succStatus = arrayReq->syncGet(false, 0, -1, getTimeoutSec());
succStatus = arrayReq->syncGet(false, 0, 0, getTimeoutSec());
if (!succStatus) {
testFail("%s: an array syncGet failed (9) ", CURRENT_FUNCTION);
return;
+3 -3
View File
@@ -1134,7 +1134,7 @@ class SyncChannelArrayRequesterImpl : public ChannelArrayRequester, public SyncB
m_lengthArrayStatus(false) {}
bool syncPut(bool lastRequest, int offset, int count, long timeOut)
bool syncPut(bool lastRequest, size_t offset, size_t count, long timeOut)
{
if (!getConnectedStatus()) {
@@ -1146,7 +1146,7 @@ class SyncChannelArrayRequesterImpl : public ChannelArrayRequester, public SyncB
}
bool syncGet(bool lastRequest, int offset, int count, long timeOut)
bool syncGet(bool lastRequest, size_t offset, size_t count, long timeOut)
{
if (!getConnectedStatus()) {
@@ -1158,7 +1158,7 @@ class SyncChannelArrayRequesterImpl : public ChannelArrayRequester, public SyncB
}
bool syncSetLength(bool lastRequest, int length, int capacity, long timeOut)
bool syncSetLength(bool lastRequest, size_t length, size_t capacity, long timeOut)
{
if (!getConnectedStatus()) {
+2 -2
View File
@@ -539,9 +539,9 @@ int main()
ChannelArray::shared_pointer channelArray = channel->createChannelArray(channelArrayRequesterImpl, pvRequest);
epicsThreadSleep ( 1.0 );
channelArray->getArray(false,0,-1);
channelArray->getArray(false,0,0);
epicsThreadSleep ( 1.0 );
channelArray->putArray(false,0,-1);
channelArray->putArray(false,0,0);
epicsThreadSleep ( 1.0 );
channelArray->setLength(false,3,4);
epicsThreadSleep ( 1.0 );
+10 -12
View File
@@ -1693,11 +1693,11 @@ public:
to->replace(freeze(temp));
}
virtual void putArray(bool lastRequest, int offset, int count)
virtual void putArray(bool lastRequest, size_t offset, size_t count)
{
size_t o = static_cast<size_t>(offset);
if (count == -1) count = static_cast<int>(m_pvArray->getLength());
size_t c = static_cast<size_t>(count);
size_t o = offset;
if (count == 0) count = m_pvArray->getLength();
size_t c = count;
Field::const_shared_pointer field = m_pvArray->getField();
Type type = field->getType();
@@ -1745,11 +1745,11 @@ public:
}
virtual void getArray(bool lastRequest, int offset, int count)
virtual void getArray(bool lastRequest, size_t offset, size_t count)
{
size_t o = static_cast<size_t>(offset);
if (count == -1) count = static_cast<int>(m_pvStructureArray->getLength());
size_t c = static_cast<size_t>(count);
size_t o = offset;
if (count == 0) count = m_pvStructureArray->getLength();
size_t c = count;
Field::const_shared_pointer field = m_pvArray->getField();
Type type = field->getType();
@@ -1781,15 +1781,13 @@ public:
destroy();
}
virtual void setLength(bool lastRequest, int length, int capacity)
virtual void setLength(bool lastRequest, size_t length, size_t capacity)
{
if (capacity > 0) {
m_pvStructureArray->setCapacity(capacity);
}
if (length > 0) {
m_pvStructureArray->setLength(length);
}
m_pvStructureArray->setLength(length);
m_channelArrayRequester->setLengthDone(Status::Ok);
if (lastRequest)