A C++ Channel Access Interface to EPICS
with extensions for Python and MATLAB

CAFE | MOCHA | PyCafe | Download

CAFE is a C++ interface to the EPICS Channel Access (CA) client library that follows recognized sound practices in CA programming by placing careful attention to:

  • connection management
  • memory optimization, particularly as connections are broken and restored
  • separation between the acquisition of data and their presentation
  • caching of pertinent data related to the channel and its current state
  • aggregation of requests to enhance performance
  • CAFE provides functionality for synchronous and asynchronous interactions for both single and groups of related or unrelated channels. Callback functions have been implemented for all operations involving channel access connection handlers, event handlers and access right handlers. Their invocation triggers their data to be written into a multi-index container provided by the Boost C++ libraries. Helper functions provide convenient access to data components held within the container. Policy classes provide control over configurable components that govern the behaviour of interactions, either on a global or individual basis. These include policies that determine procedures to establish connectivity, blocking or non-blocking method invocations, a strategy for converting between data types that are requested and offered, and allow for network time-outs to adapt dynamically. An XML configuration mechanism provides a convenient framework for users to define and initialize CAFE groups. Transactions on CAFE group objects are invoked through simple intuitive method invocations that reference groups through their identifier.

    CAFE can also act as the CA host for a number of scripting and declarative languages, as exemplified by CAFE's Cython and MATLAB extensions. A single C++ library is thus adopted across several domain-based programming languages. The advantages to this approach are:

  • The inherent simplicity and convenience of maintaining a single CA interface code
  • That the outcome of all method invocations are captured and reported with integrity, in every eventuality, ensures a common response that facilitates trace-backs in the event of exceptions
  • In house CA expertise ensures a quick response to user needs and problem solving
  • New CA functionalities from future EPICS 3 releases need only be integrated into a single base library
  • The CA class is well separated from the internals of the domain language meaning that bindings to other scripting and domain-specific libraries are vastly simplified
  • CAFE is an easy-to-use C++ interface that shelters users from the complexities of programming with the native C CA library. CAFE and its extensions are open-source and available for download.
    Feature requests, bug reports, and contributions are welcome!

    Conference Papers and EPICS Meeting Presentations

    J. Chrin, “A Cython interface to EPICS channel access for high-level Python applications”, in Proc. 11th Int. Workshop on Personal Computers and Particle Accelerator Controls (PCaPAC'16), Oct. 2016, Campinas, Brazil, pp. 21-24, doi:10.18429/JACoW-PCaPAC2016-WEUIPLCO04

    J. Chrin, “An update on CAFE, a C++ channel access client library, and its scripting language extensions”, in Proc. 15th Int. Conf. on Acclerator and Large Experimental Control Systems (ICALEPCS'15), Oct. 2015, Melbourne, Australia, pp. 1013-1016.

    J. Chrin, “MATLAB objects for EPICS channel access”, in Proc. 14th Int. Conf. on Accelerator and Large Experimental Control Systems (ICALEPCS'13), Oct. 2013, San Francisco, CA, USA, pp. 453-456.

    J. Chrin and M. C. Sloan, “CAFE, a modern C++ interface to the EPICS channel access library”, in Proc. 13th Int. Conf. on Accelerator and Large Experimental Control Systems (ICALEPCS'11), Oct. 2011, Grenoble, France, pp. 840-843.

    J. Chrin, “Channel Access from Cython (and Other Cython Use Cases)”, presented at the EPICS Collaboration Meeting (Fall 2017), 7 Oct. 2017, ICALEPCS'17, Barcelona, Spain >>

    J. Chrin, “The MEXperience, Getting to Grips with MATLAB Executable Files”, presented at the EPICS Collaboration Meeting (Spring 2012), 23-27 Apr. 2012, SLAC, Menlo Park, CA, USA >>

    J. Chrin, “Hard Rock CAFE”, presented at the EPICS Collaboration Meeting (Fall 2011), 3-7 Oct. 2011, PSI, Villigen, Switzerland >>