1 /*
2  * Python object definition of the sequence and iterator object of logical volumes
3  *
4  * Copyright (C) 2014-2021, Joachim Metz <joachim.metz@gmail.com>
5  *
6  * Refer to AUTHORS for acknowledgements.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #if !defined( _PYVSLVM_LOGICAL_VOLUMES_H )
23 #define _PYVSLVM_LOGICAL_VOLUMES_H
24 
25 #include <common.h>
26 #include <types.h>
27 
28 #include "pyvslvm_libvslvm.h"
29 #include "pyvslvm_python.h"
30 
31 #if defined( __cplusplus )
32 extern "C" {
33 #endif
34 
35 typedef struct pyvslvm_logical_volumes pyvslvm_logical_volumes_t;
36 
37 struct pyvslvm_logical_volumes
38 {
39 	/* Python object initialization
40 	 */
41 	PyObject_HEAD
42 
43 	/* The parent object
44 	 */
45 	PyObject *parent_object;
46 
47 	/* The get item by index callback function
48 	 */
49 	PyObject* (*get_item_by_index)(
50 	             PyObject *parent_object,
51 	             int index );
52 
53 	/* The current index
54 	 */
55 	int current_index;
56 
57 	/* The number of items
58 	 */
59 	int number_of_items;
60 };
61 
62 extern PyTypeObject pyvslvm_logical_volumes_type_object;
63 
64 PyObject *pyvslvm_logical_volumes_new(
65            PyObject *parent_object,
66            PyObject* (*get_item_by_index)(
67                         PyObject *parent_object,
68                         int index ),
69            int number_of_items );
70 
71 int pyvslvm_logical_volumes_init(
72      pyvslvm_logical_volumes_t *sequence_object );
73 
74 void pyvslvm_logical_volumes_free(
75       pyvslvm_logical_volumes_t *sequence_object );
76 
77 Py_ssize_t pyvslvm_logical_volumes_len(
78             pyvslvm_logical_volumes_t *sequence_object );
79 
80 PyObject *pyvslvm_logical_volumes_getitem(
81            pyvslvm_logical_volumes_t *sequence_object,
82            Py_ssize_t item_index );
83 
84 PyObject *pyvslvm_logical_volumes_iter(
85            pyvslvm_logical_volumes_t *sequence_object );
86 
87 PyObject *pyvslvm_logical_volumes_iternext(
88            pyvslvm_logical_volumes_t *sequence_object );
89 
90 #if defined( __cplusplus )
91 }
92 #endif
93 
94 #endif /* !defined( _PYVSLVM_LOGICAL_VOLUMES_H ) */
95 
96