Skip to content

Commit

Permalink
refactor: Reorganizing of code duplicates within devEvrEvent*
Browse files Browse the repository at this point in the history
devEvrEventUtag.cpp contained code duplicates from devEvrEvent.cpp. Now
implementation is included within devEvrEvent.cpp
  • Loading branch information
jerzyjamroz committed Dec 15, 2023
1 parent f264755 commit 277abf2
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 202 deletions.
4 changes: 0 additions & 4 deletions evrApp/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ evr_SRCS += evrGTIF.cpp

evr_SRCS += devEvrStringIO.cpp

ifdef BASE_7_0
evr_SRCS += devEvrEventUtag.cpp
endif

evr_SRCS += devEvrEvent.cpp
evr_SRCS += devEvrMapping.cpp

Expand Down
65 changes: 65 additions & 0 deletions evrApp/src/devEvrEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,68 @@ epicsExportAddress(dset,devSOEventEVR);
epicsExportAddress(dset,devEVEventEVR);

}


/*
* Timestamping with UTAG extension
* Date: 5.12.2023
* Authors: Joao Paulo Martins <[email protected]>
* Jerzy Jamroz <[email protected]>
*/

#ifdef DBR_UTAG

#include <int64outRecord.h>

static long process_int64out(int64outRecord *prec)
{
priv *p = static_cast<priv *>(prec->dpvt);
long ret = 0;
try
{

if (p->event >= 0 && p->event <= 255)
post_event(p->event);

if (prec->tse == epicsTimeEventDeviceTime)
{
p->evr->getTimeStamp(&prec->time, p->event);
prec->utag = static_cast<epicsUTag>(prec->val);
p->evr->setUtag(prec->utag, p->event);
}

return 0;
}
catch (std::runtime_error &e)
{
recGblRecordError(S_dev_noDevice, (void *)prec, e.what());
ret = S_dev_noDevice;
}
catch (std::exception &e)
{
recGblRecordError(S_db_noMemory, (void *)prec, e.what());
ret = S_db_noMemory;
}
return ret;
}

static long add_int64out(struct dbCommon *precord)
{
return add_record(precord, &((struct int64outRecord *)precord)->out);
}

dsxt dxtI64OEventUtagEVR = {add_int64out, del_record};
static common_dset devI64OEventUtagEVR = {
6, NULL,
dset_cast(&init_dset<&dxtI64OEventUtagEVR>),
(DEVSUPFUN)init_record_empty,
(DEVSUPFUN)&get_ioint_info,
dset_cast(&process_int64out),
NULL};

extern "C"
{
epicsExportAddress(dset, devI64OEventUtagEVR);
}

#endif
198 changes: 0 additions & 198 deletions evrApp/src/devEvrEventUtag.cpp

This file was deleted.

0 comments on commit 277abf2

Please sign in to comment.