Skip to content
Open
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
8 changes: 4 additions & 4 deletions cpp_utils/include/cpp_utils/memory/impl/InternalPtrData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace eprosima {
namespace utils {

//! Forward declaration of OwnerPtr to use it as friendly class in LesseePtr
template <class T>
template<class T>
class OwnerPtr;

/**
Expand All @@ -43,7 +43,7 @@ class OwnerPtr;
*
* @tparam T Type of the internal data.
*/
template <class T>
template<class T>
class InternalPtrData
{
public:
Expand All @@ -55,9 +55,9 @@ class InternalPtrData
//! Create an empty (non valid) data
InternalPtrData() noexcept;

//! Move constructor
//! Move constructor is disabled because the internal mutex is not movable
InternalPtrData(
InternalPtrData&& other) noexcept;
InternalPtrData&& other) noexcept = delete;

/**
* @brief Destruct object
Expand Down
9 changes: 0 additions & 9 deletions cpp_utils/include/cpp_utils/memory/impl/InternalPtrData.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ InternalPtrData<T>::InternalPtrData() noexcept
{
}

template<typename T>
InternalPtrData<T>::InternalPtrData(
InternalPtrData&& other) noexcept
: reference_(std::move(other.reference_))
, shared_mutex_(std::move(other.shared_mutex_))
, deleter_(std::move(other.deleter_))
{
}

template<typename T>
InternalPtrData<T>::~InternalPtrData() noexcept
{
Expand Down
33 changes: 33 additions & 0 deletions cpp_utils/src/cpp/event/FileWatcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,52 @@

#pragma once

#include <string>

#if !defined(__APPLE__)
#include <FileWatch.hpp>
#endif // if !defined(__APPLE__)

namespace eprosima {
namespace utils {
namespace event {

#if defined(__APPLE__)

enum class FileWatchEvent
{
added,
removed,
modified,
renamed_old,
renamed_new
};

class FileWatcher
{
public:

template<typename Callback>
FileWatcher(
std::string,
Callback&&)
{
}

};

#else

class FileWatcher : public filewatch::FileWatch<std::string>
{
using filewatch::FileWatch<std::string>::FileWatch;
};

using FileWatchEvent = filewatch::Event;

#endif // defined(__APPLE__)

} /* namespace event */
} /* namespace utils */
} /* namespace eprosima */

12 changes: 10 additions & 2 deletions cpp_utils/src/cpp/event/FileWatcherHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ void FileWatcherHandler::start_filewatcher_nts_()
{
logInfo(UTILS_FILEWATCHER, "Starting FileWatcher in file: " << file_path_);

#if defined(__APPLE__)
logWarning(
UTILS_FILEWATCHER,
"File watching is disabled on macOS because the bundled backend only supports Windows and Linux.");
filewatcher_started_.store(true);
#else
try
{
file_watch_handler_ = std::make_unique<FileWatcher>(
Expand All @@ -76,11 +82,12 @@ void FileWatcherHandler::start_filewatcher_nts_()
}
catch (const std::exception& e)
{
utils::InitializationException(STR_ENTRY <<
"Error creating file watcher: " << e.what());
utils::InitializationException(STR_ENTRY
<< "Error creating file watcher: " << e.what());
}

filewatcher_started_.store(true);
#endif // defined(__APPLE__)

logInfo(UTILS_FILEWATCHER, "Start Watching file: " << file_path_);
}
Expand Down Expand Up @@ -112,3 +119,4 @@ void FileWatcherHandler::callback_unset_nts_() noexcept
} /* namespace event */
} /* namespace utils */
} /* namespace eprosima */

Loading