From e544f4276f81b6eeb9774390a38fa233afd18167 Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Thu, 3 Nov 2016 22:49:05 +0100
Subject: [PATCH] First round of fixing Clang compiler and linker problems
---
DDCore/include/DD4hep/OpaqueData.h | 6 +++---
DDCore/src/OpaqueData.cpp | 21 +++++++++++++++++++--
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/DDCore/include/DD4hep/OpaqueData.h b/DDCore/include/DD4hep/OpaqueData.h
index 2d573a022..3c8ca5798 100644
--- a/DDCore/include/DD4hep/OpaqueData.h
+++ b/DDCore/include/DD4hep/OpaqueData.h
@@ -39,11 +39,11 @@ namespace DD4hep {
/// Standard initializing constructor
OpaqueData();
/// Standard Destructor
- virtual ~OpaqueData() = default;
+ virtual ~OpaqueData();
/// Copy constructor
- OpaqueData(const OpaqueData& copy) = default;
+ OpaqueData(const OpaqueData& c);
/// Assignment operator
- OpaqueData& operator=(const OpaqueData& copy) = default;
+ OpaqueData& operator=(const OpaqueData& c);
public:
/// Data type
diff --git a/DDCore/src/OpaqueData.cpp b/DDCore/src/OpaqueData.cpp
index 94ccf8b65..32feeda18 100644
--- a/DDCore/src/OpaqueData.cpp
+++ b/DDCore/src/OpaqueData.cpp
@@ -29,6 +29,23 @@ using namespace DD4hep;
OpaqueData::OpaqueData() : grammar(0), pointer(0) {
}
+/// Copy constructor
+OpaqueData::OpaqueData(const OpaqueData& c) : grammar(c.grammar), pointer(c.pointer) {
+}
+
+/// Standard Destructor
+OpaqueData::~OpaqueData() {
+}
+
+/// Assignment operator
+OpaqueData& OpaqueData::operator=(const OpaqueData& c) {
+ if ( &c != this ) {
+ grammar = c.grammar;
+ pointer = c.pointer;
+ }
+ return *this;
+}
+
/// Create data block from string representation
bool OpaqueData::fromString(const string& rep) {
if ( pointer && grammar ) {
@@ -109,8 +126,8 @@ OpaqueDataBlock& OpaqueDataBlock::operator=(const OpaqueDataBlock& c) {
if ( this != &c ) {
if ( this->grammar == c.grammar ) {
if ( destruct ) {
- (*destruct)(pointer);
- if ( (type&ALLOC_DATA) == ALLOC_DATA ) ::operator delete(pointer);
+ (*destruct)(pointer);
+ if ( (type&ALLOC_DATA) == ALLOC_DATA ) ::operator delete(pointer);
}
pointer = 0;
grammar = 0;
--
GitLab