LCOV - code coverage report
Current view: top level - route - route.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 4 4 100.0 %
Date: 2026-05-15 13:12:55 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #ifndef ctrlplane_route_h
       6             : #define ctrlplane_route_h
       7             : 
       8             : #include <boost/intrusive/list.hpp>
       9             : #include <boost/intrusive/set.hpp>
      10             : 
      11             : #include "db/db_entry.h"
      12             : #include "route/path.h"
      13             : 
      14             : class Route : public DBEntry {
      15             : public:
      16             :     typedef boost::intrusive::member_hook<Path,
      17             :             boost::intrusive::list_member_hook<>,
      18             :             &Path::node_> PathListMember;
      19             : 
      20             :     typedef boost::intrusive::list<Path, PathListMember> PathList;
      21             :     typedef bool (*Compare)(const Path &path1, const Path &path2);
      22             : 
      23             :     Route();
      24             : 
      25             :     virtual ~Route();
      26             : 
      27             :     virtual int CompareTo(const Route &rhs) const = 0;
      28             : 
      29             :     bool operator<(const Route &rhs) const {
      30             :         int res = CompareTo(rhs);
      31             :         return res < 0;
      32             :     }
      33             : 
      34             :     // Selected path
      35             :     const Path *front() const;
      36             : 
      37             :     // Insert a path
      38             :     void insert(const Path *path);
      39             : 
      40             :     // Remove a path
      41             :     void remove(const Path *path);
      42             : 
      43             :     // Sort paths based on compare function.
      44             :     void Sort(Compare compare, const Path *prev_front);
      45             : 
      46    16588475 :     const PathList &GetPathList() const {
      47    16588475 :         return path_;
      48             :     }
      49             : 
      50    15231194 :     PathList &GetPathList() {
      51    15231194 :         return path_;
      52             :     }
      53             : 
      54             : private:
      55             :     // Path List
      56             :     PathList path_;
      57             : 
      58             :     DISALLOW_COPY_AND_ASSIGN(Route);
      59             : };
      60             : 
      61             : 
      62             : #endif

Generated by: LCOV version 1.14