source/base: Constify
diff --git a/src/sdeventplus/source/base.cpp b/src/sdeventplus/source/base.cpp
index d361333..78ae406 100644
--- a/src/sdeventplus/source/base.cpp
+++ b/src/sdeventplus/source/base.cpp
@@ -42,7 +42,7 @@
}
}
-const char* Base::get_description()
+const char* Base::get_description() const
{
const char* description;
int r =
@@ -54,7 +54,7 @@
return description;
}
-void Base::set_description(const char* description)
+void Base::set_description(const char* description) const
{
int r = sdevent->sd_event_source_set_description(source.get(), description);
if (r < 0)
@@ -85,7 +85,7 @@
prepare = std::move(callback);
}
-int Base::get_pending()
+int Base::get_pending() const
{
int r = sdevent->sd_event_source_get_pending(source.get());
if (r < 0)
@@ -95,7 +95,7 @@
return r;
}
-int64_t Base::get_priority()
+int64_t Base::get_priority() const
{
int64_t priority;
int r = sdevent->sd_event_source_get_priority(source.get(), &priority);
@@ -106,7 +106,7 @@
return priority;
}
-void Base::set_priority(int64_t priority)
+void Base::set_priority(int64_t priority) const
{
int r = sdevent->sd_event_source_set_priority(source.get(), priority);
if (r < 0)
@@ -115,7 +115,7 @@
}
}
-int Base::get_enabled()
+int Base::get_enabled() const
{
int enabled;
int r = sdevent->sd_event_source_get_enabled(source.get(), &enabled);
@@ -126,7 +126,7 @@
return enabled;
}
-void Base::set_enabled(int enabled)
+void Base::set_enabled(int enabled) const
{
int r = sdevent->sd_event_source_set_enabled(source.get(), enabled);
if (r < 0)
diff --git a/src/sdeventplus/source/base.hpp b/src/sdeventplus/source/base.hpp
index 748f340..3b237db 100644
--- a/src/sdeventplus/source/base.hpp
+++ b/src/sdeventplus/source/base.hpp
@@ -27,14 +27,14 @@
int prepareCallback();
- const char* get_description();
- void set_description(const char* description);
+ const char* get_description() const;
+ void set_description(const char* description) const;
void set_prepare(Callback&& callback);
- int get_pending();
- int64_t get_priority();
- void set_priority(int64_t priority);
- int get_enabled();
- void set_enabled(int enabled);
+ int get_pending() const;
+ int64_t get_priority() const;
+ void set_priority(int64_t priority) const;
+ int get_enabled() const;
+ void set_enabled(int enabled) const;
protected:
const internal::SdEvent* const sdevent;