Skip to content

Commit

Permalink
Merge pull request #14 from NomAnor/improvements
Browse files Browse the repository at this point in the history
Code Improvements
  • Loading branch information
ZLLentz authored May 8, 2018
2 parents 8df7dcd + be061d8 commit d094617
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 94 deletions.
16 changes: 16 additions & 0 deletions pyca/getfunctions.hh
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ PyObject* _pyca_get_value(capv* pv, const T* dbrv, long count)
}
}

// Copy channel access status objects into python
template<class T> static inline
void _pyca_get_sts(capv* pv, const T* dbrv, long count)
{
PyObject* pydata = pv->data;
_pyca_setitem(pydata, "status", _pyca_get(dbrv->status));
_pyca_setitem(pydata, "severity", _pyca_get(dbrv->severity));
_pyca_setitem(pydata, "value", _pyca_get_value(pv, dbrv, count));
}

// Copy channel access time objects into python
template<class T> static inline
void _pyca_get_time(capv* pv, const T* dbrv, long count)
Expand Down Expand Up @@ -237,6 +247,9 @@ static const void* _pyca_event_process(capv* pv,
case DBR_TIME_DOUBLE:
_pyca_get_time(pv, &dbr->tdblval, count);
break;
case DBR_CTRL_STRING:
_pyca_get_sts(pv, &dbr->sstrval, count);
break;
case DBR_CTRL_ENUM:
_pyca_get_ctrl_enum(pv, &dbr->cenmval, count);
break;
Expand Down Expand Up @@ -289,6 +302,9 @@ static void* _pyca_adjust_buffer_size(capv* pv,
case DBR_TIME_DOUBLE:
size = sizeof(dbr_time_double) + sizeof(dbr_double_t)*(count-1);
break;
case DBR_CTRL_STRING:
size = sizeof(dbr_sts_string) + sizeof(dbr_string_t)*(count-1);
break;
case DBR_CTRL_ENUM:
size = sizeof(dbr_ctrl_enum) + sizeof(dbr_enum_t)*(count-1);
break;
Expand Down
Loading

0 comments on commit d094617

Please sign in to comment.