2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = libgda-GdaDataModelHash.html
27 * outFile = DataModelHash
28 * strct = GdaDataModelHash
31 * clss = DataModelHash
39 * - gda_data_model_hash_
46 * - GdaDataModel* -> DataModel
51 module gda
.DataModelHash
;
57 import tango
.io
.Stdout
; // use the tango loging?
61 private import gdac
.gdatypes
;
63 private import gdac
.gda
;
66 private import gda
.DataModel
;
73 * Unlike GdaDataModelArray, this data model implementation stores the GdaRow in
74 * a hash table. So it only retrieves from the database backend exactly the
75 * requested rows (while in GdaDataModelArray you have to retrieve all the rows
76 * until the one requested).
78 public class DataModelHash
81 /** the main Gtk struct */
82 protected GdaDataModelHash
* gdaDataModelHash
;
85 public GdaDataModelHash
* getDataModelHashStruct()
87 return gdaDataModelHash
;
91 /** the main Gtk struct as a void* */
92 protected void* getStruct()
94 return cast(void*)gdaDataModelHash
;
98 * Sets our main struct and passes it to the parent class
100 public this (GdaDataModelHash
* gdaDataModelHash
)
104 if ( gdaDataModelHash
is null )
109 Stdout("struct gdaDataModelHash is null on constructor").newline
;
113 printf("struct gdaDataModelHash is null on constructor");
120 assert(gdaDataModelHash
!is null, "struct gdaDataModelHash is null on constructor");
122 this.gdaDataModelHash
= gdaDataModelHash
;
131 * number of columns for rows in this data model.
133 * a pointer to the newly created GdaDataModel.
135 public static DataModel
newDataModelHash(int cols
)
137 // GdaDataModel* gda_data_model_hash_new (gint cols);
138 return new DataModel( gda_data_model_hash_new(cols
) );
142 * Retrieves the value at a specified column and row.
144 * the GdaDataModelHash to retrieve the value from.
146 * column number (starting from 0).
148 * row number (starting from 0).
150 * a pointer to a GdaValue.
152 public static GdaValue
* getValueAt(DataModel model
, int col
, int row
)
154 // const GdaValue* gda_data_model_hash_get_value_at (GdaDataModel *model, gint col, gint row);
155 return gda_data_model_hash_get_value_at((model
is null) ?
null : model
.getDataModelStruct(), col
, row
);
159 * Frees all the rows inserted in model.
161 * the model to clear.
165 // void gda_data_model_hash_clear (GdaDataModelHash *model);
166 gda_data_model_hash_clear(gdaDataModelHash
);
170 * Sets the number of columns for rows inserted in this model.
171 * cols must be greater than or equal to 0.
172 * This function calls gda_data_model_hash_clear to free the
173 * existing rows if any.
175 * the GdaDataModelHash.
177 * the number of columns for rows inserted in model.
179 public void setNColumns(int cols
)
181 // void gda_data_model_hash_set_n_columns (GdaDataModelHash *model, gint cols);
182 gda_data_model_hash_set_n_columns(gdaDataModelHash
, cols
);
186 * Inserts a row in the model.
188 * the GdaDataModelHash which is gonna hold the row.
190 * the number of the row.
192 * the row to insert. The model is responsible of freeing it!
194 public void insertRow(int rownum
, GdaRow
* row
)
196 // void gda_data_model_hash_insert_row (GdaDataModelHash *model, gint rownum, GdaRow *row);
197 gda_data_model_hash_insert_row(gdaDataModelHash
, rownum
, row
);
201 * Retrieves a row from the underlying hash table.
203 * the GdaDataModelHash
207 * a GdaRow or NULL if the requested row is not in the hash table.
209 public static GdaRow
* getRow(DataModel model
, int row
)
211 // const GdaRow* gda_data_model_hash_get_row (GdaDataModel *model, gint row);
212 return gda_data_model_hash_get_row((model
is null) ?
null : model
.getDataModelStruct(), row
);