This commit adds a helper function and an assertion in `model::operand::Object`.
- The helper function `hasData()` check whether Object has the data or not.
- Add an assertion to `model::operand::Object::data()`.
Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
public:
void data(std::unique_ptr<Data> &&data) { _data = std::move(data); }
- const Data &data(void) const { return *_data; }
+ const Data &data(void) const
+ {
+ assert(_data);
+ return *_data;
+ }
+
+ /**
+ * @brief Get true if Object has data, otherwise @c false
+ * @return @c true if Object has data, otherwise @c false
+ */
+ bool hasData(void) const { return _data != nullptr; }
public:
template <typename T, typename... Args> void data(Args &&... args)