cumbia 1.x
general purpose multi threaded library
Loading...
Searching...
No Matches
cumbia

Cumbia is a library that offers a carefree approach to multi thread application design and implementation. The user writes Activities and decides when their instances are started and to which thread they belong. A token is used to register an Activity and activities registered with the same token are run in the same thread. Work is done inside the init, execute and exit methods of an Activity. The library guarantees that the aforementioned methods are always called in the activity thread. From within init, execute and exit, computed results can be forwarded to the main execution thread, where they can be used to update a graphical interface.

Related readings

cumbia-libs on github.io

Tutorials

Tutorials Module
Writing a cumbia activity cumbia
Writing an activity cumbia-tango
CuData for Tango cumbia-tango
Writing a Qt widget that integrates with cumbia qumbia-tango-controls
Using cumbia ui make to process Qt designer UI files qumbia-apps/cuuimake
Writing a Qt application with cumbia and Tango. qumbia-apps/qumbiaprojectwizard
Porting a QTango application to cumbia-tango. qumbia-apps/qumbiaprojectwizard
cumbia new control: quickly add a custom Qt widget to a cumbia project qumbia-apps/qumbianewcontrolwizard
Understanding cumbia-qtcontrols constructors, sources and targets cumbia-qtcontrols.
Frequently Asked Questions (Tango) qumbia-tango-controls

Modules

Other cumbia modules
cumbia module.
cumbia-tango module.
cumbia-qtcontrols module.
qumbia-tango-controls module.
qumbia-epics module.
qumbia-epics-controls module.
qumbia-plugins module.

Plugins

cumbia plugins
formula plugin.
dbus plugin.
multi reader plugin.
context menu actions plugin.

apps

These applications (and their documentation, that has already been mentioned in the Tutorials table above) must be installed from the qumbia-apps sub-directory of the cumbia-libs distribution. To install them, cd into that folder and execute:

qmake
make
sudo make install

Along the applications executables and documentation, two bash scripts will be installed:

  • /etc/bash_completion.d/cumbia
  • /etc/bash/bashrc.d/cumbia.sh

They define shortcuts for the common operations provided by the qumbia-apps applications as follows.

Applications (command line) description app
cumbia new project create a new cumbia project qumbia-apps/qumbiaprojectwizard
cumbia import migrate a QTango project into cumbia qumbia-apps/qumbiaprojectwizard
cumbia new control write a cumbia control reader or writer qumbia-apps/qumbianewcontrolwizard
cumbia ui make run cuuimake to generate qt+cumbia ui_*.h files qumbia-apps/cuuimake

| cumbia client | run a generic cumbia client | qumbia-apps/cumbia_client | * | cumbia client | run a generic cumbia client | qumbia-apps/cumbia_client | | la-cumparsita | interpret a Qt designer ui file on the fly | qumbia-apps/cumbia_client |

bash auto completion will help you use these shortcuts: try

cumbia <TAB>

or

cumbia new <TAB>

Cumbia

In asynchronous environments, threads have always posed some kind of challenge for the programmer. Shared data, message exchange, proper termination are some aspects that cannot be overlooked. The Android AsyncTask offers a simple approach to writing code that is executed in a separate thread. The API provides a method that is called in the secondary thread context and functions to post results on the main one.

Activities

Cumbia CuActivity’s purpose is to replicate the carefree approach supplied by the AsyncTask. In this respect, a CuActivity is an interface to allow subclasses do work within three specific methods: init, execute and onExit. Therein, the code is run in a separate thread. The publishProgress and publishResult methods hand data to the main thread. To accomplish all this, an event loop must be running. By an initial parametrization, either a custom one (such as Qt’s, used in qumbia-qtcontrols) or the builtin cumbia CuEventLoop can be installed. New activities must be registered in the CuActivityManager service, and unregistered when they are no longer needed. In this way, a token can be used to group several activities by a smaller number of threads. In other words, activities with the same token run in the same thread.

Services

By means of the reference to the Cumbia instance, that must be maintained throughout the entire life of an application, you can access services. They are registered in the CuServiceProvider and accessed by name. The activity manager, the thread and the log services are some examples, but others can be written and installed, as long as they adhere to the CuServiceI interface (e.g cumbia-tango’s CuActionFactoryService and CuDeviceFactoryService). Cumbia can be subclassed in order to provide additional features specific to the engine employed. CumbiaPool allows to register and use multiple engines in the same application.

Data interchange

Data transfer is realised with the aid of the CuData and CuVariant classes. The former is a bundle pairing keys to values. The latter memorises data and implements several methods to store, extract and convert it to different types and formats. The cumbia-qtcontrols module handles these structures to provide a primary data display facility, unaware of the specific engine underneath (Tango, Epics, ...)