Commit ea3cc760 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Force inlining of simple UndirectedAdaptor functions

parent a993433c
......@@ -130,6 +130,8 @@ struct make_undirected_edge
bool _inverted;
typedef typename graph_traits<Graph>::edge_descriptor original_edge_t;
typedef typename UndirectedAdaptor<Graph>::EdgeDescriptor result_type;
__attribute__((always_inline))
typename UndirectedAdaptor<Graph>::EdgeDescriptor operator()(const original_edge_t& e) const
{
return typename UndirectedAdaptor<Graph>::EdgeDescriptor(e, _inverted);
......@@ -362,7 +364,8 @@ target(typename graph_traits<UndirectedAdaptor<Graph> >::edge_descriptor e,
// vertex(n,g)
//==============================================================================
template <class Graph>
inline typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor
inline __attribute__((always_inline))
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor
vertex(typename graph_traits<UndirectedAdaptor<Graph> >::vertices_size_type n,
const UndirectedAdaptor<Graph>& g)
{
......@@ -373,7 +376,7 @@ vertex(typename graph_traits<UndirectedAdaptor<Graph> >::vertices_size_type n,
// vertices(g)
//==============================================================================
template <class Graph>
inline
inline __attribute__((always_inline))
std::pair<typename graph_traits<UndirectedAdaptor<Graph> >::vertex_iterator,
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_iterator >
vertices(const UndirectedAdaptor<Graph>& g)
......@@ -385,7 +388,7 @@ vertices(const UndirectedAdaptor<Graph>& g)
// edges(g)
//==============================================================================
template <class Graph>
inline
inline __attribute__((always_inline))
std::pair<typename graph_traits<UndirectedAdaptor<Graph> >::edge_iterator,
typename graph_traits<UndirectedAdaptor<Graph> >::edge_iterator >
edges(const UndirectedAdaptor<Graph>& g)
......@@ -402,7 +405,7 @@ edges(const UndirectedAdaptor<Graph>& g)
// edge(u, v, g)
//==============================================================================
template <class Graph>
inline
inline __attribute__((always_inline))
std::pair<typename graph_traits<UndirectedAdaptor<Graph> >::edge_descriptor,
bool>
edge(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
......@@ -426,7 +429,7 @@ edge(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
// out_edges(u,g)
//==============================================================================
template <class Graph>
inline
inline __attribute__((always_inline))
std::pair<typename graph_traits<UndirectedAdaptor<Graph> >::out_edge_iterator,
typename graph_traits<UndirectedAdaptor<Graph> >::out_edge_iterator >
out_edges(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
......@@ -459,7 +462,7 @@ out_edges(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
// adjacent_vertices(u,g)
//==============================================================================
template <class Graph>
inline
inline __attribute__((always_inline))
std::pair<typename graph_traits<UndirectedAdaptor<Graph> >::adjacency_iterator,
typename graph_traits<UndirectedAdaptor<Graph> >::adjacency_iterator>
adjacent_vertices
......@@ -479,7 +482,8 @@ adjacent_vertices
// num_vertices(g)
//==============================================================================
template <class Graph>
inline typename graph_traits<UndirectedAdaptor<Graph> >::vertices_size_type
inline __attribute__((always_inline))
typename graph_traits<UndirectedAdaptor<Graph> >::vertices_size_type
num_vertices(const UndirectedAdaptor<Graph>& g)
{
return num_vertices(g.OriginalGraph());
......@@ -499,10 +503,10 @@ num_edges(const UndirectedAdaptor<Graph>& g)
// out_degree(u,g)
//==============================================================================
template <class Graph>
inline typename graph_traits<UndirectedAdaptor<Graph> >::degree_size_type
out_degree
(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
const UndirectedAdaptor<Graph>& g)
inline __attribute__((always_inline))
typename graph_traits<UndirectedAdaptor<Graph> >::degree_size_type
out_degree(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
const UndirectedAdaptor<Graph>& g)
{
return (out_degree(u, g.OriginalGraph())+in_degree(u,g.OriginalGraph()));
}
......@@ -511,7 +515,8 @@ out_degree
// degree(u,g)
//==============================================================================
template <class Graph>
inline typename graph_traits<UndirectedAdaptor<Graph> >::degree_size_type
inline __attribute__((always_inline))
typename graph_traits<UndirectedAdaptor<Graph> >::degree_size_type
degree(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
const UndirectedAdaptor<Graph>& g)
{
......@@ -523,7 +528,8 @@ degree(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
// add_vertex(g)
//==============================================================================
template <class Graph>
inline typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor
inline __attribute__((always_inline))
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor
add_vertex(UndirectedAdaptor<Graph>& g)
{
return add_vertex(g.OriginalGraph());
......@@ -543,9 +549,9 @@ add_vertex(const VertexProperties& p, UndirectedAdaptor<Graph>& g)
// clear_vertex(u,g)
//==============================================================================
template <class Graph>
inline void clear_vertex
(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
UndirectedAdaptor<Graph>& g)
inline __attribute__((always_inline))
void clear_vertex(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
UndirectedAdaptor<Graph>& g)
{
clear_vertex(u, g.OriginalGraph());
}
......@@ -554,9 +560,9 @@ inline void clear_vertex
// remove_vertex(u,g)
//==============================================================================
template <class Graph>
inline void remove_vertex
(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
UndirectedAdaptor<Graph>& g)
inline __attribute__((always_inline))
void remove_vertex(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
UndirectedAdaptor<Graph>& g)
{
remove_vertex(u, g.OriginalGraph());
}
......@@ -565,9 +571,9 @@ inline void remove_vertex
// remove_vertex_fast(u,g)
//==============================================================================
template <class Graph>
inline void remove_vertex_fast
(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
UndirectedAdaptor<Graph>& g)
inline __attribute__((always_inline))
void remove_vertex_fast(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
UndirectedAdaptor<Graph>& g)
{
remove_vertex_fast(u, g.OriginalGraph());
}
......@@ -576,7 +582,7 @@ inline void remove_vertex_fast
// add_edge(u,v,g)
//==============================================================================
template <class Graph>
inline
inline __attribute__((always_inline))
std::pair<typename graph_traits<UndirectedAdaptor<Graph> >::edge_descriptor,
bool>
add_edge(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
......@@ -595,7 +601,7 @@ add_edge(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
// add_edge(u,v,ep,g)
//==============================================================================
template <class Graph, class EdgeProperties>
inline
inline __attribute__((always_inline))
std::pair<typename graph_traits<UndirectedAdaptor<Graph> >::edge_descriptor,
bool>
add_edge(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
......@@ -614,10 +620,10 @@ add_edge(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
// remove_edge(u,v,g)
//==============================================================================
template <class Graph>
inline void remove_edge
(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor v,
UndirectedAdaptor<Graph>& g)
inline __attribute__((always_inline))
void remove_edge(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor v,
UndirectedAdaptor<Graph>& g)
{
remove_edge(u,v,g.OriginalGraph());
remove_edge(v,u,g.OriginalGraph());
......@@ -627,9 +633,9 @@ inline void remove_edge
// remove_edge(e,g)
//==============================================================================
template <class Graph>
inline void remove_edge
(typename graph_traits<UndirectedAdaptor<Graph> >::edge_descriptor e,
UndirectedAdaptor<Graph>& g)
inline __attribute__((always_inline))
void remove_edge (typename graph_traits<UndirectedAdaptor<Graph> >::edge_descriptor e,
UndirectedAdaptor<Graph>& g)
{
remove_edge(typename graph_traits<Graph>::edge_descriptor(e),
g.OriginalGraph());
......@@ -639,9 +645,9 @@ inline void remove_edge
// remove_edge(e_iter,g)
//==============================================================================
template <class Graph>
inline void remove_edge
(typename graph_traits<UndirectedAdaptor<Graph> >::out_edge_iterator iter,
UndirectedAdaptor<Graph>& g)
inline __attribute__((always_inline))
void remove_edge(typename graph_traits<UndirectedAdaptor<Graph> >::out_edge_iterator iter,
UndirectedAdaptor<Graph>& g)
{
remove_edge(*iter, g);
}
......@@ -650,9 +656,9 @@ inline void remove_edge
// remove_out_edge_if(v,predicate,g)
//==============================================================================
template <class Graph, class Predicate>
inline void remove_out_edge_if
(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor v,
Predicate predicate, UndirectedAdaptor<Graph>& g)
inline __attribute__((always_inline))
void remove_out_edge_if(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor v,
Predicate predicate, UndirectedAdaptor<Graph>& g)
{
std::list<typename UndirectedAdaptor<Graph>::EdgeDescriptor> removed_edges;
typedef typename graph_traits<UndirectedAdaptor<Graph> >::out_edge_iterator
......@@ -740,7 +746,8 @@ public:
// get(tag,g)
//==============================================================================
template <class PropertyTag, class Graph>
inline typename property_map<UndirectedAdaptor<Graph>, PropertyTag>::type
inline __attribute__((always_inline))
typename property_map<UndirectedAdaptor<Graph>, PropertyTag>::type
get(PropertyTag tag, UndirectedAdaptor<Graph>& g)
{
return get(tag, g.OriginalGraph());
......@@ -750,7 +757,8 @@ get(PropertyTag tag, UndirectedAdaptor<Graph>& g)
// const get(tag,g)
//==============================================================================
template <class PropertyTag, class Graph>
inline typename property_map<UndirectedAdaptor<Graph>, PropertyTag>::const_type
inline __attribute__((always_inline))
typename property_map<UndirectedAdaptor<Graph>, PropertyTag>::const_type
get(PropertyTag tag, const UndirectedAdaptor<Graph>& g)
{
return get(tag, g.OriginalGraph());
......@@ -760,7 +768,7 @@ get(PropertyTag tag, const UndirectedAdaptor<Graph>& g)
// get(tag,g,v)
//==============================================================================
template <class PropertyTag, class Graph>
inline
inline __attribute__((always_inline))
typename property_traits
<typename property_map<UndirectedAdaptor<Graph>,
PropertyTag>::const_type >::value_type
......@@ -774,7 +782,7 @@ get(PropertyTag tag, const UndirectedAdaptor<Graph>& g,
// get(tag,g,e)
//==============================================================================
template <class PropertyTag, class Graph>
inline
inline __attribute__((always_inline))
typename property_traits
<typename property_map<UndirectedAdaptor<Graph>,
PropertyTag>::const_type >::value_type
......@@ -788,7 +796,7 @@ get(PropertyTag tag, const UndirectedAdaptor<Graph>& g,
// put(tag, g, v, value)
//==============================================================================
template <class Graph, class PropertyTag, class Value>
inline
inline __attribute__((always_inline))
void put(PropertyTag tag, UndirectedAdaptor<Graph>& g,
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor v,
const Value& value)
......@@ -800,7 +808,7 @@ void put(PropertyTag tag, UndirectedAdaptor<Graph>& g,
// put(tag, g, e, value)
//==============================================================================
template <class Graph, class PropertyTag, class X, class Value>
inline
inline __attribute__((always_inline))
void put(PropertyTag tag, const UndirectedAdaptor<Graph>& g,
typename graph_traits<UndirectedAdaptor<Graph> >::edge_descriptor e,
const Value &value)
......@@ -812,7 +820,7 @@ void put(PropertyTag tag, const UndirectedAdaptor<Graph>& g,
// get_property(g,tag)
//==============================================================================
template <class Graph, class GraphProperties, class GraphPropertyTag>
inline
inline __attribute__((always_inline))
typename property_value<GraphProperties, GraphPropertyTag>::type&
get_property(UndirectedAdaptor<Graph>& g, GraphPropertyTag tag)
{
......@@ -823,7 +831,7 @@ get_property(UndirectedAdaptor<Graph>& g, GraphPropertyTag tag)
// const get_property(g,tag)
//==============================================================================
template <class Graph, class GraphProperties, class GraphPropertyTag>
inline
inline __attribute__((always_inline))
const typename property_value<GraphProperties, GraphPropertyTag>::type&
get_property(const UndirectedAdaptor<Graph>& g, GraphPropertyTag tag)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment