Added README.
[irreco.git] / irreco / src / core / irreco_cmd_chain.h
blob4f03011f891e30288d15d395664857cc954814ab
1 /*
2 * irreco - Ir Remote Control
3 * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 /**
21 * @addtogroup IrrecoCmdChain
22 * @{
25 /**
26 * @file
27 * Header file of @ref IrrecoCmdChain.
32 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
33 /* Typedef */
34 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
36 * Make sure that typedefs are available before we include anything elese.
38 * This makes sure that whatever other structures that depend on structures
39 * defined in this file will compile OK recardles of header inclusion order.
41 #ifndef __IRRECO_CMD_CHAIN_H_TYPEDEF__
42 #define __IRRECO_CMD_CHAIN_H_TYPEDEF__
44 typedef struct _IrrecoCmdChain IrrecoCmdChain;
45 typedef signed int IrrecoCmdChainId;
47 #endif /* __IRRECO_CMD_CHAIN_H_TYPEDEF__ */
51 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
52 /* Include */
53 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
54 #ifndef __IRRECO_CMD_CHAIN_H__
55 #define __IRRECO_CMD_CHAIN_H__
56 #include "irreco.h"
57 #include "irreco_cmd.h"
61 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
62 /* Datatypes */
63 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
64 struct _IrrecoCmdChain {
65 GList *command_list;
66 glong execution_rate;
67 IrrecoCmdChainId id;
68 gboolean show_progress;
73 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
74 /* Macro */
75 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
76 #define IRRECO_CMD_CHAIN_FOREACH(_cmd_chain, _cmd_var_name) \
77 { GList *_list; \
78 IrrecoCmd *_cmd_var_name; \
79 if ((_list = g_list_first(_cmd_chain->command_list)) != NULL) do { \
80 _cmd_var_name = (IrrecoCmd *) _list->data; {
81 #define IRRECO_CMD_CHAIN_FOREACH_END \
82 }} while ((_list = g_list_next(_list)) != NULL); }
86 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
87 /* Prototypes */
88 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
89 IrrecoCmdChain *irreco_cmd_chain_new();
90 IrrecoCmdChain *irreco_cmd_chain_new_from_config(IrrecoKeyFile *keyfile,
91 IrrecoData *irreco_data);
92 void irreco_cmd_chain_free(IrrecoCmdChain *self);
93 IrrecoCmdChain *irreco_cmd_chain_create();
94 void irreco_cmd_chain_remove_all(IrrecoCmdChain *self);
95 void irreco_cmd_chain_destroy(IrrecoCmdChain *self);
96 void irreco_cmd_chain_set_id(IrrecoCmdChain *self,
97 IrrecoCmdChainId id);
98 IrrecoCmdChainId irreco_cmd_chain_get_id(IrrecoCmdChain *self);
99 void irreco_cmd_chain_to_config(IrrecoCmdChain *self,
100 GKeyFile *keyfile);
101 gboolean irreco_cmd_chain_from_config(IrrecoCmdChain *self,
102 IrrecoKeyFile *keyfile,
103 IrrecoData *irreco_data);
104 void irreco_cmd_chain_set_execution_rate(IrrecoCmdChain *self,
105 glong execution_rate);
106 void irreco_cmd_chain_append(IrrecoCmdChain *self,
107 IrrecoCmd * irreco_cmd);
108 void irreco_cmd_chain_append_copy(IrrecoCmdChain *self,
109 IrrecoCmd * irreco_cmd);
110 void irreco_cmd_chain_remove(IrrecoCmdChain *self, guint index);
111 void irreco_cmd_chain_move(IrrecoCmdChain *self,
112 guint from_index, guint to_index);
113 void irreco_cmd_chain_copy(IrrecoCmdChain * from,
114 IrrecoCmdChain * to);
115 guint irreco_cmd_chain_length(IrrecoCmdChain *self);
116 IrrecoCmd *irreco_cmd_chain_get(IrrecoCmdChain *self,
117 guint from_index);
118 void irreco_cmd_chain_print(IrrecoCmdChain *self);
119 void irreco_cmd_chain_set_show_progress(IrrecoCmdChain *self,
120 gboolean show_progress);
121 gboolean irreco_cmd_chain_get_show_progress(IrrecoCmdChain *self);
122 gboolean irreco_cmd_chain_execute(IrrecoCmdChain *self,
123 IrrecoData * irreco_data,
124 GFunc call_when_done,
125 gpointer user_data);
127 #endif /* __IRRECO_CMD_CHAIN_H__ */
129 /** @} */