Boost logo

Boost Users :

From: Peter Aronsson (petar_at_[hidden])
Date: 2004-03-10 02:20:31


Jeremy Siek wrote:

> I'm sorry, but could I ask you to post a complete C++ program so that
> I can
> immediately reproduce the problem.
>
> Thanks,
> Jeremy

Sure,
Here is a shortened version that should produce the error on tg.cpp:62

Regards Peter Aronsson

-- 
 _________________________________________________________________
/ Peter Aronsson, Phd Student at PELAB (Programming Environments  \ 
| Laboratory ) Department for Computer & Information Science      | 
| Linköping University, Sweden                                    | 
|=================================================================|
| petar_at_[hidden] , phone +46 (0)13-28 1737 Room 3B:490          |
\_________________________________________________________________/

#include "tg.hpp"

VertexNameMap::type VertexNameProperty(TaskGraph* tg)
{
  boost::vertex_name_t pname;
  VertexNameMap::type pmap = get(pname, *tg);
  return pmap;
};

VertexUniqueIDMap::type VertexUniqueIDProperty(TaskGraph* tg)
{
  vertex_unique_id_t pname;
  VertexUniqueIDMap::type pmap = get(pname, *tg);
  return pmap;
};

VertexExecCostMap::type VertexExecCostProperty(TaskGraph* tg)
{
  vertex_execcost_t pname;
  VertexExecCostMap::type pmap = get(pname, *tg);
  return pmap;
}

EdgeCommCostMap::type EdgeCommCostProperty(TaskGraph* tg)
{
  boost::edge_weight_t pname;
  EdgeCommCostMap::type pmap= get(pname, *tg);
  return pmap;
};

int getCommCost(EdgeID edge,TaskGraph * tg)
{
  return get(EdgeCommCostProperty(tg),edge);
}

void setCommCost(EdgeID edge, int weight,TaskGraph * tg)
{
  put(EdgeCommCostProperty(tg),edge, weight);
}

int getTaskID(VertexID v,TaskGraph * tg)
{
  return get(VertexUniqueIDProperty(tg),v);
}

std::pair<ChildrenIterator, ChildrenIterator>
children(VertexID v, TaskGraph &tg)
{
  OutEdgeIterator e,e_end;
  tie(e,e_end) = out_edges(v,tg);
  ChildrenIterator c(e,&tg),c_end(e_end,&tg);
  return make_pair(c,c_end);
}

std::pair<ParentsIterator, ParentsIterator>
parents(VertexID v, TaskGraph &tg)
{
  InEdgeIterator e,e_end;
  tie(e,e_end) = in_edges(v,tg);
  ParentsIterator c(e),c_end(e_end);
  return make_pair(e,e_end);
}


#ifndef _TASKGRAPH_H
#define _TASKGRAPH_H

#include <boost/config.hpp>
#include <iostream> // for std::cout
#include <utility> // for std::pair
#include <algorithm> // for std::for_each
#include <boost/utility.hpp> // for boost::tie
#include <boost/graph/graph_traits.hpp> // for boost::graph_traits
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/adjacency_iterator.hpp>
#include <boost/graph/graphviz.hpp>

//Task graph types
using namespace std;

using boost::tie;

struct vertex_execcost_t {
  typedef boost::vertex_property_tag kind;
};

struct vertex_unique_id_t {
  typedef boost::vertex_property_tag kind;
};

struct edge_result_set_t {
  typedef boost::edge_property_tag kind;
};

typedef boost::property<boost::vertex_name_t,string,
         boost::property<vertex_execcost_t,float,
          boost::property<vertex_unique_id_t, int >
>
> VertexProperty;
  
typedef boost::property<boost::edge_weight_t, int > EdgeProperty;
  
typedef boost::adjacency_list<boost::listS, boost::listS,
                              boost::bidirectionalS,
                       VertexProperty, EdgeProperty> TaskGraph;
  
typedef boost::property_map<TaskGraph,boost::vertex_name_t> VertexNameMap;
typedef boost::property_map<TaskGraph,vertex_execcost_t> VertexExecCostMap;
typedef boost::property_map<TaskGraph,vertex_unique_id_t> VertexUniqueIDMap;
  
typedef boost::property_map<TaskGraph,boost::edge_weight_t> EdgeCommCostMap;
  
  
typedef boost::graph_traits<TaskGraph>::vertex_descriptor VertexID;
typedef boost::graph_traits<TaskGraph>::vertex_iterator VertexIterator;
typedef boost::graph_traits<TaskGraph>::edge_descriptor EdgeID;
typedef boost::graph_traits<TaskGraph>::edge_iterator EdgeIterator;
  
typedef boost::graph_traits<TaskGraph>::out_edge_iterator OutEdgeIterator;
typedef boost::graph_traits<TaskGraph>::in_edge_iterator InEdgeIterator;

typedef boost::adjacency_iterator_generator<TaskGraph, VertexID, OutEdgeIterator>::type ChildrenIterator;
  
typedef boost::inv_adjacency_iterator_generator<TaskGraph, VertexID, InEdgeIterator>::type ParentsIterator;
  
  
VertexNameMap::type VertexNameProperty(TaskGraph* tg);
  
VertexUniqueIDMap::type VertexUniqueIDProperty(TaskGraph* tg);
  
VertexExecCostMap::type VertexExecCostProperty(TaskGraph* tg);
  
EdgeCommCostMap::type EdgeCommCostProperty(TaskGraph* tg);

int getCommCost(EdgeID edge,TaskGraph * tg);
  
void setCommCost(EdgeID edge, int weight,TaskGraph * tg);
  
double getExecCost(VertexID v,TaskGraph * tg);
double getExecCost(int uniqueID,TaskGraph * tg);
  
void setExecCost(VertexID v, double weight,TaskGraph * tg);
  
int getTaskID(VertexID v,TaskGraph * tg);

std::pair<ChildrenIterator, ChildrenIterator>
children(VertexID v, TaskGraph &tg);
  
std::pair<ParentsIterator, ParentsIterator>
parents(VertexID v, TaskGraph &tg);
  
#endif


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net