Adds immediate migration results in progress

This commit is contained in:
torsten committed 2026-08-19 11:18:24 +02:00
1 parent 8453e104c5
commit 3bb6e89496
2102 files changed
+17482 -15071

No files matched your search

+335
View File
@@ -0,0 +1,335 @@
# Qt5/C++11 to Qt6/C++23 Migrationsplan
## 📋 Ausgangslage
### Projektstruktur
```
$PROJDIR_MIGRATE_QT5_TO_QT6 = /home/torsten/swy/sandbox/qt-migration-legatus
├── qt5-before/qt5-legatus-legacy/ (Qt5/C++11 Legacy-Code)
└── qt6-after/qt6-migrated-legatus/ (Qt6/C++23 migrierter Code)
```
### Submodule Konfiguration
- **Submodule**: `qt-migration-legatus` zeigt auf `feature/qt6-migration-basis-modules` (commit d176b5e)
- **Quellverzeichnis**: `qt5-before/qt5-legatus-legacy/` enthält vollständigen Qt5-Code mit CMakeLists.txt
- **Zielverzeichnis**: `qt6-after/qt6-migrated-legatus/` enthält bereits migrierte Module
### Bereits migrierte Module (Stand: Session a41bb15a)
✅ **Lts/Common** - Vollständig migriert, Tests erfolgreich (1/1 bestanden)
✅ **Lts/DDS** - Struktur vorhanden
✅ **Lts/Plugins** - Struktur vorhanden
✅ **Lts/Projects** - Struktur vorhanden
✅ **Lts/Proxies** - Struktur vorhanden
✅ **Lts/Services** - Struktur vorhanden
✅ **TetraIF** - Teilweise migriert
✅ **Z** - Teilweise migriert (nglwidgets, QtSingleApplication, qsql_informix, WMS_Interface)
### Infrastruktur
- ✅ Docker-Image: `migration-pipeline:ubuntu26.04` (Ubuntu 26.04, Qt 6.8.3)
- ✅ CMake 3.16+, C++23
- ✅ CI-Workflow mit `submodules: recursive`
- ✅ Migrationsskripte aktualisiert für Submodule-Pfade
---
## 🎯 Migrationsziele (aus combined-migration-compact.prompt.md)
### Hauptziele
1. **Qt5 → Qt6** Upgrade aller Module
2. **C++11/14/17 → C++23** Modernisierung
3. **Qt Core, Gui, Widgets** explizit verlinken
4. **QRegExp → QRegularExpression** ersetzen
5. **QDesktopWidget → QScreen**-basierte APIs
6. **QTextCodec** entfernen, Qt6-safe text handling
7. **SIGNAL/SLOT** alte Syntax → function-pointer connect syntax
8. **0/NULL** → `nullptr` ersetzen
### C++23 Modernisierung
- `auto` wo offensichtlich
- Strukturierte Bindings wo klarer
- Raw Pointer → `std::unique_ptr` / `std::shared_ptr`
- `std::make_unique` / `std::make_shared`
- `std::string_view` (lifetime safety beachten)
- `std::span` für non-owning contiguous data
- `.contains()` statt `find(...) != end()`
- Algorithms/Ranges statt manueller Loops
- `[[nodiscard]]` wo sinnvoll
- Early Returns statt nested control flow
- `std::optional` monadic operations
- `constexpr`, `if constexpr`, concepts, `requires`
- `noexcept`, `override`, `final`, `= default`, `= delete`
- `enum class` statt unscoped enums
- `std::print` / `std::println` (wenn unterstützt)
- Typed `std::chrono`, `std::jthread`
### Safety Rules
- ✅ Semantics first, modernize second
- ❌ KEINE Behavior Changes (außer Qt6 compatibility)
- ❌ KEINE Code Cleanup
- ❌ KEINE Umbenennungen
- ❌ KEINE Function/Class Extractions
- ❌ KEINE Logic Restructuring
- ❌ KEINE stylistic rewrites
- ❌ KEINE opportunistic improvements
---
## 📝 Migrationsphasen
### Phase 1: Vorbereitung und Analyse
**Todo-ID: prepare**
- [x] Submodule initialisieren: `git submodule update --init`
- [x] Docker-Image bauen: `docker build -t migration-pipeline:ubuntu26.04 ./app`
- [x] Bereits migrierte Module identifizieren
- [ ] Vollständige Inventur aller noch zu migrierenden Dateien
- [ ] Migrationsskripte für verbleibende Module vorbereiten
### Phase 2: Lts-Module komplett migrieren
**Todo-ID: lts-modules**
**Dependencies: prepare**
Bereits migriert:
- [x] Lts/Common
- [ ] Lts/DDS (prüfen, ob vollständig)
- [ ] Lts/Plugins (alle Untermodule prüfen)
- [ ] Lts/Projects (alle Untermodule prüfen)
- [ ] Lts/Proxies (alle Untermodule prüfen)
- [ ] Lts/Services (alle Untermodule prüfen)
**Vorgehen pro Modul (mit Test- und Docker-Validierung):**
1. `./migration/migrate_module.sh Lts/<Modul> --jobs 4`
2. **Tests erstellen**: Für jede Code-Änderung mindestens 3 Tests hinzufügen
- Tests in `qt6-after/qt6-migrated-legatus/tests/` ablegen
- Dateinamen: `test_<name>.cpp`, `<name>_test.cpp`, `<name>test.cpp`, oder `<name>gtest.cpp`
- Tests in CMake registrieren (CTest)
3. **Docker-Validierung** (obligatorisch vor Commit):
```bash
# Configure im Docker-Container
docker run --rm -v $(pwd):/repo migration-pipeline:ubuntu26.04 \
cmake -S /repo/qt-migration-legatus/qt6-after/qt6-migrated-legatus \
-B /repo/build -G Ninja -DCMAKE_BUILD_TYPE=Debug
# Build im Docker-Container
docker run --rm -v $(pwd):/repo migration-pipeline:ubuntu26.04 \
cmake --build /repo/build --parallel
# Tests im Docker-Container
docker run --rm -v $(pwd):/repo migration-pipeline:ubuntu26.04 \
ctest --test-dir /repo/build --output-on-failure
# Policy-Check im Docker-Container
docker run --rm -v $(pwd):/repo migration-pipeline:ubuntu26.04 \
python3 /repo/ci/check_pr_policies.py
```
4. **Fehlerklassifikation**:
- **Environment-Failures** (command not found, missing package): `ci/Dockerfile.ci` aktualisieren, Image neu bauen
- **Project-Failures** (compile/link errors, test failures): Code fixen
5. Bei Erfolg: clang-tidy laufen lassen, Changes commiten
### Phase 3: TetraIF komplett migrieren
**Todo-ID: tetraif**
**Dependencies: lts-modules**
- [ ] TetraIF Hauptcode migrieren
- [ ] Alle Includes und Abhängigkeiten prüfen
- [ ] Tests erstellen (mind. 3 Tests pro Code-Änderung)
- [ ] **Docker-Validierung** (Configure → Build → Test → Policy)
- [ ] clang-tidy Integration testen
### Phase 4: Z-Module komplett migrieren
**Todo-ID: z-modules**
**Dependencies: tetraif**
Bereits teilweise migriert:
- [x] Z/src/nglwidgets
- [x] Z/src/QtSingleApplication
- [x] Z/src/qsql_informix
- [x] Z/src/WMS_Interface
- [ ] Fehlende Z-Module identifizieren und migrieren
**Vorgehen pro Modul** (wie Phase 2 mit Test- und Docker-Validierung)
### Phase 5: Vollständige Build-Validierung
**Todo-ID: full-build**
**Dependencies: lts-modules, tetraif, z-modules**
- [ ] `./final-migration/run_final_migration.sh --jobs 6` ausführen
- [ ] **Docker-Validierung komplett**:
- [ ] Configure: `cmake -S qt6-after/qt6-migrated-legatus -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug`
- [ ] Build: `cmake --build build --parallel`
- [ ] Test: `ctest --test-dir build --output-on-failure`
- [ ] Policy: `python3 ci/check_pr_policies.py`
- [ ] Alle Tests bestehen (CTest)
- [ ] Policy-Check erfolgreich
### Phase 6: CI/CD Validierung
**Todo-ID: ci-validation**
**Dependencies: full-build**
- [ ] CI-Workflow lokal simulieren
- [ ] Submodule checkout testen
- [ ] Alle Migrationsschritte im CI-Kontext verifizieren
- [ ] Build-Artefakte prüfen
- [ ] Test-Logs analysieren
- [ ] **Docker-Image als Source of Truth**: `lifemaps/ci-cpp:latest` (oder `migration-pipeline:ubuntu26.04`)
- Bei fehlenden Tools: `ci/Dockerfile.ci` minimal aktualisieren
- Image neu bauen und Validierung wiederholen
---
## 🧪 Validierungskriterien
### Pre-Migration (lokal)
- [x] `git submodule update --init` erfolgreich
- [x] Docker-Image Build erfolgreich
- [x] Lts/Common Migration erfolgreich getestet
- [ ] Vollständige Inventur aller Module
### Post-Migration (lokal)
- [ ] Configure im Docker-Container erfolgreich
- [ ] Build im Docker-Container erfolgreich
- [ ] Alle Tests bestehen (`ctest --test-dir build --output-on-failure`)
- [ ] Policy-Check erfolgreich (`python3 ci/check_pr_policies.py`)
### CI-Validierung
- [ ] Checkout mit Submodules erfolgreich
- [ ] Lts/Common Migration Step erfolgreich
- [ ] Lts/DDS Migration Step erfolgreich
- [ ] Final Migration Build ohne Fehler
- [ ] CTest läuft und besteht
- [ ] Workflow-Zeit < 120 Minuten
---
## 📊 Fortschrittsübersicht
### Migrierte Module (✅)
| Modul | Status | Tests | Build | Notes |
|-------|--------|-------|-------|-------|
| Lts/Common | ✅ Vollständig | 1/1 ✅ | ✅ | Basis erfolgreich |
| Lts/DDS | 🟡 Struktur vorhanden | ? | ? | Prüfung ausstehend |
| Lts/Plugins | 🟡 Struktur vorhanden | ? | ? | 60 Untermodule |
| Lts/Projects | 🟡 Struktur vorhanden | ? | ? | 5 Untermodule |
| Lts/Proxies | 🟡 Struktur vorhanden | ? | ? | 13 Untermodule |
| Lts/Services | 🟡 Struktur vorhanden | ? | ? | 47 Untermodule |
| TetraIF | 🟡 Teilweise | ? | ? | Migration läuft |
| Z | 🟡 Teilweise | ? | ? | Einige Submodule fertig |
### Noch zu migrieren (❌)
- Alle Untermodule in Lts/Plugins (60)
- Alle Untermodule in Lts/Projects (5)
- Alle Untermodule in Lts/Proxies (13)
- Alle Untermodule in Lts/Services (47)
- Restliche Z-Module
---
## ⚠️ Risiken und Gegenmaßnahmen
### Risiko 1: Submodule Permissions
**Problem**: CI benötigt SSH-Zugriff auf `git@devel:lifemaps/qt-migration-legatus.git`
**Mitigation**: SSH-Key in CI secrets konfigurieren oder HTTPS mit Token verwenden
### Risiko 2: Git Operations in Submodules
**Problem**: `run_clang_tidy_common.sh` committet in Submodule-Pfad
**Mitigation**: Lokal testen, Submodule-Commits separat von Main-Repo-Commits betrachten
### Risiko 3: Externe Dependencies
**Problem**: Skripte erwarten `/repo/external` mit RTI Connext und ArcGIS SDK
**Mitigation**: CI stellt Dependencies bereit oder behandelt fehlende Dependencies gracefully
### Risiko 4: Nested Git Repo
**Problem**: `qt5-legatus-legacy` hat eigenes .git-Verzeichnis
**Mitigation**: `git submodule update --init` OHNE `--recursive` verwenden
---
## 🔄 Rollback-Plan
Bei kritischen Problemen:
1. **CI-Workflow revertieren**: `submodules: recursive` entfernen
2. **Migration-Skripte revertieren**: Original `-S /repo` Pfade wiederherstellen
3. **Fallback**: Alte Ordernstruktur temporär am Repo-Root wiederherstellen
---
## 📈 Nächste Schritte (sofort)
1. **Logging-Fixes validieren**: Build im Docker-Container nach Logger-Fixes testen
2. **Inventur vervollständigen**: Alle noch zu migrierenden Dateien identifizieren
3. **Lts/DDS prüfen**: Ist das Modul vollständig migriert? Build testen
4. **Lts/Plugins**: Erste Untermodule migrieren (priorisiere Kernfunktionalität)
5. **TetraIF**: Migration abschließen und validieren
6. **Vollständigen Build testen**: `./final-migration/run_final_migration.sh --jobs 6`
---
## 🛠️ Wichtige Commands
### Submodule Management
```bash
# Submodule initialisieren
git submodule update --init
# Submodule auf Branch aktualisieren
git submodule update --remote
# Submodule Status prüfen
git submodule status
```
### Migration
```bash
# Einzelnes Modul migrieren
./migration/migrate_module.sh Lts/<Modul> --jobs 4
# Vollständige Migration
./final-migration/run_final_migration.sh --jobs 6
# Clang-tidy für Modul
./migration/run_clang_tidy_common.sh Lts/<Modul>
```
### Docker-Validierung (OBLIGATORISCH)
```bash
# Configure im Container
docker run --rm -v $(pwd):/repo migration-pipeline:ubuntu26.04 \
cmake -S /repo/qt-migration-legatus/qt6-after/qt6-migrated-legatus \
-B /repo/build -G Ninja -DCMAKE_BUILD_TYPE=Debug
# Build im Container
docker run --rm -v $(pwd):/repo migration-pipeline:ubuntu26.04 \
cmake --build /repo/build --parallel
# Tests im Container
docker run --rm -v $(pwd):/repo migration-pipeline:ubuntu26.04 \
ctest --test-dir /repo/build --output-on-failure
# Policy-Check
docker run --rm -v $(pwd):/repo migration-pipeline:ubuntu26.04 \
python3 /repo/ci/check_pr_policies.py
```
### Docker-Image bei fehlenden Tools
```bash
# ci/Dockerfile.ci bearbeiten (fehlendes Package hinzufügen)
# Dann Image neu bauen:
docker build -t migration-pipeline:ubuntu26.04 ./app
# Validierung wiederholen
```
---
## 📝 Session-Referenzen
- **Session a41bb15a-b5cc-4955-8d71-0169516fcef3**: Vorherige Migration-Sessions
- **Checkpoint 008-qt6-migration-infrastructure**: Letzte Infrastruktur-Updates
- **Submodule Branch**: `feature/qt6-migration-basis-modules` @ d176b5e
---
**Erstellt**: 2026-08-18
**Aktualisiert**: 2026-08-18 (Test- und Docker-Validierungsanforderungen integriert)
**Status**: Bereit für User-Feedback und Implementierung
+246
View File
@@ -0,0 +1,246 @@
#!/usr/bin/env python3
"""
Add logger initialization to constructors in Qt6 .cpp files.
Pattern: m_logger(NGL::NGLLoggerBootstrap::getLogger())
"""
import os
import re
import sys
from pathlib import Path
# Paths
SCRIPT_DIR = Path(__file__).parent
QT6_BASE = SCRIPT_DIR / "qt6-after/qt6-migrated-legatus"
# Qt classes that shouldn't have logger initialization
QT_CLASSES = {
'QObject', 'QWidget', 'QMainWindow', 'QDialog', 'QMessageBox',
'QAbstractTableModel', 'QAbstractListModel', 'QAbstractItemModel',
'QTreeView', 'QTableView', 'QListView', 'QComboBox',
'QTcpSocket', 'QTcpServer', 'QUdpSocket', 'QTimer', 'QThread',
'QSettings', 'QFileInfo', 'QDir', 'QFile', 'QTextStream',
'QDomElement', 'QDomDocument', 'QXmlStreamReader', 'QXmlStreamWriter',
'QPainter', 'QPixmap', 'QImage', 'QIcon', 'QBrush', 'QPen',
'QMenu', 'QMenuBar', 'QToolBar', 'QStatusBar', 'QAction',
'QVBoxLayout', 'QHBoxLayout', 'QGridLayout', 'QFormLayout',
'QPushButton', 'QLabel', 'QLineEdit', 'QTextEdit', 'QPlainTextEdit',
'QCheckBox', 'QRadioButton', 'QSpinBox', 'QDoubleSpinBox',
'QSlider', 'QScrollBar', 'QProgressBar', 'QTabWidget',
'QStackedWidget', 'QSplitter', 'QScrollArea', 'QFrame',
'QGroupBox', 'QToolBox', 'QWizard', 'QFontDialog', 'QColorDialog',
'QFileDialog', 'QInputDialog', 'QProgressDialog', 'QErrorMessage',
'QSystemTrayIcon', 'QClipboard', 'QDrag', 'QMimeData',
'QKeyEvent', 'QMouseEvent', 'QPaintEvent', 'QResizeEvent',
'QShowEvent', 'QHideEvent', 'QCloseEvent', 'QFocusEvent',
'QMoveEvent', 'QContextMenuEvent', 'QInputEvent', 'QWheelEvent',
'QHoverEvent', 'QTabletEvent', 'QGestureEvent', 'QShortcut',
'QKeySequence', 'QValidator', 'QIntValidator', 'QDoubleValidator',
'QRegExpValidator', 'QCompleter', 'QAbstractSpinBox', 'QDateTimeEdit',
'QDateEdit', 'QTimeEdit', 'QCalendarWidget', 'QDial', 'QLCDNumber',
'QSpinBox', 'QDoubleSpinBox', 'QTimeEdit', 'QDateTimeEdit',
'QDateEdit', 'QFontComboBox', 'QToolButton', 'QCommandLinkButton',
'QDialogButtonBox', 'QPlainTextEdit', 'QTextEdit', 'QTextBrowser',
'QListWidget', 'QTreeWidget', 'QTableWidget', 'QListWidgetItem',
'QTreeWidgetItem', 'QTableWidgetItem', 'QHeaderView', 'QColumnView',
'QDataWidgetMapper', 'QFileSystemModel', 'QStandardItemModel',
'QStandardItem', 'QSortFilterProxyModel', 'QStringListModel',
'QAbstractProxyModel', 'QIdentityProxyModel', 'QItemSelectionModel',
'QItemSelection', 'QItemSelectionRange', 'QStyledItemDelegate',
'QItemDelegate', 'QAbstractItemDelegate', 'QAbstractItemView',
'QGraphicsView', 'QGraphicsScene', 'QGraphicsItem', 'QGraphicsWidget',
'QGraphicsObject', 'QGraphicsLayout', 'QGraphicsLinearLayout',
'QGraphicsGridLayout', 'QGraphicsProxyWidget', 'QGraphicsTextItem',
'QGraphicsRectItem', 'QGraphicsEllipseItem', 'QGraphicsLineItem',
'QGraphicsPathItem', 'QGraphicsPolygonItem', 'QGraphicsPixmapItem',
'QGraphicsSimpleTextItem', 'QGraphicsItemGroup', 'QGraphicsLayoutItem',
'QGraphicsAnchorLayout', 'QGraphicsGridLayout', 'QStackedLayout',
'QBoxLayout', 'QFormLayout', 'QGridLayout', 'QHBoxLayout',
'QVBoxLayout', 'QLayout', 'QLayoutItem', 'QSpacerItem',
'QSizeGrip', 'QSizePolicy', 'QStyle', 'QStyleFactory',
'QStyleOption', 'QStylePainter', 'QProxyStyle', 'QCommonStyle',
'QWindowsVistaStyle', 'QMacStyle', 'QFusionStyle', 'QCleanlooksStyle',
'QPlastiqueStyle', 'QMotifStyle', 'QApplication', 'QDesktopWidget',
'QSessionManager', 'QStyleHintReturn', 'QStyleHintReturnMask',
'QStyleHintReturnVariant', 'QStyleOptionFocusRect',
'QStyleOptionFrame', 'QStyleOptionFrameV2', 'QStyleOptionFrameV3',
'QStyleOptionButton', 'QStyleOptionComboBox', 'QStyleOptionHeader',
'QStyleOptionHeaderV2', 'QStyleOptionComplex', 'QStyleOptionSlider',
'QStyleOptionSpinBox', 'QStyleOptionToolButton', 'QStyleOptionToolBar',
'QStyleOptionDockWidget', 'QStyleOptionDockWidgetV2',
'QStyleOptionViewItem', 'QStyleOptionViewItemV2', 'QStyleOptionViewItemV3',
'QStyleOptionViewItemV4', 'QStyleOptionTab', 'QStyleOptionTabV2',
'QStyleOptionTabV3', 'QStyleOptionTabBarBase', 'QStyleOptionTabBarBaseV2',
'QStyleOptionRubberBand', 'QStyleOptionGraphicsItem',
'QStyleOptionTitleBar', 'QStyleOptionToolBox', 'QStyleOptionToolBoxV2',
'QStyleOptionViewItem', 'QStyleOptionProgressBar',
'QStyleOptionProgressBarV2', 'QStyleOptionMenuItem', 'QStyleOptionSlider',
'QStyleOptionSpinBox', 'QStyleOptionToolButton', 'QStyleOptionToolBar',
'QStyleOptionDockWidget', 'QStyleOptionDockWidgetV2',
'QStyleOptionFocusRect', 'QStyleOptionFrame', 'QStyleOptionFrameV2',
'QStyleOptionFrameV3', 'QStyleOptionButton', 'QStyleOptionComboBox',
'QStyleOptionHeader', 'QStyleOptionHeaderV2', 'QStyleOptionComplex',
'QStyleOptionTab', 'QStyleOptionTabV2', 'QStyleOptionTabV3',
'QStyleOptionTabBarBase', 'QStyleOptionTabBarBaseV2',
'QStyleOptionRubberBand', 'QStyleOptionGraphicsItem',
'QStyleOptionTitleBar', 'QStyleOptionToolBox', 'QStyleOptionToolBoxV2',
'QStyleOptionProgressBar', 'QStyleOptionProgressBarV2',
'QStyleOptionMenuItem', 'QStyleOptionSizeMode', 'QStyleOptionVersion',
}
def find_cpp_files_with_logger_member():
"""Find all Qt6 .cpp files that have m_logger member in corresponding header"""
cpp_files = []
for cpp_file in QT6_BASE.rglob("*.cpp"):
# Find corresponding header
header = cpp_file.with_suffix('.h')
if not header.exists():
header = cpp_file.with_suffix('.hpp')
if header.exists():
try:
header_content = header.read_text(encoding='utf-8', errors='ignore')
if 'm_logger' in header_content:
cpp_files.append(cpp_file)
except:
pass
print(f"Found {len(cpp_files)} .cpp files with m_logger in header")
return cpp_files
def add_logger_init_to_constructor(content, class_name):
"""Add logger initialization to constructor"""
# Pattern to match constructor initialization list
# Matches: ClassName::ClassName(...) : existing_init1(val1), existing_init2(val2)
# Also matches: ClassName::ClassName(...) {
# And: ClassName::ClassName(...)
# First check if already has logger init
if 'm_logger(' in content or 'm_logger(NGL' in content:
return content, False, "Already initialized"
# Pattern for constructor with initialization list
# Group 1: constructor signature up to :
# Group 2: existing initializers
# Group 3: opening brace or colon continuing init list
# Try to find constructor with init list
pattern_with_init = rf'({re.escape(class_name)}::\s*{re.escape(class_name)}\s*\([^)]*\))\s*:\s*([^{{]+?)\s*({{)'
match = re.search(pattern_with_init, content, re.MULTILINE | re.DOTALL)
if match:
# Add m_logger to existing init list
before = match.group(1)
inits = match.group(2).rstrip()
brace = match.group(3)
# Add m_logger initialization (comma if needed)
new_init = f"{before} : {inits},\n m_logger(NGL::NGLLoggerBootstrap::getLogger()) {brace}"
new_content = content[:match.start()] + new_init + content[match.end():]
return new_content, True, "Added to init list"
# Try constructor without init list (direct brace)
pattern_direct_brace = rf'({re.escape(class_name)}::\s*{re.escape(class_name)}\s*\([^)]*\))\s*({{)'
match = re.search(pattern_direct_brace, content, re.MULTILINE)
if match:
sig = match.group(1)
brace = match.group(2)
new_constructor = f"{sig} : m_logger(NGL::NGLLoggerBootstrap::getLogger()) {brace}"
new_content = content[:match.start()] + new_constructor + content[match.end():]
return new_content, True, "Added init list"
# Try constructor that continues on next line
pattern_multiline = rf'({re.escape(class_name)}::\s*{re.escape(class_name)}\s*\([^)]*\))\s*\n\s*:\s*([^{{]+?)\s*({{)'
match = re.search(pattern_multiline, content, re.MULTILINE)
if match:
before = match.group(1)
inits = match.group(2).rstrip()
brace = match.group(3)
new_init = f"{before}\n : {inits},\n m_logger(NGL::NGLLoggerBootstrap::getLogger()) {brace}"
new_content = content[:match.start()] + new_init + content[match.end():]
return new_content, True, "Added to multiline init"
return content, False, "No constructor found"
def extract_class_name_from_header(header_path):
"""Extract class name from header file"""
try:
content = header_path.read_text(encoding='utf-8', errors='ignore')
# Find first class definition (not forward declaration)
pattern = r'^class\s+(\w+)\s*(?::\s*public\s+\w+)?\s*\{'
match = re.search(pattern, content, re.MULTILINE)
if match:
return match.group(1)
except:
pass
return None
def main():
print("=" * 80)
print("Adding logger initialization to constructors")
print("=" * 80)
# Find cpp files with m_logger in header
cpp_files = find_cpp_files_with_logger_member()
# Track results
added = 0
skipped = 0
skip_reasons = {}
examples = []
for cpp_file in cpp_files:
try:
content = cpp_file.read_text(encoding='utf-8')
# Get class name from header
header = cpp_file.with_suffix('.h')
if not header.exists():
header = cpp_file.with_suffix('.hpp')
class_name = None
if header.exists():
class_name = extract_class_name_from_header(header)
if not class_name:
# Try to guess from filename
class_name = cpp_file.stem
# Try to add logger init
new_content, success, message = add_logger_init_to_constructor(content, class_name)
if success:
cpp_file.write_text(new_content, encoding='utf-8')
added += 1
if added <= 10:
print(f"ADDED: {cpp_file.relative_to(QT6_BASE)} - {message}")
else:
skipped += 1
reason = message
skip_reasons[reason] = skip_reasons.get(reason, 0) + 1
if len(examples) < 5:
examples.append(f"{cpp_file.relative_to(QT6_BASE)} ({class_name})")
except Exception as e:
skipped += 1
reason = f"Error: {str(e)}"
skip_reasons[reason] = skip_reasons.get(reason, 0) + 1
print("\n" + "=" * 80)
print(f"Results: {added} files updated, {skipped} skipped")
print("\nSkip reasons:")
for reason, count in sorted(skip_reasons.items(), key=lambda x: -x[1])[:10]:
print(f" {reason}: {count}")
if examples:
print("\nSkipped examples (first 5):")
for example in examples:
print(f" - {example}")
print("=" * 80)
if __name__ == "__main__":
main()
+147
View File
@@ -0,0 +1,147 @@
#!/usr/bin/env python3
"""
Add m_logger member variables to Qt6 class definitions.
Matches Qt5 and Qt6 headers by file path, then checks for m_logger.
"""
import os
import re
import sys
from pathlib import Path
# Paths
SCRIPT_DIR = Path(__file__).parent
QT5_BASE = SCRIPT_DIR / "qt5-before/qt5-legatus-legacy"
QT6_BASE = SCRIPT_DIR / "qt6-after/qt6-migrated-legatus"
def find_qt5_headers_with_logger():
"""Find all Qt5 headers with m_logger members"""
qt5_headers = []
for header in QT5_BASE.rglob("*.h"):
try:
content = header.read_text(encoding='utf-8', errors='ignore')
if 'm_logger' in content:
rel_path = header.relative_to(QT5_BASE)
qt5_headers.append(rel_path)
except Exception as e:
pass
print(f"Found {len(qt5_headers)} Qt5 headers with m_logger")
return qt5_headers
def find_qt6_header(rel_path):
"""Find corresponding Qt6 header by relative path"""
qt6_header = QT6_BASE / rel_path
if qt6_header.exists():
return qt6_header
# Try .hpp extension
qt6_header_hpp = QT6_BASE / rel_path.with_suffix('.hpp')
if qt6_header_hpp.exists():
return qt6_header_hpp
# Try lowercase path
qt6_header_lower = QT6_BASE / str(rel_path).lower()
if qt6_header_lower.exists():
return qt6_header_lower
# Try snake_case conversion for filename
filename = rel_path.name
snake_name = ''.join(['_' + c.lower() if c.isupper() else c for c in filename.split('.')[0]]).lstrip('_')
snake_path = rel_path.parent / f"{snake_name}{rel_path.suffix}"
qt6_header_snake = QT6_BASE / snake_path
if qt6_header_snake.exists():
return qt6_header_snake
return None
def add_logger_to_header(header_path):
"""Add m_logger member to class definition"""
try:
content = header_path.read_text(encoding='utf-8')
# Check if already has m_logger
if 'm_logger' in content:
return False, "Already has m_logger"
# Find private: or protected: section (handle comments after colon)
pattern = r'^(\s*)(private|protected):\s*(?:\/\/.*)?\s*\n'
match = re.search(pattern, content, re.MULTILINE)
if not match:
# Try finding end of class with just closing brace
lines = content.split('\n')
for i in range(len(lines) - 1, 0, -1):
if re.match(r'^\s*};\s*$', lines[i]):
indent = re.match(r'^(\s*)', lines[i]).group(1)
lines.insert(i, f"{indent}NGL::INGLLogger &m_logger;")
new_content = '\n'.join(lines)
header_path.write_text(new_content, encoding='utf-8')
return True, "Added (fallback)"
return False, "No private/protected section found"
# Insert m_logger after the access specifier line
indent = match.group(1)
insert_pos = match.end()
new_content = content[:insert_pos] + indent + "NGL::INGLLogger &m_logger;\n" + content[insert_pos:]
header_path.write_text(new_content, encoding='utf-8')
return True, "Added"
except Exception as e:
return False, f"Error: {str(e)}"
def main():
print("=" * 80)
print("Adding m_logger members to Qt6 headers")
print("=" * 80)
# Find Qt5 headers with m_logger
qt5_headers = find_qt5_headers_with_logger()
# Track results
added = 0
skipped = 0
skip_reasons = {}
not_found_examples = []
for rel_path in qt5_headers:
# Find corresponding Qt6 header
qt6_header = find_qt6_header(rel_path)
if not qt6_header:
skipped += 1
reason = "Header not found"
skip_reasons[reason] = skip_reasons.get(reason, 0) + 1
if len(not_found_examples) < 10:
not_found_examples.append(str(rel_path))
continue
# Try to add logger
success, message = add_logger_to_header(qt6_header)
if success:
added += 1
if added <= 10:
print(f"ADDED: {rel_path} -> {message}")
else:
skipped += 1
reason = message if not message.startswith("Already") else "Already has m_logger"
skip_reasons[reason] = skip_reasons.get(reason, 0) + 1
print("\n" + "=" * 80)
print(f"Results: {added} headers updated, {skipped} skipped")
print("\nSkip reasons:")
for reason, count in sorted(skip_reasons.items(), key=lambda x: -x[1]):
print(f" {reason}: {count}")
if not_found_examples:
print("\nHeader not found examples (first 10):")
for example in not_found_examples:
print(f" - {example}")
print("=" * 80)
if __name__ == "__main__":
main()
+72
View File
@@ -0,0 +1,72 @@
#!/usr/bin/env python3
"""
Fix logging macro calls in Qt6 migrated code.
Adds m_logger parameter to DEBUG_LOG(), WARNING_LOG(), ERROR_LOG(), FATAL_LOG(), INFO_LOG(), TRACE_LOG()
"""
import re
import os
import sys
# Logging macros that need logger parameter
LOGGING_MACROS = [
'DEBUG_LOG',
'WARNING_LOG',
'ERROR_LOG',
'FATAL_LOG',
'INFO_LOG',
'TRACE_LOG'
]
def fix_logging_in_file(filepath):
"""Fix logging macro calls in a single file."""
with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
content = f.read()
original = content
fixes = 0
for macro in LOGGING_MACROS:
# Match macro calls without parameter: MACRO()
# But not already with parameter: MACRO(m_logger) or MACRO(logger)
pattern = rf'\b{macro}\s*\(\s*\)'
replacement = f'{macro}(m_logger)'
matches = re.findall(pattern, content)
if matches:
content = re.sub(pattern, replacement, content)
fixes += len(matches)
if fixes > 0:
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
return fixes
def main():
if len(sys.argv) < 2:
print("Usage: fix_logging_macros.py <directory>")
sys.exit(1)
base_dir = sys.argv[1]
total_fixes = 0
files_fixed = 0
for root, dirs, files in os.walk(base_dir):
# Skip build directories and Qt5 sources
if 'build' in root or 'qt5-before' in root:
continue
for file in files:
if file.endswith(('.cpp', '.h', '.hpp', '.cc', '.cxx')):
filepath = os.path.join(root, file)
fixes = fix_logging_in_file(filepath)
if fixes > 0:
files_fixed += 1
total_fixes += fixes
print(f"Fixed {fixes} logging calls in {filepath}")
print(f"\nTotal: {total_fixes} logging macro calls fixed in {files_fixed} files")
if __name__ == '__main__':
main()
@@ -11,12 +11,11 @@
#include <grantlee/engine.h>
using namespace CodeGen;
GeneratorGrantleeBase::GeneratorGrantleeBase(const char *loggerName)
: m_engine(new Grantlee::Engine)
GeneratorGrantleeBase::GeneratorGrantleeBase(const char *loggerName) : m_engine(new Grantlee::Engine)
, m_ctx(new Grantlee::Context)
, m_structBuilder(nullptr)
.getNGLLogger(loggerName))
{
.getNGLLogger(loggerName)),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
}
GeneratorGrantleeBase::~GeneratorGrantleeBase()
@@ -48,7 +47,7 @@ bool GeneratorGrantleeBase::setTemplate(const QString &templateName, const QStri
m_template = m_engine->newTemplate(tmpl, QStringLiteral("myTemplate"));
if (m_template->error())
{
WARNING_LOG() << "Error parsing template '" << templateName
WARNING_LOG(m_logger) << "Error parsing template '" << templateName
<< "': " << m_template->errorString();
return false;
}
@@ -88,7 +87,7 @@ bool GeneratorGrantleeBase::generateData(const QString &templateName,
QFile f(outDirectory + QLatin1Char('/') + outFilename);
if (!f.open(QIODevice::WriteOnly))
{
ERROR_LOG() << "Error opening file '" << f.fileName() << "' for writing: "
ERROR_LOG(m_logger) << "Error opening file '" << f.fileName() << "' for writing: "
<< f.errorString() << "(" << f.error() << ")";
return false;
}
@@ -96,7 +95,7 @@ bool GeneratorGrantleeBase::generateData(const QString &templateName,
f.write(outData);
f.close();
DEBUG_LOG() << "Written data to " << f.fileName();
DEBUG_LOG(m_logger) << "Written data to " << f.fileName();
return true;
}
@@ -105,7 +104,7 @@ bool GeneratorGrantleeBase::readFile(const QString &filename, QString &data) con
QFile f(filename);
if (!f.open(QIODevice::ReadOnly))
{
ERROR_LOG() << "Error opening file " << filename
ERROR_LOG(m_logger) << "Error opening file " << filename
<< " - error: " << f.errorString();
return false;
}
@@ -121,7 +120,7 @@ bool GeneratorGrantleeBase::getFilenameFromData(const QString &dataToParse, QStr
int idx = dataToParse.indexOf(filenameMarker);
if (idx < 0)
{
ERROR_LOG() << "Could not find marker '" << filenameMarker
ERROR_LOG(m_logger) << "Could not find marker '" << filenameMarker
<< "' in data!";
return false;
}
@@ -129,7 +128,7 @@ bool GeneratorGrantleeBase::getFilenameFromData(const QString &dataToParse, QStr
int endIdx = dataToParse.indexOf(QLatin1Char('\n'), idx);
if (endIdx < 0)
{
ERROR_LOG() << "Could not find end marker '\\n' in data!";
ERROR_LOG(m_logger) << "Could not find end marker '\\n' in data!";
return false;
}
filename = dataToParse.mid(idx, endIdx - idx).trimmed();
@@ -160,12 +159,12 @@ void GeneratorGrantleeBase::addCustomFunctions(const QVector<CustomServiceFuncti
break;
case CustomServiceFunctionInformation::Type::DbNotify:
WARNING_LOG() << "Internal error - Trying to handle DbNotify in addCustomFunctions(): "
WARNING_LOG(m_logger) << "Internal error - Trying to handle DbNotify in addCustomFunctions(): "
<< csfi.methodName;
delete customFunctionWrapper;
break;
}
DEBUG_LOG() << "Added custom db function " << csfi.methodName;
DEBUG_LOG(m_logger) << "Added custom db function " << csfi.methodName;
}
m_ctx->insert(QStringLiteral("custom_dtc_procs"), vlCustomDtcFunctions);
m_ctx->insert(QStringLiteral("custom_db_procs"), vlCustomDbFunctions);
@@ -185,17 +184,17 @@ void GeneratorGrantleeBase::exportUsedServices(const XmlReader *reader)
const int idx = fullPath.lastIndexOf(QLatin1Char('.'));
if (idx < 0)
{
ERROR_LOG() << "Could not parse file path: " << fullPath;
ERROR_LOG(m_logger) << "Could not parse file path: " << fullPath;
continue;
}
const QString idlFile = fullPath.left(idx);
if (idlFile.isEmpty())
{
WARNING_LOG() << "Could not find idl file for service " << svc;
WARNING_LOG(m_logger) << "Could not find idl file for service " << svc;
continue;
}
idlServicesWrapper->addService(svc, idlFile);
DEBUG_LOG() << "Added service " << svc;
DEBUG_LOG(m_logger) << "Added service " << svc;
}
m_ctx->insert(QStringLiteral("ext_services"), idlServicesWrapper);
}
@@ -35,6 +35,7 @@ public:
const QString &outDirectory);
protected:
NGL::INGLLogger &m_logger;
explicit GeneratorGrantleeBase(const char *loggerName);
bool initInternal(const XmlReader *reader, StructBuilder *structBuilder);
@@ -43,6 +44,7 @@ protected:
void addCustomFunctions(const QVector<CustomServiceFunctionInformation> &customFunctions);
void exportUsedServices(const XmlReader *reader);
protected:
NGL::INGLLogger &m_logger;
Grantlee::Engine *m_engine;
Grantlee::Context *m_ctx;
Grantlee::Template m_template;
@@ -19,13 +19,12 @@ static QString getExerciseSchemaName(int exerciseId)
return QStringLiteral("ex_") + QString::number(exerciseId);
}
SqlGenerator::SqlGenerator(XmlReader *xmlReader, StructBuilder *structBuilder)
: m_xmlReader(xmlReader)
SqlGenerator::SqlGenerator(XmlReader *xmlReader, StructBuilder *structBuilder) : m_xmlReader(xmlReader)
, m_structBuilder(structBuilder)
, m_createdByXmlFile(false)
, m_isValid(true)
, m_exerciseId(0)
{}
, m_exerciseId(0),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
SqlGenerator::SqlGenerator(const QString &xmlFile)
: m_xmlReader(new XmlReader)
@@ -49,7 +48,7 @@ SqlGenerator::~SqlGenerator()
bool SqlGenerator::generateData(int exerciseId)
{
DEBUG_LOG() << "Generating SQL data for service " << getServiceAbbr() << " in exercise " << exerciseId << ", this: " << this;
DEBUG_LOG(m_logger) << "Generating SQL data for service " << getServiceAbbr() << " in exercise " << exerciseId << ", this: " << this;
m_exerciseId = exerciseId;
m_sqlGlobal = SqlStatements();
@@ -134,11 +133,11 @@ bool SqlGenerator::handleViews()
bool SqlGenerator::handleView(const ViewInformation &vi)
{
DEBUG_LOG() << "Handle view " << vi.name;
DEBUG_LOG(m_logger) << "Handle view " << vi.name;
const QString parent = vi.baseTable;
DEBUG_LOG() << "Parent = " << parent;
DEBUG_LOG(m_logger) << "Parent = " << parent;
if (!parent.isEmpty())
{
@@ -146,7 +145,7 @@ bool SqlGenerator::handleView(const ViewInformation &vi)
const QString createViewStmt(QStringLiteral("CREATE OR REPLACE VIEW %1 AS SELECT %2\nFROM %3\nWHERE %4;\n"));
const QString dropViewStmt(QStringLiteral("DROP VIEW IF EXISTS %1;"));
DEBUG_LOG() << "csi.primaryTable = " << csi.primaryTable.data()->name;
DEBUG_LOG(m_logger) << "csi.primaryTable = " << csi.primaryTable.data()->name;
if (!csi.primaryTable.isNull())
{
@@ -166,7 +165,7 @@ bool SqlGenerator::handleView(const ViewInformation &vi)
fqColumnNames += mi.db.table + QLatin1Char('.') + mi.db.columnName + QLatin1String(" AS ") + mi.db.getColumnNameView();
}
DEBUG_LOG() << "fqColumnNames = " << fqColumnNames.join(QStringLiteral(", "));
DEBUG_LOG(m_logger) << "fqColumnNames = " << fqColumnNames.join(QStringLiteral(", "));
if (!whereConditions.isEmpty())
@@ -185,11 +184,11 @@ bool SqlGenerator::handleView(const ViewInformation &vi)
bool SqlGenerator::handleTable(const CompleteTableInformation &cti)
{
DEBUG_LOG() << "Handle table " << cti.name;
DEBUG_LOG(m_logger) << "Handle table " << cti.name;
if (cti.columns.isEmpty())
{
WARNING_LOG() << "Table " << cti.name
WARNING_LOG(m_logger) << "Table " << cti.name
<< " has no DatabaseServiceStruct - not generating anything for this!";
return true;
}
@@ -532,11 +531,11 @@ bool SqlGenerator::handleEnumeration(const EnumInformation &ei)
QStringList SqlGenerator::handleEnumeration(const EnumInformation &ei, const QString &dbSchema) const
{
DEBUG_LOG() << "Handle enumeration " << ei.enumName;
DEBUG_LOG(m_logger) << "Handle enumeration " << ei.enumName;
if (ei.tableName.isEmpty())
{
INFO_LOG() << "No table for enumeration " << ei.enumName << " - not creating inserts for this enum";
INFO_LOG(m_logger) << "No table for enumeration " << ei.enumName << " - not creating inserts for this enum";
return QStringList();
}
@@ -565,7 +564,7 @@ bool SqlGenerator::generateDbNotifications(const QString &tableName,
if (notification.paramNames.isEmpty() ||
notification.paramNames.size() > 1)
{
ERROR_LOG() << "Can not handle more than one parameter";
ERROR_LOG(m_logger) << "Can not handle more than one parameter";
continue;
}
generateDbNotification(notification, ed);
@@ -705,7 +704,7 @@ QStringList SqlGenerator::getDbSettings(const QString &dbSchema) const
QStringList SqlGenerator::getAllSqlStmts(const QString &dbSchema, ExerciseDependency ed) const
{
DEBUG_LOG() << "Creating statements for service " << getServiceAbbr() << " in exercise " << m_exerciseId << ", this: " << this;
DEBUG_LOG(m_logger) << "Creating statements for service " << getServiceAbbr() << " in exercise " << m_exerciseId << ", this: " << this;
QStringList data;
@@ -796,7 +795,7 @@ bool SqlGenerator::writeSql(const QString &filePath, ExerciseDependency ed)
const SqlStatements &sql = getStatements(ed);
if (sql.isEmpty())
{
DEBUG_LOG() << "Sql file is emtpy: " << sqlFile;
DEBUG_LOG(m_logger) << "Sql file is emtpy: " << sqlFile;
return writeFile(sqlFile, QString());
}
@@ -806,7 +805,7 @@ bool SqlGenerator::writeSql(const QString &filePath, ExerciseDependency ed)
getExerciseSchemaName(m_exerciseId) :
getServiceAbbr());
INFO_LOG() << "Creating sql-stmt for schema (" << dbSchema << ")";
INFO_LOG(m_logger) << "Creating sql-stmt for schema (" << dbSchema << ")";
return writeSqlToFile(dbSchema, sqlFile, ed);
}
@@ -929,7 +928,7 @@ bool SqlGenerator::writeFile(const QString &fn, const QString &content) const
QFile f(fn);
if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate))
{
ERROR_LOG() << "Error opening file '" << f.fileName() << "' for writing: "
ERROR_LOG(m_logger) << "Error opening file '" << f.fileName() << "' for writing: "
<< f.errorString();
return false;
}
@@ -106,6 +106,7 @@ public:
protected:
NGL::INGLLogger &m_logger;
private:
bool handleTables();
bool handleViews();
@@ -200,6 +200,8 @@ StructBuilder::StructBuilder(XmlReader *xmlReader)
: m_needPoint3d(false)
, m_needPgArrayInclude(false)
, m_xmlReader(xmlReader)
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("CodeGen.StructBuilder"))
, m_loggerCSV(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("fileCSV"))
{}
bool StructBuilder::buildStructures()
@@ -266,7 +268,7 @@ bool StructBuilder::buildStructures()
const ServiceTypeStruct sts = extractServiceAndTypeFromTypename(tti.name);
if (!sts.isExternalType())
{
ERROR_LOG() << "Invalid external topic type name: '" << tti.name << "'";
ERROR_LOG(m_logger) << "Invalid external topic type name: '" << tti.name << "'";
return false;
}
if (!handleIdlStructInfo(tti, m_externalTopicTypes, sts.service))
@@ -287,7 +289,7 @@ bool StructBuilder::handleEnum(const EnumInformation &ei)
QSharedPointer<TableInformation> ti = m_xmlReader->getTable(ei.tableName);
if (ti.isNull())
{
WARNING_LOG() << "Could not find table information for enum: "
WARNING_LOG(m_logger) << "Could not find table information for enum: "
<< ei.enumName << ", table: " << ei.tableName;
return false;
}
@@ -323,12 +325,12 @@ EnumInformation StructBuilder::enumInformationByType(const QString &type, bool c
{
if (!checkExternals)
{
ERROR_LOG() << "Could not find enumeration '" << type << "'";
ERROR_LOG(m_logger) << "Could not find enumeration '" << type << "'";
return EnumInformation();
}
if (extInfo.type.isEmpty())
{
WARNING_LOG() << "Could not parse external enumeration '" << type << "'";
WARNING_LOG(m_logger) << "Could not parse external enumeration '" << type << "'";
return EnumInformation();
}
return m_xmlReader->getExternalEnumeration(extInfo.service, extInfo.type, verbose);
@@ -340,13 +342,13 @@ EnumInformation StructBuilder::enumInformationByType(const QString &type, bool c
return ei;
}
if (verbose)
ERROR_LOG() << "Could not find enumeration '" << type << "'";
ERROR_LOG(m_logger) << "Could not find enumeration '" << type << "'";
return EnumInformation();
}
CompleteTopicTypeInformation StructBuilder::topicTypeInformationByStructType(const QString &type, bool checkExternals)
{
DEBUG_LOG() << "topicTypeInformationByStructType(" << type << ")";
DEBUG_LOG(m_logger) << "topicTypeInformationByStructType(" << type << ")";
if (type.isEmpty())
return CompleteTopicTypeInformation();
@@ -364,26 +366,26 @@ CompleteTopicTypeInformation StructBuilder::topicTypeInformationByStructType(con
return csi;
}
DEBUG_LOG() << "Type '" << type << "' not found in idlStructs - maybe not yet exported or an enum";
DEBUG_LOG(m_logger) << "Type '" << type << "' not found in idlStructs - maybe not yet exported or an enum";
const QVector<TopicTypeInformation> idlStructsToGenerate = m_xmlReader->getIdlStructToGenerate();
for (const TopicTypeInformation &tti : idlStructsToGenerate)
{
if (tti.name == type)
{
DEBUG_LOG() << "Found not yet exported type " << type;
DEBUG_LOG(m_logger) << "Found not yet exported type " << type;
if (!handleIdlStructInfo(tti, m_topicTypeInfos))
return CompleteTopicTypeInformation();
return topicTypeInformationByStructType(type);
}
}
ERROR_LOG() << "Could not find type '" << type << "' in idlStructs";
ERROR_LOG(m_logger) << "Could not find type '" << type << "' in idlStructs";
return CompleteTopicTypeInformation();
}
CompleteTopicTypeInformation StructBuilder::externalTopicTypeByStructType(const ServiceTypeStruct &sts)
{
const QString typeToSearch = sts.fqType();
DEBUG_LOG() << "externalTopicTypeByStructType " << typeToSearch;
DEBUG_LOG(m_logger) << "externalTopicTypeByStructType " << typeToSearch;
for (const CompleteTopicTypeInformation &ctti : std::as_const(m_externalTopicTypes))
{
if (ctti.name == typeToSearch)
@@ -396,13 +398,13 @@ CompleteTopicTypeInformation StructBuilder::externalTopicTypeByStructType(const
bool StructBuilder::loadExternalTopicType(const ServiceTypeStruct &sts)
{
DEBUG_LOG() << "loadExternalTopicType(" << sts.fqType() << ")";
DEBUG_LOG(m_logger) << "loadExternalTopicType(" << sts.fqType() << ")";
const TopicTypeInformation tti = m_xmlReader->loadExternalTopicType(sts.service, sts.type);
if (!tti.isValid())
{
DEBUG_LOG() << "Could not find external topic '" << sts.fqType() << "'";
DEBUG_LOG(m_logger) << "Could not find external topic '" << sts.fqType() << "'";
return false;
}
@@ -473,11 +475,11 @@ bool StructBuilder::handleTable(const ServiceStructInformation &ssi)
QVector<QString> tableNames;
if (!getColumnsFromTable(ssi.primaryTable, columns, tableNames))
{
WARNING_LOG() << "Could not retrieve columns from table "
WARNING_LOG(m_logger) << "Could not retrieve columns from table "
<< ssi.primaryTable;
return false;
}
DEBUG_LOG() << "Got " << columns.size() << " columns for table "
DEBUG_LOG(m_logger) << "Got " << columns.size() << " columns for table "
<< ssi.primaryTable;
QSet<QString> sqlTables;
@@ -487,12 +489,12 @@ bool StructBuilder::handleTable(const ServiceStructInformation &ssi)
MemberInformation miPkFirstTable, miPkLastTable;
for (const ColumnInformationEx &ci : std::as_const(columns))
{
DEBUG_LOG() << "handling column " << ci.columnName;
DEBUG_LOG(m_logger) << "handling column " << ci.columnName;
const QSharedPointer<TableInformation> ti = ci.table;
if (ti.isNull())
{
WARNING_LOG() << "Could not find table for column " << ci.columnName
WARNING_LOG(m_logger) << "Could not find table for column " << ci.columnName
<< " primary table is " << ssi.primaryTable.data();
return false;
}
@@ -560,14 +562,14 @@ bool StructBuilder::handleTable(const ServiceStructInformation &ssi)
camelCaseString(fki->destination.tableName, true);
EnumInformation ei = enumInformationByType(enumType, true, false);
DEBUG_LOG() << "Checking if " << enumType << " is an enum: " << ei.isValid();
DEBUG_LOG(m_logger) << "Checking if " << enumType << " is an enum: " << ei.isValid();
if (!ei.isValid() && fki->destination.tableName.contains(QLatin1Char('_')))
{
enumType = fki->destination.service + QStringLiteral("::") +
camelCaseString(fki->destination.tableName.section(QLatin1Char('_'), 1), true);
ei = enumInformationByType(enumType, true, false);
DEBUG_LOG() << "Checking if " << enumType << " is an enum: " << ei.isValid();
DEBUG_LOG(m_logger) << "Checking if " << enumType << " is an enum: " << ei.isValid();
}
if (ei.isValid() &&
ei.tableName == fki->destination.tableName)
@@ -676,8 +678,8 @@ bool StructBuilder::handleIdlStructInfo(const TopicTypeInformation &tti,
if (idlData.isKey && idlData.isOptional)
{
ERROR_LOG() << "Column option isKey & isOptional are mutually exclusive!";
ERROR_LOG() << "Change column '" << tti.name << "."
ERROR_LOG(m_logger) << "Column option isKey & isOptional are mutually exclusive!";
ERROR_LOG(m_logger) << "Change column '" << tti.name << "."
<< idlData.name << "'' to have either key or optional parameter ";
return false;
}
@@ -1045,7 +1047,7 @@ bool StructBuilder::fixupQVariantConversions(MemberInformation &mi) const
}
else
{
ERROR_LOG() << "Unknown cpp datatype: " << mi.cpp.type;
ERROR_LOG(m_logger) << "Unknown cpp datatype: " << mi.cpp.type;
return false;
}
return true;
@@ -1080,7 +1082,7 @@ QVector<MemberInformation> StructBuilder::buildDbTableInformationFromIdlData(con
const CompleteTopicTypeInformation cttiChild = topicTypeInformationByStructType(member.type);
if (!cttiChild.isValid())
{
ERROR_LOG() << "Can not find structure '" << member.type << "'";
ERROR_LOG(m_logger) << "Can not find structure '" << member.type << "'";
continue;
}
QString pre;
@@ -1100,7 +1102,7 @@ QVector<MemberInformation> StructBuilder::buildDbTableInformationFromIdlData(con
const CompleteTopicTypeInformation &cttiChild = topicTypeInformationByStructType(member.dataTypeInfo->innerDataType()->idlType());
if (!cttiChild.isValid())
{
ERROR_LOG() << "Can not find structure '" << member.type << "'";
ERROR_LOG(m_logger) << "Can not find structure '" << member.type << "'";
continue;
}
buildDbTableInformationFromIdlData(cttiChild,
@@ -1194,7 +1196,7 @@ bool StructBuilder::buildJSonStructureInformationFromIdlData(const CompleteTopic
const CompleteTopicTypeInformation cttiChild = topicTypeInformationByStructType(member.type);
if (!cttiChild.isValid())
{
ERROR_LOG() << "Can not find structure '" << member.type << "'";
ERROR_LOG(m_logger) << "Can not find structure '" << member.type << "'";
continue;
}
if (!buildJSonStructureInformationFromIdlData(cttiChild))
@@ -1221,7 +1223,7 @@ bool StructBuilder::buildJSonStructureInformationFromIdlData(const CompleteTopic
return false;
}
else
WARNING_LOG() << "Can not find structure '" << member.type << "'";
WARNING_LOG(m_logger) << "Can not find structure '" << member.type << "'";
}
@@ -1316,11 +1318,11 @@ QMap<QString, CompleteTableInformation> StructBuilder::getRecordingTopicTables()
continue;
if (!ctti.isDataObject)
{
WARNING_LOG() << "Trying to record topic '" << ctti.name
WARNING_LOG(m_logger) << "Trying to record topic '" << ctti.name
<< "' which is not directly published - ignoring!";
continue;
}
DEBUG_LOG() << "Rec table: " << ctti.name;
DEBUG_LOG(m_logger) << "Rec table: " << ctti.name;
miPrimaryKey.db.table = ctti.name;
ret.insert(ctti.name, getRecordingTopicTable(ctti, miPrimaryKey));
}
@@ -1402,7 +1404,7 @@ StructBuilder::ServiceTypeStruct StructBuilder::extractServiceAndTypeFromTypenam
extTypeRef = sl.at(1);
}
else
WARNING_LOG() << "Error parsing type: " << type;
WARNING_LOG(m_logger) << "Error parsing type: " << type;
StructBuilder::ServiceTypeStruct ret;
if (!extServiceRef.isEmpty())
{
@@ -335,5 +335,7 @@ private:
bool m_needPgArrayInclude;
XmlReader *m_xmlReader;
NGL::INGLLogger &m_logger;
NGL::INGLLogger &m_loggerCSV;
};
}
@@ -31,8 +31,7 @@ private:
const QByteArray m_msg;
};
XmlReader::XmlReader()
{}
XmlReader::XmlReader() : m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
bool XmlReader::readServiceFile(const QString &svcFile,
const QString &idlServiceInfoFile,
@@ -79,18 +78,18 @@ bool XmlReader::readServiceFile(const QString &svcFile,
QFile f(svcFile);
if (!f.exists())
{
ERROR_LOG() << "Service file '" << svcFile << "' not found!";
ERROR_LOG(m_logger) << "Service file '" << svcFile << "' not found!";
return false;
}
if (!f.open(QIODevice::ReadOnly))
{
m_errorString = QLatin1String("Can not open service file '") + svcFile +
QLatin1String("' for reading: ") + f.errorString();
ERROR_LOG() << m_errorString;
ERROR_LOG(m_logger) << m_errorString;
return false;
}
INFO_LOG() << "SvcFile: " << svcFile;
INFO_LOG(m_logger) << "SvcFile: " << svcFile;
QString errMsg;
@@ -102,7 +101,7 @@ bool XmlReader::readServiceFile(const QString &svcFile,
m_errorString = QLatin1String("Error parsing service file '") + svcFile + QLatin1String("': ") +
errMsg + QLatin1String(" at ") + QString::number(errLine) +
QLatin1Char(':') + QString::number(errColumn);
ERROR_LOG() << m_errorString;
ERROR_LOG(m_logger) << m_errorString;
return false;
}
@@ -118,7 +117,7 @@ bool XmlReader::readServiceFile(const QString &svcFile,
{
m_errorString = QLatin1String("Xml file '") + svcFile +
QLatin1String("' is not a valid service file: service name/namespace is missing");
ERROR_LOG() << m_errorString;
ERROR_LOG(m_logger) << m_errorString;
return false;
}
m_svcNamespace = getAttribute(domRoot, QStringLiteral("namespace"));
@@ -129,13 +128,13 @@ bool XmlReader::readServiceFile(const QString &svcFile,
QString devModeStr = getAttribute(domRoot, QStringLiteral("devMode"), true);
m_svcDevMode = devModeStr == QStringLiteral("1") ||
devModeStr == QStringLiteral("true");
INFO_LOG() << "devMode: " << m_svcDevMode;
INFO_LOG(m_logger) << "devMode: " << m_svcDevMode;
const QString groupNamesString = getAttribute(domRoot, QStringLiteral("groups"), true);
if (!groupNamesString.isEmpty())
{
m_groupNames = groupNamesString.split(QLatin1Char(','), Qt::SkipEmptyParts);
INFO_LOG() << "groups: " << groupNamesString;
INFO_LOG(m_logger) << "groups: " << groupNamesString;
}
else
m_groupNames.clear();
@@ -150,12 +149,12 @@ bool XmlReader::readServiceFile(const QString &svcFile,
if (m_exerciseDependency != ExerciseDependency::Global &&
m_exerciseDependency != ExerciseDependency::GlobalAndExercise)
{
WARNING_LOG() << "Service " << getServiceNamespace()
WARNING_LOG(m_logger) << "Service " << getServiceNamespace()
<< " is not marked as exercise independent but should be started in group Core/Master";
}
}
INFO_LOG() << "exerciseDependency: " << (int)m_exerciseDependency;
INFO_LOG(m_logger) << "exerciseDependency: " << (int)m_exerciseDependency;
if ( domRoot.hasAttribute(QStringLiteral("prio")))
{
m_prio = getAttribute(domRoot, QStringLiteral("prio"), 0).toInt();
@@ -167,7 +166,7 @@ bool XmlReader::readServiceFile(const QString &svcFile,
catch (const XmlReaderException &ex)
{
m_errorString = QLatin1String("Error parsing dbServiceStructs: ") + QLatin1String(ex.what());
ERROR_LOG() << m_errorString;
ERROR_LOG(m_logger) << m_errorString;
return false;
}
@@ -178,7 +177,7 @@ bool XmlReader::readServiceFile(const QString &svcFile,
catch (const XmlReaderException &ex)
{
m_errorString = QLatin1String("Error parsing dbtables: ") + QLatin1String(ex.what());
ERROR_LOG() << m_errorString;
ERROR_LOG(m_logger) << m_errorString;
return false;
}
@@ -189,7 +188,7 @@ bool XmlReader::readServiceFile(const QString &svcFile,
catch (const XmlReaderException &ex)
{
m_errorString = QLatin1String("Error parsing dbviews: ") + QLatin1String(ex.what());
ERROR_LOG() << m_errorString;
ERROR_LOG(m_logger) << m_errorString;
return false;
}
@@ -200,7 +199,7 @@ bool XmlReader::readServiceFile(const QString &svcFile,
catch (const XmlReaderException &ex)
{
m_errorString = QLatin1String("Error parsing enumerations: ") + QLatin1String(ex.what());
ERROR_LOG() << m_errorString;
ERROR_LOG(m_logger) << m_errorString;
return false;
}
@@ -211,7 +210,7 @@ bool XmlReader::readServiceFile(const QString &svcFile,
catch (const XmlReaderException &ex)
{
m_errorString = QLatin1String("Error parsing custom dtc functions: ") + QLatin1String(ex.what());
ERROR_LOG() << m_errorString;
ERROR_LOG(m_logger) << m_errorString;
return false;
}
@@ -222,7 +221,7 @@ bool XmlReader::readServiceFile(const QString &svcFile,
catch (const XmlReaderException &ex)
{
m_errorString = QLatin1String("Error parsing idl strucs: ") + QLatin1String(ex.what());
ERROR_LOG() << m_errorString;
ERROR_LOG(m_logger) << m_errorString;
return false;
}
@@ -233,7 +232,7 @@ bool XmlReader::readServiceFile(const QString &svcFile,
catch (const XmlReaderException &ex)
{
m_errorString = QLatin1String("Error parsing function topics: ") + QLatin1String(ex.what());
ERROR_LOG() << m_errorString;
ERROR_LOG(m_logger) << m_errorString;
return false;
}
@@ -331,7 +330,7 @@ void XmlReader::parseDBSserviceStructs(const QDomElement &rootElement)
domDbStruct = domDbStruct.nextSiblingElement(domDbStruct.tagName());
}
INFO_LOG() << "Read " << m_structsToGenerate.size() << " database service struct(s)";
INFO_LOG(m_logger) << "Read " << m_structsToGenerate.size() << " database service struct(s)";
}
void XmlReader::parseDBTables(const QDomElement &rootElement)
@@ -373,7 +372,7 @@ void XmlReader::parseDBTables(const QDomElement &rootElement)
domDbTable = domDbTable.nextSiblingElement(domDbTable.tagName());
}
INFO_LOG() << "Read " << m_tables.size() << " database table(s)";
INFO_LOG(m_logger) << "Read " << m_tables.size() << " database table(s)";
}
void XmlReader::parseDBViews(const QDomElement &rootElement)
@@ -393,7 +392,7 @@ void XmlReader::parseDBViews(const QDomElement &rootElement)
vi->filter = getAttribute(domDbView, QStringLiteral("filter"));
vi->exerciseDependency = string2ExerciseDependency(getAttribute(domDbView, QStringLiteral("exerciseDependency"), true));
DEBUG_LOG() << "Base table = " << vi->baseTable;
DEBUG_LOG(m_logger) << "Base table = " << vi->baseTable;
m_views.insert(vi->name, vi);
@@ -401,7 +400,7 @@ void XmlReader::parseDBViews(const QDomElement &rootElement)
domDbView = domDbView.nextSiblingElement(domDbView.tagName());
}
INFO_LOG() << "Read " << m_views.size() << " database view(s)";
INFO_LOG(m_logger) << "Read " << m_views.size() << " database view(s)";
}
void XmlReader::parseEnumerations(const QDomElement &rootElement)
@@ -432,7 +431,7 @@ void XmlReader::parseEnumerations(const QDomElement &rootElement)
domEnum = domEnum.nextSiblingElement(domEnum.tagName());
}
INFO_LOG() << "Read " << m_enumerations.size() << " enumeration(s)";
INFO_LOG(m_logger) << "Read " << m_enumerations.size() << " enumeration(s)";
}
void XmlReader::parseCustomDtcFunctions(const QDomElement &rootElement)
@@ -452,7 +451,7 @@ void XmlReader::parseCustomDtcFunctions(const QDomElement &rootElement)
}
domElement = domElement.nextSiblingElement(domElement.tagName());
}
INFO_LOG() << "Read " << m_enumerations.size() << " customDtcFunction(s)";
INFO_LOG(m_logger) << "Read " << m_enumerations.size() << " customDtcFunction(s)";
}
@@ -510,7 +509,7 @@ void XmlReader::parseTopicTypes(const QDomElement &rootElement)
}
INFO_LOG() << "Read " << m_idlStructsToGenerate.size() << " idl struct(s)";
INFO_LOG(m_logger) << "Read " << m_idlStructsToGenerate.size() << " idl struct(s)";
}
void XmlReader::parseFunctionTopics(const QDomElement &rootElement)
@@ -566,7 +565,7 @@ ColumnInformation XmlReader::parseTableColumn(const QDomElement &column, const Q
}
if (ci.columnName.toLower() != ci.columnName)
WARNING_LOG() << "Column " << ci.columnName << " in Table "
WARNING_LOG(m_logger) << "Column " << ci.columnName << " in Table "
<< tableName << " has has upper-case chars which is not allowed!";
return ci;
@@ -726,18 +725,18 @@ DbNotifcationInformation XmlReader::parseDbNotification(const QDomElement &custo
TopicTypeInformation XmlReader::loadExternalTopicType(const QString &externalServiceName, const QString &topicTypeName)
{
DEBUG_LOG() << "externalServiceName: " << externalServiceName << ", topicTypeName: " << topicTypeName;
DEBUG_LOG(m_logger) << "externalServiceName: " << externalServiceName << ", topicTypeName: " << topicTypeName;
if (!loadExternalService(externalServiceName))
{
WARNING_LOG() << "Could not find service " << externalServiceName
WARNING_LOG(m_logger) << "Could not find service " << externalServiceName
<< " referenced by external topic " << topicTypeName;
return TopicTypeInformation();
}
auto extXmlReader = m_externalXmlInformations.value(externalServiceName);
if (!extXmlReader)
{
ERROR_LOG() << "Could not find service xml file for service '" << externalServiceName << "'";
ERROR_LOG(m_logger) << "Could not find service xml file for service '" << externalServiceName << "'";
return TopicTypeInformation();
}
@@ -749,7 +748,7 @@ TopicTypeInformation XmlReader::loadExternalTopicType(const QString &externalSer
m_usedServices[externalServiceName] = true;
return tti;
}
WARNING_LOG() << "Could not find topic " << topicTypeName
WARNING_LOG(m_logger) << "Could not find topic " << topicTypeName
<< " in external service definition for service "
<< externalServiceName;
return TopicTypeInformation();
@@ -757,18 +756,18 @@ TopicTypeInformation XmlReader::loadExternalTopicType(const QString &externalSer
EnumInformation XmlReader::getExternalEnumeration(const QString &externalServiceName, const QString &enumName, bool verbose)
{
DEBUG_LOG() << "externalServiceName: " << externalServiceName << ", topicTypeName: " << enumName;
DEBUG_LOG(m_logger) << "externalServiceName: " << externalServiceName << ", topicTypeName: " << enumName;
if (!loadExternalService(externalServiceName))
{
WARNING_LOG() << "Could not find service '" << externalServiceName << "'"
WARNING_LOG(m_logger) << "Could not find service '" << externalServiceName << "'"
<< " referenced by external enumeration " << enumName;
return EnumInformation();
}
auto extXmlReader = m_externalXmlInformations.value(externalServiceName);
if (!extXmlReader)
{
ERROR_LOG() << "Could not find service xml file for service '" << externalServiceName << "'";
ERROR_LOG(m_logger) << "Could not find service xml file for service '" << externalServiceName << "'";
return EnumInformation();
}
@@ -783,7 +782,7 @@ EnumInformation XmlReader::getExternalEnumeration(const QString &externalService
}
if (verbose)
{
WARNING_LOG() << "Could not find enumeration " << enumName
WARNING_LOG(m_logger) << "Could not find enumeration " << enumName
<< " in external service definition for '"
<< externalServiceName << "'";
}
@@ -821,11 +820,11 @@ bool XmlReader::loadExternalService(const QString &serviceName)
if (fileName.isEmpty())
return false;
DEBUG_LOG() << "xml file for " << serviceName << ": " << fileName;
DEBUG_LOG(m_logger) << "xml file for " << serviceName << ": " << fileName;
auto extXmlReader = QSharedPointer<XmlReader>(new XmlReader);
if (!extXmlReader->readServiceFile(fileName, QString(), this))
{
WARNING_LOG() << "Error reading service file " << fileName
WARNING_LOG(m_logger) << "Error reading service file " << fileName
<< " for service " << serviceName;
return false;
}
@@ -842,7 +841,7 @@ void XmlReader::loadIdlInfofile(const QString &idlServiceInfoFile)
QFile f(idlServiceInfoFile);
if (!f.open(QIODevice::ReadOnly))
{
WARNING_LOG() << "Could not read idl service info file " << idlServiceInfoFile;
WARNING_LOG(m_logger) << "Could not read idl service info file " << idlServiceInfoFile;
return;
}
const QList<QByteArray> files = f.readAll().split('\n');
@@ -859,7 +858,7 @@ void XmlReader::loadIdlInfofile(const QString &idlServiceInfoFile)
{
const auto svcAbbreveation = fn.split(QLatin1Char('.')).at(0).split(QLatin1Char('_')).at(0);
m_xmlFiles[svcAbbreveation] = fileName;
DEBUG_LOG() << "xml: " << svcAbbreveation << " = " << fileName;
DEBUG_LOG(m_logger) << "xml: " << svcAbbreveation << " = " << fileName;
}
else
{
@@ -867,7 +866,7 @@ void XmlReader::loadIdlInfofile(const QString &idlServiceInfoFile)
if (svcAbbreveation.endsWith(QLatin1String("_enums")))
continue;
m_idlFiles[svcAbbreveation] = fileName;
DEBUG_LOG() << "idl: " << svcAbbreveation << " = " << fileName;
DEBUG_LOG(m_logger) << "idl: " << svcAbbreveation << " = " << fileName;
}
}
}
@@ -893,7 +892,7 @@ void XmlReader::getServiceNameInfoFromFilePath(const QStringList &parts)
const QString abbreviation = parts.last().split(QLatin1Char('.')).first().split(QLatin1Char('_')).first();
const QString serviceName = parts.at(parts.size() - 2);
DEBUG_LOG() << "serviceName: " << serviceName << " = " << abbreviation;
DEBUG_LOG(m_logger) << "serviceName: " << serviceName << " = " << abbreviation;
m_fullServiceName2Abbreviation[serviceName] = abbreviation;
}
@@ -359,6 +359,7 @@ public:
XmlReader &operator=(const XmlReader &) = delete;
private:
NGL::INGLLogger &m_logger;
void parseDBSserviceStructs(const QDomElement &rootElement);
void parseDBTables(const QDomElement &rootElement);
void parseDBViews(const QDomElement &rootElement);
@@ -77,20 +77,20 @@ int main(int argc, char **argv)
QScopedPointer<CodeGen::XmlReader> reader(new CodeGen::XmlReader);
DEBUG_LOG() << "ServiceFile: " << options.serviceFile();
DEBUG_LOG() << "IdlInfoFile: " << options.idlInfoFile();
DEBUG_LOG(m_logger) << "ServiceFile: " << options.serviceFile();
DEBUG_LOG(m_logger) << "IdlInfoFile: " << options.idlInfoFile();
if (!reader->readServiceFile(options.serviceFile(), options.idlInfoFile()))
{
ERROR_LOG() << "Error parsing service file '" << options.serviceFile()
ERROR_LOG(m_logger) << "Error parsing service file '" << options.serviceFile()
<< ": " << reader->errorString();
return 2;
}
QDir dir(options.outDir());
DEBUG_LOG() << "Directory: " << options.outDir();
DEBUG_LOG(m_logger) << "Directory: " << options.outDir();
if (!dir.exists() && !dir.mkpath(options.outDir()))
{
ERROR_LOG() << "Directory '" << options.outDir()
ERROR_LOG(m_logger) << "Directory '" << options.outDir()
<< "' does not exist and can not be created!";
return 3;
}
@@ -98,7 +98,7 @@ int main(int argc, char **argv)
QScopedPointer<CodeGen::StructBuilder> structBuilder(new CodeGen::StructBuilder(reader.data()));
if (!structBuilder->buildStructures())
{
ERROR_LOG() << "Error building up structures";
ERROR_LOG(m_logger) << "Error building up structures";
return 4;
}
@@ -123,7 +123,7 @@ int main(int argc, char **argv)
if (!sql.writeSql(dir.absolutePath() + QLatin1Char('/'), CodeGen::ExerciseDependency::Exercise))
{
ERROR_LOG() << "Error while writing sql information for service " << sql.getServiceAbbr();
ERROR_LOG(m_logger) << "Error while writing sql information for service " << sql.getServiceAbbr();
return 10;
}
@@ -133,7 +133,7 @@ int main(int argc, char **argv)
if (!sql.writeSql(dir.absolutePath() + QLatin1Char('/'), CodeGen::ExerciseDependency::Exercise))
{
ERROR_LOG() << "Error while writing sql information for service " << sql.getServiceAbbr();
ERROR_LOG(m_logger) << "Error while writing sql information for service " << sql.getServiceAbbr();
return 10;
}
@@ -141,20 +141,20 @@ int main(int argc, char **argv)
sql.generateData(0);
if (!sql.writeSql(dir.absolutePath() + QLatin1Char('/'), CodeGen::ExerciseDependency::Global))
{
ERROR_LOG() << "Error while writing sql information for service " << sql.getServiceAbbr();
ERROR_LOG(m_logger) << "Error while writing sql information for service " << sql.getServiceAbbr();
return 10;
}
return 0;
}
else
{
ERROR_LOG() << "Invalid action '" << options.action() << "' given!";
ERROR_LOG(m_logger) << "Invalid action '" << options.action() << "' given!";
return 5;
}
if (!generator->init(reader.data(), structBuilder.data()))
{
ERROR_LOG() << "Error initializing generator!";
ERROR_LOG(m_logger) << "Error initializing generator!";
return 6;
}
@@ -77,4 +77,9 @@ private Q_SLOTS:
private:
NGL::INGLLogger &m_logger;
};
@@ -53,4 +53,9 @@ private Q_SLOTS:
private:
NGL::INGLLogger &m_logger;
};
@@ -80,16 +80,16 @@ LtsElevationManager::LtsElevationManager()
, d(new Private)
{
++s_counter;
TRACE_LOG() << Q_FUNC_INFO << " START, s_counter=" << s_counter << " this=" << this;
TRACE_LOG() << Q_FUNC_INFO << " END, s_counter=" << s_counter << " this=" << this;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, s_counter=" << s_counter << " this=" << this;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, s_counter=" << s_counter << " this=" << this;
}
LtsElevationManager::~LtsElevationManager()
{
--s_counter;
TRACE_LOG() << Q_FUNC_INFO << " START, s_counter=" << s_counter << " this=" << this;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, s_counter=" << s_counter << " this=" << this;
delete d;
TRACE_LOG() << Q_FUNC_INFO << " END, s_counter=" << s_counter << " this=" << this;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, s_counter=" << s_counter << " this=" << this;
}
LTS_ELEVATION_MANAGER_TYPE LtsElevationManager::createInstance(int exerciseId,
@@ -283,7 +283,7 @@ void LtsElevationManager::cleanupAll()
void LtsElevationManager::initDDS(const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc, const std::shared_ptr<AssetManagement::Interface::Dtc> &asmDtc)
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
d->m_exmDtc = exmDtc;
if (d->m_exmDtc)
@@ -293,16 +293,16 @@ void LtsElevationManager::initDDS(const std::shared_ptr<ExerciseManagement::Inte
if (d->m_asmDtc)
d->m_asmDtc->waitForHistoricalDataTrainingArea(1000);
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
QStringList LtsElevationManager::getFilenamesForExercise(int exerciseId)
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
if (!d->m_exmDtc || !d->m_asmDtc)
{
ERROR_LOG() << Q_FUNC_INFO << " no dtcs"
ERROR_LOG(m_logger) << Q_FUNC_INFO << " no dtcs"
<< ", exerciseId=" << exerciseId;
return {};
}
@@ -311,7 +311,7 @@ QStringList LtsElevationManager::getFilenamesForExercise(int exerciseId)
int trainingAreaId = exerciseIdToTrainingAreaId(exerciseId, d->m_exmDtc);
if (trainingAreaId <= 0)
{
ERROR_LOG() << Q_FUNC_INFO << " Error getting trainingAreaId"
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Error getting trainingAreaId"
<< ", exerciseId=" << exerciseId
<< ", trainingAreaId=" << trainingAreaId;
return {};
@@ -319,17 +319,17 @@ QStringList LtsElevationManager::getFilenamesForExercise(int exerciseId)
QStringList filePaths_rough_to_fine = getFilenamesForTrainingArea(trainingAreaId);
TRACE_LOG() << Q_FUNC_INFO << " END, filePaths_rough_to_fine=" << filePaths_rough_to_fine.join(QStringLiteral(";"));
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, filePaths_rough_to_fine=" << filePaths_rough_to_fine.join(QStringLiteral(";"));
return filePaths_rough_to_fine;
}
QStringList LtsElevationManager::getFilenamesForTrainingArea(int trainingAreaId)
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
if (!d->m_asmDtc)
{
ERROR_LOG() << Q_FUNC_INFO << " no dtcs"
ERROR_LOG(m_logger) << Q_FUNC_INFO << " no dtcs"
<< ", trainingAreaId=" << trainingAreaId;
return {};
}
@@ -341,7 +341,7 @@ QStringList LtsElevationManager::getFilenamesForTrainingArea(int trainingAreaId)
const AssetManagement::TrainingArea &ta = d->m_asmDtc->trainingArea(trainingAreaId);
if (ta.id() != trainingAreaId)
{
ERROR_LOG() << Q_FUNC_INFO << " Error on s_asmDtc->trainingArea"
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Error on s_asmDtc->trainingArea"
<< ", trainingAreaId=" << trainingAreaId;
return {};
}
@@ -359,7 +359,7 @@ QStringList LtsElevationManager::getFilenamesForTrainingArea(int trainingAreaId)
filePaths_rough_to_fine.append(filePathAbs);
}
}
TRACE_LOG() << Q_FUNC_INFO << " END, filePaths_rough_to_fine=" << filePaths_rough_to_fine.join(QStringLiteral(";"));
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, filePaths_rough_to_fine=" << filePaths_rough_to_fine.join(QStringLiteral(";"));
return filePaths_rough_to_fine;
}
@@ -444,11 +444,11 @@ double LtsElevationManager::elevation(double lon_rad, double lat_rad, double def
LineOfSight LtsElevationManager::lineOfSightCalculation(const LtsUtils::QPoint3D &startPointGeo_absZ,
const LtsUtils::QPoint3D &endPointGeo_absZ)
{
TRACE_LOG() << Q_FUNC_INFO << " START" << ", startPointGeo_absZ = " << startPointGeo_absZ << ", endPointGeo_absZ = " << endPointGeo_absZ;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << ", startPointGeo_absZ = " << startPointGeo_absZ << ", endPointGeo_absZ = " << endPointGeo_absZ;
if (!isValid())
{
ERROR_LOG() << Q_FUNC_INFO << " Error, LtsElevationManager not valid";
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Error, LtsElevationManager not valid";
return LineOfSight::LOS_ERROR;
}
@@ -458,14 +458,14 @@ LineOfSight LtsElevationManager::lineOfSightCalculation(const LtsUtils::QPoint3D
LtsElevation::LineOfSight result = static_cast<LtsElevation::LineOfSight>(eleMapMgrResult);
TRACE_LOG() << Q_FUNC_INFO << " END" << ", startPointGeo = " << startPointGeo_absZ << ", endPointGeo = " << endPointGeo_absZ
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << ", startPointGeo = " << startPointGeo_absZ << ", endPointGeo = " << endPointGeo_absZ
<< " -> LineOfSight " << result;
return result;
}
LineOfSight LtsElevationManager::lineOfSightCalculation(const QPointF &startPointGeo, double startHat, const QPointF &endPointGeo, double endHat)
{
TRACE_LOG() << Q_FUNC_INFO << " START"
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START"
<< ", startPointGeo = " << startPointGeo << ", startHat = " << startHat
<< ", endPointGeo = " << endPointGeo << ", endHat = " << endHat;
@@ -476,7 +476,7 @@ LineOfSight LtsElevationManager::lineOfSightCalculation(const QPointF &startPoin
LtsElevation::LineOfSight result = static_cast<LtsElevation::LineOfSight>(eleMapMgrResult);
TRACE_LOG() << Q_FUNC_INFO << " END"
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END"
<< ", startPointGeo = " << startPointGeo << ", startHat = " << startHat
<< ", endPointGeo = " << endPointGeo << ", endHat = " << endHat
<< " -> LineOfSight " << static_cast<int>(eleMapMgrResult);
@@ -122,7 +122,7 @@ bool LtsPluginManager::startApp(const LtsAppDescriptor::AppDescription &app, boo
if (!pluginLoader->loadPlugins(PluginType::DATA, cb))
{
WARNING_LOG() << "PluginLoader failed to load data plugins - abort!";
WARNING_LOG(m_logger) << "PluginLoader failed to load data plugins - abort!";
return false;
}
@@ -137,7 +137,7 @@ bool LtsPluginManager::startApp(const LtsAppDescriptor::AppDescription &app, boo
if (!pluginLoader->loadPlugins(PluginType::GUI, cbLoadPlugins))
{
WARNING_LOG() << "PluginLoader failed to load gui plugins - abort!";
WARNING_LOG(m_logger) << "PluginLoader failed to load gui plugins - abort!";
return false;
}
@@ -255,7 +255,7 @@ bool LtsPluginManager::startApp(const LtsAppDescriptor::AppDescription &app, boo
LtsSession::DdsConnectionParams connParamsNew(connParams);
if (!connParamsNew.isValid())
{
INFO_LOG() << "Invalid connection params given - using default parameter";
INFO_LOG(m_logger) << "Invalid connection params given - using default parameter";
connParamsNew.domainId = LtsSessionData::LtsSessionData::getInstance()->getDomainIdPreset();
connParamsNew.partitionId = 0;
@@ -277,7 +277,7 @@ bool LtsPluginManager::startApp(const LtsAppDescriptor::AppDescription &app, boo
headless,
hidden))
{
ERROR_LOG() << "Could not create Global Session - abort.";
ERROR_LOG(m_logger) << "Could not create Global Session - abort.";
return false;
}
@@ -3,7 +3,7 @@
#pragma once
#include "ltspluginmanager_export.h"
#include "lts_plugin_manager_export.h"
#include <LtsPluginManager/lts_plugin_loader.h>
#include <LtsAppDescriptor/lts_app_descriptor.h>
@@ -85,6 +85,7 @@ public:
LtsSession::LtsSessionManager *m_sessionManager;
private:
NGL::INGLLogger &m_logger;
friend class DeveloperTools::DevDialog;
LtsAppDescriptor::AppDescription m_app;
@@ -61,8 +61,7 @@ Base::Base(QTextDocument &doc,
const QString &_fn,
QPrinter::PaperSize _ps,
QPrinter::Orientation _or,
QPrinter::ColorMode _cm)
: m_printer(new QPrinter),
QPrinter::ColorMode _cm) : m_printer(new QPrinter),
m_painter(new QPainter),
m_iconFilenameNr(0),
m_tempdoc(nullptr),
@@ -72,8 +71,8 @@ Base::Base(QTextDocument &doc,
footersize_(10), footerrule_(0.5), footertext_(FooterText),
itemFontSize_(2),
m_settings(new NGL::Settings(NGL::findProjectConfigFile())).getNGLLogger("NGLPrinting")),
m_currentPage(1)
{
m_currentPage(1),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
QString fn = _fn;
fn = fn.remove(QLatin1Char(' '));
fn = fn.remove(QLatin1String(".."));
@@ -158,7 +157,7 @@ void Base::setPrintToFile(bool printToFile)
QPrinter *Base::printer()
{
DEBUG_LOG() << "Base::printer" ;
DEBUG_LOG(m_logger) << "Base::printer" ;
return m_printer;
}
@@ -391,7 +390,7 @@ bool Base::printTableData(QString &str,
}
str += QLatin1String("</tbody></table>");
DEBUG_LOG() << qPrintable(str) ;
DEBUG_LOG(m_logger) << qPrintable(str) ;
return true;
}
@@ -226,6 +226,8 @@ public:
QSize pageSizeInMM();
protected:
NGL::INGLLogger &m_logger;
bool printTableItemData(QString &str,
const QAbstractItemModel *model,
const QModelIndex &mi,
@@ -77,7 +77,7 @@ LoginInformation LtsProjectionWorkstation::pendingLoginRequest()
LoginInformation result = *m_pendingLoginRequest;
INFO_LOG() << " reset pendingLoginRequest..";
INFO_LOG(m_logger) << " reset pendingLoginRequest..";
delete m_pendingLoginRequest;
m_pendingLoginRequest = nullptr;
@@ -90,7 +90,7 @@ void LtsProjectionWorkstation::handleMessage(LtsWebSocket::AbstractClientMessage
CTS::LoginRequest *login = dynamic_cast<CTS::LoginRequest *>(message);
if (login)
{
INFO_LOG() << "Login request received!"
INFO_LOG(m_logger) << "Login request received!"
<< ", login->userId()=" << login->userId()
<< " with login->priority()=" << login->priority()
<< " ;;; m_lastLoginRequest.m_userId=" << m_lastLoginRequest.m_userId
@@ -108,16 +108,16 @@ void LtsProjectionWorkstation::handleMessage(LtsWebSocket::AbstractClientMessage
DEBUG_LOG() << "Login request received and DedicatedDisconnect distributed, wait some seconds...";
DEBUG_LOG(m_logger) << "Login request received and DedicatedDisconnect distributed, wait some seconds...";
int i=0;
while(i<20)
{
DEBUG_LOG() << "Login request received and DedicatedDisconnect distributed, wait some seconds...i=" << i;
DEBUG_LOG(m_logger) << "Login request received and DedicatedDisconnect distributed, wait some seconds...i=" << i;
qApp->processEvents(QEventLoop::AllEvents, 50);
QThread::msleep(50);
++i;
}
INFO_LOG() << "Login request received and DedicatedDisconnect distributed, wait some seconds... done";
INFO_LOG(m_logger) << "Login request received and DedicatedDisconnect distributed, wait some seconds... done";
login->addReply((new STC::LoginRequestReply(QUuid::createUuid().toString(),
@@ -133,10 +133,10 @@ void LtsProjectionWorkstation::handleMessage(LtsWebSocket::AbstractClientMessage
slotLoginRequestReceived(login->userId(), login->exerciseId());
INFO_LOG() << "Valid login request received -> userId: " << login->userId()
INFO_LOG(m_logger) << "Valid login request received -> userId: " << login->userId()
<< " priority: " << login->priority()
<< " exerciseId: " << login->exerciseId();
DEBUG_LOG() << "Logging in now!";
DEBUG_LOG(m_logger) << "Logging in now!";
}
else
@@ -147,17 +147,17 @@ void LtsProjectionWorkstation::handleMessage(LtsWebSocket::AbstractClientMessage
QVector<VncScreen>())
)->toReplyMessage());
DEBUG_LOG() << "Higher prioritized login received -> userId: " << login->userId()
DEBUG_LOG(m_logger) << "Higher prioritized login received -> userId: " << login->userId()
<< " priority: " << login->priority()
<< " exerciseId: " << login->exerciseId();
DEBUG_LOG() << "Last login data was -> userId: " << m_lastLoginRequest.m_userId
DEBUG_LOG(m_logger) << "Last login data was -> userId: " << m_lastLoginRequest.m_userId
<< " priority: " << m_lastLoginRequest.m_priority
<< " exerciseId: " << m_lastLoginRequest.m_exerciseId;
}
}
else
ERROR_LOG() << "invalid login request received -> userId: " << login->userId()
ERROR_LOG(m_logger) << "invalid login request received -> userId: " << login->userId()
<< " priority: " << login->priority()
<< " exerciseId: " << login->exerciseId();
@@ -167,7 +167,7 @@ void LtsProjectionWorkstation::handleMessage(LtsWebSocket::AbstractClientMessage
CTS::LogoutRequest *logout = dynamic_cast<CTS::LogoutRequest *>(message);
if (logout)
{
DEBUG_LOG() << "Logging out now!";
DEBUG_LOG(m_logger) << "Logging out now!";
slotLogoutRequestReceived();
return;
}
@@ -184,7 +184,7 @@ void LtsProjectionWorkstation::handleMessage(LtsWebSocket::AbstractClientMessage
int disconnectingUserId = discon->userId();
INFO_LOG() << "Disconnecting now! "
INFO_LOG(m_logger) << "Disconnecting now! "
<< ", disconnectingUserId=" << disconnectingUserId
<< ", m_pendingLoginRequest=" << m_pendingLoginRequest;
m_lastLoginRequest = LoginInformation();
@@ -194,7 +194,7 @@ void LtsProjectionWorkstation::handleMessage(LtsWebSocket::AbstractClientMessage
void LtsProjectionWorkstation::slotLoginRequestReceived(int userId, int exerciseId)
{
INFO_LOG() << "slotLoginRequestReceived.."
INFO_LOG(m_logger) << "slotLoginRequestReceived.."
<< ", userId=" << userId
<< ", exerciseId=" << exerciseId;
delete m_pendingLoginRequest;
@@ -219,17 +219,17 @@ void LtsProjectionWorkstation::slotLogoffDone()
void LtsProjectionWorkstation::clientDisconnected(LtsWebSocket::ClientConnection *client)
{
INFO_LOG() << Q_FUNC_INFO << " START"
INFO_LOG(m_logger) << Q_FUNC_INFO << " START"
<< ", m_connections.size = " << m_connections.size();
m_connections.removeOne(client);
if ( m_connections.size() == 0 && (m_lastLoginRequest.m_userId != 0 || m_lastLoginRequest.m_priority != 0))
{
INFO_LOG() << Q_FUNC_INFO << " reset m_lastLoginRequest";
INFO_LOG(m_logger) << Q_FUNC_INFO << " reset m_lastLoginRequest";
m_lastLoginRequest = LoginInformation();
}
INFO_LOG() << Q_FUNC_INFO << " END"
INFO_LOG(m_logger) << Q_FUNC_INFO << " END"
<< ", m_connections.size = " << m_connections.size();
}
@@ -48,7 +48,7 @@ bool VncServerManager::init(const QList<QScreen *> &screens)
const auto sortedScreens = sortScreen(screens);
DEBUG_LOG() << "Setup VNCScreens with " << screens.size() << " screens";
DEBUG_LOG(m_logger) << "Setup VNCScreens with " << screens.size() << " screens";
int count = 1;
@@ -77,13 +77,13 @@ bool VncServerManager::init(const QList<QScreen *> &screens)
count++;
}
DEBUG_LOG() << m_vncScreens.size() << " VNCScreen(s) created - Setup completed.";
DEBUG_LOG(m_logger) << m_vncScreens.size() << " VNCScreen(s) created - Setup completed.";
return true;
}
void VncServerManager::startScreens()
{
DEBUG_LOG() << "Starting " << m_vncScreens.size() << " VNCScreen(s) ... ";
DEBUG_LOG(m_logger) << "Starting " << m_vncScreens.size() << " VNCScreen(s) ... ";
for (const VncScreen &s : std::as_const(m_vncScreens))
{
connect(s.proc, &QProcess::readyReadStandardOutput,
@@ -95,16 +95,16 @@ void VncServerManager::startScreens()
for (const VncScreen &s : std::as_const(m_vncScreens))
{
if (!s.proc->waitForStarted(2000))
ERROR_LOG() << "Can not start process '" << s.proc->program() << "': "
ERROR_LOG(m_logger) << "Can not start process '" << s.proc->program() << "': "
<< s.proc->errorString();
}
DEBUG_LOG() << "Done";
DEBUG_LOG(m_logger) << "Done";
}
void VncServerManager::stopScreens()
{
DEBUG_LOG() << "Stopping " << m_vncScreens.size() << " VNCScreen(s) ...";
DEBUG_LOG(m_logger) << "Stopping " << m_vncScreens.size() << " VNCScreen(s) ...";
for (const VncScreen &s : std::as_const(m_vncScreens))
{
@@ -116,28 +116,28 @@ void VncServerManager::stopScreens()
if (!s.proc->waitForFinished(2000))
s.proc->kill();
}
DEBUG_LOG() << "Done";
DEBUG_LOG(m_logger) << "Done";
}
void VncServerManager::killScreens()
{
DEBUG_LOG() << "Killing all exisiting x11vnc processes ...";
DEBUG_LOG(m_logger) << "Killing all exisiting x11vnc processes ...";
SingleShotProcess ssp(QStringLiteral("killall x11vnc"));
ssp.execute();
DEBUG_LOG() << "Done";
DEBUG_LOG(m_logger) << "Done";
}
void VncServerManager::createPwdFile()
{
DEBUG_LOG() << "(Re)creating x11vnc password-file ...";
DEBUG_LOG(m_logger) << "(Re)creating x11vnc password-file ...";
SingleShotProcess ssp(QStringLiteral("x11vnc -storepasswd ctc11de %1/.vnc/passwd")
.arg(QDir::home().absolutePath()));
ssp.execute();
DEBUG_LOG() << "Done";
DEBUG_LOG(m_logger) << "Done";
}
@@ -151,7 +151,7 @@ void VncServerManager::slotReadStandardOutput()
QRegularExpressionMatch match = QRegularExpression(QStringLiteral("PORT=(.*?)\\s")).match(stdOut);
if (!match.hasMatch())
{
WARNING_LOG() << "Could not retrieve port information from stdout of " << p->program();
WARNING_LOG(m_logger) << "Could not retrieve port information from stdout of " << p->program();
return;
}
const quint16 port = match.capturedRef(1).toInt();
@@ -172,7 +172,7 @@ void VncServerManager::slotErrorOccured()
{
QProcess *p = qobject_cast<QProcess *>(QObject::sender());
if (p)
ERROR_LOG() << p->errorString();
ERROR_LOG(m_logger) << p->errorString();
}
@@ -49,7 +49,7 @@ void LtsSerialPortQuerry::continueQuerry()
void LtsSerialPortQuerry::restartQuerry()
{
DEBUG_LOG() << "restart querry ";
DEBUG_LOG(m_logger) << "restart querry ";
m_serialPortInfos = QSerialPortInfo::availablePorts();
m_currentQuerry = 0;
if (m_serialPortInfos.size())
@@ -73,20 +73,20 @@ void LtsSerialPortQuerry::querrySerialPort(const QSerialPortInfo &info)
m_currentSerialPort->setStopBits(m_stopBits);
m_currentSerialPort->setFlowControl(m_flowControll);
DEBUG_LOG() << "Try opening Comport:" << m_currentSerialPort->portName() << " index is: " << m_currentQuerry;
DEBUG_LOG(m_logger) << "Try opening Comport:" << m_currentSerialPort->portName() << " index is: " << m_currentQuerry;
if (!m_currentSerialPort->open(QSerialPort::ReadWrite))
{
DEBUG_LOG() << "Oppening failed query next";
DEBUG_LOG(m_logger) << "Oppening failed query next";
continueQuerry();
}else
{
connect(m_currentSerialPort, &QSerialPort::errorOccurred,
this, &LtsSerialPortQuerry::onSerialPortError, Qt::UniqueConnection);
DEBUG_LOG() << "Oppened comport" << m_currentSerialPort->portName();
DEBUG_LOG(m_logger) << "Oppened comport" << m_currentSerialPort->portName();
emit connectionEstablished();
}
}
@@ -110,7 +110,7 @@ void LtsSerialPortQuerry::onSerialPortError(QSerialPort::SerialPortError serialP
if (!m_currentSerialPort)
return;
DEBUG_LOG() << "Spontaneous error " << serialPortError << " doesn't have to be an error ...";
DEBUG_LOG(m_logger) << "Spontaneous error " << serialPortError << " doesn't have to be an error ...";
const QString errStr(QStringLiteral("QSerialPort::SerialPortError ") + QString::number(serialPortError) +
QStringLiteral(" from serial port ") + m_currentSerialPort->portName() +
@@ -129,19 +129,19 @@ void LtsSerialPortQuerry::onSerialPortError(QSerialPort::SerialPortError serialP
case QSerialPort::SerialPortError::NotOpenError:
case QSerialPort::SerialPortError::UnknownError:
{
ERROR_LOG() << "Closing port and try to reopen it. " << m_currentSerialPort->portName();
ERROR_LOG(m_logger) << "Closing port and try to reopen it. " << m_currentSerialPort->portName();
continueQuerry();
Q_FALLTHROUGH();
}
case QSerialPort::SerialPortError::UnsupportedOperationError:
{
ERROR_LOG() << errStr;
ERROR_LOG(m_logger) << errStr;
break;
}
default:
{
ERROR_LOG() << "Got an Error> " << errStr << "restarting";
ERROR_LOG(m_logger) << "Got an Error> " << errStr << "restarting";
continueQuerry();
break;
@@ -33,13 +33,16 @@ signals:
void connectionEstablished();
private:
NGL::INGLLogger &m_logger;
void querrySerialPort(const QSerialPortInfo &info);
void closeAndDeleteCurrentPort();
private:
NGL::INGLLogger &m_logger;
void onSerialPortError(QSerialPort::SerialPortError serialPortError);
private:
NGL::INGLLogger &m_logger;
QList<QSerialPortInfo> m_serialPortInfos;
int m_currentQuerry;
QSerialPort::BaudRate m_baudRate;
@@ -51,7 +51,6 @@ NGL_TARGET_LINK_LIBRARIES(LtsSession
Qt6::Network
LtsMultiMonitor
LtsSessionData
ddsconnector
LtsUtilsGuiDds # ReqHelpr & for Debug Menu ! TODO: rm on release!
LtsNotification
svcCoreClient # Core Ftc - for TLH
@@ -67,6 +66,8 @@ NGL_TARGET_LINK_LIBRARIES(LtsSession
)
IF(BUILD_RTI)
NGL_TARGET_LINK_LIBRARIES(LtsSession
PRIVATE
ddsconnector
PUBLIC
LtsSessionDataDds
)
@@ -699,6 +699,7 @@ void LtsSession::slotStapleTopicLockHandler(LtsWidgets::LtsDialog *widget)
}
widget->setProperty("topicLockStapled", true);
#ifdef BUILD_RTI
connectOnlineHelpButton(widget);
if (m_coreFtc == nullptr)
{
@@ -736,6 +737,10 @@ void LtsSession::slotStapleTopicLockHandler(LtsWidgets::LtsDialog *widget)
connectOnlineHelpButton(widget);
#else
Q_UNUSED(widget)
DEBUG_LOG(m_logger) << "BUILD_RTI=OFF, skipping TopicLockHandler setup";
#endif
}
@@ -1,5 +1,7 @@
#pragma once
#ifdef BUILD_RTI
#include <LtsSession/ltssession_export.h>
#include <LtsWidgets/lts_dialog.h>
#include <DDS/Core/core_ftc.h>
@@ -104,3 +106,9 @@ private:
} // namespace LtsSession
#else // BUILD_RTI
#include "lts_session_lock_handler_stub.h"
#endif // BUILD_RTI
@@ -0,0 +1,81 @@
/**
* @RDE_HEADER@
* Stub header for lts_session_lock_handler.h when BUILD_RTI=OFF
* Provides minimal declarations to allow compilation without RTI Connext DDS
*/
#pragma once
#include <LtsSession/ltssession_export.h>
#include <LtsWidgets/lts_dialog.h>
#include <QPointer>
#include <memory>
#include <QObject>
#include <NGLLogger/NGLLoggerBootstrap.h>
namespace LtsSession
{
// Stub TopicLockHandler class - minimal version without DDS functionality
class LTSSESSION_EXPORT TopicLockHandler : public QObject
{
Q_OBJECT
public:
explicit TopicLockHandler(QObject *parent = nullptr) : QObject(parent)
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("LtsSession.TopicLockHandler"))
{}
~TopicLockHandler() override = default;
bool init(const void * /*coreFtc*/, int /*exerciseId*/) { return false; }
bool isLocked() const { return false; }
LtsWidgets::TopicInfo getTopicInfo() const { return LtsWidgets::TopicInfo(); }
public slots:
void slotTryLock(const LtsWidgets::TopicInfo & /*topicInfo*/) {}
bool slotUnlock() { return false; }
void slotFinalize() { deleteLater(); }
signals:
void signalLockDialog(const QString & /*lockedBy*/) {}
void signalUnlockDialog() {}
private:
NGL::INGLLogger &m_logger;
};
class LTSSESSION_EXPORT TopicLockHanderData : public QObject
{
Q_OBJECT
public:
explicit TopicLockHanderData(QObject *parent = nullptr) : QObject(parent) {}
~TopicLockHanderData() override = default;
void init(const void * /*coreFtc*/, int /*exerciseId*/) {}
void unlock() {}
void slotTryLock(const LtsWidgets::TopicInfo & /*topicInfo*/) {}
bool isLocked() const { return false; }
LtsWidgets::TopicInfo getTopicInfo() const { return LtsWidgets::TopicInfo(); }
const QString &getLockedBy() const { return m_lockedBy; }
Q_SIGNALS:
void lockDataChanged();
private Q_SLOTS:
void slotLock(const QString & /*lockedBy*/) {}
void slotUnlock() {}
public:
QString m_debugName;
private:
QPointer<TopicLockHandler> m_topicLockHandler;
QString m_lockedBy;
};
} // namespace LtsSession
@@ -19,7 +19,9 @@
#include <LtsSession/lts_session_data.h>
#include <PluginInterfaces/data_plugin_interface.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#ifdef BUILD_RTI
#include <DDS/DDSConnector/dds_connector.h>
#endif
#include <QDebug>
@@ -339,12 +339,12 @@ QModelIndex TimelineModel::index(int row, int column, const QModelIndex &parent)
}
catch (const QString &msg)
{
DEBUG_LOG() << Q_FUNC_INFO << "cannot get parent track " << msg;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << "cannot get parent track " << msg;
return {};
}
catch (const std::out_of_range &oor)
{
DEBUG_LOG() << Q_FUNC_INFO << "cannot get child track " << QString::fromUtf8(oor.what());
DEBUG_LOG(m_logger) << Q_FUNC_INFO << "cannot get child track " << QString::fromUtf8(oor.what());
return {};
}
@@ -455,7 +455,7 @@ QModelIndex TimelineModel::parent(const QModelIndex &index) const
}
catch (const QString &msg)
{
DEBUG_LOG() << Q_FUNC_INFO << "cannot get parent of track with id" << trackId << msg;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << "cannot get parent of track with id" << trackId << msg;
return {};
}
@@ -473,13 +473,13 @@ QModelIndex TimelineModel::parent(const QModelIndex &index) const
}
catch (const QString &msg)
{
DEBUG_LOG() << Q_FUNC_INFO << "row of track for parent not found for parent id" << parentId << "-" << msg;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << "row of track for parent not found for parent id" << parentId << "-" << msg;
return {};
}
}
catch (const QString &msg)
{
DEBUG_LOG() << Q_FUNC_INFO << "super parent not found for super parent id" << superParentId << "-" << msg;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << "super parent not found for super parent id" << superParentId << "-" << msg;
return {};
}
@@ -722,11 +722,11 @@ void TimelineModel::setMinimumDuration(int duration)
{
if (duration < 0)
{
WARNING_LOG() << "negative duration is not possible -> setting minimum duration to 0";
WARNING_LOG(m_logger) << "negative duration is not possible -> setting minimum duration to 0";
duration = 0;
}
if (duration % 1000 && m_isSnapEnabled)
WARNING_LOG() << "Snapping to 1000ms enabled, yet minimum duration is not a multiple of 1000ms: " << duration;
WARNING_LOG(m_logger) << "Snapping to 1000ms enabled, yet minimum duration is not a multiple of 1000ms: " << duration;
m_minItemDuration = duration;
}
@@ -141,6 +141,7 @@ public:
int columnCount(const QModelIndex &) const override { return 2; }
protected:
NGL::INGLLogger &m_logger;
ItemPtrNCVRef _itemNCV(Track &track, int id) noexcept(false)
{
return track._itemNCV(id);
@@ -223,6 +224,7 @@ public slots:
virtual void onRemoveTrack(const QModelIndex &index) { Q_UNUSED(index); }
protected:
NGL::INGLLogger &m_logger;
TimelineView *m_view{nullptr};
Track m_rootTrack;
@@ -76,7 +76,7 @@ void TimelineView::setHeader(QHeaderView *header)
}
catch (...)
{
ERROR_LOG() << "header view should be of type TimelineHeaderView";
ERROR_LOG(m_logger) << "header view should be of type TimelineHeaderView";
}
}
@@ -125,7 +125,7 @@ void TimelineView::setItemDelegate(QAbstractItemDelegate *delegate)
}
catch (...)
{
ERROR_LOG() << "item delegate for TimelineView must be derived from ItemDelegate";
ERROR_LOG(m_logger) << "item delegate for TimelineView must be derived from ItemDelegate";
}
}
@@ -122,6 +122,7 @@ public:
bool isCursorWithinRangeY(int y) const;
protected:
NGL::INGLLogger &m_logger;
void dragEnterEvent(QDragEnterEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void dragLeaveEvent(QDragLeaveEvent *event) override;
@@ -89,6 +89,8 @@ public:
void hideDebugWidget();
private:
NGL::INGLLogger &m_logger;
void populateZoomFactorComboBox();
public:
@@ -10,15 +10,14 @@
namespace LtsTimelineClassic
{
AbstractTimelineModel::AbstractTimelineModel(QObject *parent)
: QAbstractItemModel(parent)
AbstractTimelineModel::AbstractTimelineModel(QObject *parent) : QAbstractItemModel(parent)
.getNGLLogger("Timeline.AbstractTimelineModel"))
, m_highestPositionedItem(0)
, m_lowestPositionedItem(0)
, m_getEventListsRecursive(true)
, m_rootItem(new Item(QLatin1String("#mwille/r00t/")))
, m_markersItem(new Item(tr("Markers"), QStringLiteral("Markers")))
{
, m_markersItem(new Item(tr("Markers"), QStringLiteral("Markers"))),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
@@ -45,6 +45,9 @@ public:
protected:
NGL::INGLLogger &m_logger;
protected:
@@ -16,8 +16,7 @@ namespace LtsTimelineClassic
Event::Event(int uniqueId, int typeId, qint64 startTime,
qint64 endTime, int playerId, int partyId, int equipmentId, const QStringList &path,
const EventPaintFunc &paintFunc, const QColor &paintColor, const QJsonObject &detailData, int subEventId,
const LtsUtils::QPoint3D &pos, LtsSession::LtsSession *session)
: m_path(path)
const LtsUtils::QPoint3D &pos, LtsSession::LtsSession *session) : m_path(path)
, m_detailData(detailData)
, m_position(pos)
, m_paintFunc(paintFunc)
@@ -32,9 +31,8 @@ Event::Event(int uniqueId, int typeId, qint64 startTime,
, m_partyId(partyId)
, m_equipmentId(equipmentId)
, m_deleted(false)
, m_visible(true)
{
, m_visible(true),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
checkDuration();
}
@@ -125,6 +125,9 @@ public:
protected:
NGL::INGLLogger &m_logger;
QStringList m_path;
QJsonObject m_detailData;
@@ -39,8 +39,7 @@
namespace LtsTimelineClassic
{
TimelineIndicator::TimelineIndicator(QWidget *parent)
: QWidget(parent)
TimelineIndicator::TimelineIndicator(QWidget *parent) : QWidget(parent)
, m_zoomFactorPoints(0)
, m_pbZoom(new QPushButton(this))
, m_pbUnzoom(new QPushButton(this))
@@ -49,8 +48,8 @@ TimelineIndicator::TimelineIndicator(QWidget *parent)
, m_currentTextWidth(0)
, m_sectionPos(0)
, m_sectionSize(0)
.getNGLLogger("Timeline.Indicator"))
{
.getNGLLogger("Timeline.Indicator")),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
m_timeArray.reserve(11 + 11 + 7 + 10);
m_timeArray <<
@@ -380,7 +379,7 @@ void TimelineIndicator::refreshData()
if (steps > 60000 || steps < 1)
{
ERROR_LOG() << "More than 60000 ("<<steps<<") or less than 1 lines to draw. Loop will exit after 60000 lines.";
ERROR_LOG(m_logger) << "More than 60000 ("<<steps<<") or less than 1 lines to draw. Loop will exit after 60000 lines.";
}
if (steps < 1)
@@ -474,7 +473,7 @@ void TimelineIndicator::paintEvent(QPaintEvent *)
DTG::toStringMSec(time, DTG::Short));
#ifdef VERBOSE
WARNING_LOG() << "paintEvent: actual drawing position: x=" << centeredPos << " y=" << textY;
WARNING_LOG(m_logger) << "paintEvent: actual drawing position: x=" << centeredPos << " y=" << textY;
#endif
}
@@ -57,6 +57,7 @@ private:
protected:
NGL::INGLLogger &m_logger;
void paintEvent(QPaintEvent *);
signals:
@@ -20,8 +20,7 @@
namespace LtsTimelineClassic
{
TimelineWidget::TimelineWidget(QWidget *parent)
: QWidget(parent)
TimelineWidget::TimelineWidget(QWidget *parent) : QWidget(parent)
.getNGLLogger("Timeline.Widget"))
, m_timelineUi(new Ui::Timeline)
, m_min(0)
@@ -29,8 +28,8 @@ TimelineWidget::TimelineWidget(QWidget *parent)
, m_sbPos(0)
, m_zoomFactor(1)
, m_headerView(new TimelineHeaderView)
, m_model(nullptr)
{
, m_model(nullptr),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
m_timelineUi->setupUi(this);
m_timelineUi->view->setHeader(m_headerView);
m_headerView->setMinimumSectionSize(150);
@@ -99,7 +98,7 @@ void TimelineWidget::knownRangesChanged(const QVector<Range> &newRanges)
EventDelegate *ed = qobject_cast<EventDelegate *>(m_timelineUi->view->itemDelegate());
if (ed == nullptr)
{
WARNING_LOG() << "ed == nullptr";
WARNING_LOG(m_logger) << "ed == nullptr";
return;
}
@@ -57,6 +57,7 @@ public:
private:
NGL::INGLLogger &m_logger;
void setTimelineRange(qint64 min, qint64 max);
void refreshData();
@@ -15,7 +15,7 @@ ClientConnection::ClientConnection(QWebSocket *socket, QObject *parent)
ClientConnection::~ClientConnection()
{
DEBUG_LOG() << "Thread closed" << this;
DEBUG_LOG(m_logger) << "Thread closed" << this;
delete m_socket;
qDeleteAll(m_messageQueue);
}
@@ -24,11 +24,11 @@ bool ClientConnection::init()
{
if (m_socket == nullptr)
{
ERROR_LOG() << "Initialisation failed due to an invalid socket";
ERROR_LOG(m_logger) << "Initialisation failed due to an invalid socket";
return false;
}
DEBUG_LOG() << "Started new thread" << this;
DEBUG_LOG(m_logger) << "Started new thread" << this;
connect(m_socket, &QWebSocket::textMessageReceived, this, &ClientConnection::onNewTextMessageFromSocket, Qt::DirectConnection);
connect(m_socket, &QWebSocket::connected, this, &ClientConnection::sendMessagesFromQueue);
connect(m_socket, &QWebSocket::disconnected, this, &ClientConnection::onSocketDisconnect);
@@ -41,24 +41,24 @@ void ClientConnection::addReply(ReplyMessage *message)
if (!m_socket || m_socket->state() != QAbstractSocket::ConnectedState)
{
m_messageQueue.enqueue(message);
DEBUG_LOG() << "Adding message to queue, size: " << m_messageQueue.size();
DEBUG_LOG(m_logger) << "Adding message to queue, size: " << m_messageQueue.size();
return;
}
const QString msg(message->toJsonString());
DEBUG_LOG() << "Sending message: " << msg ;
DEBUG_LOG(m_logger) << "Sending message: " << msg ;
m_socket->sendTextMessage(msg);
delete message;
}
void ClientConnection::onNewTextMessageFromSocket(const QString &message)
{
DEBUG_LOG() << "Recv msg: " << message << this;
DEBUG_LOG(m_logger) << "Recv msg: " << message << this;
emit newTextMessage(this, message);
}
void ClientConnection::sendMessagesFromQueue()
{
INFO_LOG() << "Client connected ip: " << m_socket->peerAddress().toString() << ":" << m_socket->peerPort();
INFO_LOG(m_logger) << "Client connected ip: " << m_socket->peerAddress().toString() << ":" << m_socket->peerPort();
if (m_socket->state() != QAbstractSocket::ConnectedState)
return;
@@ -66,16 +66,16 @@ void ClientConnection::sendMessagesFromQueue()
{
ReplyMessage *message = m_messageQueue.dequeue();
const QString msg(message->toJsonString());
TRACE_LOG() << "Send msg: " << msg;
TRACE_LOG(m_logger) << "Send msg: " << msg;
m_socket->sendTextMessage(msg);
delete message;
DEBUG_LOG() << "Sent message from queue, new size: " << m_messageQueue.size();
DEBUG_LOG(m_logger) << "Sent message from queue, new size: " << m_messageQueue.size();
}
}
void ClientConnection::onSocketDisconnect()
{
DEBUG_LOG() << "Client disconnected ip: " << m_socket->peerAddress().toString() << ":" << m_socket->peerPort();
DEBUG_LOG(m_logger) << "Client disconnected ip: " << m_socket->peerAddress().toString() << ":" << m_socket->peerPort();
exit(0);
emit disconnected(this);
}
@@ -58,9 +58,11 @@ private slots:
private:
NGL::INGLLogger &m_logger;
void sendMessages();
private:
NGL::INGLLogger &m_logger;
QWebSocket *m_socket;
QQueue<ReplyMessage *> m_messageQueue;
};
@@ -9,10 +9,9 @@
using namespace LtsWebSocket;
ConnectionHandler::ConnectionHandler(QObject *parent)
: QObject(parent)
, m_server(nullptr)
{}
ConnectionHandler::ConnectionHandler(QObject *parent) : QObject(parent)
, m_server(nullptr),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
ConnectionHandler::~ConnectionHandler()
{
@@ -33,13 +32,13 @@ bool ConnectionHandler::init(const QString &serviceName, unsigned short port)
connect(m_server, &QWebSocketServer::newConnection, this, &ConnectionHandler::onNewConnection);
connect(m_server, &QWebSocketServer::serverError, this, &ConnectionHandler::onServerError);
DEBUG_LOG() << "Trying to listen ";
DEBUG_LOG(m_logger) << "Trying to listen ";
if (!m_server->listen(QHostAddress::Any, port))
{
ERROR_LOG() << "Not possible to listen to port " << port;
ERROR_LOG(m_logger) << "Not possible to listen to port " << port;
return false;
}
DEBUG_LOG() << "... ok, port " << m_server->serverPort();
DEBUG_LOG(m_logger) << "... ok, port " << m_server->serverPort();
return true;
}
@@ -54,7 +53,7 @@ void ConnectionHandler::sendToAllClients(ReplyMessage *message)
void ConnectionHandler::onServerError(QWebSocketProtocol::CloseCode closeCode)
{
ERROR_LOG() << "Got server error with close code " << closeCode;
ERROR_LOG(m_logger) << "Got server error with close code " << closeCode;
}
void ConnectionHandler::onNewConnection()
@@ -71,7 +70,7 @@ void ConnectionHandler::onNewConnection()
if (!newConnection->init())
{
ERROR_LOG() << "Failed to initialise new client";
ERROR_LOG(m_logger) << "Failed to initialise new client";
delete newConnection;
newConnection = nullptr;
continue;
@@ -84,6 +83,6 @@ void ConnectionHandler::onNewConnection()
m_connections.insert(newConnection);
emit clientConnected(newConnection);
INFO_LOG() << "New client connected ip: " << socket->localAddress().toString() << ":" << socket->localPort();
INFO_LOG(m_logger) << "New client connected ip: " << socket->localAddress().toString() << ":" << socket->localPort();
}
}
@@ -57,6 +57,7 @@ private slots:
void onNewConnection();
private:
NGL::INGLLogger &m_logger;
QWebSocketServer *m_server;
QSet<ClientConnection *> m_connections;
};
@@ -31,7 +31,7 @@ protected:
if (!m_dbInterface->select(dataVec))
{
const QString errorMessage = QStringLiteral("Error reading data from database!");
ERROR_LOG() << errorMessage;
ERROR_LOG(m_logger) << errorMessage;
ErrorMessage::ErrorData errData;
errData.errorMessage = errorMessage;
errData.uuid = uuid;
@@ -71,18 +71,18 @@ void WebSocketHelper::doOpen(const QString &hostname, const unsigned short port)
doClose();
else
{
INFO_LOG() << "Web socket to url: " << url.toDisplayString() << " is already open.";
INFO_LOG(m_logger) << "Web socket to url: " << url.toDisplayString() << " is already open.";
return;
}
}
INFO_LOG() << "Opening web socket to url: " << url.toDisplayString();
INFO_LOG(m_logger) << "Opening web socket to url: " << url.toDisplayString();
m_socket->open(url);
}
void WebSocketHelper::doClose()
{
INFO_LOG() << "Closing web socket to url:" << m_socket->requestUrl().toDisplayString();
INFO_LOG(m_logger) << "Closing web socket to url:" << m_socket->requestUrl().toDisplayString();
m_socket->close();
}
@@ -90,29 +90,29 @@ void WebSocketHelper::doSendTextMessage(const QString &msg)
{
if (!m_socket || m_socket->state() != QAbstractSocket::ConnectedState)
{
ERROR_LOG() << "Message could not be send, socket is not connected.";
ERROR_LOG(m_logger) << "Message could not be send, socket is not connected.";
return;
}
DEBUG_LOG() << "Sending message: " << msg;
DEBUG_LOG(m_logger) << "Sending message: " << msg;
m_socket->sendTextMessage(msg);
}
void WebSocketHelper::onConnected()
{
INFO_LOG() << "Connected to server url: " << m_socket->requestUrl().toDisplayString()
INFO_LOG(m_logger) << "Connected to server url: " << m_socket->requestUrl().toDisplayString()
<< " using local port: " << m_socket->localPort();
emit connected();
}
void WebSocketHelper::onDisconnected()
{
INFO_LOG() << "Disconnected from server url: " << m_socket->requestUrl().toDisplayString();
INFO_LOG(m_logger) << "Disconnected from server url: " << m_socket->requestUrl().toDisplayString();
emit disconnected();
}
void WebSocketHelper::onError(QAbstractSocket::SocketError error)
{
ERROR_LOG() << "Error occured: " << error << " closing socket.";
ERROR_LOG(m_logger) << "Error occured: " << error << " closing socket.";
m_socket->close();
}
@@ -131,7 +131,7 @@ void WebSocketHelper::parseMessage(const QString &message)
clientMessage = m_messageFactory->createMessage(m_webSocketClient, message);
else
{
WARNING_LOG() << "Could not parse incoming message: '" << message
WARNING_LOG(m_logger) << "Could not parse incoming message: '" << message
<< "', error: " << result.errorString();
clientMessage = new InvalidMessage(m_webSocketClient, QString(),
QStringLiteral("Got message which is not JSON conform (%1)").arg(result.errorString()));
@@ -56,6 +56,8 @@ signals:
void onSendTextMessage(const QString &msg);
private:
NGL::INGLLogger &m_logger;
AbstractClientMessageFactory *m_messageFactory;
QThread *m_webSocketHelperThread;
@@ -29,7 +29,7 @@ bool LtsWebSocketServer::init(const QString &serviceName, const unsigned short p
if (!m_connectionHandler->init(serviceName, port))
{
ERROR_LOG() << "Could not init m_connectionHandler with servicename: " << serviceName << ((port == 0) ? QStringLiteral(" random port") : QStringLiteral(" port: ") + QString::number(port));
ERROR_LOG(m_logger) << "Could not init m_connectionHandler with servicename: " << serviceName << ((port == 0) ? QStringLiteral(" random port") : QStringLiteral(" port: ") + QString::number(port));
m_connectionHandler.reset();
return false;
}
@@ -59,7 +59,7 @@ bool LtsWebSocketServer::init(const QString &serviceName, const QPair<quint16, q
void LtsWebSocketServer::sendToAllClients(ReplyMessage *message)
{
DEBUG_LOG() << "Sending message to all clients: " << message->toJsonString();
DEBUG_LOG(m_logger) << "Sending message to all clients: " << message->toJsonString();
m_connectionHandler->sendToAllClients(message);
}
@@ -81,7 +81,7 @@ void LtsWebSocketServer::onNewTextMessage(ReplyHandler *client, const QString &m
client->addReply(new PongMessage(message.mid(pingMsg.size())));
return;
}
DEBUG_LOG() << "Got new message: " << message;
DEBUG_LOG(m_logger) << "Got new message: " << message;
m_messageQueue.append({client, message});
@@ -102,7 +102,7 @@ void LtsWebSocketServer::onQueueTimerTimeout()
clientMessage = m_messageFactory->createMessage(credentials.client, credentials.message);
else
{
WARNING_LOG() << "Could not parse incoming message: '" << credentials.message << "', error: " << result.errorString();
WARNING_LOG(m_logger) << "Could not parse incoming message: '" << credentials.message << "', error: " << result.errorString();
clientMessage = new InvalidMessage(credentials.client, QString(), QStringLiteral("Got message which is not JSON conform"));
}
@@ -153,40 +153,38 @@ MESSAGE(STATUS "DEBUG: After NGL_ADD_BIG_RESOURCES")
NGL_ADD_BIG_RESOURCES(ltswidgets_SRCS resources/lts_resources.qrc)
MESSAGE(STATUS "DEBUG BEFORE IF: BUILD_RTI=${BUILD_RTI}, BUILD_WS=${BUILD_WS}")
MESSAGE(STATUS "DEBUG: BUILD_RTI=${BUILD_RTI}, BUILD_WS=${BUILD_WS}, building LtsWidgets")
NGL_ADD_LIBRARY2(WS TOOLSWS TOOLSSV LtsWidgets SHARED ${ltswidgets_SRCS})
NGL_TARGET_INCLUDE_DIRECTORIES(LtsWidgets
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_BINARY_DIR}/Lts/Common/LtsUtils/LtsUtilsCore
${CMAKE_CURRENT_BINARY_DIR}
)
NGL_TARGET_LINK_LIBRARIES(LtsWidgets
PRIVATE
Qt6::Network # for QHostInfo - for portability
Qt6::Svg
ngltools
ngltranslator
TabBarTabStyle
LtsSessionData
LtsUtilsSettings
PUBLIC
LtsUtilsCore
Qt6::Core
Qt6::Widgets
Qt6::Gui
)
NGL_INSTALL_TARGET(LtsWidgets)
#
# Designer-Plugin (RTI-dependent)
#
IF(BUILD_RTI)
MESSAGE(STATUS "DEBUG: BUILD_RTI=${BUILD_RTI}, BUILD_WS=${BUILD_WS}, building LtsWidgets")
NGL_ADD_LIBRARY2(WS TOOLSWS TOOLSSV LtsWidgets SHARED ${ltswidgets_SRCS})
NGL_TARGET_INCLUDE_DIRECTORIES(LtsWidgets
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_BINARY_DIR}/Lts/Common/LtsUtils/LtsUtilsCore
${CMAKE_CURRENT_BINARY_DIR}
)
NGL_TARGET_LINK_LIBRARIES(LtsWidgets
PRIVATE
Qt6::Network # for QHostInfo - for portability
Qt6::Svg
ngltools
ngltranslator
TabBarTabStyle
LtsSessionData
LtsUtilsSettings
PUBLIC
LtsUtilsCore
Qt6::Core
Qt6::Widgets
Qt6::Gui
)
NGL_INSTALL_TARGET(LtsWidgets)
#
# Designer-Plugin
#
SET(ltswidgetsplugin_SRCS ltswidgetsplugin.cpp ltswidgetsplugin.json)
NGL_ADD_LIBRARY(WS ltswidgetsplugin MODULE ${ltswidgetsplugin_SRCS})
NGL_TARGET_LINK_LIBRARIES(ltswidgetsplugin LtsWidgets ltsCoordWidget LtsDataView LtsFileDialog LtsReportDisplay svcFlmCommon)
@@ -486,13 +486,13 @@ void LtsDialog::showEvent(QShowEvent *event)
void LtsDialog::tryLockTopic()
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
if (!m_topicInfo.isValid())
return;
if (m_topicInfo.isLocked())
{
WARNING_LOG() << Q_FUNC_INFO << " tried to lock with an already locked topic info, return";
WARNING_LOG(m_logger) << Q_FUNC_INFO << " tried to lock with an already locked topic info, return";
return;
}
@@ -508,7 +508,7 @@ void LtsDialog::tryLockTopic()
bool bIsConnected = isSignalConnected(QMetaMethod::fromSignal(&LtsDialog::signalLockTopic));
DEBUG_LOG() << Q_FUNC_INFO
DEBUG_LOG(m_logger) << Q_FUNC_INFO
<< " signalLockTopic(): "
<< ", TopicName =" << m_topicInfo.topicName()
<< ", entity =" << m_topicInfo.entityId()
@@ -520,7 +520,7 @@ void LtsDialog::tryLockTopic()
m_topicInfo.setLocked();
}
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
void LtsDialog::initTopicLockHandler(const QString &topicName, int entityId)
@@ -535,14 +535,14 @@ void LtsDialog::initTopicLockHandler(const QString &topicName, int entityId)
void LtsDialog::tryLockTopicNew()
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
tryLockTopic();
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
void LtsDialog::tryLockTopicNew(const QString &topicName, int entityId)
{
TRACE_LOG() << Q_FUNC_INFO << " START"
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START"
<< ", topicName='" << topicName << "'"
<< ", entityId=" << entityId;
@@ -550,7 +550,7 @@ void LtsDialog::tryLockTopicNew(const QString &topicName, int entityId)
if (m_topicInfo.entityId() != entityId)
{
DEBUG_LOG() << Q_FUNC_INFO << " topicName='" << topicName << "'"
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " topicName='" << topicName << "'"
<< " change from " << m_topicInfo.entityId() << " to " << entityId;
m_topicInfo.setLocked(false);
}
@@ -561,16 +561,16 @@ void LtsDialog::tryLockTopicNew(const QString &topicName, int entityId)
m_topicInfo.setValid();
tryLockTopic();
TRACE_LOG() << Q_FUNC_INFO << " END"
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END"
<< ", topicName='" << topicName << "'"
<< ", entityId=" << entityId;
}
void LtsDialog::triggerTopicLock()
{
TRACE_LOG() << Q_FUNC_INFO << " START" << " !!trigger!!";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << " !!trigger!!";
tryLockTopic();
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
@@ -43,6 +43,8 @@ public:
void setValid() { m_valid = true; }
private:
NGL::INGLLogger &m_logger;
QString m_topicName;
int m_entityId{0};
bool m_locked{false};
@@ -78,7 +78,7 @@ void Pacemaker::init(DDSConnector::DdsConnector *ddsConnector)
m_dtsCurrentRunningState = ddsConnector->createDTS<DTS::CurrentRunningStateImpl>();
if (!m_dtsCurrentRunningState)
{
WARNING_LOG() << "Can not initialize DTS::CurrentRunningState!";
WARNING_LOG(m_logger) << "Can not initialize DTS::CurrentRunningState!";
return;
}
m_state.pid(QCoreApplication::applicationPid());
@@ -41,10 +41,12 @@ public Q_SLOTS:
void publishState();
private:
NGL::INGLLogger &m_logger;
void init(DDSConnector::DdsConnector *ddsConnector);
void setNewStateInternal(Core::RunningState newState, const QString &errorString = QString());
void addPortInternal(unsigned short number, Core::PortType portType, const QString &properties = QStringLiteral(""));
private:
NGL::INGLLogger &m_logger;
static constexpr const int m_publishTimerDelay = 3000;
CurrentRunningState m_state;
@@ -33,7 +33,7 @@ DdsConnector::DdsConnector(int domainId,
.getNGLLogger("Common.DDSConnector"))
{
initInternal();
DEBUG_LOG() << "DdsConnector ctor: " << m_domainId << "," << m_partitionId << ","<< m_exerciseId << "," << static_cast<int>(m_defaultPartitionType);
DEBUG_LOG(m_logger) << "DdsConnector ctor: " << m_domainId << "," << m_partitionId << ","<< m_exerciseId << "," << static_cast<int>(m_defaultPartitionType);
}
DdsConnector::DdsConnector(int domainId,
@@ -108,7 +108,7 @@ bool DdsConnector::init(const QStringList &qosFileList)
QUrl DdsConnector::getTcpConnectionUrl() const
{
DEBUG_LOG() << this << " gettcpConnectionUrl: " << m_tcpConnectionUrl.toString();
DEBUG_LOG(m_logger) << this << " gettcpConnectionUrl: " << m_tcpConnectionUrl.toString();
return m_tcpConnectionUrl;
}
@@ -180,7 +180,7 @@ std::string DdsConnector::getPartitionString(IDL::PartitionType pt, int partitio
}
NGL::INGLLogger &m_logger = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Common.DDSConnector");
ERROR_LOG() << "Invalid partition type: " << static_cast<int>(pt);
ERROR_LOG(m_logger) << "Invalid partition type: " << static_cast<int>(pt);
return std::string();
}
@@ -204,7 +204,7 @@ void DdsConnector::setDomainParticipant(const dds::domain::DomainParticipant &pa
}
catch (const dds::core::Exception &ex)
{
WARNING_LOG() << "Could not enable DomainParticipant: " << ex.what();
WARNING_LOG(m_logger) << "Could not enable DomainParticipant: " << ex.what();
exit(1);
}
}
@@ -213,7 +213,7 @@ void DdsConnector::setPublisher(Publisher *publisher)
{
if (m_publisher && publisher != m_publisher)
{
WARNING_LOG() << "Trying to set publisher but there is already a publisher set - overwriting!";
WARNING_LOG(m_logger) << "Trying to set publisher but there is already a publisher set - overwriting!";
delete m_publisher;
}
m_publisher = publisher;
@@ -232,7 +232,7 @@ void DdsConnector::setSubscriber(Subscriber *subscriber)
{
if (m_subscriber && subscriber != m_subscriber)
{
WARNING_LOG() << "Trying to set subscriber but there is already a subscriber set - overwriting!";
WARNING_LOG(m_logger) << "Trying to set subscriber but there is already a subscriber set - overwriting!";
delete m_subscriber;
}
m_subscriber = subscriber;
@@ -257,13 +257,13 @@ void DdsConnector::initInternal()
m_defaultPartitionType == IDL::PartitionType::AllExercises)
m_partitionId = -1;
if (m_defaultPartitionType == IDL::PartitionType::Exercise && m_partitionId < 0)
WARNING_LOG() << "Want to subscribe to an exercise, but no exercise Id is given!";
WARNING_LOG(m_logger) << "Want to subscribe to an exercise, but no exercise Id is given!";
if (m_defaultPartitionType == IDL::PartitionType::Global)
{
m_partitionId = 0;
m_exerciseId = 0;
}
INFO_LOG() << "DDSConnector(" << m_domainId << ") for partition: " << m_partitionId
INFO_LOG(m_logger) << "DDSConnector(" << m_domainId << ") for partition: " << m_partitionId
<< " with partition type " << static_cast<int>(m_defaultPartitionType);
@@ -182,9 +182,11 @@ public:
}
private:
NGL::INGLLogger &m_logger;
void initInternal();
void createWaitSetHandler();
private:
NGL::INGLLogger &m_logger;
int m_domainId;
IDL::PartitionType m_defaultPartitionType;
int m_partitionId;
@@ -207,6 +209,7 @@ public:
: m_coherentSet(connector->getDdsPublisher())
{}
private:
NGL::INGLLogger &m_logger;
dds::pub::CoherentSet m_coherentSet;
};
@@ -18,6 +18,7 @@ namespace DDSConnector
class DDSCONNECTOR_EXPORT PubSubBase
{
protected:
NGL::INGLLogger &m_logger;
PubSubBase(const dds::domain::DomainParticipant &domainParticipant,
const std::string &partition,
const char *loggerName);
@@ -81,12 +81,12 @@ public:
{
if (m_subscriberCallback)
{
WARNING_LOG() << "Can not set subscriber callback - already set ...";
WARNING_LOG(m_logger) << "Can not set subscriber callback - already set ...";
return false;
}
if (!m_subscriberListener)
{
WARNING_LOG() << "Can not set subscriber callback - no subscriber listener ...";
WARNING_LOG(m_logger) << "Can not set subscriber callback - no subscriber listener ...";
return false;
}
@@ -94,7 +94,7 @@ public:
if (!m_dataReaderObject)
{
WARNING_LOG() << "Can not set subscriber callback - no data reader object ...";
WARNING_LOG(m_logger) << "Can not set subscriber callback - no data reader object ...";
return false;
}
@@ -193,7 +193,7 @@ protected:
Q_UNUSED(topicType);
if (m_writerState.testAndSetRelaxed(1, 0))
{
DEBUG_LOG() << "Recreate Reader for topic " << topicName
DEBUG_LOG(m_logger) << "Recreate Reader for topic " << topicName
<< ", type name " << DDS::topic_type_name<TopicTypeRead>::value();
if (m_subscriberListener)
m_subscriberListener->removeCallback(m_dataReaderObject->getDataReader(), this);
@@ -202,7 +202,7 @@ protected:
m_subscriberListener->addCallback(m_dataReaderObject->getDataReader(), this);
}
DEBUG_LOG() << "IN droDataAvailable(), topic name: " << topicName
DEBUG_LOG(m_logger) << "IN droDataAvailable(), topic name: " << topicName
<< ", type name " << DDS::topic_type_name<TopicTypeRead>::value()
<< ", this: " << this
<< ", m_dataReaderObject: " << m_dataReaderObject
@@ -235,7 +235,7 @@ protected:
{
if (!droInitOk)
{
ERROR_LOG() << "Error initializing DRO for type " << DDS::topic_type_name<TopicTypeRead>::value();
ERROR_LOG(m_logger) << "Error initializing DRO for type " << DDS::topic_type_name<TopicTypeRead>::value();
delete m_dataReaderObject;
m_dataReaderObject = nullptr;
return false;
@@ -243,13 +243,13 @@ protected:
if (m_subscriberListener)
{
DEBUG_LOG() << "subscriberListener exists, adding type "
DEBUG_LOG(m_logger) << "subscriberListener exists, adding type "
<< DDS::topic_type_name<TopicTypeRead>::value();
m_subscriberListener->addCallback(m_dataReaderObject->getDataReader(), this);
}
else
{
DEBUG_LOG() << "Cannot add DTC to subscriberListener callback - type: "
DEBUG_LOG(m_logger) << "Cannot add DTC to subscriberListener callback - type: "
<< DDS::topic_type_name<TopicTypeRead>::value();
}
m_dataReaderObject->setHaveSubscriberCallback(m_subscriberListener != nullptr);
@@ -36,7 +36,7 @@ namespace DTS
bool write(const TopicType &data,
const dds::core::optional<dds::sub::SampleInfo> &si = dds::core::optional<dds::sub::SampleInfo>()) override final
{
DEBUG_LOG() << "IN write ("
DEBUG_LOG(m_logger) << "IN write ("
<< DDS::topic_type_name<TopicType>::value()
<< ")";
@@ -45,11 +45,11 @@ namespace DTS
if (!m_dataWriterObject->write(data, si))
{
ERROR_LOG() << "Error writing for "
ERROR_LOG(m_logger) << "Error writing for "
<< DDS::topic_type_name<TopicType>::value();
return false;
}
DEBUG_LOG() << "TopicData ("
DEBUG_LOG(m_logger) << "TopicData ("
<< DDS::topic_type_name<TopicType>::value()
<< ") written";
@@ -58,7 +58,7 @@ namespace DTS
bool remove(const TopicType &data, bool errorMsgIfNotExists = true) override final
{
DEBUG_LOG() << "IN remove ("
DEBUG_LOG(m_logger) << "IN remove ("
<< DDS::topic_type_name<TopicType>::value()
<< ")";
@@ -68,11 +68,11 @@ namespace DTS
if (!m_dataWriterObject->remove(data, errorMsgIfNotExists))
{
if (errorMsgIfNotExists)
ERROR_LOG() << "Error removing for "
ERROR_LOG(m_logger) << "Error removing for "
<< DDS::topic_type_name<TopicType>::value();
return false;
}
DEBUG_LOG() << "TopicData ("
DEBUG_LOG(m_logger) << "TopicData ("
<< DDS::topic_type_name<TopicType>::value()
<< ") removed";
@@ -15,8 +15,7 @@
#include <QThread>
DataTopicTests::DataTopicTests()
: m_domainParticipantPub(nullptr)
DataTopicTests::DataTopicTests() : m_domainParticipantPub(nullptr)
, m_domainParticipantSub(nullptr)
, m_domainId(0)
, m_partitionId(1)
@@ -26,12 +25,12 @@ DataTopicTests::DataTopicTests()
, m_subscriberListener(nullptr)
, m_dtcTestPart(nullptr)
, m_mainThreadId(QThread::currentThreadId())
.getNGLLogger("UnitTests.DataTopicTests"))
{
.getNGLLogger("UnitTests.DataTopicTests")),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
if (!DDS::QosProfile::setDefault())
ERROR_LOG() << "Error setting default QoS from xml-file ";
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
DEBUG_LOG() << "Main thread ID is " << m_mainThreadId;
DEBUG_LOG(m_logger) << "Main thread ID is " << m_mainThreadId;
}
DataTopicTests::~DataTopicTests()
@@ -65,7 +64,7 @@ bool DataTopicTests::initPublisher()
partitionQos.name( { partition.toStdString() } );
publisherQos << partitionQos;
DEBUG_LOG() << "Publish on partition " << partition;
DEBUG_LOG(m_logger) << "Publish on partition " << partition;
m_ddsPublisher = dds::pub::Publisher(m_domainParticipantPub, publisherQos);
m_testPart = new DTS::TestParticipantImpl(m_domainParticipantPub, m_ddsPublisher);
@@ -75,8 +74,8 @@ bool DataTopicTests::initPublisher()
bool DataTopicTests::write(const DdsUnitTests::TestParticipant &data)
{
INFO_LOG() << "Publish topic TestParticipant ";
DEBUG_LOG() << "ParticipantId: " << data.location().participantId()
INFO_LOG(m_logger) << "Publish topic TestParticipant ";
DEBUG_LOG(m_logger) << "ParticipantId: " << data.location().participantId()
<< ", equipNo = " << data.location().equipNo();
return m_testPart->write(data);
@@ -88,7 +87,7 @@ bool DataTopicTests::write(const DdsUnitTests::TestParticipant &data)
bool DataTopicTests::initSubscriber()
{
DEBUG_LOG() << "Initialisation DDS (Subscriber/Reader)";
DEBUG_LOG(m_logger) << "Initialisation DDS (Subscriber/Reader)";
m_domainParticipantSub =
dds::domain::DomainParticipant(m_domainId,
@@ -108,7 +107,7 @@ bool DataTopicTests::initSubscriber()
partitionQos.name( partitions );
subscriberQos << partitionQos;
DEBUG_LOG() << "Initialise DTC::SubscriberListener";
DEBUG_LOG(m_logger) << "Initialise DTC::SubscriberListener";
m_subscriberListener = new DDSGeneric::SubscriberListener();
m_ddsSubscriber = dds::sub::Subscriber(m_domainParticipantSub,
subscriberQos,
@@ -142,10 +141,10 @@ void DataTopicTests::deleteSubscriber()
void DataTopicTests::processData(const DdsUnitTests::TestParticipant &instance, const dds::sub::SampleInfo &si)
{
INFO_LOG() << "process data in topic TestParticipant, Sampleinfo: " << si.source_timestamp().sec();
INFO_LOG(m_logger) << "process data in topic TestParticipant, Sampleinfo: " << si.source_timestamp().sec();
DEBUG_LOG() << "participantId: " << instance.location().participantId();
DEBUG_LOG() << "equipNo: " << instance.location().equipNo();
DEBUG_LOG(m_logger) << "participantId: " << instance.location().participantId();
DEBUG_LOG(m_logger) << "equipNo: " << instance.location().equipNo();
m_receivedParticipantData = instance;
@@ -34,6 +34,7 @@ public:
protected:
NGL::INGLLogger &m_logger;
void processData(const DdsUnitTests::TestParticipant &instance, const dds::sub::SampleInfo &si);
Q_SIGNALS:
@@ -33,7 +33,7 @@ DataTopicTestsMain::DataTopicTestsMain()
void DataTopicTestsMain::initTestCase()
{
DEBUG_LOG() <<"DataTopicTestsMain: initTestCase";
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: initTestCase";
m_dtTest = new DataTopicTests();
QVERIFY2(m_dtTest, "Initialisation of DataTopicTest failed");
@@ -46,20 +46,20 @@ void DataTopicTestsMain::initTestCase()
void DataTopicTestsMain::publishTestCase()
{
DEBUG_LOG() <<"DataTopicTestsMain: publish TestParticipant";
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: publish TestParticipant";
m_sentParticipantData.location().participantId(100);
m_sentParticipantData.location().equipNo(1010);
m_sentParticipantData.testId(100);
QVERIFY2(m_dtTest->write(m_sentParticipantData), "Publishing Topic TestParticipant failed");
DEBUG_LOG() <<"DataTopicTestsMain: publish ready";
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: publish ready";
}
void DataTopicTestsMain::subscribeTestCase()
{
DEBUG_LOG() << "IN subscribeTestCase";
DEBUG_LOG(m_logger) << "IN subscribeTestCase";
QTRY_COMPARE(m_participantDataArrivedSpy->count(), 1);
@@ -95,7 +95,7 @@ void DataTopicTestsMain::deleteDataReaderTestCase()
void DataTopicTestsMain::cleanupTestCase()
{
DEBUG_LOG() <<"DataTopicTestsMain: cleanupTestCase";
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: cleanupTestCase";
delete m_dtTest; m_dtTest = nullptr;
delete m_participantDataArrivedSpy; m_participantDataArrivedSpy = nullptr;
}
@@ -30,6 +30,7 @@ private Q_SLOTS:
protected:
NGL::INGLLogger &m_logger;
private:
DdsUnitTests::TestParticipant m_sentParticipantData;
QSignalSpy *m_participantDataArrivedSpy = nullptr;
@@ -27,10 +27,9 @@ int main(int argc, char *argv[])
}
FunctionTopicTests::FunctionTopicTests()
: m_mainThreadId(QThread::currentThreadId())
.getNGLLogger("UnitTests.FunctionTopicTests"))
{
FunctionTopicTests::FunctionTopicTests() : m_mainThreadId(QThread::currentThreadId())
.getNGLLogger("UnitTests.FunctionTopicTests")),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
qRegisterMetaType<DdsUnitTests::FunctionReply>("DdsUnitTests::FunctionReply");
qRegisterMetaType<DdsUnitTests::FunctionReplyWithState>("DdsUnitTests::FunctionReplyWithState");
}
@@ -38,7 +37,7 @@ FunctionTopicTests::FunctionTopicTests()
void FunctionTopicTests::initTestCase()
{
DEBUG_LOG() <<"FunctionTopicTests: initTestCase";
DEBUG_LOG(m_logger) <<"FunctionTopicTests: initTestCase";
const int domainId = 0;
@@ -97,7 +96,7 @@ void FunctionTopicTests::requestWithState()
QSignalSpy spyRequest(this, &FunctionTopicTests::functionTopicRequestFinished);
QSignalSpy spyReply(this, &FunctionTopicTests::functionTopicReply);
DEBUG_LOG() <<"FunctionTopicTests: request";
DEBUG_LOG(m_logger) <<"FunctionTopicTests: request";
DdsUnitTests::FunctionRequestWithState data;
@@ -125,7 +124,7 @@ void FunctionTopicTests::requestTestCase2()
QSignalSpy spyRequest(this, &FunctionTopicTests::functionTopicRequestFinished);
QSignalSpy spyReply(this, &FunctionTopicTests::functionTopicReply);
DEBUG_LOG() <<"FunctionTopicTests: request";
DEBUG_LOG(m_logger) <<"FunctionTopicTests: request";
DdsUnitTests::FunctionRequest data;
@@ -149,7 +148,7 @@ void FunctionTopicTests::requestTestCase2()
void FunctionTopicTests::cleanupTestCase()
{
DEBUG_LOG() <<"FunctionTopicTests: cleanupTestCase";
DEBUG_LOG(m_logger) <<"FunctionTopicTests: cleanupTestCase";
m_fts = nullptr;
m_ftc = nullptr;
@@ -165,7 +164,7 @@ void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity
{
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
INFO_LOG() << "Got function topic request (with status member)";
INFO_LOG(m_logger) << "Got function topic request (with status member)";
m_requestTopicWithState = request;
QCOMPARE(m_requestTopicWithState.id(), 1);
QCOMPARE(m_requestTopicWithState.info().get(), std::string("Test request"));
@@ -173,7 +172,7 @@ void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity
DdsUnitTests::FunctionReplyWithState reply;
DEBUG_LOG() << "Send sample with status REPLY_COMPLETED";
DEBUG_LOG(m_logger) << "Send sample with status REPLY_COMPLETED";
reply.id(1);
reply.errorString("Hello");
reply.replyState(Core::FtReplyState::Completed);
@@ -191,7 +190,7 @@ void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity
{
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
INFO_LOG() << "Got function topic request (without status member)";
INFO_LOG(m_logger) << "Got function topic request (without status member)";
m_requestTopic = request;
@@ -214,7 +213,7 @@ void FunctionTopicTests::slotRequestedData(const DdsUnitTests::FunctionTopicTest
Q_UNUSED(seqNo);
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
INFO_LOG() << "Got reply from FTS: " << reply.replyState();
INFO_LOG(m_logger) << "Got reply from FTS: " << reply.replyState();
m_replyTopicWithState = reply;
@@ -48,9 +48,11 @@ protected Q_SLOTS:
const DdsUnitTests::FunctionRequestWithState &request);
private:
NGL::INGLLogger &m_logger;
void requestWithState();
private:
NGL::INGLLogger &m_logger;
std::unique_ptr<FTS::FunctionTopicTest> m_fts;
std::unique_ptr<FTS::FunctionTopicTestWithState> m_ftsWS;
@@ -38,7 +38,7 @@ GenericDataTests::GenericDataTests()
void GenericDataTests::initTestCase()
{
DEBUG_LOG() <<"GenericDataTests: initTestCase";
DEBUG_LOG(m_logger) <<"GenericDataTests: initTestCase";
m_init = new Initialisation();
@@ -81,7 +81,7 @@ void GenericDataTests::initDWTestCase()
void GenericDataTests::dataWriterTestCase()
{
DEBUG_LOG() <<"GenericDataTests: dataWriter";
DEBUG_LOG(m_logger) <<"GenericDataTests: dataWriter";
DdsUnitTests::SpatialData data;
@@ -125,7 +125,7 @@ void GenericDataTests::dataWriterTestCase()
void GenericDataTests::dataReaderTestCase()
{
DEBUG_LOG() << "GenericDataTests: dataReader";
DEBUG_LOG(m_logger) << "GenericDataTests: dataReader";
QTRY_COMPARE(m_spatialData.equipNo(), 999);
@@ -136,7 +136,7 @@ void GenericDataTests::dataReaderTestCase()
bool bSeenUnreadSamples = false;
dds::sub::LoanedSamples<DdsUnitTests::TestParticipant> vecTp = m_dataReader->readAlive(bSeenUnreadSamples);
INFO_LOG() <<"vecTp size: " << vecTp.length();
INFO_LOG(m_logger) <<"vecTp size: " << vecTp.length();
QCOMPARE(vecTp.length(), static_cast<decltype(vecTp.length())>(5));
QCOMPARE(vecTp[0].data().id(), 10000);
QCOMPARE(vecTp[1].data().id(), 11000);
@@ -145,7 +145,7 @@ void GenericDataTests::dataReaderTestCase()
QCOMPARE(vecTp[4].data().id(), 11111);
dds::sub::LoanedSamples<DdsUnitTests::TestParticipant> vecTpLoaned = m_dataReader->takeAlive(bSeenUnreadSamples);
INFO_LOG() <<"vecTpLoaned size: " << vecTp.length();
INFO_LOG(m_logger) <<"vecTpLoaned size: " << vecTp.length();
QCOMPARE(vecTpLoaned.length(), static_cast<decltype(vecTpLoaned.length())>(5));
QCOMPARE(vecTpLoaned[0].data().id(), 10000);
QCOMPARE(vecTpLoaned[1].data().id(), 11000);
@@ -177,7 +177,7 @@ void GenericDataTests::deleteDataReaderTestCase()
void GenericDataTests::cleanupTestCase()
{
DEBUG_LOG() <<"GenericDataTests: cleanupTestCase";
DEBUG_LOG(m_logger) <<"GenericDataTests: cleanupTestCase";
if (m_dataReader)
{
m_init->getSubscriberListener()->removeCallback(m_dataReader->getDataReader(), this);
@@ -198,21 +198,21 @@ void GenericDataTests::cleanupTestCase()
void GenericDataTests::processData(const DdsUnitTests::SpatialData &data, DataModification modType)
{
DEBUG_LOG() << "SpatialData: equipNo = " << data.equipNo() << " modType: " << modType;
DEBUG_LOG(m_logger) << "SpatialData: equipNo = " << data.equipNo() << " modType: " << modType;
m_spatialData = data;
}
void GenericDataTests::processData(const DdsUnitTests::TestParticipant &data, const dds::sub::SampleInfo &si)
{
Q_UNUSED(si);
DEBUG_LOG() << "TestParticipant: equipNo = " << data.location().equipNo();
DEBUG_LOG(m_logger) << "TestParticipant: equipNo = " << data.location().equipNo();
m_testPart = data;
}
void GenericDataTests::droDataAvailable(const std::string &topicType, const std::string &topicName)
{
Q_UNUSED(topicName)
DEBUG_LOG() << "IN droDataAvailable: type = " << topicType;
DEBUG_LOG(m_logger) << "IN droDataAvailable: type = " << topicType;
if (topicType == "DdsUnitTests::TestParticipant")
{
m_init->getSubscriberListener()->enableCallback(m_dataReader->getDataReader(), this);
@@ -34,6 +34,7 @@ private Q_SLOTS:
void cleanupTestCase();
protected:
NGL::INGLLogger &m_logger;
void droDataAvailable(const std::string &topicType, const std::string &topicName) override;
void noWriterAnymore(const std::string &topicType, const std::string &topicName) override
{
@@ -8,18 +8,17 @@
#include <Lts/Common/ProjectConfig/project_defines.h>
Initialisation::Initialisation()
: m_domainParticipant(nullptr)
Initialisation::Initialisation() : m_domainParticipant(nullptr)
, m_domainParticipantSub(nullptr)
, m_domainId(0)
, m_exerciseId(-1)
, m_ddsPublisher(nullptr)
, m_ddsSubscriber(nullptr)
, m_subListener(new DDSGeneric::SubscriberListener)
.getNGLLogger("UnitTests.Initialisation"))
{
.getNGLLogger("UnitTests.Initialisation")),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
if (!DDS::QosProfile::setDefault())
ERROR_LOG() << "Error setting default QoS from xml-file ";
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
}
@@ -52,7 +51,7 @@ bool Initialisation::initDDS(int domainId, int exerciseId, PubSub pubsub)
{
dds::pub::qos::PublisherQos publisherQos = m_domainParticipant.default_publisher_qos();
DEBUG_LOG() << "Publish on partition " << IDL::exercisePartition(exerciseId);
DEBUG_LOG(m_logger) << "Publish on partition " << IDL::exercisePartition(exerciseId);
dds::core::policy::Partition partitionQos;
@@ -74,7 +73,7 @@ bool Initialisation::initDDS(int domainId, int exerciseId, PubSub pubsub)
dds::sub::qos::SubscriberQos subscriberQos = domainPart.default_subscriber_qos();
DEBUG_LOG() << "Subsribing on partition " << IDL::exercisePartition(exerciseId);
DEBUG_LOG(m_logger) << "Subsribing on partition " << IDL::exercisePartition(exerciseId);
dds::core::policy::Partition partitionQos;
@@ -33,6 +33,7 @@ public:
DDSGeneric::SubscriberListener *getSubscriberListener() { return m_subListener; }
private:
NGL::INGLLogger &m_logger;
dds::domain::DomainParticipant m_domainParticipant;
dds::domain::DomainParticipant m_domainParticipantSub;
int m_domainId;
@@ -100,7 +100,7 @@ public:
DDS::QosProfile::print(m_requesterParams.datareader_qos(), m_logger);
DDS::QosProfile::print(m_requesterParams.datawriter_qos(), m_logger);
DEBUG_LOG() << "=> Static request using request/reply topic names: "
DEBUG_LOG(m_logger) << "=> Static request using request/reply topic names: "
<< TopicNameHelper::requestTopicName()
<< ", reply: "
<< TopicNameHelper::replyTopicName();
@@ -395,13 +395,13 @@ private:
bool inProgress = true;
while (inProgress && isRun())
{
DEBUG_LOG() << "Waiting for reply ";
DEBUG_LOG(m_logger) << "Waiting for reply ";
connext::Sample<ReplyTopic> reply;
if (!requester.receive_reply(reply, MAX_WAIT))
{
WARNING_LOG() << "Timed out waiting for reply";
WARNING_LOG(m_logger) << "Timed out waiting for reply";
sendError(request, 3);
return;
}
@@ -412,14 +412,14 @@ private:
if (request.sample.info().identity() != reply.info()->related_original_publication_virtual_sample_identity())
{
INFO_LOG() << "#receiveReply - outdated. sample id: " << connext::DebugInfo::toReadable(request.sample.info().identity())
INFO_LOG(m_logger) << "#receiveReply - outdated. sample id: " << connext::DebugInfo::toReadable(request.sample.info().identity())
<< ", virutal sample id: " << connext::DebugInfo::toReadable(reply.info()->related_original_publication_virtual_sample_identity());
continue;
}
inProgress = isInProgress(reply);
if (request.replySlot.isValid())
{
INFO_LOG() << "#receiveReply for " << TopicNameHelper::replyTopicTypeName();
INFO_LOG(m_logger) << "#receiveReply for " << TopicNameHelper::replyTopicTypeName();
request.replySlot.invoke(m_objToInform, Qt::QueuedConnection,
QArgument<ReplyTopic>(TopicNameHelper::replyTopicTypeName(), reply.data()),
@@ -428,13 +428,13 @@ private:
}
else
{
WARNING_LOG() << "reply slot doesn't exist for " << dds::topic::topic_type_name<ReplyTopic>::value();
WARNING_LOG(m_logger) << "reply slot doesn't exist for " << dds::topic::topic_type_name<ReplyTopic>::value();
}
if (!inProgress)
return;
}
else
WARNING_LOG() << "No valid data available ";
WARNING_LOG(m_logger) << "No valid data available ";
@@ -457,7 +457,7 @@ private:
if (!requester.receive_reply(reply, MAX_WAIT))
{
WARNING_LOG() << "Timeout while waiting for reply!";
WARNING_LOG(m_logger) << "Timeout while waiting for reply!";
throw std::runtime_error("Timeout while waiting for reply!");
}
@@ -465,7 +465,7 @@ private:
if (!reply.info().valid())
{
WARNING_LOG() << "No valid data available!";
WARNING_LOG(m_logger) << "No valid data available!";
throw std::runtime_error("No valid data available!");
}
@@ -473,7 +473,7 @@ private:
if (request.sample.info().identity() != reply.info()->related_original_publication_virtual_sample_identity())
{
INFO_LOG() << "#receiveReply - outdated. sample id: " << connext::DebugInfo::toReadable(request.sample.info().identity())
INFO_LOG(m_logger) << "#receiveReply - outdated. sample id: " << connext::DebugInfo::toReadable(request.sample.info().identity())
<< ", virutal sample id: " << connext::DebugInfo::toReadable(reply.info()->related_original_publication_virtual_sample_identity());
continue;
}
@@ -481,10 +481,10 @@ private:
Q_ASSERT(!isInProgress(reply));
if (isInProgress(reply))
{
ERROR_LOG() << "Used ModernRequest for a request with FtReplyState! Your data will most likely be imcomplete!";
ERROR_LOG(m_logger) << "Used ModernRequest for a request with FtReplyState! Your data will most likely be imcomplete!";
}
INFO_LOG() << "#receiveReply for " << TopicNameHelper::replyTopicTypeName();
INFO_LOG(m_logger) << "#receiveReply for " << TopicNameHelper::replyTopicTypeName();
request.promise.set_value(reply.data());
@@ -312,7 +312,7 @@ public:
m_contentFilteredTopic->filter(dds::topic::Filter(filterContent.data()));
}
DEBUG_LOG() << "content filter for topic "
DEBUG_LOG(m_logger) << "content filter for topic "
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
<< " - related_sample_identity should be: "
<< writerGuid;
@@ -349,7 +349,7 @@ public:
m_dataWriter->write(request.data(), request.info());
const rti::core::SampleIdentity currentSampleIdentity = request.info().identity();
DEBUG_LOG() << "send_request for topic "
DEBUG_LOG(m_logger) << "send_request for topic "
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
<< ", m_currentSampleIdentity: "
<< DebugInfo::toReadable(currentSampleIdentity);
@@ -369,12 +369,12 @@ public:
if (m_dataReader->take(reply.data(), reply.info()) && reply.info().valid())
{
DEBUG_LOG() << "receive_reply for topic "
DEBUG_LOG(m_logger) << "receive_reply for topic "
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
<< ", SampleIdentity - original publication virtual: "
<< DebugInfo::toReadable(reply.info()->original_publication_virtual_sample_identity());
DEBUG_LOG() << "receive_reply for topic "
DEBUG_LOG(m_logger) << "receive_reply for topic "
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
<< ", SampleIdentity - related original: "
<< DebugInfo::toReadable(reply.info()->related_original_publication_virtual_sample_identity());
@@ -387,7 +387,7 @@ public:
dds::core::cond::WaitSet::ConditionSeq activeConditionsSeq = waitset.wait(duration);
if (activeConditionsSeq.empty())
{
ERROR_LOG() << "Bailing out!";
ERROR_LOG(m_logger) << "Bailing out!";
break;
}
}
@@ -398,7 +398,7 @@ public:
if (!m_curInstanceHandle.is_nil())
{
DEBUG_LOG() << "Keyed topic - disposing instance: "
DEBUG_LOG(m_logger) << "Keyed topic - disposing instance: "
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name();
m_dataWriter.dispose_instance(m_curInstanceHandle);
}
@@ -448,7 +448,7 @@ public:
const rti::core::SampleIdentity &identity,
bool bLastSample = true)
{
DEBUG_LOG() << "send_reply for topic "
DEBUG_LOG(m_logger) << "send_reply for topic "
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
<< ", sampleIdentity: " << DebugInfo::toReadable(identity);
@@ -459,7 +459,7 @@ public:
sf |= rti::core::SampleFlag::intermediate_reply_sequence();
reply.info().flag(sf);
reply.info().related_sample_identity(identity);
DEBUG_LOG() << "send_reply for topic "
DEBUG_LOG(m_logger) << "send_reply for topic "
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
<< ", related sampleIdentity: " << DebugInfo::toReadable(reply.info().related_sample_identity());
@@ -473,7 +473,7 @@ public:
if (request.info().valid())
{
DEBUG_LOG() << "receive_request for topic "
DEBUG_LOG(m_logger) << "receive_request for topic "
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
<< ", sampleIdentity publication_virtual_sample_identity: "
<< DebugInfo::toReadable(request.info()->publication_virtual_sample_identity())
@@ -131,7 +131,7 @@ public:
{
if (m_subscriberCallback)
{
WARNING_LOG() << "Can not set subscriber callback - already set ...";
WARNING_LOG(m_logger) << "Can not set subscriber callback - already set ...";
return false;
}
@@ -157,7 +157,7 @@ public:
bool sendReply(const rti::core::SampleIdentity &requestIdentity, const QVector<ReplyTopic> &replyData) override final
{
DEBUG_LOG() << TopicNameHelper::requestTopicName() << " - IN sendReply";
DEBUG_LOG(m_logger) << TopicNameHelper::requestTopicName() << " - IN sendReply";
for(int i = 0; i < replyData.size(); ++i)
{
@@ -184,7 +184,7 @@ protected:
void processRequest(const connext::Sample<RequestTopic> &request)
{
DEBUG_LOG() << TopicNameHelper::requestTopicName() << " - processRequest: "
DEBUG_LOG(m_logger) << TopicNameHelper::requestTopicName() << " - processRequest: "
<< connext::DebugInfo::toReadable(request.identity());
qint64 age = qAbs(qint64(request.info().source_timestamp().to_secs()) - time(nullptr));
@@ -203,7 +203,7 @@ protected:
s.append("...");
}
DEBUG_LOG() << "received a request for topic "
DEBUG_LOG(m_logger) << "received a request for topic "
<< TopicNameHelper::requestTopicName()
<< " but it was outdated - ignoring. "
<< " local time: " << (time(nullptr) - 10) << "[s], source timestamp: "
@@ -226,7 +226,7 @@ protected:
void processRequests() override
{
DEBUG_LOG() << TopicNameHelper::requestTopicName() << " - processRequests";
DEBUG_LOG(m_logger) << TopicNameHelper::requestTopicName() << " - processRequests";
while (true)
{
@@ -235,21 +235,21 @@ protected:
std::lock_guard<std::mutex> l(m_requestMutex);
if (m_requests.empty())
{
DEBUG_LOG() << "No more requests";
DEBUG_LOG(m_logger) << "No more requests";
return;
}
DEBUG_LOG() << TopicNameHelper::requestTopicName() << " - read one request for ";
DEBUG_LOG(m_logger) << TopicNameHelper::requestTopicName() << " - read one request for ";
request = m_requests.front();
m_requests.pop();
}
if (!request.info().valid())
{
WARNING_LOG() << TopicNameHelper::requestTopicName() << " - No valid data";
WARNING_LOG(m_logger) << TopicNameHelper::requestTopicName() << " - No valid data";
continue;
}
processRequest(request);
}
DEBUG_LOG() << TopicNameHelper::requestTopicName() << " - processRequests finished";
DEBUG_LOG(m_logger) << TopicNameHelper::requestTopicName() << " - processRequests finished";
}
bool enqueueRequests() override
@@ -53,19 +53,19 @@ public:
const std::string &specialTopicName,
const StructType &structType)
{
DEBUG_LOG() << "IN DynamicDataReader::create ("
DEBUG_LOG(m_logger) << "IN DynamicDataReader::create ("
<< m_structType->name()
<< ")";
if (domainParticipant == nullptr)
{
ERROR_LOG() << "DomainParticipant does not exist ";
ERROR_LOG(m_logger) << "DomainParticipant does not exist ";
return false;
}
if (m_ddsTopic != nullptr)
{
ERROR_LOG() << "Type '"
ERROR_LOG(m_logger) << "Type '"
<< m_structType->name()
<< "' already created";
return false;
@@ -84,7 +84,7 @@ public:
DDS::Helper::getShortTopicName(m_structType->name()) :
specialTopicName;
DEBUG_LOG() << "Creating topic " << topicName << " with type: "
DEBUG_LOG(m_logger) << "Creating topic " << topicName << " with type: "
<< m_structType->name();
m_ddsTopic = dds::topic::find<dds::topic::Topic<DynamicData>>(domainParticipant, topicName);
@@ -97,16 +97,16 @@ public:
m_ddsTopic = dds::topic::Topic<DynamicData>(domainParticipant, topicName, structType);
}
DEBUG_LOG() << "m_ddsTopic created: " << m_ddsTopic.name();
DEBUG_LOG(m_logger) << "m_ddsTopic created: " << m_ddsTopic.name();
if (m_logger.isDebugEnabled())
{
dds::sub::qos::SubscriberQos subscriberQoS = ddsSubscriber.qos();
dds::core::policy::Partition partition = subscriberQoS.policy<dds::core::policy::Partition>();
dds::core::StringSeq parititionNames = partition.name();
DEBUG_LOG() << "Subscribing partitions: " << parititionNames.size();
DEBUG_LOG(m_logger) << "Subscribing partitions: " << parititionNames.size();
for (const std::string &name : parititionNames)
DEBUG_LOG() << "SubscriberQoS: partition name = " << name;
DEBUG_LOG(m_logger) << "SubscriberQoS: partition name = " << name;
}
dds::sub::qos::DataReaderQos dataReaderQos = ddsSubscriber.default_datareader_qos();
@@ -129,7 +129,7 @@ public:
if (m_dataReader == nullptr)
{
ERROR_LOG() << "Creating dataReader for '" << topicName << "' with type: '"
ERROR_LOG(m_logger) << "Creating dataReader for '" << topicName << "' with type: '"
<< m_structType->name()
<< "' failed";
return false;
@@ -138,11 +138,11 @@ public:
}
catch (const dds::core::Exception &ex)
{
ERROR_LOG() << ex.what();
ERROR_LOG(m_logger) << ex.what();
return false;
}
DEBUG_LOG() << "dataReader created ("
DEBUG_LOG(m_logger) << "dataReader created ("
<< m_structType->name()
<< ")";
@@ -153,7 +153,7 @@ public:
bool hasSamples() const
{
qint64 sampleSize = m_dataReader->datareader_cache_status().sample_count();
DEBUG_LOG() << "sampleSize = " << sampleSize;
DEBUG_LOG(m_logger) << "sampleSize = " << sampleSize;
return sampleSize > 0;
}
@@ -162,7 +162,7 @@ public:
{
dds::sub::LoanedSamples<DynamicData> samples =
m_dataReader.select().state(dds::sub::status::InstanceState::alive()).read();
TRACE_LOG() << "readAlive for " << DDS::topic_type_name<TopicType>::value()
TRACE_LOG(m_logger) << "readAlive for " << DDS::topic_type_name<TopicType>::value()
<< ", count: " << samples.length()
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
@@ -175,7 +175,7 @@ public:
{
dds::sub::LoanedSamples<DynamicData> samples =
m_dataReader.select().state(dds::sub::status::InstanceState::alive()).take();
TRACE_LOG() << "takeAlive for " << DDS::topic_type_name<TopicType>::value()
TRACE_LOG(m_logger) << "takeAlive for " << DDS::topic_type_name<TopicType>::value()
<< ", count: " << samples.length()
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
@@ -187,7 +187,7 @@ public:
{
dds::sub::LoanedSamples<DynamicData> samples =
m_dataReader.select().state(dds::sub::status::InstanceState::not_alive_disposed()).take();
TRACE_LOG() << "takeDisposed for " << DDS::topic_type_name<TopicType>::value()
TRACE_LOG(m_logger) << "takeDisposed for " << DDS::topic_type_name<TopicType>::value()
<< ", count: " << samples.length()
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
return samples;
@@ -196,18 +196,18 @@ public:
template<typename C>
bool read(C callbackFunc)
{
DEBUG_LOG() << "IN read ("
DEBUG_LOG(m_logger) << "IN read ("
<< DDS::topic_type_name<TopicType>::value()
<< "), this: " << this << ", instance handle " << m_dataReader.instance_handle();
if (m_dataReader == nullptr || m_ddsTopic == nullptr)
{
ERROR_LOG() << "No dataReader initialised ";
ERROR_LOG(m_logger) << "No dataReader initialised ";
return false;
}
if (!isValid(callbackFunc))
{
ERROR_LOG() << "No subscriber set for "
ERROR_LOG(m_logger) << "No subscriber set for "
<< DDS::topic_type_name<TopicType>::value();
return false;
}
@@ -216,7 +216,7 @@ public:
dds::sub::LoanedSamples<DynamicData> samples = m_dataReader.select().state(dds::sub::status::DataState::new_data()).read();
DEBUG_LOG() << "got " << samples.length() + m_newSamplesDuringRead.size() << " samples from reader for "
DEBUG_LOG(m_logger) << "got " << samples.length() + m_newSamplesDuringRead.size() << " samples from reader for "
<< DDS::topic_type_name<TopicType>::value();
for (const auto &sample : samples)
@@ -297,7 +297,7 @@ private:
if (samples.length() == 0)
return false;
DEBUG_LOG() << "got " << samples.length() << " disposed instances from reader for "
DEBUG_LOG(m_logger) << "got " << samples.length() << " disposed instances from reader for "
<< m_ddsTopic.name();
for (const auto &sample : samples)
@@ -47,19 +47,19 @@ public:
const std::string &topicName = DDS::Helper::getShortTopicName(DDS::topic_type_name<TopicType>::value()),
bool bCreateDataReader = true)
{
DEBUG_LOG() << "IN GenericDataReader::create ("
DEBUG_LOG(m_logger) << "IN GenericDataReader::create ("
<< DDS::topic_type_name<TopicType>::value()
<< "), this: " << this;
if (domainParticipant == nullptr)
{
ERROR_LOG() << "DomainParticipant does not exist ";
ERROR_LOG(m_logger) << "DomainParticipant does not exist ";
return false;
}
if (m_ddsTopic != nullptr)
{
ERROR_LOG() << "Type '"
ERROR_LOG(m_logger) << "Type '"
<< DDS::topic_type_name<TopicType>::value()
<< "' already created";
return false;
@@ -67,7 +67,7 @@ public:
try
{
DEBUG_LOG() << "Creating read topic " << topicName << " with type: "
DEBUG_LOG(m_logger) << "Creating read topic " << topicName << " with type: "
<< DDS::topic_type_name<TopicType>::value();
m_ddsTopic = dds::topic::find<DataTopic>(domainParticipant, topicName);
@@ -79,9 +79,9 @@ public:
dds::sub::qos::SubscriberQos subscriberQoS = ddsSubscriber.qos();
dds::core::policy::Partition partition = subscriberQoS.policy<dds::core::policy::Partition>();
dds::core::StringSeq parititionNames = partition.name();
DEBUG_LOG() << "Subscribing partitions: " << parititionNames.size();
DEBUG_LOG(m_logger) << "Subscribing partitions: " << parititionNames.size();
for (const std::string &name : parititionNames)
DEBUG_LOG() << " partition name = " << name;
DEBUG_LOG(m_logger) << " partition name = " << name;
}
if (bCreateDataReader)
@@ -90,7 +90,7 @@ public:
m_dataReader = DataReader(ddsSubscriber, m_ddsTopic, drQos);
if (m_dataReader == nullptr)
{
ERROR_LOG() << "Creating dataReader for '" << topicName << "' with type: '"
ERROR_LOG(m_logger) << "Creating dataReader for '" << topicName << "' with type: '"
<< DDS::topic_type_name<TopicType>::value()
<< "' failed";
return false;
@@ -99,11 +99,11 @@ public:
}
catch (const dds::core::Exception &ex)
{
ERROR_LOG() << ex.what();
ERROR_LOG(m_logger) << ex.what();
return false;
}
DEBUG_LOG() << "dataReader created ("
DEBUG_LOG(m_logger) << "dataReader created ("
<< DDS::topic_type_name<TopicType>::value()
<< ")";
@@ -114,7 +114,7 @@ public:
bool hasSamples() const
{
qint64 sampleSize = m_dataReader->datareader_cache_status().sample_count();
DEBUG_LOG() << "sampleSize = " << sampleSize;
DEBUG_LOG(m_logger) << "sampleSize = " << sampleSize;
return sampleSize > 0;
}
@@ -124,7 +124,7 @@ public:
{
dds::sub::LoanedSamples<TopicTypeRead> samples =
m_dataReader.select().state(dds::sub::status::InstanceState::alive()).read();
TRACE_LOG() << "readAlive for " << DDS::topic_type_name<TopicType>::value()
TRACE_LOG(m_logger) << "readAlive for " << DDS::topic_type_name<TopicType>::value()
<< ", count: " << samples.length()
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
@@ -138,7 +138,7 @@ public:
{
dds::sub::LoanedSamples<TopicTypeRead> samples =
m_dataReader.select().state(dds::sub::status::InstanceState::alive()).take();
TRACE_LOG() << "takeAlive for " << DDS::topic_type_name<TopicType>::value()
TRACE_LOG(m_logger) << "takeAlive for " << DDS::topic_type_name<TopicType>::value()
<< ", count: " << samples.length()
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
@@ -150,7 +150,7 @@ public:
{
dds::sub::LoanedSamples<TopicTypeRead> samples =
m_dataReader.select().state(dds::sub::status::InstanceState::not_alive_disposed()).take();
TRACE_LOG() << "takeDisposed for " << DDS::topic_type_name<TopicType>::value()
TRACE_LOG(m_logger) << "takeDisposed for " << DDS::topic_type_name<TopicType>::value()
<< ", count: " << samples.length()
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
return samples;
@@ -159,18 +159,18 @@ public:
template<typename C>
bool read(C callbackFunc)
{
DEBUG_LOG() << "IN read ("
DEBUG_LOG(m_logger) << "IN read ("
<< DDS::topic_type_name<TopicType>::value()
<< "), this: " << this << ", instance handle " << m_dataReader.instance_handle();
if (m_dataReader == nullptr)
{
ERROR_LOG() << "No dataReader initialised ";
ERROR_LOG(m_logger) << "No dataReader initialised ";
return false;
}
if (!isValid(callbackFunc))
{
ERROR_LOG() << "No subscriber set for "
ERROR_LOG(m_logger) << "No subscriber set for "
<< DDS::topic_type_name<TopicType>::value();
return false;
}
@@ -189,7 +189,7 @@ public:
}
}
DEBUG_LOG() << "got " << samples.size() + m_newSamplesDuringRead.size() << " samples from reader for "
DEBUG_LOG(m_logger) << "got " << samples.size() + m_newSamplesDuringRead.size() << " samples from reader for "
<< DDS::topic_type_name<TopicType>::value();
for (const SampleStruct &ss : samples)
@@ -265,7 +265,7 @@ private:
if (samples.length() == 0)
return false;
DEBUG_LOG() << "got " << samples.length() << " disposed instances from reader for "
DEBUG_LOG(m_logger) << "got " << samples.length() << " disposed instances from reader for "
<< DDS::topic_type_name<TopicType>::value();
for (const auto &sample : samples)
@@ -32,19 +32,19 @@ public:
const dds::pub::Publisher &ddsPublisher,
const std::string &topicName = DDS::Helper::getShortTopicName(DDS::topic_type_name<TopicType>::value()))
{
DEBUG_LOG() << "IN GenericDataWriter::create ("
DEBUG_LOG(m_logger) << "IN GenericDataWriter::create ("
<< DDS::topic_type_name<TopicType>::value()
<< ")";
if (participant == nullptr)
{
ERROR_LOG() << "Participant not available, aborting. ";
ERROR_LOG(m_logger) << "Participant not available, aborting. ";
return false;
}
if (m_ddsTopic != nullptr)
{
ERROR_LOG() << "Type '"
ERROR_LOG(m_logger) << "Type '"
<< DDS::topic_type_name<TopicType>::value()
<< "' already created";
return false;
@@ -52,7 +52,7 @@ public:
try {
DEBUG_LOG() << "Creating write topic " << topicName << " with type: "
DEBUG_LOG(m_logger) << "Creating write topic " << topicName << " with type: "
<< DDS::topic_type_name<TopicType>::value();
m_ddsTopic = dds::topic::find<DataTopic>(participant, topicName);
@@ -65,7 +65,7 @@ public:
if (m_dataWriter == nullptr)
{
ERROR_LOG() << "Initialisation of "
ERROR_LOG(m_logger) << "Initialisation of "
<< DDS::topic_type_name<TopicType>::value()
<< " failed ";
return false;
@@ -74,11 +74,11 @@ public:
}
catch ( const dds::core::Exception &ex )
{
ERROR_LOG() << ex.what();
ERROR_LOG(m_logger) << ex.what();
return false;
}
DEBUG_LOG() << "dataWriter created ("
DEBUG_LOG(m_logger) << "dataWriter created ("
<< DDS::topic_type_name<TopicType>::value()
<< ")";
@@ -88,12 +88,12 @@ public:
bool write(const TopicType &data,
const dds::core::optional<dds::sub::SampleInfo> &si = dds::core::optional<dds::sub::SampleInfo>())
{
DEBUG_LOG() << "IN write ("
DEBUG_LOG(m_logger) << "IN write ("
<< DDS::topic_type_name<TopicType>::value()
<< ") ";
if (m_dataWriter == nullptr) {
ERROR_LOG() << "No dataWriter initialised ";
ERROR_LOG(m_logger) << "No dataWriter initialised ";
return false;
}
@@ -112,18 +112,18 @@ public:
bool remove(const TopicType &data, bool errorMsgIfNotExists = true)
{
DEBUG_LOG() << "IN remove ("
DEBUG_LOG(m_logger) << "IN remove ("
<< DDS::topic_type_name<TopicType>::value()
<< ") ";
if (m_dataWriter == nullptr) {
ERROR_LOG() << "No dataWriter initialised ";
ERROR_LOG(m_logger) << "No dataWriter initialised ";
return false;
}
const dds::core::InstanceHandle ih = m_dataWriter.lookup_instance(data);
if (ih.is_nil()) {
if (errorMsgIfNotExists)
ERROR_LOG() << "Could not find instance for topic "
ERROR_LOG(m_logger) << "Could not find instance for topic "
<< DDS::topic_type_name<TopicType>::value()
<< " for unregistering!";
return false;
@@ -13,7 +13,7 @@ SubscriberListener::SubscriberListener()
, m_logger(DDS::getLogger("SubscriberListener", DDS::DataType::DATA_TOPIC_CLIENT))
{
qRegisterMetaType<std::string>("std::string");
DEBUG_LOG() << "SubscriberListener initialized, this " << this;
DEBUG_LOG(m_logger) << "SubscriberListener initialized, this " << this;
}
void SubscriberListener::addCallback(const std::string &topicName,
@@ -21,7 +21,7 @@ void SubscriberListener::addCallback(const std::string &topicName,
const dds::sub::AnyDataReader &dataReader,
SubscriberListenerCallback *cb)
{
DEBUG_LOG() << "addSubscriberCallback for " << topicName << ", type " << topicTypeName
DEBUG_LOG(m_logger) << "addSubscriberCallback for " << topicName << ", type " << topicTypeName
<< ", cb " << cb << ", this " << this;
QWriteLocker l(&m_accessLock);
if (m_bPrepareForShutdown)
@@ -34,7 +34,7 @@ void SubscriberListener::removeCallback(const std::string &topicName,
const dds::sub::AnyDataReader &dataReader,
SubscriberListenerCallback *cb)
{
DEBUG_LOG() << "IN removeSubscriberCallback for " << topicName << ", type " << topicTypeName
DEBUG_LOG(m_logger) << "IN removeSubscriberCallback for " << topicName << ", type " << topicTypeName
<< ", cb " << cb << ", this " << this;
QWriteLocker l(&m_accessLock);
m_droCallbacks.remove(std::make_pair(topicName, topicTypeName), fillData(dataReader, cb));
@@ -68,7 +68,7 @@ void SubscriberListener::enaDisaCallback(const std::string &topicName,
}
if (!bFound)
WARNING_LOG() << "Can not " << (bEnable ? "enable" : "disable")
WARNING_LOG(m_logger) << "Can not " << (bEnable ? "enable" : "disable")
<< " callback for " << topicName << ", type " << topicTypeName
<< ", cb " << cb << ", this " << this << " - not found!";
}
@@ -91,7 +91,7 @@ void SubscriberListener::on_data_available(dds::sub::AnyDataReader &reader)
QReadLocker l(&m_accessLock);
if (m_droCallbacks.isEmpty() || m_bPrepareForShutdown)
return;
DEBUG_LOG() << "Data available for " << topicName << ", type " << topicTypeName << ", this " << this;
DEBUG_LOG(m_logger) << "Data available for " << topicName << ", type " << topicTypeName << ", this " << this;
QMultiMap<std::pair<std::string, std::string>, cbData>::iterator cbIt = m_droCallbacks.find(key);
const QMultiMap<std::pair<std::string, std::string>, cbData>::iterator cbEnd = m_droCallbacks.end();
for( ; cbIt != cbEnd && cbIt.key() == key; ++cbIt)
@@ -122,7 +122,7 @@ void SubscriberListener::on_liveliness_changed(dds::sub::AnyDataReader &reader,
const std::string &topicName = reader.topic_name();
const std::string &topicTypeName = reader.type_name();
DEBUG_LOG() << "on_liveliness_changed: " << livelinessStatus.alive_count()
DEBUG_LOG(m_logger) << "on_liveliness_changed: " << livelinessStatus.alive_count()
<< ", " << livelinessStatus.not_alive_count()
<< ", " << livelinessStatus.alive_count_change()
<< ", " << livelinessStatus.not_alive_count_change()
@@ -154,7 +154,7 @@ void SubscriberListener::on_liveliness_changed(dds::sub::AnyDataReader &reader,
if (bNoWritersAnymore)
{
DEBUG_LOG() << "bNoWritersAnymore for " << topicName << ", type " << topicTypeName;
DEBUG_LOG(m_logger) << "bNoWritersAnymore for " << topicName << ", type " << topicTypeName;
data.cb->noWriterAnymore(topicTypeName, topicName);
}
else if (bNewWriters)
@@ -164,7 +164,7 @@ void SubscriberListener::on_liveliness_changed(dds::sub::AnyDataReader &reader,
continue;
if (data.methodToCall.isValid())
{
DEBUG_LOG() << "methodcall is valid for " << topicName << ", type " << topicTypeName;
DEBUG_LOG(m_logger) << "methodcall is valid for " << topicName << ", type " << topicTypeName;
data.methodToCall.invoke(data.cb, Qt::QueuedConnection,
Q_ARG(std::string, topicTypeName),
Q_ARG(std::string, topicName));
@@ -71,6 +71,7 @@ public:
void prepareShutdown();
protected:
NGL::INGLLogger &m_logger;
void addCallback(const std::string &topicName,
const std::string &topicTypeName,
const dds::sub::AnyDataReader &dataReader,
@@ -24,7 +24,7 @@ WaitSetHandler::~WaitSetHandler()
bool WaitSetHandler::attachWaitSet(const dds::core::cond::Condition &cond, CallbackInterface *cb)
{
DEBUG_LOG() << "AttachWaitSet with callback " << cb;
DEBUG_LOG(m_logger) << "AttachWaitSet with callback " << cb;
WaitSetData wsd(cond, cb);
@@ -33,7 +33,7 @@ bool WaitSetHandler::attachWaitSet(const dds::core::cond::Condition &cond, Callb
auto it = m_waitSetData.find(wsd.condition->native_condition());
if (it != m_waitSetData.end())
{
WARNING_LOG() << "Waitset " << cb << " already registered";
WARNING_LOG(m_logger) << "Waitset " << cb << " already registered";
return false;
}
@@ -47,7 +47,7 @@ bool WaitSetHandler::attachWaitSet(const dds::core::cond::Condition &cond, Callb
bool WaitSetHandler::detachWaitSet(const dds::core::cond::Condition &cond, CallbackInterface *cb)
{
DEBUG_LOG() << "DetachWaitSet with callback " << cb;
DEBUG_LOG(m_logger) << "DetachWaitSet with callback " << cb;
WaitSetData wsd(cond, cb);
@@ -56,7 +56,7 @@ bool WaitSetHandler::detachWaitSet(const dds::core::cond::Condition &cond, Callb
auto it = m_waitSetData.find(wsd.condition->native_condition());
if (it == m_waitSetData.end())
{
WARNING_LOG() << "Waitset for " << cb << " not registered";
WARNING_LOG(m_logger) << "Waitset for " << cb << " not registered";
return false;
}
@@ -67,7 +67,7 @@ bool WaitSetHandler::detachWaitSet(const dds::core::cond::Condition &cond, Callb
bool WaitSetHandler::enableWaitSet(const dds::core::cond::Condition &cond, CallbackInterface *cb)
{
DEBUG_LOG() << "EnableWaitSet with callback " << cb;
DEBUG_LOG(m_logger) << "EnableWaitSet with callback " << cb;
WaitSetData wsd(cond, cb);
@@ -75,7 +75,7 @@ bool WaitSetHandler::enableWaitSet(const dds::core::cond::Condition &cond, Callb
auto it = m_waitSetData.find(wsd.condition->native_condition());
if (it == m_waitSetData.end())
{
ERROR_LOG() << "Could not find WaitSetData - cannot enable waitSet for " << cb;
ERROR_LOG(m_logger) << "Could not find WaitSetData - cannot enable waitSet for " << cb;
return false;
}
@@ -88,7 +88,7 @@ bool WaitSetHandler::enableWaitSet(const dds::core::cond::Condition &cond, Callb
bool WaitSetHandler::disableWaitSet(const dds::core::cond::Condition &cond, CallbackInterface *cb)
{
DEBUG_LOG() << "DisableWaitSet with callback " << cb;
DEBUG_LOG(m_logger) << "DisableWaitSet with callback " << cb;
WaitSetData wsd(cond, cb);
@@ -96,7 +96,7 @@ bool WaitSetHandler::disableWaitSet(const dds::core::cond::Condition &cond, Call
auto it = m_waitSetData.find(wsd.condition->native_condition());
if (it == m_waitSetData.end())
{
ERROR_LOG() << "Could not find WaitSetData - cannot disable waitSet for " << cb;
ERROR_LOG(m_logger) << "Could not find WaitSetData - cannot disable waitSet for " << cb;
return false;
}
@@ -133,7 +133,7 @@ void WaitSetHandler::waitSetTask()
WaitSetData &wsd = it->second;
if (wsd.enabled)
{
DEBUG_LOG() << "Condition triggered for " << wsd.callback;
DEBUG_LOG(m_logger) << "Condition triggered for " << wsd.callback;
wsd.callback->dataAvailable();
}
++it;
@@ -39,6 +39,7 @@ public:
int attachedConditionCount() const;
private:
NGL::INGLLogger &m_logger;
struct WaitSetData final
{
dds::core::cond::Condition condition;
@@ -52,9 +53,11 @@ private:
{}
};
private:
NGL::INGLLogger &m_logger;
void waitSetTask();
private:
NGL::INGLLogger &m_logger;
dds::core::cond::WaitSet m_waitSet;
dds::core::cond::GuardCondition m_abortCondition;
std::future<void> m_task;
@@ -132,7 +132,7 @@ public:
void writeSamples() override
{
TRACE_LOG() << "Writing samples for " << DDS::topic_type_name<TOPIC>::value()
TRACE_LOG(m_logger) << "Writing samples for " << DDS::topic_type_name<TOPIC>::value()
<< ", sample count: " << m_loanedSamples.length();
rti::pub::WriteParams writeParams;
for (const auto &sample : m_loanedSamples)
@@ -148,7 +148,7 @@ public:
TRACE_LOG() << "identity: " << DebugInfo::toReadable(writeParams.identity())
TRACE_LOG(m_logger) << "identity: " << DebugInfo::toReadable(writeParams.identity())
<< ", related_sample_identity: " << DebugInfo::toReadable(writeParams.related_sample_identity());
const auto &state = sample.info().state();
@@ -159,20 +159,20 @@ public:
}
else if (instanceState == dds::sub::status::InstanceState::not_alive_disposed())
{
TRACE_LOG() << " - is disposed";
TRACE_LOG(m_logger) << " - is disposed";
m_dataWriter->dispose_instance(writeParams);
}
else if (instanceState == dds::sub::status::InstanceState::not_alive_no_writers())
{
TRACE_LOG() << " - is unregistered";
TRACE_LOG(m_logger) << " - is unregistered";
m_dataWriter->unregister_instance(writeParams);
}
else
WARNING_LOG() << "Unknown instance state: " << instanceState;
WARNING_LOG(m_logger) << "Unknown instance state: " << instanceState;
}
catch (const dds::core::Exception &ex)
{
ERROR_LOG() << "writeSamples exception: " << ex.what();
ERROR_LOG(m_logger) << "writeSamples exception: " << ex.what();
}
}
m_dataWriter->flush();
@@ -207,7 +207,7 @@ public:
{
if (!m_dwt)
return false;
DEBUG_LOG() << "Creating DataWriter for domain " << dpOut.domain_id();
DEBUG_LOG(m_logger) << "Creating DataWriter for domain " << dpOut.domain_id();
m_dataWriter = dds::pub::DataWriter<T>(pubOut,
getTopic<T>(dpOut, m_topicName),
DDS::QosProfile::dataWriterDefault(m_topicType));
@@ -222,7 +222,7 @@ public:
{
TRACE_LOG() << "Data available for " << DDS::topic_type_name<T>::value();
TRACE_LOG(m_logger) << "Data available for " << DDS::topic_type_name<T>::value();
auto ws = new SampleWriter<T>(reader.take(), m_dataWriter, m_topicType == DDS::QosProfile::TopicType::FunctionTopic, m_logger);
m_dwt->enqueue(ws);
}
@@ -275,14 +275,14 @@ protected:
const dds::domain::DomainParticipant &dpOut,
const dds::pub::Publisher &pubOut) override
{
DEBUG_LOG() << "Initializing TopicDispatcher " << "(" << this << ")";
DEBUG_LOG(m_logger) << "Initializing TopicDispatcher " << "(" << this << ")";
if (m_dataReader != nullptr)
return false;
m_dataReader = dds::sub::DataReader<TOPIC>(subIn,
getTopic<TOPIC>(dpIn, m_topicName),
DDS::QosProfile::dataReaderDefault(m_topicType));
DEBUG_LOG() << "Creating DataReader for domain " << dpIn.domain_id() << ", ptr: " << m_dataReader.delegate().get();
DEBUG_LOG(m_logger) << "Creating DataReader for domain " << dpIn.domain_id() << ", ptr: " << m_dataReader.delegate().get();
m_dtl.reset(new DataTopicListener<TOPIC>(dwt, m_topicName, m_topicType, m_logger));
@@ -294,10 +294,10 @@ protected:
void shutdown() override
{
DEBUG_LOG() << "Cleaning up TopicDispatcher " << "(" << this << ")";
DEBUG_LOG(m_logger) << "Cleaning up TopicDispatcher " << "(" << this << ")";
if (m_dataReader != nullptr)
{
DEBUG_LOG() << "shutting down DataReader: " << m_dataReader.delegate().get();
DEBUG_LOG(m_logger) << "shutting down DataReader: " << m_dataReader.delegate().get();
m_dataReader.listener(nullptr, dds::core::status::StatusMask::none());
try
{
@@ -305,7 +305,7 @@ protected:
}
catch (const dds::core::Exception &ex)
{
ERROR_LOG() << "topic close ex: " << ex.what();
ERROR_LOG(m_logger) << "topic close ex: " << ex.what();
}
}
@@ -19,7 +19,7 @@ ForeignInterfaceImpl::ForeignInterfaceImpl(const std::shared_ptr<ParticipantMana
{
if (!m_ppmDtc)
{
WARNING_LOG() << "m_ppmDtc not available, No color and injury information will be included in created symbols";
WARNING_LOG(m_logger) << "m_ppmDtc not available, No color and injury information will be included in created symbols";
Q_ASSERT(false);
}
}
@@ -97,7 +97,7 @@ QSharedPointer<SymbolResult> ForeignInterfaceImpl::findImage(const ParticipantMa
{
if (!m_aesDtc)
{
WARNING_LOG() << "Fetching 'm_aesDtc' failed, No color and injury information will be included in symbol created for participant.id() " << participant.id();
WARNING_LOG(m_logger) << "Fetching 'm_aesDtc' failed, No color and injury information will be included in symbol created for participant.id() " << participant.id();
return findImage(symDataToRender);
}
const int partyId = m_aesDtc->partyForDusMine(lastState.originatorId());
@@ -110,7 +110,7 @@ QSharedPointer<SymbolResult> ForeignInterfaceImpl::findImage(const ParticipantMa
{
if (!m_aesDtc)
{
WARNING_LOG() << "Fetching 'm_aesDtc' failed, No color and injury information will be included in symbol created for participant.id() " << participant.id();
WARNING_LOG(m_logger) << "Fetching 'm_aesDtc' failed, No color and injury information will be included in symbol created for participant.id() " << participant.id();
return findImage(symDataToRender);
}
@@ -52,6 +52,8 @@ public:
AdvancedSymbology::SymbologyType defaultSymbologyType() const override;
private:
NGL::INGLLogger &m_logger;
static AdvancedSymbology::Injury stateToInjury(const ProjectDataManagement::VulnerabilityState &state);
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
@@ -20,6 +20,8 @@ public:
~SelectTextDialog();
protected:
NGL::INGLLogger &m_logger;
Ui_SelectTextDialog *ui;
private:
@@ -180,6 +180,8 @@ private slots:
private:
NGL::INGLLogger &m_logger;
void resetGUI();
void updateGUI();
void updateSymbolAttributesWidgets();
@@ -105,7 +105,7 @@ FlmSubscriber::FlmSubscriber(const std::shared_ptr<FileManagement::Interface::Dt
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("AdvSymbology.FlmSubscriber"))
, d(new Private())
{
INFO_LOG() << Q_FUNC_INFO << " m_counter =" << ++d->m_counter;
INFO_LOG(m_logger) << Q_FUNC_INFO << " m_counter =" << ++d->m_counter;
d->m_flmDtc = flmDtc;
d->m_flmFtc = flmFtc;
d->m_opmDtc = opmDtc;
@@ -122,7 +122,7 @@ FlmSubscriber::FlmSubscriber(const std::shared_ptr<FileManagement::Interface::Dt
FlmSubscriber::~FlmSubscriber()
{
INFO_LOG() << Q_FUNC_INFO << " m_counter =" << d->m_counter--;
INFO_LOG(m_logger) << Q_FUNC_INFO << " m_counter =" << d->m_counter--;
if (d->m_reFetchTimer)
d->m_reFetchTimer->stop();
@@ -154,9 +154,9 @@ bool FlmSubscriber::createFlmSymbolProxy(int type_placeholder)
updateFileContentMap(data);
};
if (!d->m_flmDtc->fileContents(cb))
ERROR_LOG() << Q_FUNC_INFO << " Error performing fileContents";
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Error performing fileContents";
INFO_LOG() << Q_FUNC_INFO << " m_fileContentMap.size()=" << d->m_fileContentMap.size() ;
INFO_LOG(m_logger) << Q_FUNC_INFO << " m_fileContentMap.size()=" << d->m_fileContentMap.size() ;
@@ -181,7 +181,7 @@ bool FlmSubscriber::createFlmSymbolProxy(int type_placeholder)
fcsRef.monitoring.replyState = FileContentStruct::Requested;
} else {
fcsRef.monitoring.replyState = FileContentStruct::RequestFailure;
ERROR_LOG() << "Error requesting FileContentData, fileContentId=" << fileContentId;
ERROR_LOG(m_logger) << "Error requesting FileContentData, fileContentId=" << fileContentId;
}
}
@@ -192,7 +192,7 @@ bool FlmSubscriber::createFlmSymbolProxy(int type_placeholder)
const int randomOffset = rand() % 10 + 5;
QTimer::singleShot(randomOffset, this , [this]()
{
DEBUG_LOG() << "start ReFetchingTimer";
DEBUG_LOG(m_logger) << "start ReFetchingTimer";
d->m_reFetchTimer->start();
});
@@ -204,11 +204,11 @@ void FlmSubscriber::onGetFileContentDataReply(const FileManagement::GetFileConte
{
const int32_t fileContentId = reply.id();
TRACE_LOG() << Q_FUNC_INFO << " START, " << fileContentId;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, " << fileContentId;
if (!d->m_fileContentMap.contains(fileContentId))
{
ERROR_LOG() << Q_FUNC_INFO << " fileContentId unknown, fileContentId=" << fileContentId;
ERROR_LOG(m_logger) << Q_FUNC_INFO << " fileContentId unknown, fileContentId=" << fileContentId;
return;
}
@@ -218,7 +218,7 @@ void FlmSubscriber::onGetFileContentDataReply(const FileManagement::GetFileConte
const QString &operatorName = fcData.operatorName;
const qint64 lastModified = fcData.lastModified;
DEBUG_LOG() << Q_FUNC_INFO
DEBUG_LOG(m_logger) << Q_FUNC_INFO
<< " fileContentId=" << fileContentId
<< " name=" << name
<< " operatorName=" << operatorName
@@ -234,7 +234,7 @@ void FlmSubscriber::onGetFileContentDataReply(const FileManagement::GetFileConte
QImage image;
if (!svgToImage(QByteArray::fromRawData(reinterpret_cast<const char*>(&reply.content().at(0)), reply.content().size()), image))
{
ERROR_LOG() << Q_FUNC_INFO << " svgToImage failed, fileContentId=" << fileContentId;
ERROR_LOG(m_logger) << Q_FUNC_INFO << " svgToImage failed, fileContentId=" << fileContentId;
fcData.monitoring.replyState = FileContentStruct::ReplyFailure;
return;
}
@@ -265,7 +265,7 @@ void FlmSubscriber::onGetFileContentDataReply(const FileManagement::GetFileConte
}
else
{
ERROR_LOG() << Q_FUNC_INFO << " xmlSymbolContent is empty, fileContentId=" << fileContentId;
ERROR_LOG(m_logger) << Q_FUNC_INFO << " xmlSymbolContent is empty, fileContentId=" << fileContentId;
fcData.monitoring.replyState = FileContentStruct::ReplyFailure;
}
break;
@@ -273,24 +273,24 @@ void FlmSubscriber::onGetFileContentDataReply(const FileManagement::GetFileConte
case FileContentStruct::SymbolType::UnsupportedSymbol:
{
ERROR_LOG() << Q_FUNC_INFO << " unsupported symbol found, fileContentId=" << fileContentId;
ERROR_LOG(m_logger) << Q_FUNC_INFO << " unsupported symbol found, fileContentId=" << fileContentId;
fcData.monitoring.replyState = FileContentStruct::ReplyFailure;
break;
}
}
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
bool FlmSubscriber::svgToImage(const QByteArray &svgByteArray, QImage &imageOut)
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
QSvgRenderer svgRenderer;
if (!svgRenderer.load(svgByteArray))
{
ERROR_LOG() << Q_FUNC_INFO << " svgRenderer.load failed";
ERROR_LOG(m_logger) << Q_FUNC_INFO << " svgRenderer.load failed";
return false;
}
@@ -304,7 +304,7 @@ bool FlmSubscriber::svgToImage(const QByteArray &svgByteArray, QImage &imageOut)
svgRenderer.render(&painter);
painter.end();
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
return true;
}
@@ -383,7 +383,7 @@ void FlmSubscriber::checkForReFetching()
void FlmSubscriber::onFileContentChanged(const FileManagement::FileContent &data, DataModification modType)
{
TRACE_LOG() << Q_FUNC_INFO
TRACE_LOG(m_logger) << Q_FUNC_INFO
<< " data.id=" << data.id()
<< " data.fileStatus=" << data.fileStatus().underlying()
<< " modType=" << modType
@@ -432,13 +432,13 @@ void FlmSubscriber::onFileContentChanged(const FileManagement::FileContent &data
FileManagement::GetFileContentDataRequest request(fileContentId);
if (!d->m_flmFtc->getFileContentDataRequest(request, this))
ERROR_LOG() << Q_FUNC_INFO << "Error reading FileContentData, fileContentId=" << fileContentId;
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Error reading FileContentData, fileContentId=" << fileContentId;
break;
}
case DataModification::eRemoved:
{
DEBUG_LOG() << Q_FUNC_INFO
DEBUG_LOG(m_logger) << Q_FUNC_INFO
<< " modType=" << modType
<< " fileContentId=" << fileContentId
<< " fileContentName=" << data.name();
@@ -448,7 +448,7 @@ void FlmSubscriber::onFileContentChanged(const FileManagement::FileContent &data
if (!d->m_symbolProxy.removeSymbol(fileContentId))
ERROR_LOG() << Q_FUNC_INFO << " removeSymbol failed"
ERROR_LOG(m_logger) << Q_FUNC_INFO << " removeSymbol failed"
<< " fileContentId=" << fileContentId
<< " fileContentName='" << data.name() << "'"
<< " contains=" << d->m_fileContentMap.contains(fileContentId);
@@ -460,7 +460,7 @@ void FlmSubscriber::onFileContentChanged(const FileManagement::FileContent &data
void FlmSubscriber::updateFileContentMap(const FileManagement::FileContent &data)
{
TRACE_LOG() << Q_FUNC_INFO << " START"
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START"
<< " d->m_fileContentMap.size()=" << d->m_fileContentMap.size()
<< " fileContentId=" << data.id()
<< " data.isDeleted()=" <<data.isDeleted()
@@ -534,7 +534,7 @@ void FlmSubscriber::updateFileContentMap(const FileManagement::FileContent &data
}
} else {
ERROR_LOG() << Q_FUNC_INFO
ERROR_LOG(m_logger) << Q_FUNC_INFO
<< " QJsonParseError->errorString: '" << parseError.errorString() << "'"
<< ", offset: " << parseError.offset;
}
@@ -542,7 +542,7 @@ void FlmSubscriber::updateFileContentMap(const FileManagement::FileContent &data
d->m_fileContentMap[fileContentId] = fcData;
TRACE_LOG() << Q_FUNC_INFO << " END"
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END"
<< " d->m_fileContentMap.size()=" << d->m_fileContentMap.size()
<< " fileContentId=" << data.id()
<< " data.isDeleted()=" <<data.isDeleted()
@@ -573,7 +573,7 @@ void FlmSubscriber::onLocalSymbolProxyEtsSymbolRemoved(qint32 fileContentId, con
{
AdvancedSymbology::SymbolDictionary &dict =
AdvancedSymbology::SymbolDictionary::dictionary(symbologyType);
INFO_LOG() << Q_FUNC_INFO << " dict.removeEtsSymbol:"
INFO_LOG(m_logger) << Q_FUNC_INFO << " dict.removeEtsSymbol:"
<< " symbologyType='" << (int)symbologyType << "'"
<< ", name='" << name << "'"
<< ", fileContentId=" << fileContentId;
@@ -589,7 +589,7 @@ void FlmSubscriber::onLocalSymbolProxyXmlSymbolAdded(qint32 fileContentId,
const QString &xmlContent,
const QStringList &usrTags)
{
TRACE_LOG() << Q_FUNC_INFO << " START"
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START"
<< " fileContentId=" << fileContentId
<< " name='" << name << "'";
@@ -600,25 +600,25 @@ void FlmSubscriber::onLocalSymbolProxyXmlSymbolAdded(qint32 fileContentId,
AdvancedSymbology::SymbolDictionary &dict =
AdvancedSymbology::SymbolDictionary::dictionary(symbologyType);
if (!this->setXmlSymbolToDict(dict, fileContentId, operatorName, lastModified, name, xmlContent, usrTags))
ERROR_LOG() << Q_FUNC_INFO << " dict.setXmlSymbolToDict failed"
ERROR_LOG(m_logger) << Q_FUNC_INFO << " dict.setXmlSymbolToDict failed"
<< ", symbologyType='" << (int)symbologyType << "'"
<< ", name='" << name << "'";
}
}
TRACE_LOG() << Q_FUNC_INFO << " END"
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END"
<< " fileContentId=" << fileContentId
<< " name='" << name << "'";
}
void FlmSubscriber::onLocalSymbolProxyXmlSymbolRemoved(qint32 fileContentId)
{
TRACE_LOG() << Q_FUNC_INFO << " START" << " fileContentId=" << fileContentId;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << " fileContentId=" << fileContentId;
for (const SymbologyType &symbologyType : std::as_const(d->m_symbolDictionaryToUpdate))
{
AdvancedSymbology::SymbolDictionary &dict =
AdvancedSymbology::SymbolDictionary::dictionary(symbologyType);
DEBUG_LOG() << Q_FUNC_INFO << " dict.removeXmlSymbol:"
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " dict.removeXmlSymbol:"
<< " symbologyType='" << symbologyType << "'"
<< ", fileContentId=" << fileContentId;
@@ -627,7 +627,7 @@ void FlmSubscriber::onLocalSymbolProxyXmlSymbolRemoved(qint32 fileContentId)
dict.removeXmlSymbol(sidc);
dict.removeXmlSymbol(fileContentId);
}
TRACE_LOG() << Q_FUNC_INFO << " END" << " fileContentId=" << fileContentId;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << " fileContentId=" << fileContentId;
}
@@ -638,7 +638,7 @@ void FlmSubscriber::onLocalSymbolProxyXmlSymbolRemoved(qint32 fileContentId)
bool FlmSubscriber::connectFlmSymbolProxy(int type_placeholder, SymbologyType symbologyType)
{
Q_UNUSED(type_placeholder);
TRACE_LOG() << Q_FUNC_INFO << " m_fileContentMap.size()=" << d->m_fileContentMap.size() ;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " m_fileContentMap.size()=" << d->m_fileContentMap.size() ;
d->m_symbolDictionaryToUpdate.insert(symbologyType);
@@ -701,12 +701,12 @@ bool FlmSubscriber::setEtsSymbolToDict(SymbolDictionary &dict,
if (!dict.setEtsSymbol(fileContentId, symProps.sidc(), symProps, image))
{
ERROR_LOG() << Q_FUNC_INFO << " dict.insertExtraSymbol failed"
ERROR_LOG(m_logger) << Q_FUNC_INFO << " dict.insertExtraSymbol failed"
<< ", fileContentId=" << fileContentId << ", name='" << name << "'";
return false;
}
else
INFO_LOG() << Q_FUNC_INFO << " dict.insertExtraSymbol done"
INFO_LOG(m_logger) << Q_FUNC_INFO << " dict.insertExtraSymbol done"
<< ", fileContentId=" << fileContentId << ", name='" << name << "'";
return true;
@@ -731,7 +731,7 @@ bool FlmSubscriber::setXmlSymbolToDict(SymbolDictionary &dict,
bool success = dict.setXmlSymbol(fileContentId, name, operatorName, lastModified, xmlContent, symProps);
if (!success)
ERROR_LOG() << Q_FUNC_INFO << " setXmlSymbol failed:"
ERROR_LOG(m_logger) << Q_FUNC_INFO << " setXmlSymbol failed:"
<< ", file-id=" << fileContentId
<< ", filenameid='" << name << "'";
return success;
@@ -40,6 +40,8 @@ public:
bool connectFlmSymbolProxy(int type_placeholder, SymbologyType symbologyType) override;
private:
NGL::INGLLogger &m_logger;
bool setEtsSymbolToDict(SymbolDictionary &dict,
qint32 fileContentId,
const QString &name,
@@ -43,7 +43,7 @@ bool ConfigAlarmModel::initModel(const std::shared_ptr<AlarmManagement::Interfac
const QMap<qint32, AlarmManagement::AlarmConfig> alarmConfigs = m_dtc->alarmConfigs();
INFO_LOG() << "initModel - #AlarmConfig: " << alarmConfigs.size();
INFO_LOG(m_logger) << "initModel - #AlarmConfig: " << alarmConfigs.size();
connect(m_dtc.get(), &Interface::Dtc::alarmConfigChanged,
this, &ConfigAlarmModel::onAlarmConfigChanged);
@@ -59,7 +59,7 @@ bool ConfigAlarmModel::initModel(const std::shared_ptr<AlarmManagement::Interfac
QVariant ConfigAlarmModel::data(const QModelIndex &index, int role) const
{
DEBUG_LOG() << "AlarmManagementModel::data";
DEBUG_LOG(m_logger) << "AlarmManagementModel::data";
if (role != Qt::DisplayRole || !indexIsValid(index))
return QVariant();
@@ -123,7 +123,7 @@ void ConfigAlarmModel::onAlarmConfigChanged(const AlarmManagement::AlarmConfig &
const int eventTypeId = data.eventTypeId().underlying();
const bool messageWindow = data.messageWindow();
const bool setMarker = data.setMarker();
DEBUG_LOG() << "onAlarmConfigChanged: " << eventTypeId << " messageWindow=" << messageWindow
DEBUG_LOG(m_logger) << "onAlarmConfigChanged: " << eventTypeId << " messageWindow=" << messageWindow
<< "setMarker"<<setMarker;
switch (modType)
@@ -131,7 +131,7 @@ void ConfigAlarmModel::onAlarmConfigChanged(const AlarmManagement::AlarmConfig &
case DataModification::eRemoved:
{
DEBUG_LOG() << "AlarmConfig was removed: " << id;
DEBUG_LOG(m_logger) << "AlarmConfig was removed: " << id;
AlarmManagement::AlarmConfig data1 = data;
data1.messageWindow(false);
data1.setMarker(false);
@@ -141,7 +141,7 @@ void ConfigAlarmModel::onAlarmConfigChanged(const AlarmManagement::AlarmConfig &
}
case DataModification::eModified:
{
DEBUG_LOG() << "DataModification::eModified: ";
DEBUG_LOG(m_logger) << "DataModification::eModified: ";
if (row < 0)
{
@@ -153,7 +153,7 @@ void ConfigAlarmModel::onAlarmConfigChanged(const AlarmManagement::AlarmConfig &
}
case DataModification::eAdded:
{
DEBUG_LOG() << "DataModification::eAdded";
DEBUG_LOG(m_logger) << "DataModification::eAdded";
insertRow(data);
}
break;
@@ -45,6 +45,7 @@ private slots:
void onAlarmConfigChanged(const AlarmManagement::AlarmConfig &data,
const DataModification modType);
private:
NGL::INGLLogger &m_logger;
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
AlarmHistoryModel *m_alarmHistoryModel;
@@ -176,7 +176,7 @@ void AlarmHistoryModel::onNotificationChanged(const AlarmManagement::Notificatio
const int global = propertieJsonObj[QStringLiteral("Global")].toInt();
const int friendlyFire = propertieJsonObj[QStringLiteral("FriendlyFire")].toInt();
DEBUG_LOG() << Q_FUNC_INFO
DEBUG_LOG(m_logger) << Q_FUNC_INFO
<< " notification:" << data
<< ", Global: " << global
<< ", FriendlyFire: " << friendlyFire;
@@ -197,7 +197,7 @@ void AlarmHistoryModel::onParticipantChanged(const ParticipantManagement::Partic
QString tacticalIdentifier = QString::fromStdString(participant.tacticalIdentifier());
m_idTactIdentifierMap.insert(participant.id(), tacticalIdentifier);
DEBUG_LOG() << Q_FUNC_INFO << " id=" << participant.id()
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " id=" << participant.id()
<< " designator=" << designator
<< " tacticalIdentifier=" << tacticalIdentifier;
}
@@ -205,7 +205,7 @@ void AlarmHistoryModel::onParticipantChanged(const ParticipantManagement::Partic
int AlarmHistoryModel::participantId2EquipNo(const int participantId) const
{
int ret = m_partId2EquipNoMap.value(participantId, 0);
INFO_LOG() << "participantId2EquipNo participantId=" << participantId
INFO_LOG(m_logger) << "participantId2EquipNo participantId=" << participantId
<< " EquipmentNumber=" << ret;
return ret;
}
@@ -213,7 +213,7 @@ int AlarmHistoryModel::participantId2EquipNo(const int participantId) const
QString AlarmHistoryModel::getDesignator(const int participantId) const
{
QString designator = m_idDesignatorMap.value(participantId);
DEBUG_LOG() << "m_idDesignatorMap.value(participantId)=" << designator;
DEBUG_LOG(m_logger) << "m_idDesignatorMap.value(participantId)=" << designator;
return designator;
}
@@ -221,7 +221,7 @@ QString AlarmHistoryModel::getDesignator(const int participantId) const
QString AlarmHistoryModel::getTactIdentifier(const int participantId) const
{
QString tactIdentifier = m_idTactIdentifierMap.value(participantId);
DEBUG_LOG() << "m_idTactIdentifierMap.value(participantId)=" << tactIdentifier;
DEBUG_LOG(m_logger) << "m_idTactIdentifierMap.value(participantId)=" << tactIdentifier;
return tactIdentifier;
}
@@ -234,7 +234,7 @@ void AlarmHistoryModel::onBCContaminationChanged(const AreaEffectSimulation::BCC
int id = data.id();
QString name = QString::fromStdString(data.name());
m_aesNameMap[id] = name;
DEBUG_LOG() << "onBCContaminationChanged: " << data
DEBUG_LOG(m_logger) << "onBCContaminationChanged: " << data
<< " Name=" << name
<< " id=" << id;
}
@@ -247,7 +247,7 @@ void AlarmHistoryModel::onBoobyTrapChanged(const AreaEffectSimulation::BoobyTrap
int id = data.id();
QString name = QString::fromStdString(data.name());
m_aesNameMap[id] = name;
DEBUG_LOG() << "BoobyTrap: " << data
DEBUG_LOG(m_logger) << "BoobyTrap: " << data
<< " Name=" << name
<< " id=" << id;
}
@@ -260,7 +260,7 @@ void AlarmHistoryModel::onOffRouteMineChanged(const AreaEffectSimulation::OffRou
int id = data.id();
QString name = QString::fromStdString(data.name());
m_aesNameMap[id] = name;
DEBUG_LOG() << "OffRouteMine: " << data
DEBUG_LOG(m_logger) << "OffRouteMine: " << data
<< " Name=" << name
<< " id=" << id;
}
@@ -273,7 +273,7 @@ void AlarmHistoryModel::onAesItemChanged(const AreaEffectSimulation::AesItem &it
QString name = QString::fromStdString(item.name());
int id = item.id();
m_aesNameMap[id] = name;
DEBUG_LOG() << "AreaEffectSimulation::AesItem onAesItemChanged: " << item
DEBUG_LOG(m_logger) << "AreaEffectSimulation::AesItem onAesItemChanged: " << item
<< " Name=" << name
<< " id=" << item.id();
}
@@ -63,6 +63,8 @@ public:
QString getTactIdentifier(const int participantId) const;
protected:
NGL::INGLLogger &m_logger;
bool isFiltered(const NotificationEx &data, DataModification modType) const override;
private slots:
void onNotificationChanged(const AlarmManagement::Notification &data,
@@ -154,7 +154,7 @@ bool AlarmDialog::init(const std::shared_ptr<AlarmManagement::Interface::Ftc> &f
bool global = true;
m_configAlarmModel->initModel(m_dtc, ppmDtc, alarmHistoryModel, global);
INFO_LOG() << "AlarmDialog::init";
INFO_LOG(m_logger) << "AlarmDialog::init";
return true;
}
@@ -170,7 +170,7 @@ void AlarmDialog::onAlarmConfigChanged(const AlarmManagement::AlarmConfig &data,
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG() << "************** onAlarmConfigChanged "
DEBUG_LOG(m_logger) << "************** onAlarmConfigChanged "
<< " id=" << data.id()
<< " operatorId=" << data.operatorId()
<< " m_operatorId=" << m_operatorId
@@ -183,33 +183,33 @@ void AlarmDialog::onAlarmConfigChanged(const AlarmManagement::AlarmConfig &data,
if (data.operatorId() == m_operatorId)
{
DEBUG_LOG() << "************** onAlarmConfig zuweisen ";
DEBUG_LOG(m_logger) << "************** onAlarmConfig zuweisen ";
switch (data.eventTypeId().underlying())
{
case ProjectDataManagement::EventType_def::EnterNuclear:
{
DEBUG_LOG() << "EnterNuclear zuweisen ";
DEBUG_LOG(m_logger) << "EnterNuclear zuweisen ";
m_ui->cbxNMarker->setChecked(setMarker);
m_ui->cbxNMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::EventType_def::EnterDangerArea:
{
DEBUG_LOG() << "EnterDangerArea zuweisen ";
DEBUG_LOG(m_logger) << "EnterDangerArea zuweisen ";
m_ui->cbxDanerAreaMarker->setChecked(setMarker);
m_ui->cbxDangerAreaMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::EventType_def::EnterMineArea:
{
DEBUG_LOG() << "EnterMineArea zuweisen ";
DEBUG_LOG(m_logger) << "EnterMineArea zuweisen ";
m_ui->cbxMineAreaEntryMarker->setChecked(setMarker);
m_ui->cbxMineAreaEntryMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::EventType_def::HitMine:
{
DEBUG_LOG() << "HitMine zuweisen ";
DEBUG_LOG(m_logger) << "HitMine zuweisen ";
m_ui->cbxMineAreaHitMarker->setChecked(setMarker);
m_ui->cbxMineAreaHitMessage->setChecked(messageWindow);
break;
@@ -217,14 +217,14 @@ void AlarmDialog::onAlarmConfigChanged(const AlarmManagement::AlarmConfig &data,
case ProjectDataManagement::EventType_def::Hit:
{
DEBUG_LOG() << "Hit zuweisen ";
DEBUG_LOG(m_logger) << "Hit zuweisen ";
m_ui->cbxDirectFireMarker->setChecked(setMarker);
m_ui->cbxDirectFireMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::EventType_def::HitEffectSimulation:
{
DEBUG_LOG() << "HitEffectSimulation zuweisen ";
DEBUG_LOG(m_logger) << "HitEffectSimulation zuweisen ";
m_ui->cbxIndirectFireMarker->setChecked(setMarker);
m_ui->cbxIndirectFireMessage->setChecked(messageWindow);
break;
@@ -232,27 +232,27 @@ void AlarmDialog::onAlarmConfigChanged(const AlarmManagement::AlarmConfig &data,
case ProjectDataManagement::EventType_def::CrossLocalBorderline:
{
DEBUG_LOG() << "CrossLocalBorderline zuweisen ";
DEBUG_LOG(m_logger) << "CrossLocalBorderline zuweisen ";
m_ui->cbxLocalBorderMarker->setChecked(setMarker);
m_ui->cbxLocalBorderMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::EventType_def::CrossGlobalBorderline:
{
DEBUG_LOG() << "CrossGlobalBorderline zuweisen ";
DEBUG_LOG(m_logger) << "CrossGlobalBorderline zuweisen ";
m_ui->cbxGlobalBorderMarker->setChecked(setMarker);
m_ui->cbxGlobalBorderMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::EventType_def::AirSupport:
{
DEBUG_LOG() << "AirSupport zuweisen ";
DEBUG_LOG(m_logger) << "AirSupport zuweisen ";
m_ui->cbxAirSupportMarker->setChecked(setMarker);
m_ui->cbxAirSupportMessage->setChecked(messageWindow);
break;
}
default:
ERROR_LOG() << "Not possible to set with Operator App!!!";
ERROR_LOG(m_logger) << "Not possible to set with Operator App!!!";
break;
}
}
@@ -272,22 +272,22 @@ std::vector<AlarmManagement::AlarmAction> AlarmDialog::getCheckedValues() const
if (item.checkboxMarker->isChecked())
{
alarmActionDds.setMarker(true);
DEBUG_LOG() << item.name << " setMarker = true";
DEBUG_LOG(m_logger) << item.name << " setMarker = true";
}
else
{
alarmActionDds.setMarker(false);
DEBUG_LOG() << item.name << " setMarker = false";
DEBUG_LOG(m_logger) << item.name << " setMarker = false";
}
if (item.checkboxWindow->isChecked())
{
alarmActionDds.messageWindow(true);
DEBUG_LOG() << item.name << " messageWindow = true";
DEBUG_LOG(m_logger) << item.name << " messageWindow = true";
}
else
{
alarmActionDds.messageWindow(false);
DEBUG_LOG() << item.name << " messageWindow = false";
DEBUG_LOG(m_logger) << item.name << " messageWindow = false";
}
if (alarmActionDds.setMarker() || alarmActionDds.messageWindow())
ret.push_back(alarmActionDds);
@@ -21,7 +21,7 @@ AlarmView::AlarmView(LtsSession::LtsSession *session, QWidget *parent)
, m_session(session)
, m_ui(new Ui::AlarmView)
{
DEBUG_LOG() << Q_FUNC_INFO << " --- AlarmView Konstruktor() ";
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " --- AlarmView Konstruktor() ";
m_ui->setupUi(this);
m_ui->widget->setSelectionMode(QAbstractItemView::MultiSelection);
@@ -50,7 +50,7 @@ AlarmView::AlarmView(LtsSession::LtsSession *session, QWidget *parent)
AlarmView::~AlarmView()
{
INFO_LOG() << "--- AlarmView Destruktor() ";
INFO_LOG(m_logger) << "--- AlarmView Destruktor() ";
m_sitMapGuiIfc = nullptr;
delete m_ui;
}
@@ -65,14 +65,14 @@ void AlarmView::retranslate()
bool AlarmView::init(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
AlarmHistoryModel *alarmHistoryModel)
{
INFO_LOG() << "--- init() ";
INFO_LOG(m_logger) << "--- init() ";
if (!dtc)
return false;
m_dtc = dtc;
m_alarmHistoryModel = alarmHistoryModel;
DEBUG_LOG() << "--- AlarmView::init ";
DEBUG_LOG(m_logger) << "--- AlarmView::init ";
m_proxyModel = new AlarmHistoryProxyModel(this);
m_proxyModel->setSourceModel(m_alarmHistoryModel);
m_ui->widget->setModel(m_proxyModel);
@@ -101,14 +101,14 @@ void AlarmView::onSelectionChanged()
void AlarmView::onShowAlarm()
{
INFO_LOG() << "--- onShowMAlarm() ";
INFO_LOG(m_logger) << "--- onShowMAlarm() ";
}
void AlarmView::onRemoveAlarm()
{
DEBUG_LOG() << "onRemoveAlarm selectedRows.size"
DEBUG_LOG(m_logger) << "onRemoveAlarm selectedRows.size"
<< m_ui->widget->selectedRows().size();
const QModelIndexList idxList = m_ui->widget->selectedRows();
@@ -124,7 +124,7 @@ void AlarmView::onRemoveAlarm()
void AlarmView::onCenterAlarm()
{
DEBUG_LOG() << "onCenterAlarm";
DEBUG_LOG(m_logger) << "onCenterAlarm";
if (!m_sitMapGuiIfc)
return;
const QModelIndexList indexList = m_ui->widget->selectedRows();
@@ -137,14 +137,14 @@ void AlarmView::onCenterAlarm()
if (!position.isNull())
{
DEBUG_LOG() << Q_FUNC_INFO << " position=" << position.x() << " - " << position.y();
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " position=" << position.x() << " - " << position.y();
m_sitMapGuiIfc->setCenterPoint(position);
}
else
{
const QModelIndex &indexParticipantId = m_alarmHistoryModel->index(index.row(), AlarmHistoryModel::ParticipantId, index.parent());
const int participantId = indexParticipantId.data().toInt();
DEBUG_LOG() << Q_FUNC_INFO << " participantId=" << participantId;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " participantId=" << participantId;
m_sitMapGuiIfc->centerMapToParticipant(participantId);
}
}
@@ -29,6 +29,8 @@ public:
AlarmHistoryModel *alarmHistoryModel);
private:
NGL::INGLLogger &m_logger;
void retranslate() override;
void onSelectionChanged();
void onShowAlarm();
@@ -99,10 +99,10 @@ bool ConfigParticipantsDialog::init(const std::shared_ptr<ParticipantManagement:
m_ui->equipmentNoContent->setText(equipmentNumbersStr);
DEBUG_LOG() << "current participantId = " << participantData.id();
DEBUG_LOG(m_logger) << "current participantId = " << participantData.id();
m_typeClass = ppmDtc->type(participantData.typeId()).typeClass();
DEBUG_LOG() << "m_typeClass=" << m_typeClass << " TypeId=" << participantData.typeId();
DEBUG_LOG(m_logger) << "m_typeClass=" << m_typeClass << " TypeId=" << participantData.typeId();
fillCbx();
m_almDtc->alarmConfigs([this](const AlarmManagement::AlarmConfig &alarm) { setAlaramData(alarm); });
@@ -111,7 +111,7 @@ bool ConfigParticipantsDialog::init(const std::shared_ptr<ParticipantManagement:
void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig &alarm)
{
DEBUG_LOG() << "setAlaramData:" << alarm;
DEBUG_LOG(m_logger) << "setAlaramData:" << alarm;
if (alarm.operatorId() != m_operatorId ||
alarm.participantId() != m_participantData.id() ||
alarm.global())
@@ -121,7 +121,7 @@ void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig
{
case ProjectDataManagement::EventType_def::Hit:
{
DEBUG_LOG() << "Hit zuweisen ";
DEBUG_LOG(m_logger) << "Hit zuweisen ";
m_ui->cbxDirectFire->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
@@ -135,7 +135,7 @@ void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig
}
case ProjectDataManagement::EventType_def::HitEffectSimulation:
{
DEBUG_LOG() << "HitIndirect zuweisen ";
DEBUG_LOG(m_logger) << "HitIndirect zuweisen ";
m_ui->cbxIndirectFire->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
@@ -143,7 +143,7 @@ void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig
}
case ProjectDataManagement::EventType_def::AirSupport:
{
DEBUG_LOG() << "AirSupport zuweisen ";
DEBUG_LOG(m_logger) << "AirSupport zuweisen ";
m_ui->cbxAirSupport->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
@@ -151,7 +151,7 @@ void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig
}
case ProjectDataManagement::EventType_def::HitMine:
{
DEBUG_LOG() << "HitMine zuweisen ";
DEBUG_LOG(m_logger) << "HitMine zuweisen ";
m_ui->cbxMines->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
@@ -161,7 +161,7 @@ void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig
case ProjectDataManagement::EventType_def::HitN:
case ProjectDataManagement::EventType_def::HitC:
{
DEBUG_LOG() << "Hit N/B/C zuweisen ";
DEBUG_LOG(m_logger) << "Hit N/B/C zuweisen ";
m_ui->cbxNbcAgent->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
@@ -169,7 +169,7 @@ void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig
}
case ProjectDataManagement::EventType_def::FriendlyFire:
{
DEBUG_LOG() << "FriendlyFire zuweisen ";
DEBUG_LOG(m_logger) << "FriendlyFire zuweisen ";
m_ui->cbxFriendlyFire->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
@@ -183,7 +183,7 @@ void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig
}
case ProjectDataManagement::EventType_def::Manipulation:
{
DEBUG_LOG() << "Manipulation zuweisen ";
DEBUG_LOG(m_logger) << "Manipulation zuweisen ";
m_ui->cbxManipulation->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
@@ -191,7 +191,7 @@ void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig
}
case ProjectDataManagement::EventType_def::CrossGlobalBorderline:
{
DEBUG_LOG() << "CrossGlobalBorderline zuweisen ";
DEBUG_LOG(m_logger) << "CrossGlobalBorderline zuweisen ";
m_ui->cbxGlobalBorderLine->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
@@ -199,7 +199,7 @@ void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig
}
case ProjectDataManagement::EventType_def::CrossLocalBorderline:
{
DEBUG_LOG() << "CrossLocalBorderline zuweisen ";
DEBUG_LOG(m_logger) << "CrossLocalBorderline zuweisen ";
m_ui->cbxLocalBorderLine->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
@@ -207,7 +207,7 @@ void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig
}
default:
{
ERROR_LOG() << "Not possible to set with Operator App!!!";
ERROR_LOG(m_logger) << "Not possible to set with Operator App!!!";
}
}
}
@@ -215,7 +215,7 @@ void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig
std::vector<AlarmManagement::AlarmAction> ConfigParticipantsDialog::getCheckedValues() const
{
AlarmManagement::AlarmAction alarmActionDds;
DEBUG_LOG() << "getCheckedValues";
DEBUG_LOG(m_logger) << "getCheckedValues";
std::vector<AlarmManagement::AlarmAction> alarmsDds;
@@ -289,7 +289,7 @@ std::vector<AlarmManagement::AlarmAction> ConfigParticipantsDialog::getCheckedVa
bool ConfigParticipantsDialog::apply()
{
DEBUG_LOG() << "apply";
DEBUG_LOG(m_logger) << "apply";
AlarmManagement::ConfigureAlarmsRequest req;
req.participantIds(m_participantVector);
req.alarms(getCheckedValues());
@@ -35,6 +35,8 @@ public:
const std::vector<int> &equipmentVector);
protected:
NGL::INGLLogger &m_logger;
void onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
private:
@@ -112,7 +112,7 @@ bool ParticipantsDialog::init(LtsSession::LtsSession *session,
void ParticipantsDialog::onSelectionChanged()
{
bool configureAlarms = false;
DEBUG_LOG() << "onSelectionChanged";
DEBUG_LOG(m_logger) << "onSelectionChanged";
const QModelIndexList currentlySelectedParticipants = m_ui->dvParticipants->selectedRows();
for (const QModelIndex &index : currentlySelectedParticipants)
@@ -121,7 +121,7 @@ void ParticipantsDialog::onSelectionChanged()
if ((data.equipmentNumber().is_set() && data.equipmentNumber().get() > 0) ||
m_ppmDtc->type(data.typeId()).typeClass() == ParticipantManagement::TypeClass_def::Unit)
configureAlarms = true;
DEBUG_LOG() << "setChildrenSelected row =" << index.row() << " column=" << index.column();
DEBUG_LOG(m_logger) << "setChildrenSelected row =" << index.row() << " column=" << index.column();
}
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, configureAlarms);
@@ -141,7 +141,7 @@ void ParticipantsDialog::onCbPartyChanged()
void ParticipantsDialog::onAddButtonClicked()
{
DEBUG_LOG() << "onAddButtonClicked";
DEBUG_LOG(m_logger) << "onAddButtonClicked";
m_participantVector.clear();
m_equipmentVector.clear();
@@ -151,14 +151,14 @@ void ParticipantsDialog::onAddButtonClicked()
for (const QModelIndex &index : currentlySelectedParticipants)
{
DEBUG_LOG() << "setChildrenSelected: " << index.row() << " column=" << index.column();
DEBUG_LOG(m_logger) << "setChildrenSelected: " << index.row() << " column=" << index.column();
setChildrenSelected(index);
}
}
QModelIndex participantIndex = m_ui->dvParticipants->currentIndex();
ParticipantManagement::ParticipantData data = m_participantModel->getParticipantData(participantIndex);
DEBUG_LOG() << "current participantId = " << data.id();
DEBUG_LOG(m_logger) << "current participantId = " << data.id();
m_participantVector.push_back(data.id());
const auto partData = m_participantModel->getParticipantData(participantIndex);
@@ -186,16 +186,16 @@ void ParticipantsDialog::setChildrenSelected(const QModelIndex &parent)
if (m_participantModel->hasChildren(childIndex))
setChildrenSelected(childIndex);
DEBUG_LOG() << "Setting row "
DEBUG_LOG(m_logger) << "Setting row "
<< childIndex.row()
<< " selected";
ParticipantManagement::ParticipantData data = m_participantModel->getParticipantData(childIndex);
DEBUG_LOG() << "append participantId = " << data.id();
DEBUG_LOG(m_logger) << "append participantId = " << data.id();
m_participantVector.push_back(data.id());
if (data.equipmentNumber().is_set())
{
DEBUG_LOG() << "append equipmentNumber = " << data.equipmentNumber().get();
DEBUG_LOG(m_logger) << "append equipmentNumber = " << data.equipmentNumber().get();
m_equipmentVector.push_back(data.equipmentNumber().get());
}
@@ -211,7 +211,7 @@ void ParticipantsDialog::tableColumnOrganiserSetting()
void ParticipantsDialog::onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObject)
{
DEBUG_LOG() << "onConfigureAlarmsReply" << replyObject.str();
DEBUG_LOG(m_logger) << "onConfigureAlarmsReply" << replyObject.str();
m_requestHelper->requestReply(replyObject);
}
@@ -220,7 +220,7 @@ void ParticipantsDialog::onDoubleClicked()
if (!m_buttonBox->isButtonEnabled(LtsWidgets::DialogButton::Edit))
return;
DEBUG_LOG() << "onDoubleClicked";
DEBUG_LOG(m_logger) << "onDoubleClicked";
onAddButtonClicked();
}
@@ -45,6 +45,8 @@ public:
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmGuiCbxIfc);
protected:
NGL::INGLLogger &m_logger;
void onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObject) override final;
private slots:
@@ -19,7 +19,7 @@ ParticipantAlarmModel::ParticipantAlarmModel(QObject *parent,
{
m_titles += tr("Alarm Assignable");
DEBUG_LOG() << "ParticipantAlarmModel::ParticipantAlarmModel";
DEBUG_LOG(m_logger) << "ParticipantAlarmModel::ParticipantAlarmModel";
}
QVariant ParticipantAlarmModel::data(const QModelIndex &index, int role) const
@@ -42,7 +42,7 @@ void ParticipantAlarmModel::onParticipantChanged(const ParticipantManagement::Pa
if (data.partyId() != partyId())
return;
INFO_LOG() << "onParticipantChanged isSimulated=" << data.isSimulated();
INFO_LOG(m_logger) << "onParticipantChanged isSimulated=" << data.isSimulated();
onReinitModel(partyId());
emit newData();
}
@@ -56,7 +56,7 @@ bool ParticipantAlarmModel::isSelectableByAlarm(const QModelIndex &index, bool *
m_dtc->type(data.typeId()).typeClass() == ParticipantManagement::TypeClass_def::Unit)
isSimulatable = true;
DEBUG_LOG() << "ParticipantId: " << data.id()
DEBUG_LOG(m_logger) << "ParticipantId: " << data.id()
<< " isSimulated:" << data.isSimulated()
<< " equipmentNo:" << data.equipmentNumber()
<< " typeId=" << data.typeId()
Loaded 100 of 2102 files, more files were not shown because too many files have changed in this diff. Show more