Skip to content

Commit

Permalink
Merge pull request #8 from LnnrtS/main
Browse files Browse the repository at this point in the history
Do not include stdlib headers inside namespace
  • Loading branch information
DNedic authored Oct 24, 2023
2 parents 74e5c60 + 196a1a8 commit 959ad2e
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 17 deletions.
6 changes: 3 additions & 3 deletions lockfree/mpmc/priority_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ template <typename T, size_t size, size_t priority_count> class PriorityQueue {

/************************** INCLUDE ***************************/

/* Include the implementation */
#include "priority_queue_impl.hpp"

} /* namespace mpmc */
} /* namespace lockfree */

/* Include the implementation */
#include "priority_queue_impl.hpp"

#endif /* LOCKFREE_MPMC_PRIORITY_QUEUE_HPP */
6 changes: 6 additions & 0 deletions lockfree/mpmc/priority_queue_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@

/********************** PUBLIC METHODS ************************/

namespace lockfree {
namespace mpmc {

template <typename T, size_t size, size_t priority_count>
bool PriorityQueue<T, size, priority_count>::Push(const T &element,
const size_t priority) {
Expand Down Expand Up @@ -80,3 +83,6 @@ std::optional<T> PriorityQueue<T, size, priority_count>::PopOptional() {
}
}
#endif

} /* namespace mpmc */
} /* namespace lockfree */
6 changes: 3 additions & 3 deletions lockfree/mpmc/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ template <typename T, size_t size> class Queue {

/************************** INCLUDE ***************************/

/* Include the implementation */
#include "queue_impl.hpp"

} /* namespace mpmc */
} /* namespace lockfree */

/* Include the implementation */
#include "queue_impl.hpp"

#endif /* LOCKFREE_MPMC_QUEUE_HPP */
6 changes: 6 additions & 0 deletions lockfree/mpmc/queue_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@

/********************** PUBLIC METHODS ************************/

namespace lockfree {
namespace mpmc {

template <typename T, size_t size>
Queue<T, size>::Queue() : _r_count(0U), _w_count(0U) {}

Expand Down Expand Up @@ -124,3 +127,6 @@ std::optional<T> Queue<T, size>::PopOptional() {
}
}
#endif

} /* namespace mpmc */
} /* namespace lockfree */
6 changes: 4 additions & 2 deletions lockfree/spsc/bipartite_buf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,14 @@ template <typename T, size_t size> class BipartiteBuf {
bool _read_wrapped; /**< Read wrapped flag, used only in the consumer */
};

} /* namespace spsc */
} /* namespace lockfree */

/************************** INCLUDE ***************************/

/* Include the implementation */
#include "bipartite_buf_impl.hpp"

} /* namespace spsc */
} /* namespace lockfree */


#endif /* LOCKFREE_BIPARTITE_BUF_HPP */
6 changes: 6 additions & 0 deletions lockfree/spsc/bipartite_buf_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@

/********************** PUBLIC METHODS ************************/

namespace lockfree {
namespace spsc {

template <typename T, size_t size>
BipartiteBuf<T, size>::BipartiteBuf()
: _r(0U), _w(0U), _i(0U), _write_wrapped(false), _read_wrapped(false) {}
Expand Down Expand Up @@ -199,3 +202,6 @@ size_t BipartiteBuf<T, size>::CalcFree(const size_t w, const size_t r) {
return (size - (w - r)) - 1U;
}
}

} /* namespace spsc */
} /* namespace lockfree */
6 changes: 3 additions & 3 deletions lockfree/spsc/priority_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ template <typename T, size_t size, size_t priority_count> class PriorityQueue {

/************************** INCLUDE ***************************/

/* Include the implementation */
#include "priority_queue_impl.hpp"

} /* namespace spsc */
} /* namespace lockfree */

/* Include the implementation */
#include "priority_queue_impl.hpp"

#endif /* LOCKFREE_PRIORITY_QUEUE_HPP */
6 changes: 6 additions & 0 deletions lockfree/spsc/priority_queue_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@

/********************** PUBLIC METHODS ************************/

namespace lockfree {
namespace spsc {

template <typename T, size_t size, size_t priority_count>
bool PriorityQueue<T, size, priority_count>::Push(const T &element,
const size_t priority) {
Expand Down Expand Up @@ -81,3 +84,6 @@ std::optional<T> PriorityQueue<T, size, priority_count>::PopOptional() {
}
}
#endif

} /* namespace spsc */
} /* namespace lockfree */
6 changes: 3 additions & 3 deletions lockfree/spsc/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ template <typename T, size_t size> class Queue {

/************************** INCLUDE ***************************/

/* Include the implementation */
#include "queue_impl.hpp"

} /* namespace spsc */
} /* namespace lockfree */

/* Include the implementation */
#include "queue_impl.hpp"

#endif /* LOCKFREE_QUEUE_HPP */
6 changes: 6 additions & 0 deletions lockfree/spsc/queue_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@

/********************** PUBLIC METHODS ************************/

namespace lockfree {
namespace spsc {

template <typename T, size_t size> Queue<T, size>::Queue() : _r(0U), _w(0U) {}

template <typename T, size_t size> bool Queue<T, size>::Push(const T &element) {
Expand Down Expand Up @@ -107,3 +110,6 @@ std::optional<T> Queue<T, size>::PopOptional() {
}
}
#endif

} /* namespace spsc */
} /* namespace lockfree */
6 changes: 3 additions & 3 deletions lockfree/spsc/ring_buf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ template <typename T, size_t size> class RingBuf {

/************************** INCLUDE ***************************/

/* Include the implementation */
#include "ring_buf_impl.hpp"

} /* namespace spsc */
} /* namespace lockfree */

/* Include the implementation */
#include "ring_buf_impl.hpp"

#endif /* LOCKFREE_RING_BUF_HPP */
6 changes: 6 additions & 0 deletions lockfree/spsc/ring_buf_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@

/********************** PUBLIC METHODS ************************/

namespace lockfree {
namespace spsc {

template <typename T, size_t size>
RingBuf<T, size>::RingBuf() : _r(0U), _w(0U) {}

Expand Down Expand Up @@ -237,3 +240,6 @@ size_t RingBuf<T, size>::CalcAvailable(const size_t w, const size_t r) {
return size - (r - w);
}
}

} /* namespace spsc */
} /* namespace lockfree */

0 comments on commit 959ad2e

Please sign in to comment.