Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RTTI] Move AttributeAdapter<..>'s dtor definitions to cpp #29073

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 26 additions & 25 deletions src/core/include/openvino/core/attribute_adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ template <>
class OPENVINO_API AttributeAdapter<float> : public IndirectScalarValueAccessor<float, double> {
public:
AttributeAdapter(float& value) : IndirectScalarValueAccessor<float, double>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<float>");
};

Expand All @@ -241,7 +241,7 @@ template <>
class OPENVINO_API AttributeAdapter<double> : public DirectValueAccessor<double> {
public:
AttributeAdapter(double& value) : DirectValueAccessor<double>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<double>");
};

Expand All @@ -250,7 +250,7 @@ template <>
class OPENVINO_API AttributeAdapter<std::string> : public DirectValueAccessor<std::string> {
public:
AttributeAdapter(std::string& value) : DirectValueAccessor<std::string>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::string>");
};

Expand All @@ -259,7 +259,7 @@ template <>
class OPENVINO_API AttributeAdapter<bool> : public DirectValueAccessor<bool> {
public:
AttributeAdapter(bool& value) : DirectValueAccessor<bool>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<bool>");
};

Expand All @@ -268,7 +268,7 @@ template <>
class OPENVINO_API AttributeAdapter<int8_t> : public IndirectScalarValueAccessor<int8_t, int64_t> {
public:
AttributeAdapter(int8_t& value) : IndirectScalarValueAccessor<int8_t, int64_t>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<int8_t>");
};

Expand All @@ -277,7 +277,7 @@ template <>
class OPENVINO_API AttributeAdapter<int16_t> : public IndirectScalarValueAccessor<int16_t, int64_t> {
public:
AttributeAdapter(int16_t& value) : IndirectScalarValueAccessor<int16_t, int64_t>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<int16_t>");
};

Expand All @@ -286,7 +286,7 @@ template <>
class OPENVINO_API AttributeAdapter<int32_t> : public IndirectScalarValueAccessor<int32_t, int64_t> {
public:
AttributeAdapter(int32_t& value) : IndirectScalarValueAccessor<int32_t, int64_t>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<int32_t>");
};

Expand All @@ -295,7 +295,7 @@ template <>
class OPENVINO_API AttributeAdapter<int64_t> : public DirectValueAccessor<int64_t> {
public:
AttributeAdapter(int64_t& value) : DirectValueAccessor<int64_t>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<int64_t>");
};

Expand All @@ -304,7 +304,7 @@ template <>
class OPENVINO_API AttributeAdapter<uint8_t> : public IndirectScalarValueAccessor<uint8_t, int64_t> {
public:
AttributeAdapter(uint8_t& value) : IndirectScalarValueAccessor<uint8_t, int64_t>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<uint8_t>");
};

Expand All @@ -313,7 +313,7 @@ template <>
class OPENVINO_API AttributeAdapter<uint16_t> : public IndirectScalarValueAccessor<uint16_t, int64_t> {
public:
AttributeAdapter(uint16_t& value) : IndirectScalarValueAccessor<uint16_t, int64_t>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<uint16_t>");
};

Expand All @@ -322,7 +322,7 @@ template <>
class OPENVINO_API AttributeAdapter<uint32_t> : public IndirectScalarValueAccessor<uint32_t, int64_t> {
public:
AttributeAdapter(uint32_t& value) : IndirectScalarValueAccessor<uint32_t, int64_t>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<uint32_t>");
};

Expand All @@ -331,7 +331,7 @@ template <>
class OPENVINO_API AttributeAdapter<uint64_t> : public IndirectScalarValueAccessor<uint64_t, int64_t> {
public:
AttributeAdapter(uint64_t& value) : IndirectScalarValueAccessor<uint64_t, int64_t>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<uint64_t>");
};

Expand All @@ -341,7 +341,7 @@ template <>
class OPENVINO_API AttributeAdapter<size_t> : public IndirectScalarValueAccessor<size_t, int64_t> {
public:
AttributeAdapter(size_t& value) : IndirectScalarValueAccessor<size_t, int64_t>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<size_t>");
};

Expand All @@ -351,7 +351,7 @@ class OPENVINO_API AttributeAdapter<std::vector<size_t>>
public:
AttributeAdapter(std::vector<size_t>& value)
: IndirectVectorValueAccessor<std::vector<size_t>, std::vector<int64_t>>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::vector<size_t>");
};
#endif
Expand All @@ -364,7 +364,7 @@ template <>
class OPENVINO_API AttributeAdapter<std::vector<int8_t>> : public DirectValueAccessor<std::vector<int8_t>> {
public:
AttributeAdapter(std::vector<int8_t>& value) : DirectValueAccessor<std::vector<int8_t>>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::vector<int8_t>");
};

Expand All @@ -373,7 +373,7 @@ template <>
class OPENVINO_API AttributeAdapter<std::vector<int16_t>> : public DirectValueAccessor<std::vector<int16_t>> {
public:
AttributeAdapter(std::vector<int16_t>& value) : DirectValueAccessor<std::vector<int16_t>>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::vector<int16_t>");
};

Expand All @@ -382,7 +382,7 @@ template <>
class OPENVINO_API AttributeAdapter<std::vector<int32_t>> : public DirectValueAccessor<std::vector<int32_t>> {
public:
AttributeAdapter(std::vector<int32_t>& value) : DirectValueAccessor<std::vector<int32_t>>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::vector<int32_t>");
};

Expand All @@ -391,7 +391,7 @@ template <>
class OPENVINO_API AttributeAdapter<std::vector<int64_t>> : public DirectValueAccessor<std::vector<int64_t>> {
public:
AttributeAdapter(std::vector<int64_t>& value) : DirectValueAccessor<std::vector<int64_t>>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::vector<int64_t>");
};

Expand All @@ -400,7 +400,7 @@ template <>
class OPENVINO_API AttributeAdapter<std::vector<uint8_t>> : public DirectValueAccessor<std::vector<uint8_t>> {
public:
AttributeAdapter(std::vector<uint8_t>& value) : DirectValueAccessor<std::vector<uint8_t>>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::vector<uint8_t>");
};

Expand All @@ -409,7 +409,7 @@ template <>
class OPENVINO_API AttributeAdapter<std::vector<uint16_t>> : public DirectValueAccessor<std::vector<uint16_t>> {
public:
AttributeAdapter(std::vector<uint16_t>& value) : DirectValueAccessor<std::vector<uint16_t>>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::vector<uint16_t>");
};

Expand All @@ -418,7 +418,7 @@ template <>
class OPENVINO_API AttributeAdapter<std::vector<uint32_t>> : public DirectValueAccessor<std::vector<uint32_t>> {
public:
AttributeAdapter(std::vector<uint32_t>& value) : DirectValueAccessor<std::vector<uint32_t>>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::vector<uint32_t>");
};

Expand All @@ -427,7 +427,7 @@ template <>
class OPENVINO_API AttributeAdapter<std::vector<uint64_t>> : public DirectValueAccessor<std::vector<uint64_t>> {
public:
AttributeAdapter(std::vector<uint64_t>& value) : DirectValueAccessor<std::vector<uint64_t>>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::vector<uint64_t>");
};

Expand All @@ -436,7 +436,7 @@ template <>
class OPENVINO_API AttributeAdapter<std::vector<float>> : public DirectValueAccessor<std::vector<float>> {
public:
AttributeAdapter(std::vector<float>& value) : DirectValueAccessor<std::vector<float>>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::vector<float>");
};

Expand All @@ -445,7 +445,7 @@ template <>
class OPENVINO_API AttributeAdapter<std::vector<double>> : public DirectValueAccessor<std::vector<double>> {
public:
AttributeAdapter(std::vector<double>& value) : DirectValueAccessor<std::vector<double>>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::vector<double>");
};

Expand All @@ -454,7 +454,7 @@ template <>
class OPENVINO_API AttributeAdapter<std::vector<std::string>> : public DirectValueAccessor<std::vector<std::string>> {
public:
AttributeAdapter(std::vector<std::string>& value) : DirectValueAccessor<std::vector<std::string>>(value) {}

~AttributeAdapter() override;
OPENVINO_RTTI("AttributeAdapter<std::vector<std::string>");
};

Expand All @@ -463,5 +463,6 @@ class OPENVINO_API AttributeAdapter<std::set<std::string>> : public DirectValueA
public:
OPENVINO_RTTI("AttributeAdapter<set<string>>");
AttributeAdapter(std::set<std::string>& value) : DirectValueAccessor<std::set<std::string>>(value) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know whether it's possible that we have other AttributeAdapter instances which are not defined in this file?

Or each usage of AttributeAdapter should be doubled here?

~AttributeAdapter() override;
};
} // namespace ov
40 changes: 40 additions & 0 deletions src/core/src/attribute_adapter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (C) 2025 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "openvino/core/attribute_adapter.hpp"

namespace ov {

ValueAccessor<void>::~ValueAccessor() = default;

AttributeAdapter<float>::~AttributeAdapter() = default;
AttributeAdapter<double>::~AttributeAdapter() = default;
AttributeAdapter<std::string>::~AttributeAdapter() = default;
AttributeAdapter<bool>::~AttributeAdapter() = default;
AttributeAdapter<int8_t>::~AttributeAdapter() = default;
AttributeAdapter<int16_t>::~AttributeAdapter() = default;
AttributeAdapter<int32_t>::~AttributeAdapter() = default;
AttributeAdapter<int64_t>::~AttributeAdapter() = default;
AttributeAdapter<uint8_t>::~AttributeAdapter() = default;
AttributeAdapter<uint16_t>::~AttributeAdapter() = default;
AttributeAdapter<uint32_t>::~AttributeAdapter() = default;
AttributeAdapter<uint64_t>::~AttributeAdapter() = default;
#if defined(__APPLE__) || defined(__EMSCRIPTEN__)
AttributeAdapter<size_t>::~AttributeAdapter() = default;
AttributeAdapter<std::vector<size_t>>::~AttributeAdapter() = default;
#endif
AttributeAdapter<std::vector<int8_t>>::~AttributeAdapter() = default;
AttributeAdapter<std::vector<int16_t>>::~AttributeAdapter() = default;
AttributeAdapter<std::vector<int32_t>>::~AttributeAdapter() = default;
AttributeAdapter<std::vector<int64_t>>::~AttributeAdapter() = default;
AttributeAdapter<std::vector<uint8_t>>::~AttributeAdapter() = default;
AttributeAdapter<std::vector<uint16_t>>::~AttributeAdapter() = default;
AttributeAdapter<std::vector<uint32_t>>::~AttributeAdapter() = default;
AttributeAdapter<std::vector<uint64_t>>::~AttributeAdapter() = default;
AttributeAdapter<std::vector<float>>::~AttributeAdapter() = default;
AttributeAdapter<std::vector<double>>::~AttributeAdapter() = default;
AttributeAdapter<std::vector<std::string>>::~AttributeAdapter() = default;
AttributeAdapter<std::set<std::string>>::~AttributeAdapter() = default;

} // namespace ov
2 changes: 0 additions & 2 deletions src/core/src/attribute_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

using namespace std;

ov::ValueAccessor<void>::~ValueAccessor() = default;

ov::AttributeVisitor::~AttributeVisitor() = default;

void ov::AttributeVisitor::start_structure(const string& name) {
Expand Down
Loading