Skip to content

Commit

Permalink
fix linux compil
Browse files Browse the repository at this point in the history
  • Loading branch information
bha committed Feb 14, 2024
1 parent aeea8c6 commit 381ad16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
6 changes: 4 additions & 2 deletions lib/include/bofstd/bofscopeguard.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ class BofScopeGuard
BofScopeGuard() = delete;
BofScopeGuard(const BofScopeGuard &) = delete;
BofScopeGuard &operator=(const BofScopeGuard &) = delete;
BofScopeGuard(BofScopeGuard &&_rrhs) : mF(std::move(_rrhs.mOutOfScopeCallback)), mActive_B(_rrhs.mActive_B)
BofScopeGuard(BofScopeGuard &&_rrhs)
: mOutOfScopeCallback(std::move(_rrhs.mOutOfScopeCallback)), mActive_B(_rrhs.mActive_B)
{
_rrhs.dismiss();
}
BofScopeGuard(OutOfScopeCallback _OutOfScopeCallback) : mOutOfScopeCallback(std::move(_OutOfScopeCallback)), mActive_B(true)
BofScopeGuard(OutOfScopeCallback _OutOfScopeCallback)
: mOutOfScopeCallback(_OutOfScopeCallback), mActive_B(true)
{
}
~BofScopeGuard()
Expand Down
19 changes: 10 additions & 9 deletions tests/src/ut_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,19 @@ This example demonstrates the basic structure of a directed graph with nodes and
#include <bofstd/bofstd.h>

#include <algorithm>
#include <atomic>
#include <cassert>
#include <iterator>
#include <mutex>
#include <stack>
#include <stddef.h>
#include <utility>
#include <vector>
#include <mutex>

BEGIN_BOF_NAMESPACE()
struct BOF_DIR_GRAPH_PARAM
{
bool MultiThreadAware_B; /*! true if the object is used in a multi threaded application (use mCircularBufferMtx_X)*/
bool MultiThreadAware_B; /*! true if the object is used in a multi threaded application (use mCircularBufferMtx_X)*/

BOF_DIR_GRAPH_PARAM()
{
Expand All @@ -124,7 +125,7 @@ struct Span

template <typename Container>
Span(Container &_Container)
: mBegin(_Container.data()), mEnd(mBegin + _Container.size())
: mBegin(_Container.data()), mEnd(mBegin + _Container.size())
{
}
iterator begin() const
Expand Down Expand Up @@ -179,7 +180,7 @@ class IdMap
return mElementCollection.end();
}

//Span<ElementType> &Element() const
// Span<ElementType> &Element() const
std::vector<ElementType> &Element()
{
return mElementCollection;
Expand Down Expand Up @@ -326,7 +327,8 @@ template <typename NodeType>
class BofDirGraph
{
public:
BofDirGraph(const BOF_DIR_GRAPH_PARAM &_rBofDirGraphParam_X) : mCrtId(1), mNodeCollection(), mEdgeFromNodeCollection(), mNodeNeighborCollection(), mEdgeCollection()
BofDirGraph(const BOF_DIR_GRAPH_PARAM &_rBofDirGraphParam_X)
: mCrtId(1), mNodeCollection(), mEdgeFromNodeCollection(), mNodeNeighborCollection(), mEdgeCollection()
{
mBofDirGraphParam_X = _rBofDirGraphParam_X;
}
Expand All @@ -339,7 +341,7 @@ class BofDirGraph

Edge() = default;
Edge(const uint32_t _Id_U32, const uint32_t _From_U32, const uint32_t _To_U32)
: Id_U32(_Id_U32), From_U32(_From_U32), To_U32(_To_U32)
: Id_U32(_Id_U32), From_U32(_From_U32), To_U32(_To_U32)
{
}
inline uint32_t Opposite(const uint32_t _Id_U32) const
Expand Down Expand Up @@ -394,7 +396,7 @@ template <typename NodeType>
const NodeType &BofDirGraph<NodeType>::Node(const uint32_t _Id_U32) const
{
std::lock_guard<std::mutex> Lock(mMtx);
const auto iter = mNodeCollection.find(id);
const auto iter = mNodeCollection.find(_Id_U32);
BOF_ASSERT(iter != mNodeCollection.end());
return *iter;
}
Expand Down Expand Up @@ -425,13 +427,12 @@ Span<const uint32_t> BofDirGraph<NodeType>::Neighbor(uint32_t _Id_U32) const
return *iter;
}


template <typename NodeType>
size_t BofDirGraph<NodeType>::NbEdgeFromNode(const uint32_t _Id_U32) const
{
std::lock_guard<std::mutex> Lock(mMtx);
auto Rts = mEdgeFromNodeCollection.Find(_Id_U32);
BOF_ASSERT(Rts != mEdgeFromNodeCollection.end());
BOF_ASSERT(Rts != mEdgeFromNodeCollection.cend());
return *Rts;
}

Expand Down

0 comments on commit 381ad16

Please sign in to comment.