Commit 87ead56c authored by Arnaud Blanchard's avatar Arnaud Blanchard

Add const to member which does not modify the object

parent 31d28088
......@@ -68,7 +68,7 @@ typedef struct blc_channel
~blc_channel();
///Before writting, check that name, type, format and parameter have been initialized.
void check_name_type_format_parameter();
void check_name_type_format_parameter() const;
/**Check if the current description of the blc_channel and the blc_channel **name** are compatible. Useful to know if you need to use another name for a new blc_channel or to remove the previous one.
......@@ -88,9 +88,9 @@ typedef struct blc_channel
int fscan_info(FILE *file, int scan_id=false);
/**Write the properties of the blc_channel on the buffer*/
int sprint_info(char *buffer, size_t buffer_size, bool print_id=false);
int sprint_info(char *buffer, size_t buffer_size, bool print_id=false) const;
/**Write the properties of the blc_channel in the file. **print_id** is a flag in order to require to print or not the blc_channel id*/
int fprint_info(FILE *file, bool print_id=false);
int fprint_info(FILE *file, bool print_id=false) const;
/**Create a new blc_channel with the already defined arguments*/
void create(int mode);
/**Create a new blc_channel with the list of dims described as va_args*/
......@@ -120,7 +120,7 @@ typedef struct blc_channel
///Send the name of the channel on stdout. Useful to send this blc_channel on a pipe. It is a simple printf but with a unavoided fflush (with a pipe \n does not have effect)
void publish();
///Displays all the informations about the blc_channel
void fprint_debug(FILE *file=stderr);
void fprint_debug(FILE *file=stderr) const;
///Remove the blc_channel on the system. However other already running processes using it will still work but no new process will be able to use it.
void remove();
///Map the shared memory with the blc_channel
......
......@@ -60,7 +60,7 @@ blc_channel::blc_channel(char const *new_name, int mode, uint32_t type, uint32_t
va_end(arguments);
}
void blc_channel::check_name_type_format_parameter(){
void blc_channel::check_name_type_format_parameter() const{
if (strlen(name)==0) EXIT_ON_ERROR("name is empty");
if (type==0) EXIT_ON_ERROR("The type should not be null for '%s'. Use 'NDEF' by default.", name);
if (format==0) EXIT_ON_ERROR("The format should not be null for '%s'. Use 'NDEF' by default.", name);
......@@ -69,7 +69,7 @@ void blc_channel::check_name_type_format_parameter(){
}
//Should use code in common with fprint_info
int blc_channel::sprint_info(char *buffer, size_t buffer_size, bool print_id){
int blc_channel::sprint_info(char *buffer, size_t buffer_size, bool print_id) const{
int width=0;
uint32_t str_type, str_format;
......@@ -83,7 +83,7 @@ int blc_channel::sprint_info(char *buffer, size_t buffer_size, bool print_id){
return width;
}
int blc_channel::fprint_info(FILE *file, bool print_id){
int blc_channel::fprint_info(FILE *file, bool print_id) const{
int width=0;
uint32_t str_type, str_format;
......@@ -496,7 +496,7 @@ void blc_channel::publish(){
fflush(stdout);
}
void blc_channel::fprint_debug(FILE *file){
void blc_channel::fprint_debug(FILE *file)const {
uint32_t type_str, format_str;
fprintf(file, "\nblc_channel:\n name:%s, type:%.4s, format:%.4s, id:%d, fd:%d, mode:%d, dims_nb:%d, size:%ld \n", name, UINT32_TO_STRING(type_str, type), UINT32_TO_STRING(format_str, format), id, fd, access_mode, dims_nb, size);
......
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