2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef MESSAGE_FACTORY_H
18 #define MESSAGE_FACTORY_H
20 #include "messages/message.h"
23 * @brief the factory handle.
25 typedef struct _message_factory message_factory_t;
28 * @brief Creates new instance of message factory.
30 * @return new factory pointer or NULL on error.
32 message_factory_t *message_factory_create();
35 * @brief Destroys factory instance.
37 * @param[in] factory factory pointer.
39 void message_factory_destroy(message_factory_t *factory);
42 * @brief Returns message poiner.
44 * @param[in] factory factory pointer.
45 * @param[in] type of message to be created.
47 * @note only ONE message instance returned by a factory is considered
48 * valid at time. User should destroy previous message returned by
49 * this function with @message_destroy function.
51 * @return message pointer or NULL on error.
53 message_t *message_factory_create_message(message_factory_t *factory, message_type_e type);
55 #endif /* end of include guard: MESSAGE_FACTORY_H */