Skip to content

Commit

Permalink
Merge pull request #7 from doug1234/CleanupCrud
Browse files Browse the repository at this point in the history
More Cleanup
  • Loading branch information
iguessthislldo authored Jun 2, 2023
2 parents e62af00 + 95307da commit 5814b2c
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 664 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ set(MANAGER_HEADER
src/dds_logging.h
src/dds_manager.h
src/dds_simple.h
src/filesystem.h
src/participant_monitor.h
src/platformIndependent.h
src/qos_dictionary.h
Expand Down
7 changes: 0 additions & 7 deletions src/dds_listeners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,6 @@ void GenericReaderListener::on_sample_lost(
}


//------------------------------------------------------------------------------
// GenericSubscriberListener
//------------------------------------------------------------------------------
// void GenericSubscriberListener::on_data_on_readers(DDS::Subscriber*)
// {}


//------------------------------------------------------------------------------
// GenericWriterListener
//------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/dds_logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ enum class LogMessageType {
void SetACELogger(std::function<void(LogMessageType mt, const std::string& message)> messageHandler);


#endif // __CALLBACK_H__
#endif // __DDS_LOGGING__H__
477 changes: 129 additions & 348 deletions src/dds_manager.cpp

Large diffs are not rendered by default.

12 changes: 1 addition & 11 deletions src/dds_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
#include <mutex>
#include <map>
#include <memory>
#ifndef CANT_SUPPORT_SHARED_MUTEX
#include <shared_mutex>
#endif

#include "dds_callback.h"
#include "dds_listeners.h"
Expand Down Expand Up @@ -515,20 +513,12 @@ class DDSManager

int m_domainID;

bool m_autoConfig;
bool m_iniCustomization;

std::string m_config;

//Thread safety mutex.
#ifndef CANT_SUPPORT_SHARED_MUTEX

mutable std::shared_mutex m_topicMutex;
mutable std::shared_lock<decltype(m_topicMutex)> m_sharedLock;
#else
mutable std::mutex m_topicMutex;
//No such thing as shared locks. Less efficient. Hopefully no deadlocks!
mutable std::unique_lock<decltype(m_topicMutex)> m_sharedLock;
#endif
mutable std::unique_lock<decltype(m_topicMutex)> m_uniqueLock;

/**
Expand Down
22 changes: 6 additions & 16 deletions src/dds_manager_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,16 @@
#define __DDS_MANAGER_DEFS__

// Define DLL_PUBLIC as the import or export symbol declaration
#if defined WIN32 || defined WIN64 || defined __CYGWIN__
#if defined DDSMAN_STATIC_BUILD
#define DLL_PUBLIC
#elif defined WIN32 || defined WIN64
#ifdef OpenDDSManager_EXPORTS // Set automatically by CMake
#ifdef __GNUC__
#define DLL_PUBLIC __attribute__ ((dllexport))
#else
#define DLL_PUBLIC __declspec(dllexport)
#endif
#define DLL_PUBLIC __declspec(dllexport)
#else
#ifdef __GNUC__
#define DLL_PUBLIC __attribute__ ((dllimport))
#else
#define DLL_PUBLIC __declspec(dllimport)
#endif
#define DLL_PUBLIC __declspec(dllimport)
#endif
#else
#if __GNUC__ >= 4
#define DLL_PUBLIC __attribute__ ((visibility("default")))
#else
#define DLL_PUBLIC
#endif
#define DLL_PUBLIC __attribute__ ((visibility("default")))
#endif

#endif
Expand Down
9 changes: 2 additions & 7 deletions src/dds_simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#include <mutex>
#include <unordered_set>
#include <future>
#ifndef CANT_SUPPORT_SHARED_MUTEX
#include <shared_mutex>
#endif

class DDSSimpleManager : public DDSManager
{
Expand Down Expand Up @@ -408,13 +406,10 @@ class DDSSimpleManager : public DDSManager
///The subscriber map is built when calling Callback<> or Subscriber<>. It keeps a list of all topics that the manager
///is subscribed to; useful when determining of there is a publisher of a given topic.
std::map<std::string, std::string> m_subMap;
#ifdef CANT_SUPPORT_SHARED_MUTEX
std::mutex mutex_shr;
std::shared_lock<decltype(mutex_shr)> m_sharedLock;
#else

std::shared_mutex mutex_shr;
std::unique_lock<decltype(mutex_shr)> m_sharedLock;
#endif

std::unique_lock<decltype(mutex_shr)> m_uniqueLock;
// Helper function to help us maintain Subscriber & Callback functions.
// If readername is empty, create a generic name based on topic name. Otherwise just take the specified name
Expand Down
72 changes: 0 additions & 72 deletions src/filesystem.h

This file was deleted.

Loading

0 comments on commit 5814b2c

Please sign in to comment.