@@ -31,7 +31,7 @@ using namespace std::literals;
3131// /// PUBLIC METHODS
3232// ///////////////////////////////////////////////
3333
34- DSRGraph::DSRGraph (GraphSettings settings) :
34+ DSRGraph::DSRGraph (GraphSettings settings) :
3535 agent_id(settings.agent_id),
3636 agent_name(std::move(settings.graph_name)),
3737 copy(false ),
@@ -163,7 +163,7 @@ std::optional<DSR::Node> DSRGraph::get_node(uint64_t id)
163163
164164std::tuple<bool , std::optional<IDL::MvregNode>> DSRGraph::insert_node_ (CRDTNode &&node)
165165{
166- if (deleted.find (node.id ()) == deleted. end ( ))
166+ if (! deleted.contains (node.id ()))
167167 {
168168 if (auto it = nodes.find (node.id ()); it != nodes.end () and not it->second .empty () and it->second .read_reg () == node)
169169 {
@@ -563,7 +563,6 @@ DSRGraph::insert_or_assign_edge_(CRDTEdge &&attrs, uint64_t from, uint64_t to)
563563 // Update
564564 if (node.fano ().contains ({to, attrs.type ()}))
565565 {
566- std::vector<IDL::MvregEdgeAttr> atts_deltas;
567566 auto iter = nodes.at (from).read_reg ().fano ().find ({attrs.to (), attrs.type ()});
568567 auto end = nodes.at (from).read_reg ().fano ().end ();
569568 if (iter != end) {
@@ -1171,15 +1170,13 @@ void DSRGraph::join_delta_edge(IDL::MvregEdge &&mvreg)
11711170 std::optional<Edge> deleted_edge;
11721171 {
11731172 auto crdt_delta = IDLEdge_to_CRDT (std::move (mvreg));
1173+ deleted_edge = get_edge_ (from, to, type);
11741174 std::unique_lock<std::shared_mutex> lock (_mutex);
11751175 // Check if the node where we are joining the edge exist.
11761176 bool cfrom{nodes.contains (from)}, cto{nodes.contains (to)};
11771177 bool dfrom{deleted.contains (from)}, dto{deleted.contains (to)};
11781178 if (cfrom and cto) {
11791179 joined = true ;
1180- if (!crdt_delta.empty ()) {
1181- deleted_edge = crdt_delta.read_reg ();
1182- }
11831180 signal = process_delta_edge (from, to, type, std::move (crdt_delta));
11841181 if (signal) {
11851182 consume_unprocessed_deltas ();
@@ -1566,13 +1563,13 @@ void print_sample_info(const eprosima::fastdds::dds::SampleInfo& info) {
15661563
15671564 double now = static_cast <double >(secs_t .count ()) * 1000.0 ;
15681565 now += static_cast <double >(duration_cast<std::chrono::nanoseconds>(t_since_epoch).count ()) / 1000000.0 ;
1569-
1566+
15701567 std::ostringstream oss;
15711568 oss << " SampleInfo:" << std::endl;
1572- oss << " ms diff reception: " << (milliseconds_recv - milliseconds_send) << " ms" << std::endl;
1573- oss << " ms taken from dds: " << (now - milliseconds_send) << " ms" << std::endl;
1569+ oss << " ms diff reception: " << (milliseconds_recv - milliseconds_send) << " ms" << std::endl;
1570+ oss << " ms taken from dds: " << (now - milliseconds_send) << " ms" << std::endl;
15741571 oss << " Valid Data: " << (info.valid_data ? " true" : " false" ) << std::endl;
1575- std::cout << oss.str ();
1572+ std::cout << oss.str ();
15761573}
15771574
15781575
@@ -1744,7 +1741,7 @@ void DSRGraph::node_attrs_subscription_thread()
17441741 }
17451742 std::vector<std::future<std::optional<std::string>>> futures;
17461743 for (auto &&s: samples.vec ()) {
1747- if (ignored_attributes.contains (s.attr_name ())) {
1744+ if (! ignored_attributes.contains (s.attr_name ())) {
17481745 futures.emplace_back (tp.spawn_task_waitable ([this , samp{std::move (s)}]() mutable {
17491746 auto f = join_delta_node_attr (std::move (samp));
17501747 return f;
@@ -1839,7 +1836,7 @@ std::pair<bool, bool> DSRGraph::fullgraph_request_thread()
18391836{
18401837 bool sync = false ;
18411838 bool repeated = false ;
1842- auto lambda_request_answer = [&](eprosima::fastdds::dds::DataReader *reader, const DSR::DSRGraph *graph)
1839+ auto lambda_request_answer = [&](eprosima::fastdds::dds::DataReader *reader, DSR::DSRGraph *graph)
18431840 {
18441841 while (true )
18451842 {
0 commit comments