diff --git a/.clang-format b/.clang-format
new file mode 100644
index 000000000..112004a90
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,100 @@
+# BasedOnStyle: LLVM
+AccessModifierOffset: -3
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: None
+# This would be nice to have but seems to also (mis)align function parameters
+AlignConsecutiveDeclarations: None
+AlignEscapedNewlines: Left
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: Never
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: Inline
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+# This option is "deprecated and is retained for backwards compatibility."
+# AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: Yes
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+ AfterClass: false
+ AfterControlStatement: Never
+ AfterEnum: false
+ AfterFunction: true
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+ColumnLimit: 120
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+ConstructorInitializerIndentWidth: 3
+ContinuationIndentWidth: 3
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IndentCaseLabels: false
+IndentWidth: 3
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 3
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 10
+PointerAlignment: Right
+ReflowComments: true
+SortIncludes: Never
+SpaceAfterCStyleCast: false
+SpaceBeforeAssignmentOperators: true
+# You want this : enable it if you have https://reviews.llvm.org/D32525
+# SpaceBeforeColon: false
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: c++11
+TabWidth: 3
+UseTab: Never
+
+# Order alphabetically and by generality the included header files.
+IncludeCategories:
+ - Regex: '^"[^/]+\"'
+ Priority: 10
+ - Regex: '^("|<)T'
+ Priority: 12
+ - Regex: '^"ROOT/'
+ Priority: 15
+ - Regex: '^"cling/'
+ Priority: 20
+ - Regex: '^"clang/'
+ Priority: 30
+ - Regex: '^"llvm/'
+ Priority: 40
+ - Regex: '^<'
+ Priority: 50
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 000000000..9ddfeae90
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1 @@
+WarningsAsErrors: '*'
diff --git a/plugins/dogma/CMakeLists.txt b/plugins/dogma/CMakeLists.txt
index 59df49f18..ba1216291 100644
--- a/plugins/dogma/CMakeLists.txt
+++ b/plugins/dogma/CMakeLists.txt
@@ -5,11 +5,14 @@ dabc_link_library(
src/defines.cxx
src/UdpTransport.cxx
src/TypeDefs.cxx
+ src/api.cxx
HEADERS dogma/TerminalModule.h
dogma/Factory.h
+ dogma/Iterator.h
dogma/defines.h
dogma/UdpTransport.h
dogma/TypeDefs.h
+ dogma/api.h
INCDIR dogma
LIBRARIES DabcBase
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR})
@@ -19,6 +22,11 @@ dabc_executable(
SOURCES dogmacmd.cxx
LIBRARIES DabcBase)
+dabc_executable(
+ dogmaprint
+ SOURCES dogmaprint.cxx
+ LIBRARIES DabcBase DabcMbs DabcDogma)
+
dabc_install_plugin_data(
DabcDogma
DIRECTORIES app
diff --git a/plugins/dogma/Readme.md b/plugins/dogma/Readme.md
index 8c7df3648..1afdc3840 100644
--- a/plugins/dogma/Readme.md
+++ b/plugins/dogma/Readme.md
@@ -1,4 +1,21 @@
-# Short info
+## Usage of `dogmaprint`
+
+1. Start readout
+
+ dabc_exe plugins/dogma/app/readout.xml
+
+2. Run print on any other node
+
+ dogmaprint host:6002 -raw
+
+ dogmaprint host:6002 -rate
+
+
+
+## Usage of `dogmacmd`
+
+This is demo how one use DABC command channel to submit arbitrary commands
+to remote node. Any kind of protocol can be implemented on top.
1. Start on the control node
diff --git a/plugins/dogma/app/dogma.xml b/plugins/dogma/app/dogma.xml
index 1c9060dbe..361f97c32 100644
--- a/plugins/dogma/app/dogma.xml
+++ b/plugins/dogma/app/dogma.xml
@@ -2,6 +2,7 @@
+
diff --git a/plugins/dogma/app/print.xml b/plugins/dogma/app/print.xml
index 81aeae134..d600ab6c2 100644
--- a/plugins/dogma/app/print.xml
+++ b/plugins/dogma/app/print.xml
@@ -4,6 +4,7 @@
+
@@ -30,7 +31,7 @@
-
+
diff --git a/plugins/dogma/app/readout.xml b/plugins/dogma/app/readout.xml
new file mode 100644
index 000000000..e845e0b43
--- /dev/null
+++ b/plugins/dogma/app/readout.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/dogma/dogma/Factory.h b/plugins/dogma/dogma/Factory.h
index 839a46272..23be073e9 100644
--- a/plugins/dogma/dogma/Factory.h
+++ b/plugins/dogma/dogma/Factory.h
@@ -30,6 +30,8 @@ namespace dogma {
public:
Factory(const std::string &name) : dabc::Factory(name) {}
+ dabc::Reference CreateObject(const std::string &classname, const std::string &objname, dabc::Command cmd) override;
+
dabc::Module *CreateModule(const std::string &classname, const std::string &modulename, dabc::Command cmd) override;
dabc::Module *CreateTransport(const dabc::Reference& port, const std::string &typ, dabc::Command cmd) override;
diff --git a/plugins/dogma/dogma/Iterator.h b/plugins/dogma/dogma/Iterator.h
new file mode 100644
index 000000000..2c3e1a416
--- /dev/null
+++ b/plugins/dogma/dogma/Iterator.h
@@ -0,0 +1,89 @@
+// $Id$
+
+/************************************************************
+ * The Data Acquisition Backbone Core (DABC) *
+ ************************************************************
+ * Copyright (C) 2009 - *
+ * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
+ * Planckstr. 1, 64291 Darmstadt, Germany *
+ * Contact: http://dabc.gsi.de *
+ ************************************************************
+ * This software can be used under the GPL license *
+ * agreements as stated in LICENSE.txt file *
+ * which is part of the distribution. *
+ ************************************************************/
+
+#ifndef DOGMA_Iterator
+#define DOGMA_Iterator
+
+#ifndef DABC_Buffer
+#include "dabc/Buffer.h"
+#endif
+
+#ifndef DABC_Pointer
+#include "dabc/Pointer.h"
+#endif
+
+#ifndef DABC_eventsapi
+#include "dabc/eventsapi.h"
+#endif
+
+#ifndef DOGMA_TypeDefs
+#include "dogma/TypeDefs.h"
+#endif
+
+#ifndef DOGMA_defines
+#include "dogma/defines.h"
+#endif
+
+namespace dogma {
+
+ class RawIterator : public dabc::EventsIterator {
+ protected:
+ dabc::Pointer fRawPtr;
+
+ public:
+ RawIterator(const std::string &name) : dabc::EventsIterator(name) {}
+ ~RawIterator() override {}
+
+ bool Assign(const dabc::Buffer& buf) override
+ {
+ Close();
+ if (buf.null() || (buf.GetTypeId() != mbt_DogmaTransportUnit))
+ return false;
+
+ fRawPtr = buf;
+ return true;
+ }
+ void Close() override { return fRawPtr.reset(); }
+
+ bool NextEvent() override
+ {
+ auto sz = EventSize();
+ if (sz >= fRawPtr.fullsize()) {
+ fRawPtr.reset();
+ return false;
+ }
+ fRawPtr.shift(sz);
+ return !fRawPtr.null();
+ };
+
+ void *Event() override
+ {
+ if (fRawPtr.fullsize() < sizeof(DogmaTu))
+ fRawPtr.reset();
+
+ return fRawPtr();
+ }
+
+ dabc::BufferSize_t EventSize() override
+ {
+ auto tu = (DogmaTu *) Event();
+ return tu ? tu->GetSize() : 0;
+ }
+ };
+
+
+}
+
+#endif
diff --git a/plugins/dogma/dogma/api.h b/plugins/dogma/dogma/api.h
new file mode 100644
index 000000000..b6ce4f8c2
--- /dev/null
+++ b/plugins/dogma/dogma/api.h
@@ -0,0 +1,69 @@
+// $Id$
+
+/************************************************************
+ * The Data Acquisition Backbone Core (DABC) *
+ ************************************************************
+ * Copyright (C) 2009 - *
+ * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
+ * Planckstr. 1, 64291 Darmstadt, Germany *
+ * Contact: http://dabc.gsi.de *
+ ************************************************************
+ * This software can be used under the GPL license *
+ * agreements as stated in LICENSE.txt file *
+ * which is part of the distribution. *
+ ************************************************************/
+
+#ifndef DOGMA_api
+#define DOGMA_api
+
+#ifndef MBS_api
+#include "mbs/api.h"
+#endif
+
+#ifndef DOGMA_Iterator
+#include "dogma/Iterator.h"
+#endif
+
+namespace dogma {
+
+ class ReadoutHandle;
+
+ class ReadoutModule : public mbs::ReadoutModule {
+ protected:
+
+ friend class ReadoutHandle;
+
+ dogma::RawIterator fIter2; ///< iterator over DOGMA buffers
+
+ int AcceptBuffer(dabc::Buffer &buf) override;
+
+ public:
+
+ ReadoutModule(const std::string &name, dabc::Command cmd);
+ };
+
+
+ class ReadoutHandle : protected mbs::ReadoutHandle {
+
+ DABC_REFERENCE(ReadoutHandle, mbs::ReadoutHandle, dogma::ReadoutModule)
+
+ /** Connect with data source */
+ static ReadoutHandle Connect(const std::string &url);
+
+ /** Return true if handle not initialized */
+ bool null() const { return mbs::ReadoutHandle::null(); }
+
+ /** Disconnect from MBS server */
+ bool Disconnect() { return mbs::ReadoutHandle::Disconnect(); }
+
+ /** Retrieve next event from the server */
+ DogmaTu *NextTu(double tm = 1.0, double maxage = -1.);
+
+ /** Get current event pointer */
+ DogmaTu *GetTu();
+ };
+
+}
+
+
+#endif
diff --git a/plugins/dogma/dogma/defines.h b/plugins/dogma/dogma/defines.h
index 313e2382e..c3d6d2197 100644
--- a/plugins/dogma/dogma/defines.h
+++ b/plugins/dogma/dogma/defines.h
@@ -53,7 +53,7 @@ namespace dogma {
inline uint32_t GetAddr() const { return Value(&tuAddr); }
- inline uint32_t GetTrigType() const { return Value(&tuTrigTypeNumber) << 24; }
+ inline uint32_t GetTrigType() const { return Value(&tuTrigTypeNumber) >> 24; }
inline uint32_t GetTrigNumber() const { return Value(&tuTrigTypeNumber) & 0xffffff; }
@@ -61,7 +61,10 @@ namespace dogma {
inline uint32_t GetPayloadLen() const { return Value(&tuLenPayload) & 0xffff; }
- inline uint32_t GetMessageSize() const { return 20 + GetPayloadLen(); }
+ inline uint32_t GetSize() const { return 20 + GetPayloadLen(); }
+
+ inline uint32_t GetPayload(uint32_t indx) const { return Value(&tuLenPayload + 1 + indx); }
+
};
}
diff --git a/plugins/dogma/dogmaprint.cxx b/plugins/dogma/dogmaprint.cxx
new file mode 100644
index 000000000..c23198d7d
--- /dev/null
+++ b/plugins/dogma/dogmaprint.cxx
@@ -0,0 +1,244 @@
+// $Id$
+
+/********************************************************************
+ * The Data Acquisition Backbone Core (DABC)
+ ********************************************************************
+ * Copyright (C) 2009-
+ * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
+ * Planckstr. 1
+ * 64291 Darmstadt
+ * Germany
+ * Contact: http://dabc.gsi.de
+ ********************************************************************
+ * This software can be used under the GPL license agreements as stated
+ * in LICENSE.txt file which is part of the distribution.
+ ********************************************************************/
+
+#include
+#include
+#include
diff --git a/plugins/stream/app/astransport.xml b/plugins/stream/app/astransport.xml
index b0772265c..a73f254c4 100644
--- a/plugins/stream/app/astransport.xml
+++ b/plugins/stream/app/astransport.xml
@@ -1,29 +1,29 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
+
-
+
@@ -31,7 +31,7 @@
-
+