Commit 7a0e958b authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Add const to member which does not modify the object

parent 7e36e9f2
...@@ -80,15 +80,15 @@ typedef struct blc_array ...@@ -80,15 +80,15 @@ typedef struct blc_array
==========================================*/ ==========================================*/
/**Print the properties of the dims in a string (i.e. "3x800x600" )*/ /**Print the properties of the dims in a string (i.e. "3x800x600" )*/
int sprint_dims(char *string, int max_string_size); int sprint_dims(char *string, int max_string_size) const;
/**Print the properties of the dims in a file or stderr by default (i.e. "3x800x600" )*/ /**Print the properties of the dims in a file or stderr by default (i.e. "3x800x600" )*/
int fprint_dims(FILE *file=stderr) const; int fprint_dims(FILE *file=stderr) const;
/**Print all the informations about the blc_array. Useful for debuging.*/ /**Print all the informations about the blc_array. Useful for debuging.*/
void fprint_debug(FILE *file=stderr) const; void fprint_debug(FILE *file=stderr) const;
/**Print all the properties of the array in a string (i.e. "UIN8 RGB3 3x800x600")*/ /**Print all the properties of the array in a string (i.e. "UIN8 RGB3 3x800x600")*/
void sprint_properties(char *string, size_t max_string_size); void sprint_properties(char *string, size_t max_string_size) const;
/**Print all the properties of the array in a file or stderr by default. (i.e. "UIN8 RGB3 3x800x600")*/ /**Print all the properties of the array in a file or stderr by default. (i.e. "UIN8 RGB3 3x800x600")*/
void fprint_properties(FILE *file=stderr); void fprint_properties(FILE *file=stderr) const;
/* Modifying the properties of the array /* Modifying the properties of the array
======================================*/ ======================================*/
...@@ -127,13 +127,13 @@ typedef struct blc_array ...@@ -127,13 +127,13 @@ typedef struct blc_array
=====================*/ =====================*/
/**Create a .blc file with the content of the blc_array. This is meant to be used with init_with_blc_file, update_with_blc_file.*/ /**Create a .blc file with the content of the blc_array. This is meant to be used with init_with_blc_file, update_with_blc_file.*/
void save_blc_file(char const *filename); void save_blc_file(char const *filename) const;
/**Write the content of the blc_array as TSV (tab separated values) in a file. It can also be used to write on the terminal.*/ /**Write the content of the blc_array as TSV (tab separated values) in a file. It can also be used to write on the terminal.*/
void fprint_tsv(FILE *file=stderr); void fprint_tsv(FILE *file=stderr) const;
/**Comme fprint_tsv but automtically create the file. With filename which must have .tsv extension.*/ /**Comme fprint_tsv but automtically create the file. With filename which must have .tsv extension.*/
void save_tsv_file(char const *filename); void save_tsv_file(char const *filename) const;
/**Print the blc_array as a text_graph surface. Only works with 2D blc_array of type 'UIN8'. It draws a matrix of values. If ansi terminal is 1, it draws colored valuse depending on the blc_uchar_color_scale.*/ /**Print the blc_array as a text_graph surface. Only works with 2D blc_array of type 'UIN8'. It draws a matrix of values. If ansi terminal is 1, it draws colored valuse depending on the blc_uchar_color_scale.*/
void fprint_surface_uchars(FILE *file, int ansi_terminal=0); void fprint_surface_uchars(FILE *file, int ansi_terminal=0) const;
/*miscellaneous /*miscellaneous
=============*/ =============*/
......
...@@ -164,7 +164,7 @@ int blc_array::get_type_size(){ ...@@ -164,7 +164,7 @@ int blc_array::get_type_size(){
return blc_get_type_size(type); return blc_get_type_size(type);
} }
int blc_array::sprint_dims(char *string, int string_size){ int blc_array::sprint_dims(char *string, int string_size) const{
int i, width=0; int i, width=0;
if (dims_nb==0) width=snprintf(string, string_size, "0"); if (dims_nb==0) width=snprintf(string, string_size, "0");
...@@ -176,7 +176,7 @@ int blc_array::sprint_dims(char *string, int string_size){ ...@@ -176,7 +176,7 @@ int blc_array::sprint_dims(char *string, int string_size){
return width; return width;
} }
int blc_array::fprint_dims(FILE *file)const { int blc_array::fprint_dims(FILE *file) const {
int i, width; int i, width;
if (dims_nb==0) width=fprintf(file, "0"); if (dims_nb==0) width=fprintf(file, "0");
...@@ -234,7 +234,7 @@ int blc_array::sscan_dims(char const *string){ ...@@ -234,7 +234,7 @@ int blc_array::sscan_dims(char const *string){
//Should use code in common with fprint_info //Should use code in common with fprint_info
void blc_array::sprint_properties(char *buffer, size_t buffer_size){ void blc_array::sprint_properties(char *buffer, size_t buffer_size) const{
int width; int width;
uint32_t str_type; uint32_t str_type;
uint32_t str_format; uint32_t str_format;
...@@ -246,7 +246,7 @@ void blc_array::sprint_properties(char *buffer, size_t buffer_size){ ...@@ -246,7 +246,7 @@ void blc_array::sprint_properties(char *buffer, size_t buffer_size){
width+=sprint_dims(buffer+width,buffer_size-width); width+=sprint_dims(buffer+width,buffer_size-width);
} }
void blc_array::fprint_properties(FILE *file){ void blc_array::fprint_properties(FILE *file) const {
int width; int width;
uint32_t net_type = htonl(type); uint32_t net_type = htonl(type);
uint32_t net_format = htonl(format); uint32_t net_format = htonl(format);
...@@ -366,7 +366,7 @@ void blc_array::update_with_blc_file(char const *filename){ ...@@ -366,7 +366,7 @@ void blc_array::update_with_blc_file(char const *filename){
fclose(file); fclose(file);
} }
void blc_array::save_blc_file(char const *filename){ void blc_array::save_blc_file(char const *filename)const{
FILE *file; FILE *file;
ssize_t ret; ssize_t ret;
char const *ext; char const *ext;
...@@ -387,7 +387,7 @@ void blc_array::save_blc_file(char const *filename){ ...@@ -387,7 +387,7 @@ void blc_array::save_blc_file(char const *filename){
} }
void blc_array::fprint_tsv(FILE *file){ void blc_array::fprint_tsv(FILE *file)const{
int dim, length, i, j; int dim, length, i, j;
uint32_t type_str; uint32_t type_str;
blc_dim *tmp_dims; blc_dim *tmp_dims;
...@@ -575,7 +575,7 @@ void blc_array::update_with_tsv_file(char const *filename){ ...@@ -575,7 +575,7 @@ void blc_array::update_with_tsv_file(char const *filename){
fclose(file); fclose(file);
} }
void blc_array::save_tsv_file(char const *filename){ void blc_array::save_tsv_file(char const *filename)const{
FILE *file; FILE *file;
char const *ext; char const *ext;
...@@ -590,7 +590,7 @@ void blc_array::save_tsv_file(char const *filename){ ...@@ -590,7 +590,7 @@ void blc_array::save_tsv_file(char const *filename){
fclose(file); fclose(file);
} }
void blc_array::fprint_surface_uchars(FILE *file, int ansi_terminal){ void blc_array::fprint_surface_uchars(FILE *file, int ansi_terminal)const{
blc_fprint_3Darray(file, this->uchars, this->size, 0, 1, 1, dims[0].step, dims[0].length, dims[1].step, dims[1].length, ansi_terminal); blc_fprint_3Darray(file, this->uchars, this->size, 0, 1, 1, dims[0].step, dims[0].length, dims[1].step, dims[1].length, ansi_terminal);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment