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

whitespace cleanup #2

Merged
merged 2 commits into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 6 additions & 6 deletions iceoryx_examples/icedelivery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ include(GNUInstallDirs)

find_package(iceoryx_posh CONFIG REQUIRED)

add_executable(ice_sender ./ice_sender.cpp)
add_executable(ice_sender ./ice_sender.cpp)
target_link_libraries(ice_sender
iceoryx_posh::iceoryx_posh
)

add_executable(ice_receiver ./ice_receiver.cpp)
add_executable(ice_receiver ./ice_receiver.cpp)
target_link_libraries(ice_receiver
iceoryx_posh::iceoryx_posh
)

add_executable(ice_sender_simple ./ice_sender_simple.cpp)
add_executable(ice_sender_simple ./ice_sender_simple.cpp)
target_link_libraries(ice_sender_simple
iceoryx_posh::iceoryx_posh
)

add_executable(ice_receiver_simple ./ice_receiver_simple.cpp)
add_executable(ice_receiver_simple ./ice_receiver_simple.cpp)
target_link_libraries(ice_receiver_simple
iceoryx_posh::iceoryx_posh
)

set_target_properties(ice_sender ice_receiver ice_sender_simple ice_receiver_simple
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/icedelivery")
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/icedelivery")

install(
TARGETS ice_sender ice_receiver ice_sender_simple ice_receiver_simple
RUNTIME DESTINATION bin
)
)
16 changes: 8 additions & 8 deletions iceoryx_examples/icedelivery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ communication setup but does not actually participate in the communication betwe
of RouDi as the switchboard operator of iceoryx. One of his other major tasks is the setup of the shared memory,
which the applications are using to talk to each other. We currently use memory pools with different chunk sizes,
called in literature a segregated free-list approach. RouDi is delivered pre-built in the Debian package
with a default memory config. We don't support the memory pool configuration with a config file yet, so it has to be
with a default memory config. We don't support the memory pool configuration with a config file yet, so it has to be
changed in the source file [mepoo_config.cpp](../../iceoryx_posh/source/mepoo/mepoo_config.cpp).
To view the available command line options call `RouDi --help`.

Expand Down Expand Up @@ -42,9 +42,9 @@ The counter can differ depending on startup of the applications.
### RouDi

Reserving 99683360 bytes in the shared memory [/iceoryx_mgmt]
[ Reserving shared memory successful ]
[ Reserving shared memory successful ]
Reserving 410709312 bytes in the shared memory [/username]
[ Reserving shared memory successful ]
[ Reserving shared memory successful ]

### Sender

Expand Down Expand Up @@ -108,12 +108,12 @@ to everyone:
The strings inside the first parameter of the constructor of `iox::popo::Publisher` are of the type
`capro::ServiceDescription`. `capro` stands for **ca**nionical **pro**tocol and is used to abstract different
SoA protocols. `Radar` is the service name, `FrontLeft` an instance of the service `Radar` and the third string the
specific event `Counter` of the instance. This service model comes from AUTOSAR. It is maybe not the best fit for
typical publish/subscribe APIs but it allows us a matching to different technologies. The event can be compared to
specific event `Counter` of the instance. This service model comes from AUTOSAR. It is maybe not the best fit for
typical publish/subscribe APIs but it allows us a matching to different technologies. The event can be compared to
a topic in other publish/subscribe approaches. The service is not a single request/response thing but an element
for grouping of events and/or methods that can be discovered as a service. Service and instance are like classes and
for grouping of events and/or methods that can be discovered as a service. Service and instance are like classes and
objects in C++. So you always have a specific instance of a service during runtime. In iceoryx a publisher and
a subscriber only match if all the three IDs match.
a subscriber only match if all the three IDs match.

Now comes the work mode. Data needs to be created. But hang on.. we need memory first! Let's reserve a chunk of
shared memory:
Expand Down Expand Up @@ -239,7 +239,7 @@ Another difference to the prior sender is the simpler `allocate()` call with the
myTypedPublisher.publish(std::move(sample));

Now `allocate()` returns a `std::unique_ptr<TopicType, SampleDeleter<TopicType>>` instead of a `void*` , which
automatically frees the memory when going out of scope. For sening the sample the ownership must be transferred
automatically frees the memory when going out of scope. For sening the sample the ownership must be transferred
to the middleware with a move operation.

### Receiver (simple)
Expand Down
8 changes: 4 additions & 4 deletions iceoryx_examples/icedelivery/a_typed_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ using SamplePtr = std::unique_ptr<TopicType, SampleDeleter<TopicType>>;
/// @brief A typed publisher that takes the topic type as template argument
/// A RAII pattern is used with offering the the publisher in c'tor and stop offering in d'tor
/// This class has the limitation that the topic type is a fixed size data structure.
/// I.e. we can get the size of memory to allcoate with the sizeof() operation.
/// I.e. we can get the size of memory to allcoate with the sizeof() operation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*allocate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in a204c13

/// So the topic type is not allowed to use heap-based members like a std::vector with default allocator
/// allocate() returns a unique_ptr to a sample. This must be moved to the publish call for sending
/// If the unique_ptr goes out of scope without publishing, the provided custom deleter frees the memory chunk
Expand Down Expand Up @@ -121,8 +121,8 @@ class TypedSubscriber
while (m_subscriber.getChunk(&chunk))
{
auto sample = static_cast<const CounterTopic*>(chunk);
// call the provided callback

// call the provided callback
m_callback(*sample);

// release the chunk
Expand All @@ -132,4 +132,4 @@ class TypedSubscriber

iox::popo::Subscriber m_subscriber;
OnReceiveCallback<TopicType> m_callback;
};
};
2 changes: 1 addition & 1 deletion iceoryx_examples/icedelivery/ice_receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void receiving()
{
std::cout << "Not subscribed" << std::endl;
}

// sleep
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_examples/icedelivery/ice_receiver_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void receiving()
TypedSubscriber<CounterTopic> myTypedSubscriber({"Radar", "FrontRight", "Counter"}, myCallback);

while (!killswitch)
{
{
// sleep
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
Expand Down
4 changes: 2 additions & 2 deletions iceoryx_examples/icedelivery/ice_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void sending()

// Create a publisher
iox::popo::Publisher myPublisher({"Radar", "FrontLeft", "Counter"});

// With offer() the publisher gets visible to potential subscribers
myPublisher.offer();

Expand All @@ -53,7 +53,7 @@ void sending()

// Send the sample
myPublisher.sendChunk(sample);

ct++;

// Sleep some time
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_examples/icedelivery/ice_sender_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void sending()

// pass the ownership to the middleware for sending the sample
myTypedPublisher.publish(std::move(sample));

ct++;

// Sleep some time
Expand Down
8 changes: 4 additions & 4 deletions iceoryx_posh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ endif( clang-tidy )
########## set variables for library export ##########
#
setup_package_name_and_create_files(
NAME ${PROJECT_NAME}
NAMESPACE iceoryx_posh
NAME ${PROJECT_NAME}
NAMESPACE iceoryx_posh
PROJECT_PREFIX ${PREFIX}
)

Expand Down Expand Up @@ -182,7 +182,7 @@ if(PERFORM_CLANG_TIDY)
)
endif(PERFORM_CLANG_TIDY)
target_link_libraries(RouDi
PRIVATE
PRIVATE
${PROJECT_NAMESPACE}::iceoryx_posh_roudi
)

Expand Down Expand Up @@ -214,7 +214,7 @@ endif(roudi_environment)
########## exporting library ##########
#
setup_install_directories_and_export_package(
TARGETS iceoryx_posh iceoryx_posh_roudi RouDi
TARGETS iceoryx_posh iceoryx_posh_roudi RouDi
INCLUDE_DIRECTORY include/
)

Expand Down
4 changes: 2 additions & 2 deletions iceoryx_posh/cmake/iceoryx_versions.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define ICEORYX_BUILDDATE "@ICEORYX_BUILDDATE@"


#define ICEORYX_PRINT_BUILDINFO() INFO_PRINTF("Built: %s\n",ICEORYX_BUILDDATE);
#define ICEORYX_PRINT_BUILDINFO() INFO_PRINTF("Built: %s\n",ICEORYX_BUILDDATE);


#endif
20 changes: 10 additions & 10 deletions iceoryx_posh/cmake/iceoryxversions.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Find GIT revisions
execute_process(COMMAND
git describe --match=None --always --abbrev=40 --dirty
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE ICEORYX_SHA1
OUTPUT_STRIP_TRAILING_WHITESPACE)
git describe --match=None --always --abbrev=40 --dirty
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE ICEORYX_SHA1
OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(COMMAND
date -u -R
OUTPUT_VARIABLE ICEORYX_BUILDDATE
OUTPUT_STRIP_TRAILING_WHITESPACE)
date -u -R
OUTPUT_VARIABLE ICEORYX_BUILDDATE
OUTPUT_STRIP_TRAILING_WHITESPACE)

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/iceoryx_versions.hpp.in"
"${CMAKE_BINARY_DIR}/generated/iceoryx/include/iceoryx_versions.hpp" @ONLY)
"${CMAKE_BINARY_DIR}/generated/iceoryx/include/iceoryx_versions.hpp" @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/generated/iceoryx/include/iceoryx_versions.hpp
DESTINATION include/${PREFIX}
COMPONENT dev)
DESTINATION include/${PREFIX}
COMPONENT dev)
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct ReceiverPortData : public BasePortData
mutable std::atomic_bool m_chunkSendCallbackActive{false};
mutable cxx::optional<mutex_t> m_chunkSendCallbackMutex = mutex_t::CreateMutex(false);
posix::Semaphore* m_chunkSendSemaphore{nullptr};

// offer semaphore that is stored in shared memory
sem_t m_shmSemaphoreHandle;
posix::Semaphore::result_t m_shmSemaphore = posix::Semaphore::create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,5 @@ class UsedChunkList
std::array<mepoo::ChunkManagement*, Size> m_data;
};


} // namespace popo
} // namespace iox
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,5 @@ void MemPoolIntrospection<MemoryManager, SegmentManager, SenderPort>::copyMemPoo
}
}


} // namespace roudi
} // namespace iox
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <thread>
#include <vector>

#include <map>
#include <map>

namespace iox
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,5 @@ bool PortIntrospection<SenderPort>::removeReceiver(const std::string& name, cons
return m_portData.removeReceiver(name, service);
}


} // namespace roudi
} // namespace iox
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ class ProcessIntrospection
*/
using ProcessIntrospectionType = ProcessIntrospection<SenderPortType>;


} // namespace roudi
} // namespace iox

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,5 @@ void ProcessIntrospection<SenderPort>::setSendInterval(unsigned int interval_ms)
}
}


} // namespace roudi
} // namespace iox
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct RunnableData


iox::cxx::CString100 m_process;
iox::cxx::CString100 m_runnable;
iox::cxx::CString100 m_runnable;
uint64_t m_runnableDeviceIdentifier;
};
} // namespace runtime
Expand Down
4 changes: 2 additions & 2 deletions iceoryx_posh/include/iceoryx_posh/mepoo/mepoo_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct MePooConfig

using MePooConfigContainerType = cxx::vector<Entry, MAX_NUMBER_OF_MEMPOOLS>;
MePooConfigContainerType m_mempoolConfig;

/// @brief Default constructor to set the configuration for memory pools
MePooConfig() = default;

Expand All @@ -55,7 +55,7 @@ struct MePooConfig
/// @brief Function for adding new entry
/// @param[in] Entry structure of mempool configuration
void addMemPool(Entry f_entry) noexcept;

/// @brief Function for creating default memory pools
MePooConfig& setDefaults() noexcept;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace popo
{
class InterfacePort;

/// @brief Discover the gateway
/// @brief Discover the gateway
template <typename Impl_T = GatewayGeneric>
class GatewayDiscovery
{
Expand Down
3 changes: 1 addition & 2 deletions iceoryx_posh/include/iceoryx_posh/popo/gateway_generic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ class GatewayGeneric
{
public:
using CaproMessage = capro::CaproMessage;

/// @brief Constructor for creating generic gateway based on type of interface
/// @param[in] f_interface Type of interface
GatewayGeneric(const Interfaces f_interface) noexcept;

GatewayGeneric& operator=(const GatewayGeneric& other) = delete;
GatewayGeneric(const GatewayGeneric& other) = delete;


/// @brief Get function for type of capro message - service or event or field
/// @param[in] msg Type of caro message
bool getCaProMessage(CaproMessage& msg) noexcept;
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_posh/include/iceoryx_posh/popo/subscriber.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Subscriber
using mutex_t = std::mutex;
using ReceiveHandler_t = std::function<void(void)>;

/// @brief Constructor
/// @brief Constructor
/// @param[in] service Information on service , service, instance, event Id
/// @param[in] runnableName optional name of the runnable the subscriber belongs to
explicit Subscriber(const capro::ServiceDescription& service, const cxx::CString100& runnableName = "") noexcept;
Expand Down
4 changes: 2 additions & 2 deletions iceoryx_posh/source/mepoo/mepoo_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ MePooConfig& MePooConfig::setDefaults() noexcept
m_mempoolConfig.push_back({1024 * 1024 * 2, 20});
m_mempoolConfig.push_back({1024 * 1024 * 4, 10});
m_mempoolConfig.push_back({1024 * 1024 * 8, 10});
m_mempoolConfig.push_back({1024 * 1024 * 16, 5});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default mempool configuration reserves nearly 500 megabytes of RAM, with your adaptions it would consume approx. 730 megabytes. Is this intended?

On the side i take the point with me to provide an example with a custom-sized mempool in RouDi for the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

legacy changes for presentation.

m_mempoolConfig.push_back({1024 * 1024 * 32, 2});
m_mempoolConfig.push_back({1024 * 1024 * 16, 10});
m_mempoolConfig.push_back({1024 * 1024 * 32, 10});

return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_posh/source/popo/base_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace popo
std::atomic<uint64_t> BasePort::MemberType_t::s_uniqueIdCounter{1};

BasePort::BasePort(BasePortData* const f_basePortDataPtr) noexcept
: m_basePortDataPtr(f_basePortDataPtr)
: m_basePortDataPtr(f_basePortDataPtr)
{
}

Expand Down
1 change: 0 additions & 1 deletion iceoryx_posh/source/roudi/roudi_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ void ProcessManager::addSenderForProcess(const std::string& f_name,
l_process->sendToMQ(l_sendBuffer);
ERR_PRINTF("Could not create SenderPortImpl for application %s\n", f_name.c_str());
}

}
else
{
Expand Down
Loading