@@ -81,39 +81,6 @@ namespace internal
8181 A_MAP m_attributes;
8282 };
8383
84- enum class SetAttributeMode : char
85- {
86- WhileReadingAttributes,
87- FromPublicAPICall
88- };
89-
90- /* * Verify values of attributes in the frontend
91- *
92- * verify string attributes are not empty (backend restriction, e.g., HDF5)
93- */
94- template <typename T>
95- inline void attr_value_check (
96- std::string const /* key */ , T /* value */ , SetAttributeMode)
97- {}
98-
99- template <>
100- inline void attr_value_check (
101- std::string const key, std::string const value, SetAttributeMode mode)
102- {
103- switch (mode)
104- {
105- case SetAttributeMode::FromPublicAPICall:
106- if (value.empty ())
107- throw std::runtime_error (
108- " [setAttribute] Value for string attribute '" + key +
109- " ' must not be empty!" );
110- break ;
111- case SetAttributeMode::WhileReadingAttributes:
112- // no checks while reading
113- break ;
114- }
115- }
116-
11784 template <typename >
11885 class BaseRecordData ;
11986} // namespace internal
@@ -289,12 +256,6 @@ OPENPMD_protected
289256
290257 void flushAttributes (internal::FlushParams const &);
291258
292- template <typename T>
293- bool setAttributeImpl (
294- std::string const &key, T value, internal::SetAttributeMode);
295- bool setAttributeImpl (
296- std::string const &key, char const value[], internal::SetAttributeMode);
297-
298259 enum ReadMode
299260 {
300261 /* *
@@ -435,30 +396,11 @@ OPENPMD_protected
435396 virtual void linkHierarchy (Writable &w);
436397}; // Attributable
437398
438- template <typename T>
439- inline bool Attributable::setAttribute (std::string const &key, T value)
440- {
441- return setAttributeImpl (
442- key, std::move (value), internal::SetAttributeMode::FromPublicAPICall);
443- }
444-
445- inline bool
446- Attributable::setAttribute (std::string const &key, char const value[])
447- {
448- return setAttributeImpl (
449- key, value, internal::SetAttributeMode::FromPublicAPICall);
450- }
451-
452399// note: we explicitly instantiate Attributable::setAttributeImpl for all T in
453400// Datatype in Attributable.cpp
454401template <typename T>
455- inline bool Attributable::setAttributeImpl (
456- std::string const &key,
457- T value,
458- internal::SetAttributeMode setAttributeMode)
402+ inline bool Attributable::setAttribute (std::string const &key, T value)
459403{
460- internal::attr_value_check (key, value, setAttributeMode);
461-
462404 auto &attri = get ();
463405 if (IOHandler () &&
464406 IOHandler ()->m_seriesStatus == internal::SeriesStatus::Default &&
@@ -487,12 +429,10 @@ inline bool Attributable::setAttributeImpl(
487429 }
488430}
489431
490- inline bool Attributable::setAttributeImpl (
491- std::string const &key,
492- char const value[],
493- internal::SetAttributeMode setAttributeMode)
432+ inline bool
433+ Attributable::setAttribute (std::string const &key, char const value[])
494434{
495- return this ->setAttributeImpl (key, std::string (value), setAttributeMode );
435+ return this ->setAttribute (key, std::string (value));
496436}
497437
498438template <typename T>
0 commit comments