Commit Graph

30 Commits

Author SHA1 Message Date
Alexey Rybalchenko
5aaf27bf02 Refactor the transport interface
- give transport Initialize() method with access to device config.
 - avoid using global context in the transport.
 - simplify shutdown procedure (no need for extra thread).
2017-04-20 11:07:49 +02:00
Alexey Rybalchenko
c66fd6fe91 Adding multiple transports support & other fixes:
- Avoid polling when only one input channel is used.
 - Send only handles for shared memory transport.
 - Avoid waiting in the rate logger thread when nothing to log.
 - Hide warnings from generated files
 - Fix #483
2017-02-23 06:47:09 +01:00
Alexey Rybalchenko
a332d9fc83 First version of the shared memory transport.
Use via `--transport shmem` cmd option. No pub/sub.
2016-12-18 14:50:58 +01:00
Alexey Rybalchenko
0fb49a0986 State machine update
- Fix regression from last commit (preventing static run from proper shutdown).
 - Guard state changes (for the internal transitions) (msm::process_event is not thread safe).
 - Remove unused transition from RUNNING to EXITING.
2016-11-24 22:35:46 +01:00
Alexey Rybalchenko
b166cedb63 Convert factory methods to return smart ptrs
- Convert factory methods to return smart ptrs.
 - Refactor state machine to use same thread for user states.
 - Remove unused includes and dependencies, use std.
2016-11-18 14:19:16 +01:00
Alexey Rybalchenko
12f04c7237 Fix race condition in the state machine & channel. 2016-11-15 16:17:56 +01:00
Alexey Rybalchenko
16fd63cd5b Enable new callback API
- OnData() channel data handler.
 - ConditionalRun() for devices without incoming data.
 - Header file with common main(), to be extended with getDevice/addCustomOptions.
 - Update examples (MQ/Tutorial3) to use the new API and config.
 - NewSimpleMessage() for simpler creation of small messages (additional copy).
 - Replace SetProperty/GetProperty with fConfig access.
 - Runtime configurable channel names for common devices.
 - Configurable logging interval per channel.
 - FairMQMultiplier for distributing same data to multiple outputs.
 - Cleanup state machine messages.
 - Cmd option to toggle signal handling.
 - Simpler API for send/receive timeouts.
 - Enable --log-to-file.
 - Fix coverity issues, warnings.
 - Various code cleanup and minor tweaks.
2016-09-30 14:36:35 +02:00
Alexey Rybalchenko
cc88339791 Cleanup command line options
- Remove old cmd options --config-json-file and --config-xml-file.
   Now handled by --mq-config with file extension detection.
 - Fix --config-json-string and --config-xml-string
 - Move config-key to proper place (in --help)
2016-05-23 16:40:32 +02:00
Alexey Rybalchenko
e9f09143b2 Gracefully end the device also in the termination case (instead of abort). 2016-05-17 12:27:18 +02:00
Florian Uhlig
4ca66e33da Fix compiler warnings.
Switch of compiler warnings for part of the code.
The compiler flag -Weffc++ of the gcc compiler creates many warnings about non virtual destructor of base classes where the
base class is actually a class from boost or from stl. Switch of the compiler flag for the problematic parts of the code
using preprocessor statements. There are also such preprocessor guards for code which creates many warnings when
using clang.

Filter warnings comming from generated files.
When using CTest all warnings comming from generated code (Root Dictionaries, code generated by protoc) will be filtered
before sending the results to the CDash web server.

Remove unused variables or use them.
Initialize all data members in initializer lists.
Use in initializer list the same order of data members as defined in the class declaration.
Declare private copy constructors and assignment operators where needed.

Fix format problems in printf statements.
Correctly cast the variables.
2016-03-17 21:33:40 +01:00
Alexey Rybalchenko
e1fef82657 FairMQ: Extend Multipart and messaging API
- Extend the multipart API to allow sending vectors of messages or helper
   thin wrapper FairMQParts. See example in examples/MQ/8-multipart.
 - NewMessage() can be used in devices instead of
   fTransportFactory->CreateMessage().
   Possible arguments remain unchanged (no args, size or data+size).
 - Send()/Receive() methods can be used in devices instead of
   fChannels.at("chan").at(i).Send()/Receive():
   Send(msg, "chan", i = 0), Receive(msg, "chan", i = 0).
 - Use the new methods in MQ examples and tests.
 - No breaking changes, but FAIRMQ_INTERFACE_VERSION is incremented to 3
   to allow to check for new methods.
2016-02-29 16:25:39 +01:00
Alexey Rybalchenko
e4fed2fa1b Fix copy constructor & assignment operator warning in FairMQChannel
Fix Weffc++ warnings

  - Add missing copy constructors and assignment operators .
  - Hide the warning from FairMQStateMachine.h where it is produced by boost and/or is intended.
  - Some code cleanup.
2016-01-14 14:19:03 +01:00
Alexey Rybalchenko
8b71e4d20b Use FairMQDevice::CatchSignals for Tutorial7 2015-09-28 12:17:24 +02:00
Alexey Rybalchenko
fbf7dbf2ba Add orthogonal OK/ERROR states.
Replace state check mutex with atomic.

Update DDS example documentation.
2015-09-28 12:17:24 +02:00
Alexey Rybalchenko
1302e77a16 Several FairMQ fixes and improvements:
- FairMQ: add possibility to poll on multiple channels.
- FairMQ: include command channel when polling on blocking calls (for unblocking without termination).
- FairMQ: move signal handler inside of FairMQDevice class (call FairMQDevice::CatchSignals() in the main function).
- FairMQ: add 'bool CheckCurrentState(statename)' (instead of 'GetCurrentState() == statename' that cannot be thread safe).
- FairMQDevice: add 'InteractiveStateLoop()' method that can be used to change states from the command line.
- FairMQDevice: add automatic transition to IDLE state if Run() exits without an external event.
- FairMQDevice: implement device reset.
- FairMQDevice: use unordered_map for device channels.
- FairMQChannel: improve address validation for channels.
- FairMQChannel: add ExpectsAnotherPart() method to check if another msg part is expected (old approach still works).
- FairMQ: remove invalid transition from the run files.
- FairMQFileSink: disable ROOT termination signal handler.
- Tutorial3: spawn xterm windows from start scripts without overlapping for better visibility.
- FairMQ Examples: update protobuf test and move its files to a common directory.
- FairMQStateMachine: improve feedback on invalid transitions (more readable).
2015-09-28 12:17:22 +02:00
Alexey Rybalchenko
295d9bba57 add WaitForEndOfStateForMs(state, duration) 2015-06-17 16:01:11 +02:00
Alexey Rybalchenko
a3d919b763 Use FairMQProgOptions for Sink and BenchmarkSampler 2015-06-16 12:43:23 +02:00
Alexey Rybalchenko
7fda980710 Update FairMQStateMachine & introduce FairMQChannels
Organize sockets as a map of vectors of FairMQChannels.

Update FairMQStateMachine by removing SETTINGINPUT, SETTINGOUTPUT,
BIND and CONNECT states and by adding INITIALIZING_TASK, RESETTING_TASK
and RESETTING_DEVICE states. Run states functions in their own thread.
2015-06-16 09:29:53 +02:00
Alexey Rybalchenko
8a82afe184 Expose BIND and CONNECT states for use with dynamic configuration
introduce FairMQ interface version
2015-02-11 15:15:23 +01:00
Alexey Rybalchenko
ce58ee2302 Fix warnings produced with -Weffc++ in fairmq, base/MQ and Tutorial3.
Remaining warnings originate from boost::msm and boost::mpl.
Also, warnings with missing initializer list entries for DeviceOptions are false positives, since those are PODs.
2015-01-21 16:19:16 +01:00
Alexey Rybalchenko
0cef5692b1 Use boost::program_options for managing command line options of the executables.
Existing scripts in example/Tutorial3/macro have been updated to use the new format.
Your own executables are not affected, but your scripts which use FairMQ executables have to be updated to the new format.
Use the `--help` option with any FairMQ executable to find out the available options.
2014-11-04 11:50:57 +01:00
Alexey Rybalchenko
bd79420f93 Condition check before ending the main thread.
Make sure the main thread waits for the child thread with the Run() method.

* Add this at the end of your Run() method for each device:
```
boost::lock_guard<boost::mutex> lock(fRunningMutex);
fRunningFinished = true;
fRunningCondition.notify_one();
```
* Then you must replace the `char ch; cin.get(ch);` in your main() function with:
```
boost::unique_lock<boost::mutex> lock(processor.fRunningMutex);
while (!processor.fRunningFinished)
{
    processor.fRunningCondition.wait(lock);
}
```
2014-09-01 15:26:37 +02:00
Alexey Rybalchenko
0a610926a1 - Proper process termination:
if interrupted with CTRL+C blocking socket calls will return with -1. Each device should call FairMQDevice::Shutdown() before ending the running state to close open sockets, otherwise the interrupt call itself will block.

- FIX: Update number of received messages for FairMQFileSink.
- Add ability to poll on outputs for FairMQPoller.
2014-08-20 13:48:51 +02:00
Alexey Rybalchenko
8cd120aef4 - Add multipart support to the interface and enable its use out of tasks.
Examples on the use out of tasks are provided in:
  `example/Tutorial3/digitization/TestDetectorDigiLoader.tpl:76-85`: sending a part.
  `example/Tutorial3/reconstruction/FairTestDetectorMQRecoTask.tpl:177-182`: receiving a part.

- This commit also makes structure within processorTask more consistent with samplerTask.

- add macro MQLOG to FairMQLogger.
2014-08-08 14:52:31 +02:00
Florian Uhlig
865c0e010f Add license file LICENSE with LPGL license text copied from https://www.gnu.org/licenses/lgpl.html. Add license text to most of files of the project.
Add license text to all header files

Add license text to all c++ source files

Add license text to all C macro files

Converting file to UNIX format.

Add license text to all build system files

Add license text to all c source files

Rename file LICENCE to LICENSE. Change preamble in all files.
2014-06-06 14:57:56 +02:00
Alexey Rybalchenko
c03d4ad6d5 use clang-format for Tutorial3 2014-06-06 14:30:41 +02:00
Thorsten Kollegger
24d26e802a Using boost::msm inside FairMQStateMachine. 2014-05-08 12:56:30 +02:00
Alexey Rybalchenko
3803a3d155 a little clean up 2014-01-28 11:56:08 +01:00
Mohammad Al-Turany
5121fe3ae5 merge the trunk with the development of ZeroMQ branch
git-svn-id: https://subversion.gsi.de/fairroot/fairbase/trunk@22451 0381ead4-6506-0410-b988-94b70fbc4730
2013-10-25 12:42:48 +00:00
Mohammad Al-Turany
231c7c8f7e Zero MQ implimentation and example (Tutorial3)
git-svn-id: https://subversion.gsi.de/fairroot/fairbase/trunk@20162 0381ead4-6506-0410-b988-94b70fbc4730
2013-06-07 08:07:48 +00:00