added new files
This commit is contained in:
38
src/cas/example/Makefile.Vx
Normal file
38
src/cas/example/Makefile.Vx
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
CAS = ../../
|
||||
TOP = $(CAS)/../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
CXXCMPLR = STRICT
|
||||
|
||||
USR_INCLUDES =
|
||||
USR_LDFLAGS =
|
||||
|
||||
DEPLIBS_BASE = $(EPICS_BASE_LIB)
|
||||
DEPLIBS = $(DEPLIBS_BASE)/libcas.a $(DEPLIBSWOCAS)
|
||||
|
||||
SRCS.cc += ../vxEntry.cc
|
||||
SRCS.cc += ../exServer.cc
|
||||
SRCS.cc += ../exPV.cc
|
||||
SRCS.cc += ../exSyncPV.cc
|
||||
SRCS.cc += ../exAsyncPV.cc
|
||||
SRCS.cc += ../exChannel.cc
|
||||
|
||||
LIBOBJS += vxEntry.o
|
||||
LIBOBJS += exServer.o
|
||||
LIBOBJS += exPV.o
|
||||
LIBOBJS += exSyncPV.o
|
||||
LIBOBJS += exAsyncPV.o
|
||||
LIBOBJS += exChannel.o
|
||||
|
||||
LIBNAME = libexserver.o
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
excas: $(OBJS) $(DEPLIBS)
|
||||
$(LINK.cc) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
|
||||
|
||||
clean::
|
||||
@$(RM) -rf Templates.DB
|
||||
@$(RM) core
|
||||
|
||||
61
src/cas/example/main.cc
Normal file
61
src/cas/example/main.cc
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
#include <exServer.h>
|
||||
#include <fdManager.h>
|
||||
|
||||
//
|
||||
// main()
|
||||
//
|
||||
int main (int argc, const char **argv)
|
||||
{
|
||||
osiTime begin(osiTime::getCurrent());
|
||||
exServer *pCAS;
|
||||
unsigned debugLevel = 0u;
|
||||
float executionTime;
|
||||
aitBool forever = aitTrue;
|
||||
int i;
|
||||
|
||||
pCAS = new exServer(32u,5u,500u);
|
||||
if (!pCAS) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
for (i=1; i<argc; i++) {
|
||||
if (sscanf(argv[i], "-d %u", &debugLevel)==1) {
|
||||
continue;
|
||||
}
|
||||
if (sscanf(argv[i],"-t %f", &executionTime)==1) {
|
||||
forever = aitFalse;
|
||||
continue;
|
||||
}
|
||||
printf ("usage: %s -d<debug level> -t<execution time>\n",
|
||||
argv[0]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
pCAS->setDebugLevel(debugLevel);
|
||||
|
||||
if (forever) {
|
||||
osiTime delay(1000u,0u);
|
||||
//
|
||||
// loop here forever
|
||||
//
|
||||
while (aitTrue) {
|
||||
fileDescriptorManager.process(delay);
|
||||
}
|
||||
}
|
||||
else {
|
||||
osiTime total(executionTime);
|
||||
osiTime delay(osiTime::getCurrent() - begin);
|
||||
//
|
||||
// loop here untime the specified execution time
|
||||
// expires
|
||||
//
|
||||
while (delay < total) {
|
||||
fileDescriptorManager.process(delay);
|
||||
delay = osiTime::getCurrent() - begin;
|
||||
}
|
||||
}
|
||||
delete pCAS;
|
||||
return (0);
|
||||
}
|
||||
|
||||
43
src/cas/example/vxEntry.cc
Normal file
43
src/cas/example/vxEntry.cc
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
#include <exServer.h>
|
||||
#include <taskLib.h>
|
||||
|
||||
//
|
||||
// main()
|
||||
//
|
||||
int excas (unsigned debugLevel=0u, unsigned delaySec=0)
|
||||
{
|
||||
osiTime begin(osiTime::getCurrent());
|
||||
exServer *pCAS;
|
||||
|
||||
pCAS = new exServer(32u,5u,500u);
|
||||
if (!pCAS) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
pCAS->setDebugLevel(debugLevel);
|
||||
|
||||
if (delaySec==0u) {
|
||||
//
|
||||
// loop here forever
|
||||
//
|
||||
while (aitTrue) {
|
||||
taskDelay(10);
|
||||
}
|
||||
}
|
||||
else {
|
||||
osiTime total( ((float)delaySec) );
|
||||
osiTime delay(osiTime::getCurrent() - begin);
|
||||
//
|
||||
// loop here untill the specified execution time
|
||||
// expires
|
||||
//
|
||||
while (delay < total) {
|
||||
taskDelay(10);
|
||||
delay = osiTime::getCurrent() - begin;
|
||||
}
|
||||
}
|
||||
delete pCAS;
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user