Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated code #262

Merged
merged 5 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions include/realtime_tools/realtime_box.h

This file was deleted.

97 changes: 0 additions & 97 deletions include/realtime_tools/realtime_box.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,37 +152,6 @@ class RealtimeBoxBase
return true;
}

/**
* @brief set a new content with best effort
* @return false if mutex could not be locked
* @note disabled for pointer types
* @deprecated Use try_set(const T & value) instead!
*/
template <typename U = T>
[[deprecated("Use try_set(const T & value) instead!")]]
typename std::enable_if_t<!is_ptr_or_smart_ptr<U>, bool> trySet(const T & value)
{
std::unique_lock<mutex_t> guard(lock_, std::defer_lock);
if (!guard.try_lock()) {
return false;
}
value_ = value;
return true;
}

/**
* @brief access the content readable with best effort
* @return false if the mutex could not be locked
* @note only safe way to access pointer type content (rw)
* @deprecated Use try_set(const std::function<void(T &)> & func) instead!
*/
template <typename U = T>
[[deprecated("Use try_set(const std::function<void(T &)> & func) instead!")]]
bool trySet(const std::function<void(T &)> & func)
{
return try_set(func);
}

/**
* @brief get the content with best effort
* @return std::nullopt if content could not be access, otherwise the content is returned
Expand Down Expand Up @@ -213,31 +182,6 @@ class RealtimeBoxBase
return true;
}

/**
* @brief get the content with best effort
* @return std::nullopt if content could not be access, otherwise the content is returned
* @deprecated Use try_get() instead!
*/
template <typename U = T>
[[deprecated("Use try_get() instead!")]] [[nodiscard]]
typename std::enable_if_t<!is_ptr_or_smart_ptr<U>, std::optional<U>> tryGet() const
{
return try_get();
}

/**
* @brief access the content (r) with best effort
* @return false if the mutex could not be locked
* @note only safe way to access pointer type content (r)
* @deprecated Use try_get(const std::function<void(const T &)> & func) instead!
*/
template <typename U = T>
[[deprecated("Use try_get(const std::function<void(const T &)> & func) instead!")]]
bool tryGet(const std::function<void(const T &)> & func)
{
return try_get(func);
}

/**
* @brief Wait until the mutex can be locked and set the content (RealtimeBox behavior)
* @note disabled for pointer types
Expand All @@ -251,21 +195,6 @@ class RealtimeBoxBase
value_ = value;
}

/**
* @brief Wait until the mutex can be locked and set the content (RealtimeBox behavior)
* @note same signature as in the existing RealtimeBox<T>
* @note Not the safest way to access pointer type content (rw)
* @deprecated Use set(const std::function<void(T &)> & func) instead!
*/
template <typename U = T>
[[deprecated("Use set(const std::function<void(T &)> & func) instead!")]]
typename std::enable_if_t<is_ptr_or_smart_ptr<U>, void> set(const T & value)
{
std::lock_guard<mutex_t> guard(lock_);
// cppcheck-suppress missingReturn
value_ = value;
}

/**
* @brief wait until the mutex could be locked and access the content (rw)
*/
Expand Down Expand Up @@ -304,21 +233,6 @@ class RealtimeBoxBase
in = value_;
}

/**
* @brief Wait until the mutex could be locked and get the content (r)
* @note same signature as in the existing RealtimeBox<T>
* @note Not the safest way to access pointer type content (r)
* @deprecated Use get(const std::function<void(const T &)> & func) instead!
*/
template <typename U = T>
[[deprecated("Use get(const std::function<void(const T &)> & func) instead!")]]
typename std::enable_if_t<is_ptr_or_smart_ptr<U>, void> get(T & in) const
{
std::lock_guard<mutex_t> guard(lock_);
// cppcheck-suppress missingReturn
in = value_;
}

/**
* @brief Wait until the mutex could be locked and access the content (r)
* @note only safe way to access pointer type content (r)
Expand Down Expand Up @@ -368,12 +282,6 @@ class RealtimeBoxBase
[[nodiscard]] const mutex_t & get_mutex() const { return lock_; }
[[nodiscard]] mutex_t & get_mutex() { return lock_; }

[[nodiscard]] [[deprecated("Use get_mutex() instead!")]] mutex_t & getMutex() { return lock_; }
[[nodiscard]] [[deprecated("Use get_mutex() instead!")]] const mutex_t & getMutex() const
{
return lock_;
}

private:
T value_;

Expand All @@ -387,11 +295,6 @@ class RealtimeBoxBase

// Introduce some easier to use names

// Only kept for compatibility reasons
template <typename T, typename mutex_type = std::mutex>
using RealtimeBoxBestEffort [[deprecated("Use RealtimeBox instead")]] =
RealtimeBoxBase<T, mutex_type>;

// Provide specialisations for different mutex types
template <typename T>
using RealtimeBoxStandard = RealtimeBoxBase<T, std::mutex>;
Expand Down
29 changes: 0 additions & 29 deletions include/realtime_tools/realtime_box_best_effort.h

This file was deleted.

29 changes: 0 additions & 29 deletions include/realtime_tools/realtime_buffer.h

This file was deleted.

13 changes: 0 additions & 13 deletions include/realtime_tools/realtime_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,6 @@ bool has_realtime_kernel();
*/
bool configure_sched_fifo(int priority);

/**
* Locks the memory pages of the calling thread to prevent page faults.
* By calling this method, the programs locks all pages mapped into the address
* space of the calling process and future mappings. This means that the kernel
* will not swap out the pages to disk i.e., the pages are guaranteed to stay in
* RAM until later unlocked - which is important for realtime applications.
* \param[out] message a message describing the result of the operation
* \returns true if memory locking succeeded, false otherwise.
*/

[[deprecated("Use std::pair<bool, std::string> lock_memory() instead.")]]
bool lock_memory(std::string & message);

/**
* Locks the memory pages of the calling thread to prevent page faults.
* By calling this method, the programs locks all pages mapped into the address
Expand Down
29 changes: 0 additions & 29 deletions include/realtime_tools/realtime_publisher.h

This file was deleted.

29 changes: 0 additions & 29 deletions include/realtime_tools/realtime_server_goal_handle.h

This file was deleted.

43 changes: 0 additions & 43 deletions include/realtime_tools/thread_priority.hpp

This file was deleted.

7 changes: 0 additions & 7 deletions src/realtime_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ bool configure_sched_fifo(int priority)
#endif
}

bool lock_memory(std::string & message)
{
const auto lock_result = lock_memory();
message = lock_result.second;
return lock_result.first;
}

std::pair<bool, std::string> lock_memory()
{
#ifdef _WIN32
Expand Down