Skip to content

Commit

Permalink
Pimpl idiom on wbt::Signal
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed May 7, 2018
1 parent 6385004 commit 75c1d36
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 104 deletions.
21 changes: 8 additions & 13 deletions toolbox/include/base/Signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#ifndef WBT_SIGNAL_H
#define WBT_SIGNAL_H

#include <memory>

namespace wbt {
class Signal;
enum class DataType;
Expand Down Expand Up @@ -75,15 +77,8 @@ class wbt::Signal
};

private:
int m_width = DynamicSize;
const bool m_isConst;
const DataType m_portDataType;
const DataFormat m_dataFormat;

void* m_bufferPtr; ///< Pointer to the data buffer @see DataFormat

void deleteBuffer();
void allocateBuffer(const void* const bufferInput, void*& bufferOutput, unsigned length);
class impl;
std::unique_ptr<impl> pImpl;

public:
static const int DynamicSize;
Expand All @@ -93,11 +88,11 @@ class wbt::Signal
const bool& isConst = true);
~Signal();

Signal(const Signal& signal);
Signal& operator=(const Signal& signal) = delete;
Signal(const Signal& other);
Signal& operator=(const Signal& other) = delete;

Signal(Signal&& signal);
Signal& operator=(Signal&& signal) = delete;
Signal(Signal&& other);
Signal& operator=(Signal&& other) = delete;

/**
* @brief Initialize the signal from a contiguous buffer
Expand Down
Loading

0 comments on commit 75c1d36

Please sign in to comment.