--- /dev/null
+/*
+* Copyright 2016 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.1 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef _UTILS_ALARM_LIST_H_
+#define _UTILS_ALARM_LIST_H_
+
+#include <list>
+
+#include "Utils/ObservableList.h"
+#include "Utils/Serialization.h"
+#include "Model/Alarm.h"
+#include "Utils/Log.h"
+
+namespace model {
+ /**
+ * @brief AlarmList is an observable list of alarms with limited size.
+ */
+ class AlarmList : public utils::ObservableList<model::Alarm>, utils::ISerializable
+ {
+ public:
+ /**
+ * @brief AlarmList iterator
+ */
+ typedef utils::ObservableList<model::Alarm>::Iterator Iterator;
+
+ /**
+ * @brief AlarmList constructor
+ *
+ * @param[in] max maximum size of the list
+ */
+ AlarmList(unsigned int max) : max_size_(max) {}
+
+ /**
+ * @brief Deserializing constructor
+ */
+ AlarmList(unsigned int max, utils::IReader &reader) : max_size_(max)
+ {
+ utils::Deserialize(reader, list_);
+ }
+
+ /**
+ * @brief Add element to the end of the list
+ *
+ * @return Iterator to last element
+ */
+ Iterator Add(model::Alarm &alarm)
+ {
+ if (Size() >= max_size_)
+ return End();
+ return utils::ObservableList<Alarm>::Add(alarm);
+ }
+
+ /**
+ * @brief Gets maximum size of the list
+ */
+ size_t MaxSize() const
+ {
+ return max_size_;
+ }
+
+ void Serialize(utils::IWriter &w) const
+ {
+ utils::Serialize(w, list_);
+ }
+ private:
+ unsigned int max_size_;
+ };
+}
+
+#endif
--- /dev/null
+/*
+* Copyright 2016 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.1 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef _UTILS_OBSERVABLE_LIST_H_
+#define _UTILS_OBSERVABLE_LIST_H_
+
+#include <list>
+
+#include "Utils/Signal.h"
+
+namespace utils {
+ /**
+ * @brief Class implements observable list
+ */
+ template<typename T>
+ class ObservableList : protected std::list<T>
+ {
+ public:
+ /**
+ * @brief ObservableList iterator
+ */
+ typedef typename std::list<T>::iterator Iterator;
+
+ /**
+ * @brief Constructs observable list
+ */
+ ObservableList() {}
+
+ /**
+ * @brief Constructs observable list from std list.
+ *
+ * @param[in] list std list.
+ */
+ ObservableList(std::list<T> &list) : std::list<T>(list) {}
+
+ /**
+ * @brief Constructs observable list with predefined size.
+ *
+ * @param[in] size size of the list
+ */
+ ObservableList(int size) : std::list<T>(size) {}
+
+ /**
+ * @brief Add element to the end of the list
+ *
+ * @param[in] obj reference to object.
+ */
+ inline Iterator Add(T &obj)
+ {
+ push_back(obj);
+ auto it = --end();
+ OnAdded(it);
+ return it;
+ }
+
+ /**
+ * @brief Remove element on specified position in the list.
+ *
+ * @param[in] it iterator to element.
+ */
+ void Remove(Iterator it)
+ {
+ OnRemoved(it);
+ erase(it);
+ }
+
+ /**
+ * @brief Replaces element on specified position in the list.
+ *
+ * @param[in] position iterator to element.
+ * @param[in] obj iterator to object.
+ */
+ void Replace(const Iterator position, T &obj)
+ {
+ *position = obj;
+ OnReplaced(position);
+ }
+
+ /**
+ * @brief Returns interator to first element of the list.
+ */
+ inline Iterator Begin() { return begin(); }
+
+ /**
+ * @brief Returns interator to first element of the list.
+ */
+ inline Iterator End() { return end(); }
+
+ /**
+ * @brief Signal emitted when new alarm has been added.
+ */
+ utils::Signal<void(Iterator)> OnAdded;
+
+ /**
+ * @brief Signal emitted when new alarm has been removed.
+ */
+ utils::Signal<void(Iterator)> OnRemoved;
+
+ /**
+ * @brief Signal emitted when new alarm has been replaced with other
+ * one.
+ */
+ utils::Signal<void(Iterator)> OnReplaced;
+
+ /**
+ * @brief Returns size of the list.
+ *
+ * @return size of the list.
+ */
+ size_t Size() const
+ {
+ return size();
+ }
+ };
+};
+
+#endif