remove previously deprecated executor.h, queue.h and timerFunction.h

This commit is contained in:
Michael Davidsaver
2017-12-28 12:12:11 -06:00
parent 09574c0e82
commit a239b95ca1
10 changed files with 1 additions and 749 deletions

View File

@@ -59,11 +59,6 @@ testTimeStamp_SRCS += testTimeStamp.cpp
testHarness_SRCS += testTimeStamp.cpp
TESTS += testTimeStamp
TESTPROD_HOST += testQueue
testQueue_SRCS += testQueue.cpp
testHarness_SRCS += testQueue.cpp
TESTS += testQueue
TESTPROD_HOST += testTypeCast
testTypeCast_SRCS += testTypeCast.cpp
testHarness_SRCS += testTypeCast.cpp

View File

@@ -1,164 +0,0 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/*
* testQueue.cpp
*
* Created on: 2010.12
* Author: Marty Kraimer
*/
#include <cstddef>
#include <cstdlib>
#include <cstddef>
#include <string>
#include <cstdio>
#include <epicsUnitTest.h>
#include <testMain.h>
#include <epicsThread.h>
#include <pv/lock.h>
#include <pv/timeStamp.h>
#include <pv/queue.h>
#include <pv/event.h>
using namespace epics::pvData;
struct Data {
int a;
int b;
};
typedef std::tr1::shared_ptr<Data> DataPtr;
typedef std::vector<DataPtr> DataPtrArray;
static const int numElements = 5;
typedef Queue<Data> DataQueue;
class Sink;
typedef std::tr1::shared_ptr<Sink> SinkPtr;
class Sink : public epicsThreadRunable {
public:
static SinkPtr create(DataQueue &queue);
Sink(DataQueue &queue);
~Sink();
void stop();
void look();
virtual void run();
private:
DataQueue &queue;
bool isStopped;
Event *wait;
Event *stopped;
Event *waitReturn;
Event *waitEmpty;
epicsThread *thread;
};
SinkPtr Sink::create(DataQueue &queue)
{
return SinkPtr(new Sink(queue));
}
Sink::Sink(DataQueue &queue)
: queue(queue),
isStopped(false),
wait(new Event()),
stopped(new Event()),
waitReturn(new Event()),
waitEmpty(new Event()),
thread(new epicsThread(*this,"sink",epicsThreadGetStackSize(epicsThreadStackSmall)))
{
thread->start();
}
Sink::~Sink() {
delete thread;
delete waitEmpty;
delete waitReturn;
delete stopped;
delete wait;
}
void Sink::stop()
{
isStopped = true;
wait->signal();
stopped->wait();
}
void Sink::look()
{
wait->signal();
waitEmpty->wait();
}
void Sink::run()
{
while(!isStopped) {
wait->wait();
if(isStopped) break;
while(true) {
DataPtr data = queue.getUsed();
if(data.get()==NULL) {
waitEmpty->signal();
break;
}
printf(" sink a %d b %d\n",data->a,data->b);
queue.releaseUsed(data);
}
}
stopped->signal();
}
static void testBasic() {
DataPtrArray dataArray;
dataArray.reserve(numElements);
for(int i=0; i<numElements; i++) {
dataArray.push_back(DataPtr(new Data()));
}
DataQueue queue(dataArray);
DataPtr data = queue.getFree();
int value = 0;
while(data.get()!=NULL) {
data->a = value;
data->b = value*10;
value++;
queue.setUsed(data);
data = queue.getFree();
}
SinkPtr sink = SinkPtr(new Sink(queue));
queue.clear();
while(true) {
data = queue.getFree();
if(data.get()==NULL) break;
printf("source a %d b %d\n",data->a,data->b);
queue.setUsed(data);
}
sink->look();
// now alternate
for(int i=0; i<numElements; i++) {
data = queue.getFree();
testOk1(data.get()!=NULL);
printf("source a %d b %d\n",data->a,data->b);
queue.setUsed(data);
sink->look();
}
sink->stop();
printf("PASSED\n");
}
MAIN(testQueue)
{
testPlan(5);
testDiag("Tests queue");
testBasic();
return testDone();
}

View File

@@ -23,8 +23,6 @@
#include <pv/event.h>
#include <pv/thread.h>
#include <pv/executor.h>
#include <pv/timeFunction.h>
using namespace epics::pvData;
using std::string;
@@ -65,49 +63,6 @@ static void testThreadRun() {
testDiag("testThreadRun PASSED");
}
class Basic;
typedef std::tr1::shared_ptr<Basic> BasicPtr;
class Basic :
public Command,
public std::tr1::enable_shared_from_this<Basic>
{
public:
POINTER_DEFINITIONS(Basic);
Basic(ExecutorPtr const &executor)
: executor(executor) {}
~Basic()
{
}
void run()
{
executor->execute(getPtrSelf());
bool result = wait.wait();
testOk1(result==true);
if(result==false) testDiag("basic::run wait returned false");
}
virtual void command()
{
wait.signal();
}
private:
Basic::shared_pointer getPtrSelf()
{
return shared_from_this();
}
ExecutorPtr executor;
Event wait;
};
typedef std::tr1::shared_ptr<Basic> BasicPtr;
static void testBasic() {
ExecutorPtr executor(new Executor(string("basic"),middlePriority));
BasicPtr basic( new Basic(executor));
basic->run();
testDiag("testBasic PASSED");
}
namespace {
struct fninfo {
int cnt;
@@ -197,26 +152,6 @@ static void testBinders()
#endif
}
class MyFunc : public TimeFunctionRequester {
public:
POINTER_DEFINITIONS(MyFunc);
MyFunc(BasicPtr const &basic);
virtual void function();
private:
BasicPtr basic;
};
MyFunc::MyFunc(BasicPtr const &basic)
: basic(basic)
{}
void MyFunc::function()
{
basic->run();
}
typedef std::tr1::shared_ptr<MyFunc> MyFuncPtr;
#ifdef TESTTHREADCONTEXT
static void testThreadContext() {
@@ -233,10 +168,9 @@ static void testThreadContext() {
MAIN(testThread)
{
testPlan(7);
testPlan(6);
testDiag("Tests thread");
testThreadRun();
testBasic();
testBinders();
#ifdef TESTTHREADCONTEXT
testThreadContext();

View File

@@ -22,7 +22,6 @@ int testBaseException(void);
int testBitSet(void);
int testByteBuffer(void);
int testOverrunBitSet(void);
int testQueue(void);
int testSerialization(void);
int testSharedVector(void);
int testThread(void);
@@ -71,7 +70,6 @@ void pvDataAllTests(void)
runTest(testBitSet);
runTest(testByteBuffer);
runTest(testOverrunBitSet);
runTest(testQueue);
runTest(testSerialization);
runTest(testSharedVector);
runTest(testThread);