1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a apache 2.0 license that can be
3 // found in the LICENSE file.
5 #ifndef COMMON_UTILS_PROPERTY_H_
6 #define COMMON_UTILS_PROPERTY_H_
11 /** Template class for defining smart attributes.
13 * Property should be used when, given attribute needs to have pure
14 * setter and getter. This template class will generate getter and setter.
15 * It uses operator() overloading.
17 template<typename Type>
20 Property() {} // NOLINT
21 Property(const Type &val): value_(val) { } // NOLINT
22 Property(Type &&val): value_(std::move(val)) { } // NOLINT
23 const Type& get() const { return value_; }
24 Type& get() { return value_; }
25 void set(Type val) { value_ = std::move(val); }
30 #endif // COMMON_UTILS_PROPERTY_H_