23 #include "tf_processor.h" 24 #include <webview/page_reply.h> 25 #include <webview/file_reply.h> 26 #include <webview/error_reply.h> 52 baseurl_ = strdup(baseurl);
53 baseurl_len_ = strlen(baseurl_);
54 transformer_ = transformer;
68 if ( strncmp(baseurl_, request->
url().c_str(), baseurl_len_) == 0 ) {
70 std::string subpath = request->
url().substr(baseurl_len_);
72 if (subpath ==
"/graph.png") {
73 std::string graph = transformer_->all_frames_as_dot(
true);
78 "Cannot open temp file: %s", strerror(errno));
81 GVC_t* gvc = gvContext();
82 Agraph_t* G = agmemread((
char *)graph.c_str());
83 gvLayout(gvc, G, (
char *)
"dot");
84 gvRender(gvc, G, (
char *)
"png", f);
98 r->
append_body(
"<p><img src=\"%s/graph.png\" /></p>", baseurl_);
Dynamic raw file transfer reply.
Fawkes library namespace.
virtual ~WebviewTfRequestProcessor()
Destructor.
WebviewTfRequestProcessor(const char *baseurl, fawkes::tf::Transformer *transformer)
Constructor.
Base class for exceptions in Fawkes.
iterator begin()
Get iterator for messages.
Web request meta data carrier.
void append_body(const char *format,...)
Append to body.
const std::string & url() const
Get URL.
virtual fawkes::WebReply * process_request(const fawkes::WebRequest *request)
Process a request.