Declared all non member manipulating methods as const, so compiler can optimize.
authorBjoern Sikora <bjoern.sikora@intra2net.com>
Tue, 11 Aug 2009 07:43:04 +0000 (09:43 +0200)
committerBjoern Sikora <bjoern.sikora@intra2net.com>
Tue, 11 Aug 2009 07:43:04 +0000 (09:43 +0200)
14 files changed:
src/config.cpp
src/config.h
src/dhs.cpp
src/dhs.h
src/logger.cpp
src/logger.h
src/ods.cpp
src/ods.h
src/service.cpp
src/service.h
src/serviceholder.cpp
src/serviceholder.h
src/updater.cpp
src/updater.h

index 517f5f8..458ed9a 100644 (file)
@@ -107,7 +107,7 @@ Config::~Config()
  * This function serializes all Service objects in Services and OldServices (where the update Timeout isn't expired) into a specified file.
  * @return 0 if all is fine, -1 if output file could not be opened for reading or error while serializing.
  */
-int Config::serialize_services()
+int Config::serialize_services() const
 {
     // Put Services and OldServices into Serviceholder.
     Serviceholder::Ptr service_holder(new Serviceholder());
@@ -336,7 +336,7 @@ Service::Ptr Config::create_service(const string &protocol,const string &hostnam
  * @param input String.
  * @return String in lowercase.
  */
-string Config::to_lower(string input)
+string Config::to_lower(string input) const
 {
     int i = 0;
     while ( input[i] && i<10 )
@@ -491,7 +491,7 @@ int Config::load_config_from_files()
  * Getter method for Service list member.
  * @return Pointer to a list of Service's.
  */
-list<Service::Ptr> Config::get_services()
+list<Service::Ptr> Config::get_services() const
 {
     return this->Services;
 }
@@ -501,7 +501,7 @@ list<Service::Ptr> Config::get_services()
  * Getter method for member OptDescCmd.
  * @return options_description*.
  */
-Config::Options_descriptionPtr Config::get_opt_desc_cmd()
+Config::Options_descriptionPtr Config::get_opt_desc_cmd() const
 {
     return OptDescCmd;
 }
@@ -511,7 +511,7 @@ Config::Options_descriptionPtr Config::get_opt_desc_cmd()
  * Getter method for member OptDescConfMain.
  * @return options_description*.
  */
-Config::Options_descriptionPtr Config::get_opt_desc_conf_main()
+Config::Options_descriptionPtr Config::get_opt_desc_conf_main() const
 {
     return OptDescConfMain;
 }
@@ -521,7 +521,7 @@ Config::Options_descriptionPtr Config::get_opt_desc_conf_main()
  * Getter method for member OptDescConfService.
  * @return options_description*.
  */
-Config::Options_descriptionPtr Config::get_opt_desc_conf_service()
+Config::Options_descriptionPtr Config::get_opt_desc_conf_service() const
 {
     return OptDescConfService;
 }
@@ -531,7 +531,7 @@ Config::Options_descriptionPtr Config::get_opt_desc_conf_service()
  * Getter for member Loglevel.
  * @return Member Loglevel.
  */
-int Config::get_loglevel()
+int Config::get_loglevel() const
 {
     return Loglevel;
 }
@@ -541,7 +541,7 @@ int Config::get_loglevel()
  * Getter for member DaemonMode.
  * @return TRUE if enabled, FALSE if disabled.
  */
-bool Config::get_daemon_mode()
+bool Config::get_daemon_mode() const
 {
     return DaemonMode;
 }
@@ -583,7 +583,7 @@ void Config::delete_variables_map()
  * Getter for member Syslog.
  * @return True if logging through syslog is enabled, false otherwise.
  */
-bool Config::get_syslog()
+bool Config::get_syslog() const
 {
     return Syslog;
 }
index 841ac8c..65cff88 100644 (file)
@@ -44,7 +44,7 @@ private:
     Service::Ptr create_service(const std::string&,const std::string&,const std::string&,const std::string&);
     int load_main_config_file(const std::string&);
     int load_service_config_file(const std::string&);
-    std::string to_lower(std::string);
+    std::string to_lower(std::string) const;
 
 public:
 
@@ -54,7 +54,7 @@ public:
 
     ~Config();
 
-    int serialize_services();
+    int serialize_services() const;
 
     int deserialize_services();
 
@@ -62,21 +62,21 @@ public:
 
     int load_config_from_files();
 
-    std::list<Service::Ptr> get_services();
+    std::list<Service::Ptr> get_services() const;
 
-    Options_descriptionPtr get_opt_desc_cmd();
+    Options_descriptionPtr get_opt_desc_cmd() const;
 
-    Options_descriptionPtr get_opt_desc_conf_main();
+    Options_descriptionPtr get_opt_desc_conf_main() const;
 
-    Options_descriptionPtr get_opt_desc_conf_service();
+    Options_descriptionPtr get_opt_desc_conf_service() const;
 
-    bool get_daemon_mode();
+    bool get_daemon_mode() const;
 
     void delete_services();
 
-    int get_loglevel();
+    int get_loglevel() const;
 
-    bool get_syslog();
+    bool get_syslog() const;
 
     void delete_variables_map();
 
index 77950ca..21fe15a 100644 (file)
@@ -96,7 +96,7 @@ void DHS::set_timeout(const int _timeout)
  * Getter for member Timeout.
  * @return Value of Timeout.
  */
-int DHS::get_timeout()
+int DHS::get_timeout() const
 {
     return Timeout;
 }
@@ -106,7 +106,7 @@ int DHS::get_timeout()
  * Setter for member MaxUpdatesWithinTimeout.
  * @param  _max_updates_per_timeout Value to set MaxUpdatesWithinTimeout to.
  */
-void DHS::set_max_updates_per_timeout(const int _max_updates_per_timeout)
+void DHS::set_max_updates_within_timeout(const int _max_updates_per_timeout)
 {
     MaxUpdatesWithinTimeout = _max_updates_per_timeout;
 }
@@ -116,7 +116,7 @@ void DHS::set_max_updates_per_timeout(const int _max_updates_per_timeout)
  * Getter for member MaxUpdatesWithinTimeout.
  * @return Value of MaxUpdatesWithinTimeout.
  */
-int DHS::get_max_updates_per_timeout() const
+int DHS::get_max_updates_within_timeout() const
 {
     return MaxUpdatesWithinTimeout;
 }
index 7cc403e..6ca1384 100644 (file)
--- a/src/dhs.h
+++ b/src/dhs.h
@@ -43,10 +43,10 @@ public:
     ~DHS();
 
     void set_timeout(const int);
-    int get_timeout();
+    int get_timeout() const;
 
-    void set_max_updates_per_timeout(const int);
-    int get_max_updates_per_timeout() const;
+    void set_max_updates_within_timeout(const int);
+    int get_max_updates_within_timeout() const;
 
     void update(const std::string&);
 };
index 37c642f..3a24b22 100644 (file)
@@ -40,7 +40,7 @@ Logger::~Logger()
  * Decides if Logging through syslog if enabled or through std.
  * @param msg The message to log.
  */
-void Logger::log_notice(const string& msg)
+void Logger::log_notice(const string& msg) const
 {
     if ( Syslog )
         syslog(LOG_NOTICE,msg.c_str());
@@ -53,7 +53,7 @@ void Logger::log_notice(const string& msg)
  * Decides if Logging through syslog if enabled or through std.
  * @param msg The message to log.
  */
-void Logger::log_warning(const string& msg)
+void Logger::log_warning(const string& msg) const
 {
     if ( Syslog )
         syslog(LOG_WARNING,msg.c_str());
@@ -66,7 +66,7 @@ void Logger::log_warning(const string& msg)
  * Decides if Logging through syslog if enabled or through std.
  * @param msg The message to log.
  */
-void Logger::log_error(const string& msg)
+void Logger::log_error(const string& msg) const
 {
     if ( Syslog )
         syslog(LOG_ERR,msg.c_str());
@@ -90,7 +90,7 @@ void Logger::set_loglevel(const int _loglevel)
  * Getter for member Loglevel.
  * @return Loglevel.
  */
-int Logger::get_loglevel()
+int Logger::get_loglevel() const
 {
     return Loglevel;
 }
@@ -110,7 +110,7 @@ void Logger::set_syslog(const bool _syslog)
  * Getter for member Syslog.
  * @return True if logging through syslog is enabled, false otherwise.
  */
-bool Logger::get_syslog()
+bool Logger::get_syslog() const
 {
     return Syslog;
 }
@@ -132,7 +132,7 @@ void Logger::set_log_facility(const int _loglevel, const bool _syslog)
 /**
  * Prints out the usage to the command line.
  */
-void Logger::print_usage(const Options_descriptionPtr opt_desc)
+void Logger::print_usage(const Options_descriptionPtr opt_desc) const
 {
     if ( 0 <= Loglevel )
     {
@@ -148,7 +148,7 @@ void Logger::print_usage(const Options_descriptionPtr opt_desc)
  * Prints out the programm name and the given version string on stdout.
  * @param version Version string.
  */
-void Logger::print_version()
+void Logger::print_version() const
 {
     if ( 0 <= Loglevel )
     {
@@ -162,7 +162,7 @@ void Logger::print_version()
 /**
  * Prints out the successful parsing of the command line options.
  */
-void Logger::print_cmd_parsed()
+void Logger::print_cmd_parsed() const
 {
     if ( 1 <= Loglevel )
     {
@@ -173,7 +173,7 @@ void Logger::print_cmd_parsed()
 }
 
 
-void Logger::print_conf_files_parsed()
+void Logger::print_conf_files_parsed() const
 {
     if ( 1 <= Loglevel )
     {
@@ -188,7 +188,7 @@ void Logger::print_conf_files_parsed()
  * Prints out the successful parsing of the config files.
  * @param config_path The specified config path.
  */
-void Logger::print_conf_loaded(const string& config_path)
+void Logger::print_conf_loaded(const string& config_path) const
 {
     if ( 1 <= Loglevel )
     {
@@ -203,7 +203,7 @@ void Logger::print_conf_loaded(const string& config_path)
  * Prints out the unsuccessful parsing of the config files.
  * @param config_path The specified config path.
  */
-void Logger::print_conf_not_loaded(const string& config_path)
+void Logger::print_conf_not_loaded(const string& config_path) const
 {
     if ( 0 <= Loglevel )
     {
@@ -218,7 +218,7 @@ void Logger::print_conf_not_loaded(const string& config_path)
  * A file could not be opened for reading.
  * @param filename The filename.
  */
-void Logger::print_error_opening_r(const string& filename)
+void Logger::print_error_opening_r(const string& filename) const
 {
     if ( 0 <= Loglevel )
     {
@@ -233,7 +233,7 @@ void Logger::print_error_opening_r(const string& filename)
  * A file could not be opened for writing.
  * @param filename The filename.
  */
-void Logger::print_error_opening_rw(const string& filename)
+void Logger::print_error_opening_rw(const string& filename) const
 {
     if ( 0 <= Loglevel )
     {
@@ -248,7 +248,7 @@ void Logger::print_error_opening_rw(const string& filename)
  * Desctructor of specified class was called.
  * @param _class Name of the class.
  */
-void Logger::print_destructor_call(const string& _class)
+void Logger::print_destructor_call(const string& _class) const
 {
     if ( 1 <= Loglevel )
     {
@@ -263,7 +263,7 @@ void Logger::print_destructor_call(const string& _class)
  * Constructor of specified class was called.
  * @param _class Name of the class.
  */
-void Logger::print_constructor_call(const string& _class)
+void Logger::print_constructor_call(const string& _class) const
 {
     if ( 1 <= Loglevel )
     {
@@ -278,7 +278,7 @@ void Logger::print_constructor_call(const string& _class)
  * Update method for specified service was called.
  * @param service The service for which is the update running.
  */
-void Logger::print_update_service(const string& service)
+void Logger::print_update_service(const string& service) const
 {
     if ( 0 <= Loglevel )
     {
@@ -293,7 +293,7 @@ void Logger::print_update_service(const string& service)
  * An unknown option on the command line was detected.
  * @param unknown_option The unknown option.
  */
-void Logger::print_unknown_cmd_option(const string& unknown_option)
+void Logger::print_unknown_cmd_option(const string& unknown_option) const
 {
     if ( 0 <= Loglevel )
     {
@@ -308,7 +308,7 @@ void Logger::print_unknown_cmd_option(const string& unknown_option)
  * An unknown protocol was specified.
  * @param protocol The unknown protocol.
  */
-void Logger::print_unknown_protocol(const string& protocol)
+void Logger::print_unknown_protocol(const string& protocol) const
 {
     if ( 0 <= Loglevel )
     {
@@ -323,7 +323,7 @@ void Logger::print_unknown_protocol(const string& protocol)
  * Loading a service config file.
  * @param filename The service config file.
  */
-void Logger::print_load_service_conf(const string& filename)
+void Logger::print_load_service_conf(const string& filename) const
 {
     if ( 1 <= Loglevel )
     {
@@ -338,7 +338,7 @@ void Logger::print_load_service_conf(const string& filename)
  * Loading the main config file.
  * @param filename The main config file.
  */
-void Logger::print_load_main_conf(const string& filename)
+void Logger::print_load_main_conf(const string& filename) const
 {
     if ( 1 <= Loglevel )
     {
@@ -353,7 +353,7 @@ void Logger::print_load_main_conf(const string& filename)
  * There is an unknown option in a service config file.
  * @param unknown_option The unknown option.
  */
-void Logger::print_unknown_service_conf_option(const string& unknown_option)
+void Logger::print_unknown_service_conf_option(const string& unknown_option) const
 {
     if ( 0 <= Loglevel )
     {
@@ -368,7 +368,7 @@ void Logger::print_unknown_service_conf_option(const string& unknown_option)
  * There is an unknown option in the main config file.
  * @param unknown_option The unknown option.
  */
-void Logger::print_unknown_main_conf_option(const string& unknown_option)
+void Logger::print_unknown_main_conf_option(const string& unknown_option) const
 {
     if ( 0 <= Loglevel )
     {
@@ -383,7 +383,7 @@ void Logger::print_unknown_main_conf_option(const string& unknown_option)
  * The defined config path doesn't exist or is not a directory.
  * @param config_path The defined config path.
  */
-void Logger::print_error_config_path(const string& config_path)
+void Logger::print_error_config_path(const string& config_path) const
 {
     if ( 0 <= Loglevel )
     {
@@ -397,7 +397,7 @@ void Logger::print_error_config_path(const string& config_path)
 /**
  * There is a missing command line option to initialize a service object.
  */
-void Logger::print_missing_cmd_service_option()
+void Logger::print_missing_cmd_service_option() const
 {
     if ( 0 <= Loglevel )
     {
@@ -412,7 +412,7 @@ void Logger::print_missing_cmd_service_option()
  * Process running as daemon.
  * @param pid The pid of the daemon.
  */
-void Logger::print_runnig_as_daemon(const int pid)
+void Logger::print_runnig_as_daemon(const int pid) const
 {
     if ( 1 <= Loglevel )
     {
@@ -427,7 +427,7 @@ void Logger::print_runnig_as_daemon(const int pid)
  * Prints out the daemon mode.
  * @param daemon_mode The daemon mode.
  */
-void Logger::print_daemon_mode(const bool daemon_mode)
+void Logger::print_daemon_mode(const bool daemon_mode) const
 {
     if ( 1 <= Loglevel )
     {
@@ -444,7 +444,7 @@ void Logger::print_daemon_mode(const bool daemon_mode)
 /**
  * There was an error while trying to fork.
  */
-void Logger::print_error_fork()
+void Logger::print_error_fork() const
 {
     if ( 0 <= Loglevel )
     {
@@ -459,7 +459,7 @@ void Logger::print_error_fork()
  * A pid in the pidfile was found.
  * @param pid The pid found in the pidfile.
  */
-void Logger::print_pid_found(const int pid)
+void Logger::print_pid_found(const int pid) const
 {
     if ( 1 <= Loglevel )
     {
@@ -474,7 +474,7 @@ void Logger::print_pid_found(const int pid)
  * Another process is already running.
  * @param pid The pid of the other process.
  */
-void Logger::print_process_already_running(const int pid)
+void Logger::print_process_already_running(const int pid) const
 {
     if ( 0 <= Loglevel )
     {
@@ -488,7 +488,7 @@ void Logger::print_process_already_running(const int pid)
 /**
  * SIGTERM caught.
  */
-void Logger::print_caught_sigterm()
+void Logger::print_caught_sigterm() const
 {
     if ( 0 <= Loglevel )
     {
@@ -502,7 +502,7 @@ void Logger::print_caught_sigterm()
 /**
  * SIGUSR1 caught.
  */
-void Logger::print_caught_siguser1()
+void Logger::print_caught_siguser1() const
 {
     if ( 0 <= Loglevel )
     {
@@ -516,7 +516,7 @@ void Logger::print_caught_siguser1()
 /**
  * SIGHUP caught.
  */
-void Logger::print_caught_sighup()
+void Logger::print_caught_sighup() const
 {
     if ( 0 <= Loglevel )
     {
@@ -530,7 +530,7 @@ void Logger::print_caught_sighup()
 /**
  * Error while setting signal handler.
  */
-void Logger::print_error_setting_signal(const string& signal)
+void Logger::print_error_setting_signal(const string& signal) const
 {
     if ( 0 <= Loglevel )
     {
@@ -544,7 +544,7 @@ void Logger::print_error_setting_signal(const string& signal)
 /**
  * Error while setting signal handler.
  */
-void Logger::print_init_log_facility()
+void Logger::print_init_log_facility() const
 {
     if ( 1 <= Loglevel )
     {
@@ -558,7 +558,7 @@ void Logger::print_init_log_facility()
 /**
  * Be verbose. Currently we are in offline mode.
  */
-void Logger::print_offline_mode()
+void Logger::print_offline_mode() const
 {
     if ( 0 <= Loglevel )
     {
@@ -572,7 +572,7 @@ void Logger::print_offline_mode()
 /**
  * Objects successfully serialized.
  */
-void Logger::print_serialized_objects_success()
+void Logger::print_serialized_objects_success() const
 {
     if ( 1 <= Loglevel )
     {
@@ -586,7 +586,7 @@ void Logger::print_serialized_objects_success()
 /**
  * Objects successfully de-serialized.
  */
-void Logger::print_deserialized_objects_success()
+void Logger::print_deserialized_objects_success() const
 {
     if ( 1 <= Loglevel )
     {
@@ -607,7 +607,7 @@ void Logger::print_deserialized_objects_success()
  * @param actual_ip Service's actual_ip.
  * @param lastupdated Service's lastupdated.
  */
-void Logger::print_service_object(const string& message, const string& protocol, const string& hostname, const string& login, const string& password, const string& actual_ip, const int lastupdated)
+void Logger::print_service_object(const string& message, const string& protocol, const string& hostname, const string& login, const string& password, const string& actual_ip, const int lastupdated) const
 {
     if ( 1 <= Loglevel )
     {
@@ -628,7 +628,7 @@ void Logger::print_service_object(const string& message, const string& protocol,
  * Caught exception while serialize.
  * @param exception Exception message.
  */
-void Logger::print_exception_serialize(const string& exception)
+void Logger::print_exception_serialize(const string& exception) const
 {
     if ( 0 <= Loglevel )
     {
@@ -643,7 +643,7 @@ void Logger::print_exception_serialize(const string& exception)
  * Caught exception while de-serialize.
  * @param exception Exception message.
  */
-void Logger::print_exception_deserialize(const std::string& exception)
+void Logger::print_exception_deserialize(const std::string& exception) const
 {
     if ( 0 <= Loglevel )
     {
@@ -658,7 +658,7 @@ void Logger::print_exception_deserialize(const std::string& exception)
  * Child couldn't be killed by parent.
  * @param pid Pid of the child.
  */
-void Logger::print_error_kill_child(const int pid)
+void Logger::print_error_kill_child(const int pid) const
 {
     if ( 0 <= Loglevel )
     {
@@ -669,7 +669,7 @@ void Logger::print_error_kill_child(const int pid)
 }
 
 
-void Logger::print_child_killed(const int pid)
+void Logger::print_child_killed(const int pid) const
 {
     if ( 0 <= Loglevel )
     {
@@ -684,7 +684,7 @@ void Logger::print_child_killed(const int pid)
  * There is no object file.
  * @param object_file The object file.
  */
-void Logger::print_no_object_file(const std::string& object_file)
+void Logger::print_no_object_file(const std::string& object_file) const
 {
     if ( 1 <= Loglevel )
     {
index 5f008b7..b47bb12 100644 (file)
@@ -33,97 +33,97 @@ public:
 
     ~Logger();
 
-    void log_notice(const std::string&);
+    void log_notice(const std::string&) const;
 
-    void log_warning(const std::string&);
+    void log_warning(const std::string&) const;
 
-    void log_error(const std::string&);
+    void log_error(const std::string&) const;
 
     void set_loglevel(const int);
 
-    int get_loglevel();
+    int get_loglevel() const;
 
     void set_syslog(const bool);
 
-    bool get_syslog();
+    bool get_syslog() const;
 
     void set_log_facility(const int, const bool);
 
-    void print_usage(const Options_descriptionPtr);
+    void print_usage(const Options_descriptionPtr) const;
 
-    void print_version();
+    void print_version() const;
 
-    void print_cmd_parsed();
+    void print_cmd_parsed() const;
 
-    void print_conf_files_parsed();
+    void print_conf_files_parsed() const;
 
-    void print_destructor_call(const std::string&);
+    void print_destructor_call(const std::string&) const;
 
-    void print_constructor_call(const std::string&);
+    void print_constructor_call(const std::string&) const;
 
-    void print_update_service(const std::string&);
+    void print_update_service(const std::string&) const;
 
-    void print_unknown_cmd_option(const std::string&);
+    void print_unknown_cmd_option(const std::string&) const;
 
-    void print_unknown_protocol(const std::string&);
+    void print_unknown_protocol(const std::string&) const;
 
-    void print_load_service_conf(const std::string&);
+    void print_load_service_conf(const std::string&) const;
 
-    void print_load_main_conf(const std::string&);
+    void print_load_main_conf(const std::string&) const;
 
-    void print_unknown_service_conf_option(const std::string&);
+    void print_unknown_service_conf_option(const std::string&) const;
 
-    void print_unknown_main_conf_option(const std::string&);
+    void print_unknown_main_conf_option(const std::string&) const;
 
-    void print_error_opening_r(const std::string&);
+    void print_error_opening_r(const std::string&) const;
 
-    void print_error_opening_rw(const std::string&);
+    void print_error_opening_rw(const std::string&) const;
 
-    void print_error_config_path(const std::string&);
+    void print_error_config_path(const std::string&) const;
 
-    void print_conf_loaded(const std::string&);
+    void print_conf_loaded(const std::string&) const;
 
-    void print_conf_not_loaded(const std::string&);
+    void print_conf_not_loaded(const std::string&) const;
 
-    void print_missing_cmd_service_option();
+    void print_missing_cmd_service_option() const;
 
-    void print_runnig_as_daemon(const int);
+    void print_runnig_as_daemon(const int) const;
 
-    void print_daemon_mode(const bool);
+    void print_daemon_mode(const bool) const;
 
-    void print_error_fork();
+    void print_error_fork() const;
 
-    void print_pid_found(const int);
+    void print_pid_found(const int) const;
 
-    void print_process_already_running(const int);
+    void print_process_already_running(const int) const;
 
-    void print_caught_sigterm();
+    void print_caught_sigterm() const;
 
-    void print_caught_siguser1();
+    void print_caught_siguser1() const;
 
-    void print_caught_sighup();
+    void print_caught_sighup() const;
 
-    void print_error_setting_signal(const std::string&);
+    void print_error_setting_signal(const std::string&) const;
 
-    void print_init_log_facility();
+    void print_init_log_facility() const;
 
-    void print_offline_mode();
+    void print_offline_mode() const;
 
-    void print_serialized_objects_success();
+    void print_serialized_objects_success() const;
 
-    void print_deserialized_objects_success();
+    void print_deserialized_objects_success() const;
 
-    void print_service_object(const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const int);
+    void print_service_object(const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const int) const;
 
-    void print_exception_serialize(const std::string&);
+    void print_exception_serialize(const std::string&) const;
 
-    void print_exception_deserialize(const std::string&);
+    void print_exception_deserialize(const std::string&) const;
 
-    void print_error_kill_child(const int);
+    void print_error_kill_child(const int) const;
 
-    void print_child_killed(const int);
+    void print_child_killed(const int) const;
 
-    void print_no_object_file(const std::string&);
+    void print_no_object_file(const std::string&) const;
 };
 
 #endif
index 0e6930e..c8fad25 100644 (file)
@@ -96,7 +96,7 @@ void ODS::set_timeout(const int _timeout)
  * Getter for member Timeout.
  * @return Value of Timeout.
  */
-int ODS::get_timeout()
+int ODS::get_timeout() const
 {
     return Timeout;
 }
@@ -116,7 +116,7 @@ void ODS::set_max_updates_within_timeout(const int _max_updates_per_timeout)
  * Getter for member Max_updates_per_timeout.
  * @return Value of Max_updates_per_timeout.
  */
-int ODS::get_max_updates_within_timeout()
+int ODS::get_max_updates_within_timeout() const
 {
     return MaxUpdatesWithinTimeout;
 }
index dab37f2..242be85 100644 (file)
--- a/src/ods.h
+++ b/src/ods.h
@@ -43,10 +43,10 @@ public:
     ~ODS();
 
     void set_timeout(const int);
-    int get_timeout();
+    int get_timeout() const;
 
     void set_max_updates_within_timeout(const int);
-    int get_max_updates_within_timeout();
+    int get_max_updates_within_timeout() const;
 
     void update(const std::string&);
 };
index 009aad3..bdbf8d5 100644 (file)
@@ -64,7 +64,7 @@ void Service::set_protocol(const string& _protocol)
  * Getter for memeber Protocol.
  * @return Value of member Protocol.
  */
-string Service::get_protocol()
+string Service::get_protocol() const
 {
     return Protocol;
 }
@@ -84,7 +84,7 @@ void Service::set_hostname(const string& _hostname)
  * Getter for member Hostname.
  * @return Value of member Hostname.
  */
-string Service::get_hostname()
+string Service::get_hostname() const
 {
     return Hostname;
 }
@@ -104,7 +104,7 @@ void Service::set_login(const string& _login)
  * Getter for member Login.
  * @return Value of member Login.
  */
-string Service::get_login()
+string Service::get_login() const
 {
     return Login;
 }
@@ -124,7 +124,7 @@ void Service::set_password(const string& _password)
  * Getter for member Password.
  * @return Value of member Password.
  */
-string Service::get_password()
+string Service::get_password() const
 {
     return Password;
 }
@@ -144,7 +144,7 @@ void Service::set_logger(const Logger::Ptr& _log)
  * Getter for member Log.
  * @return Shared pointer to Logger object.
  */
-Logger::Ptr Service::get_logger()
+Logger::Ptr Service::get_logger() const
 {
     return Log;
 }
@@ -164,7 +164,7 @@ void Service::set_lastupdated(const int _lastupdated)
  * Getter for member Lastupdated.
  * @return Value of member Lastupdated.
  */
-int Service::get_lastupdated()
+int Service::get_lastupdated() const
 {
     return Lastupdated;
 }
@@ -184,7 +184,7 @@ void Service::set_actual_ip(const std::string& _actual_ip)
  * Getter for member ActualIP.
  * @return Value of member ActualIP.
  */
-std::string Service::get_actual_ip()
+std::string Service::get_actual_ip() const
 {
     return ActualIP;
 }
index a996f63..1cde30f 100644 (file)
@@ -48,29 +48,32 @@ public:
 
     virtual void update(const std::string&)=0;
 
-    virtual int get_timeout()=0;
+    virtual int get_timeout()const =0 ;
     virtual void set_timeout(const int)=0;
 
+    virtual int get_max_updates_within_timeout() const =0;
+    virtual void set_max_updates_within_timeout(const int)=0;
+
     void set_protocol(const std::string&);
-    std::string get_protocol();
+    std::string get_protocol() const;
 
     void set_hostname(const std::string&);
-    std::string get_hostname();
+    std::string get_hostname() const;
 
     void set_login(const std::string&);
-    std::string get_login();
+    std::string get_login() const;
 
     void set_password(const std::string&);
-    std::string get_password();
+    std::string get_password() const;
 
     void set_lastupdated(const int);
-    int get_lastupdated();
+    int get_lastupdated() const;
 
     void set_actual_ip(const std::string&);
-    std::string get_actual_ip();
+    std::string get_actual_ip() const;
 
     void set_logger(const Logger::Ptr&);
-    Logger::Ptr get_logger();
+    Logger::Ptr get_logger() const;
 
     bool operator== (const Service&) const;
     bool operator!= (const Service&) const;
index 8d620e6..a4bc90f 100644 (file)
@@ -57,7 +57,7 @@ void Serviceholder::add_service(Service::Ptr service)
  * Needed after deserialization to get the valid list of Service* back.
  * @return The list of Service*.
  */
-std::list<Service::Ptr> Serviceholder::get_hold_services()
+std::list<Service::Ptr> Serviceholder::get_hold_services() const
 {
     return HoldServices;
 }
index a46d2b8..d938b4a 100644 (file)
@@ -41,7 +41,7 @@ public:
 
     void add_service(Service::Ptr);
 
-    std::list<Service::Ptr> get_hold_services();
+    std::list<Service::Ptr> get_hold_services() const;
 };
 
 #endif
index e98e69c..d3103ad 100644 (file)
@@ -85,7 +85,7 @@ int Updater::init_config_from_files()
  * Getter for member Config.
  * @return Member Config.
  */
-Config::Ptr Updater::get_config()
+Config::Ptr Updater::get_config() const
 {
     return Conf;
 }
@@ -95,7 +95,7 @@ Config::Ptr Updater::get_config()
  * Getter for member Logger.
  * @return Member Logger.
  */
-Logger::Ptr Updater::get_logger()
+Logger::Ptr Updater::get_logger() const
 {
     return Log;
 }
index 13bec10..347b311 100644 (file)
@@ -38,9 +38,9 @@ public:
 
     int init_config_from_files();
 
-    Config::Ptr get_config();
+    Config::Ptr get_config() const;
 
-    Logger::Ptr get_logger();
+    Logger::Ptr get_logger() const;
 
     int reload_config();