Skip to content

Commit

Permalink
cmake folders synched with ecal-core
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Feb 9, 2024
1 parent 4dd6154 commit a06fdad
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 44 deletions.
52 changes: 31 additions & 21 deletions ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,23 @@

project(core VERSION ${eCAL_VERSION_STRING})

find_package(Threads REQUIRED)
find_package(asio REQUIRED)
find_package(tclap REQUIRED)
find_package(simpleini REQUIRED)
find_package(tcp_pubsub REQUIRED)
find_package(asio REQUIRED)
find_package(Threads REQUIRED)

if (ECAL_CORE_CONFIG_INIFILE)
find_package(simpleini REQUIRED)
endif()

if (ECAL_CORE_COMMAND_LINE)
find_package(tclap REQUIRED)
endif()

if (ECAL_CORE_TRANSPORT_TCP)
find_package(tcp_pubsub REQUIRED)
endif()

if (ECAL_CORE_NPCAP_SUPPORT)
find_package(udpcap REQUIRED)
find_package(udpcap REQUIRED)
endif()

# If we're currently doing a build within a git repository, we will configure the header files.
Expand Down Expand Up @@ -307,7 +316,7 @@ if (ECAL_CORE_REGISTRATION)
endif()
endif()

############################################################################
######################################
# serialization
######################################
set(ecal_serialization_src
Expand Down Expand Up @@ -455,6 +464,7 @@ set(ecal_header_cmn
include/ecal/types/monitoring.h
include/ecal/ecal.h
include/ecal/ecal_callback.h
include/ecal/ecal_clang.h
include/ecal/ecal_client.h
include/ecal/ecal_config.h
include/ecal/ecal_core.h
Expand Down Expand Up @@ -525,21 +535,21 @@ ecal_add_ecal_shared_library(${PROJECT_NAME}
${ecal_io_mtx_src}
${ecal_io_mtx_linux_src}
${ecal_io_mtx_win_src}
${ecal_io_shm_src}
${ecal_io_shm_src}
${ecal_io_shm_linux_src}
${ecal_io_shm_win_src}
${ecal_io_udp_fragmentation_src}
${ecal_io_udp_sendreceive_src}
${ecal_io_udp_src}
${ecal_io_udp_sendreceive_linux_src}
${ecal_io_udp_sendreceive_win_src}
${ecal_logging_src}
${ecal_monitoring_src}
${ecal_pub_src}
${ecal_sub_src}
${ecal_logging_src}
${ecal_monitoring_src}
${ecal_pub_src}
${ecal_sub_src}
${ecal_writer_src}
${ecal_reader_src}
${ecal_registration_src}
${ecal_registration_src}
${ecal_serialization_src}
${ecal_service_src}
${ecal_time_src}
Expand Down Expand Up @@ -670,8 +680,8 @@ target_link_libraries(${PROJECT_NAME}
eCAL::ecal-utils
)

set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER ecal/core)
set_property(TARGET ${PROJECT_NAME}_c PROPERTY FOLDER ecal/core)
set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER core)
set_property(TARGET ${PROJECT_NAME}_c PROPERTY FOLDER core)

ecal_install_ecal_shared_library(${PROJECT_NAME}_c)
ecal_install_ecal_shared_library(${PROJECT_NAME})
Expand All @@ -692,9 +702,9 @@ if(NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
${ecal_io_mtx_src}
${ecal_io_mtx_linux_src}
${ecal_io_mtx_win_src}
${ecal_io_shm_src}
${ecal_io_shm_src}
${ecal_io_shm_linux_src}
${ecal_io_shm_win_src}
${ecal_io_shm_win_src}
${ecal_io_udp_fragmentation_src}
${ecal_io_udp_sendreceive_src}
${ecal_io_udp_src}
Expand All @@ -704,10 +714,10 @@ if(NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
${ecal_monitoring_src}
${ecal_pub_src}
${ecal_sub_src}
${ecal_writer_src}
${ecal_reader_src}
${ecal_writer_src}
${ecal_reader_src}
${ecal_registration_src}
${ecal_serialization_src}
${ecal_serialization_src}
${ecal_service_src}
${ecal_time_src}
${ecal_util_src}
Expand All @@ -729,5 +739,5 @@ if(UNIX)

ecal_install_app(${PROJECT_NAME_PROCESS_STUB})

set_property(TARGET ${PROJECT_NAME_PROCESS_STUB} PROPERTY FOLDER ecal/core)
set_property(TARGET ${PROJECT_NAME_PROCESS_STUB} PROPERTY FOLDER core)
endif(UNIX)
49 changes: 31 additions & 18 deletions ecal/core/src/util/ecal_expmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -42,31 +42,38 @@ namespace eCAL
template<class Key,
class T,
class Compare = std::less<Key>,
class Alloc = std::allocator<std::pair<const Key, T> > >
class CExpMap
class Alloc = std::allocator<std::pair<const Key, T> > >
class CExpMap
{
public:
using clock_type = std::chrono::steady_clock;

// Key access history, most recent at back
using key_tracker_type = std::list<std::pair<clock_type::time_point, Key>>;

// Key to value and key history iterator
using key_to_value_type = std::map<Key, std::pair<T, typename key_tracker_type::iterator>>;

using allocator_type = Alloc;
using value_type = std::pair<const Key, T>;
using reference = typename Alloc::reference;
using allocator_type = Alloc;
using value_type = std::pair<const Key, T>;
using reference = typename Alloc::reference;
using const_reference = typename Alloc::const_reference;
using difference_type = typename Alloc::difference_type;
using size_type = typename Alloc::size_type;
using key_type = Key;
using mapped_type = T;
using size_type = typename Alloc::size_type;
using key_type = Key;
using mapped_type = T;

class iterator : public std::iterator<std::bidirectional_iterator_tag, std::pair<Key, T>>
class iterator
{
friend class const_iterator;

public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = std::pair<Key, T>;
using difference_type = std::ptrdiff_t;
using pointer = std::pair<Key, T>*;
using reference = std::pair<Key, T>&;

iterator(const typename key_to_value_type::iterator _it)
: it(_it)
{}
Expand All @@ -87,44 +94,50 @@ namespace eCAL
{
return std::make_pair(it->first, it->second.first);
}

//friend void swap(iterator& lhs, iterator& rhs); //C++11 I think
bool operator==(const iterator& rhs) const { return it == rhs.it; }
bool operator!=(const iterator& rhs) const { return it != rhs.it; }

private:
typename key_to_value_type::iterator it;
};
};

class const_iterator : public std::iterator<std::bidirectional_iterator_tag, const std::pair<Key, T>>
class const_iterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = std::pair<Key, T>;
using difference_type = std::ptrdiff_t;
using pointer = std::pair<Key, T>*;
using reference = std::pair<Key, T>&;

const_iterator(const iterator& other)
: it(other.it)
{}

const_iterator(const typename key_to_value_type::const_iterator _it)
: it(_it)
{}

const_iterator& operator++()
{
it++;
return *this;
} //prefix increment

const_iterator& operator--()
{
it--;
return *this;
} //prefix decrement
//reference operator*() const

std::pair<Key, T> operator*() const
{
return std::make_pair(it->first, it->second.first);
}

//friend void swap(iterator& lhs, iterator& rhs); //C++11 I think
bool operator==(const const_iterator& rhs) const { return it == rhs.it; }
bool operator!=(const const_iterator& rhs) const { return it != rhs.it; }
Expand Down
2 changes: 1 addition & 1 deletion ecal/core_pb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ if(BUILD_PY_BINDING)
set_source_files_properties(${python_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
endif()

set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER ecal/core_pb)
set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER core)
3 changes: 1 addition & 2 deletions ecal/service/ecal_service/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:
/W4>)


# Add own public include directory
target_include_directories(${PROJECT_NAME}
PUBLIC
Expand All @@ -96,7 +95,7 @@ target_include_directories(${PROJECT_NAME}

set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME ${PROJECT_NAME}
FOLDER ecal/service
FOLDER core/service
)

##################################
Expand Down
2 changes: 1 addition & 1 deletion ecal/service/sample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ target_link_libraries(${PROJECT_NAME}

target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)

set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER ecal/service)
set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER core/service)

source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES
${sources}
Expand Down
2 changes: 1 addition & 1 deletion ecal/service/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)

ecal_install_gtest(${PROJECT_NAME})

set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER testing/ecal/service)
set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER core/service)

source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES
${sources}
Expand Down

0 comments on commit a06fdad

Please sign in to comment.