Skip to content

Commit

Permalink
iox-eclipse-iceoryx#25: review findings
Browse files Browse the repository at this point in the history
Signed-off-by: Poehnl Michael (CC-AD/ESW1) <[email protected]>
  • Loading branch information
Poehnl Michael (CC-AD/ESW1) committed Apr 14, 2020
1 parent 0dd4f60 commit dfbfa43
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once
#ifndef IOX_POPO_CHUNK_DISTRIBUTOR_HPP_
#define IOX_POPO_CHUNK_DISTRIBUTOR_HPP_

#include "iceoryx_posh/internal/mepoo/shared_chunk.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/chunk_distributor_data.hpp"
Expand Down Expand Up @@ -119,3 +120,5 @@ class ChunkDistributor
} // namespace iox

#include "iceoryx_posh/internal/popo/building_blocks/chunk_distributor.inl"

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once
#ifndef IOX_POPO_CHUNK_DISTRIBUTOR_DATA_HPP_
#define IOX_POPO_CHUNK_DISTRIBUTOR_DATA_HPP_

#include "iceoryx_posh/iceoryx_posh_types.hpp"
#include "iceoryx_posh/internal/log/posh_logging.hpp"
Expand Down Expand Up @@ -94,3 +95,5 @@ struct ChunkDistributorData : public LockingPolicy

} // namespace popo
} // namespace iox

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once
#ifndef IOX_POPO_CHUNK_QUEUE_HPP_
#define IOX_POPO_CHUNK_QUEUE_HPP_

#include "iceoryx_posh/internal/mepoo/shared_chunk.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/chunk_queue_data.hpp"
Expand Down Expand Up @@ -100,3 +101,5 @@ class ChunkQueue

} // namespace popo
} // namespace iox

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once
#ifndef IOX_POPO_CHUNK_QUEUE_DATA_HPP_
#define IOX_POPO_CHUNK_QUEUE_DATA_HPP_

#include "iceoryx_posh/iceoryx_posh_types.hpp"
#include "iceoryx_utils/cxx/variant_queue.hpp"
Expand Down Expand Up @@ -53,3 +54,5 @@ struct ChunkQueueData

} // namespace popo
} // namespace iox

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef IOX_POSH_POPO_CHUNK_RECEIVER_HPP_
#define IOX_POSH_POPO_CHUNK_RECEIVER_HPP_
#ifndef IOX_POPO_CHUNK_RECEIVER_HPP_
#define IOX_POPO_CHUNK_RECEIVER_HPP_

#include "iceoryx_posh/internal/popo/building_blocks/chunk_queue.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/chunk_receiver_data.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef IOX_POSH_POPO_CHUNK_RECEIVER_DATA_HPP_
#define IOX_POSH_POPO_CHUNK_RECEIVER_DATA_HPP_
#ifndef IOX_POPO_CHUNK_RECEIVER_DATA_HPP_
#define IOX_POPO_CHUNK_RECEIVER_DATA_HPP_

#include "iceoryx_posh/iceoryx_posh_types.hpp"
#include "iceoryx_posh/internal/mepoo/shared_chunk.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef IOX_POSH_POPO_CHUNK_SENDER_HPP_
#define IOX_POSH_POPO_CHUNK_SENDER_HPP_
#ifndef IOX_POPO_CHUNK_SENDER_HPP_
#define IOX_POPO_CHUNK_SENDER_HPP_

#include "iceoryx_posh/internal/mepoo/shared_chunk.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/chunk_sender_data.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef IOX_POSH_POPO_CHUNK_SENDER_DATA_HPP_
#define IOX_POSH_POPO_CHUNK_SENDER_DATA_HPP_
#ifndef IOX_POPO_CHUNK_SENDER_DATA_HPP_
#define IOX_POPO_CHUNK_SENDER_DATA_HPP_

#include "iceoryx_posh/iceoryx_posh_types.hpp"
#include "iceoryx_posh/internal/mepoo/memory_manager.hpp"
Expand Down
17 changes: 4 additions & 13 deletions iceoryx_posh/test/moduletests/test_popo_chunk_receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ struct DummySample
uint64_t dummy{42};
};

class ChunkReceiver_testBase : public Test
class ChunkReceiver_test : public Test
{
protected:
ChunkReceiver_testBase()
ChunkReceiver_test()
{
m_mempoolconf.addMemPool({CHUNK_SIZE, NUM_CHUNKS_IN_POOL});
m_memoryManager.configureMemoryManager(m_mempoolconf, &m_memoryAllocator, &m_memoryAllocator);
}

~ChunkReceiver_testBase()
~ChunkReceiver_test()
{
}

Expand All @@ -52,7 +52,7 @@ class ChunkReceiver_testBase : public Test
}

static constexpr size_t MEMORY_SIZE = 1024 * 1024;
uint8_t m_memory[1024 * 1024];
uint8_t m_memory[MEMORY_SIZE];
static constexpr uint32_t NUM_CHUNKS_IN_POOL = iox::MAX_CHUNKS_HELD_PER_RECEIVER + iox::MAX_RECEIVER_QUEUE_CAPACITY;
static constexpr uint32_t CHUNK_SIZE = 128;

Expand All @@ -64,15 +64,6 @@ class ChunkReceiver_testBase : public Test
iox::popo::ChunkReceiver m_chunkReceiver{&m_chunkReceiverData};
};

class ChunkReceiver_test : public ChunkReceiver_testBase
{
public:
ChunkReceiver_test()
: ChunkReceiver_testBase()
{
}
};

TEST_F(ChunkReceiver_test, getNoChunkFromEmptyQueue)
{
auto getRet = m_chunkReceiver.get();
Expand Down
19 changes: 5 additions & 14 deletions iceoryx_posh/test/moduletests/test_popo_chunk_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ struct DummySample
uint64_t dummy{42};
};

class ChunkSender_testBase : public Test
class ChunkSender_test : public Test
{
protected:
ChunkSender_testBase()
ChunkSender_test()
{
m_mempoolconf.addMemPool({SMALL_CHUNK, NUM_CHUNKS_IN_POOL});
m_mempoolconf.addMemPool({BIG_CHUNK, NUM_CHUNKS_IN_POOL});
m_memoryManager.configureMemoryManager(m_mempoolconf, &m_memoryAllocator, &m_memoryAllocator);
}

~ChunkSender_testBase()
~ChunkSender_test()
{
}

Expand All @@ -57,7 +57,7 @@ class ChunkSender_testBase : public Test
}

static constexpr size_t MEMORY_SIZE = 1024 * 1024;
uint8_t m_memory[1024 * 1024];
uint8_t m_memory[MEMORY_SIZE];
static constexpr uint32_t NUM_CHUNKS_IN_POOL = 20;
static constexpr uint32_t SMALL_CHUNK = 128;
static constexpr uint32_t BIG_CHUNK = 256;
Expand All @@ -74,20 +74,11 @@ class ChunkSender_testBase : public Test
iox::popo::ChunkSenderData<ChunkDistributorData_t> m_chunkSenderData{&m_memoryManager, 0}; // must be 0 for test
iox::popo::ChunkSenderData<ChunkDistributorData_t> m_chunkSenderDataWithHistory{&m_memoryManager, HISTORY_CAPACITY};

using ChunkDistributor_t = iox::popo::ChunkDistributor<MAX_NUMBER_QUEUES, iox::popo::ThreadSafePolicy>;
using ChunkDistributor_t = iox::popo::ChunkDistributor<ChunkDistributorData_t>;
iox::popo::ChunkSender<ChunkDistributor_t> m_chunkSender{&m_chunkSenderData};
iox::popo::ChunkSender<ChunkDistributor_t> m_chunkSenderWithHistory{&m_chunkSenderDataWithHistory};
};

class ChunkSender_test : public ChunkSender_testBase
{
public:
ChunkSender_test()
: ChunkSender_testBase()
{
}
};

TEST_F(ChunkSender_test, allocate_OneChunk)
{
auto chunk = m_chunkSender.allocate(sizeof(DummySample));
Expand Down

0 comments on commit dfbfa43

Please sign in to comment.