Revision: 7996
http://playerstage.svn.sourceforge.net/playerstage/?rev=7996&view=rev
Author: rtv
Date: 2009-07-11 22:51:21 +0000 (Sat, 11 Jul 2009)
Log Message:
-----------
improving usability and working on federation
Modified Paths:
--------------
code/websim/src/req_model.cc
code/websim/src/req_sim.cc
code/websim/src/websim.cc
code/websim/src/websim.hh
Modified: code/websim/src/req_model.cc
===================================================================
--- code/websim/src/req_model.cc 2009-07-11 22:49:28 UTC (rev 7995)
+++ code/websim/src/req_model.cc 2009-07-11 22:51:21 UTC (rev 7996)
@@ -1,10 +1,7 @@
-#include "websim.hh"
#include <boost/lexical_cast.hpp>
-
-//#include <assert.h>
-//#include <stdlib.h>
-//#include <string.h>
#include <libxml/encoding.h>
+
+#include "websim.hh"
using namespace websim;
#define MY_ENCODING "ISO-8859-1"
@@ -14,11 +11,11 @@
bool
WebSim::HandleModelRequest(const std::string& model,
- const std::string& prop,
- const std::string& action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+
const std::string& prop,
+
const std::string& action,
+
Format format,
+
struct evkeyvalq* kv,
+
std::string& response)
{
if(prop == "pva")
return HandleModelPVARequest(model, action, format, kv, response );
@@ -40,47 +37,47 @@
bool
WebSim::HandleModelDataRequest( std::string model,
- std::string action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+
std::string action,
+
Format format,
+
struct evkeyvalq* kv,
+
std::string& response)
{
- if(action == "get"){
+ if(action == "get"){
- if(!GetModelData(model, response, format, NULL)){
- response = "ERROR: failed to get the Data of model " + model;
- return false;
+ if(!GetModelData(model, response, format, NULL)){
+ response = "ERROR: failed to get the Data of model " +
model;
+ return false;
+ }
}
- }
- return true;
+ return true;
}
bool
WebSim::HandleModelTreeRequest( std::string model,
- std::string action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+
std::string action,
+
Format format,
+
struct evkeyvalq* kv,
+
std::string& response)
{
- if(action == "get"){
- if(!GetModelTree(model, format, response, false)){
+ if(action == "get"){
+ if(!GetModelTree(model, format, response, false)){
response = "ERROR: failed to get the tree of model " + model;
- return false;
+ return false;
+ }
}
- }
- return true;
+ return true;
}
bool
WebSim::HandleModelGeometryRequest( std::string model,
- std::string action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+
std::string
action,
+
Format format,
+
struct
evkeyvalq* kv,
+
std::string&
response)
{
double x,y,z;
@@ -98,17 +95,17 @@
}
- return true;
+ return true;
}
bool
WebSim::HandleModelPVARequest( std::string model,
- std::string action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+
std::string action,
+
Format format,
+
struct evkeyvalq* kv,
+
std::string& response)
{
- if(action == "get"){
+ if(action == "get"){
Pose p;
Velocity v;
@@ -116,17 +113,17 @@
Time t;
if(GetModelPVA(model, t, p, v, a, response)){
- GetPVA(model, t, p, v, a, format, response, NULL);
+ GetPVA(model, t, p, v, a, format, response, NULL);
return true;
}else{
- response = "ERROR: failed to get the PVA of model "+model;
- return false;
+ response = "ERROR: failed to get the PVA of model
"+model;
+ return false;
}
- }else if(action == "set"){
+ }else if(action == "set"){
std::string sx, sy, sz, sroll, spitch, syaw;
@@ -143,78 +140,78 @@
try
{
if(GetValue(sx, kv, "px"))
- p.x = boost::lexical_cast<float>(sx);
+ p.x = boost::lexical_cast<float>(sx);
if(GetValue(sy, kv, "py"))
- p.y = boost::lexical_cast<float>(sy);
+ p.y = boost::lexical_cast<float>(sy);
if(GetValue(sz, kv, "pz"))
- p.z = boost::lexical_cast<float>(sz);
+ p.z = boost::lexical_cast<float>(sz);
if(GetValue(sroll, kv, "pr"))
- p.r = boost::lexical_cast<float>(sroll);
+ p.r = boost::lexical_cast<float>(sroll);
if(GetValue(spitch, kv, "pp"))
- p.p = boost::lexical_cast<float>(spitch);
+ p.p =
boost::lexical_cast<float>(spitch);
if(GetValue(syaw, kv, "pa"))
- p.a = boost::lexical_cast<float>(syaw);
+ p.a = boost::lexical_cast<float>(syaw);
if(GetValue(sx, kv, "vx"))
- v.x = boost::lexical_cast<float>(sx);
+ v.x = boost::lexical_cast<float>(sx);
if(GetValue(sy, kv, "vy"))
- v.y = boost::lexical_cast<float>(sy);
+ v.y = boost::lexical_cast<float>(sy);
if(GetValue(sz, kv, "vz"))
- v.z = boost::lexical_cast<float>(sz);
+ v.z = boost::lexical_cast<float>(sz);
if(GetValue(sroll, kv, "vr"))
- v.r = boost::lexical_cast<float>(sroll);
+ v.r = boost::lexical_cast<float>(sroll);
if(GetValue(spitch, kv, "vp"))
- v.p = boost::lexical_cast<float>(spitch);
+ v.p =
boost::lexical_cast<float>(spitch);
if(GetValue(syaw, kv, "va"))
- v.a = boost::lexical_cast<float>(syaw);
+ v.a = boost::lexical_cast<float>(syaw);
if(GetValue(sx, kv, "ax"))
- a.x = boost::lexical_cast<float>(sx);
+ a.x = boost::lexical_cast<float>(sx);
if(GetValue(sy, kv, "ay"))
- a.y = boost::lexical_cast<float>(sy);
+ a.y = boost::lexical_cast<float>(sy);
if(GetValue(sz, kv, "az"))
- a.z = boost::lexical_cast<float>(sz);
+ a.z = boost::lexical_cast<float>(sz);
if(GetValue(sroll, kv, "ar"))
- a.r = boost::lexical_cast<float>(sroll);
+ a.r = boost::lexical_cast<float>(sroll);
if(GetValue(spitch, kv, "ap"))
- a.p = boost::lexical_cast<float>(spitch);
+ a.p =
boost::lexical_cast<float>(spitch);
if(GetValue(syaw, kv, "aa"))
- a.a = boost::lexical_cast<float>(syaw);
+ a.a = boost::lexical_cast<float>(syaw);
}
catch(boost::bad_lexical_cast e)
{
response = std::string("Failed to parse input value(s): ") +
- e.what();
+ e.what();
return false;
}
return(SetModelPVA(model, p, v, a, response));
- }
+ }
- return false;
+ return false;
}
void
WebSim::GetPVA(const std::string& name,
- Time& t,
- const Pose& p,
- const Velocity& v,
- const Acceleration& a,
- Format format,
- std::string& response,
- void* xmlnode)
+ Time& t,
+ const Pose& p,
+ const Velocity& v,
+ const Acceleration& a,
+ Format format,
+ std::string& response,
+ void* xmlnode)
{
if(format == TEXT){
char buf[1024];
snprintf(buf, sizeof(buf),
- "%s's state @%s: \n pose: (%.3f,%.3f,%.3f) (%.3f,%.3f,%.3f)\n"
- " vel : (%.3f,%.3f,%.3f) (%.3f,%.3f,%.3f)\n"
- " acc : (%.3f,%.3f,%.3f) (%.3f,%.3f,%.3f)\n",
- name.c_str(),
- t.String().c_str(),
- p.x, p.y, p.z, p.r, p.p, p.a,
- v.x, v.y, v.z, v.r, v.p, v.a,
- a.x, a.y, a.z, a.r, a.p, a.a);
+ "%s's state @%s: \n pose:
(%.3f,%.3f,%.3f) (%.3f,%.3f,%.3f)\n"
+ " vel : (%.3f,%.3f,%.3f)
(%.3f,%.3f,%.3f)\n"
+ " acc : (%.3f,%.3f,%.3f)
(%.3f,%.3f,%.3f)\n",
+ name.c_str(),
+ t.String().c_str(),
+ p.x, p.y, p.z, p.r, p.p, p.a,
+ v.x, v.y, v.z, v.r, v.p, v.a,
+ a.x, a.y, a.z, a.r, a.p, a.a);
response = buf;
}else if (format == XML){
@@ -277,14 +274,14 @@
void
WebSim::GetLaserData(const std::string& name,
- Time& t,
- uint32_t& resolution,
- double& fov,
- Pose& p,
- std::vector<double>& ranges,
- Format format,
- std::string& response,
- void* xmlnode)
+
Time& t,
+
uint32_t& resolution,
+
double& fov,
+
Pose& p,
+
std::vector<double>& ranges,
+
Format format,
+
std::string& response,
+
void* xmlnode)
{
if(format == TEXT){
@@ -294,20 +291,20 @@
sprintf(temp,"%.3f",ranges.at(i));
res.append(temp);
if(i+1 != ranges.size())
- res.append(",");
+ res.append(",");
}
char buf[4096];
snprintf(buf, sizeof(buf),
- "%s's state @%s: \n laser: (%s)\n resolution: (%d)\n
fov(%.2f)\n"
- " pose (%.3f,%.3f,%.3f) (%.3f,%.3f,%.3f)\n",
- name.c_str(),
- t.String().c_str(),
- res.c_str(),
- resolution,
- fov,
- p.x,p.y,p.z,p.r,p.p,p.a);
+ "%s's state @%s: \n laser:
(%s)\n resolution: (%d)\n fov(%.2f)\n"
+ " pose (%.3f,%.3f,%.3f)
(%.3f,%.3f,%.3f)\n",
+ name.c_str(),
+ t.String().c_str(),
+ res.c_str(),
+ resolution,
+ fov,
+ p.x,p.y,p.z,p.r,p.p,p.a);
response = buf;
}else if(format == XML){
@@ -337,7 +334,7 @@
sprintf(temp,"%.3f",ranges.at(i));
res.append(temp);
if(i+1 != ranges.size())
- res.append(",");
+ res.append(",");
}
@@ -383,12 +380,12 @@
void
WebSim::GetRangerData(const std::string& name,
- Time& t,
- std::vector<Pose>& p,
- std::vector<double>& ranges,
- Format format,
- std::string& response,
- void* xmlnode)
+
Time& t,
+
std::vector<Pose>& p,
+
std::vector<double>& ranges,
+
Format format,
+
std::string& response,
+
void* xmlnode)
{
if(format == TEXT){
@@ -398,7 +395,7 @@
sprintf(temp,"%.3f",ranges.at(i));
res.append(temp);
if(i+1 != ranges.size())
- res.append(",");
+ res.append(",");
}
std::string pstr;
@@ -406,18 +403,18 @@
for(unsigned int i=0;i<p.size();i++){
Pose pos = p.at(i);
sprintf(ptmp," (%.3f,%.3f,%.3f) (%.3f,%.3f,%.3f)",
- pos.x,pos.y,pos.x,pos.r,pos.p,pos.a);
+
pos.x,pos.y,pos.x,pos.r,pos.p,pos.a);
pstr.append(ptmp);
}
char buf[2048];
snprintf(buf, sizeof(buf),
- "%s's state @%s: \n ranger\n ranges: (%s)\n pose: %s",
- name.c_str(),
- t.String().c_str(),
- res.c_str(),
- pstr.c_str());
+ "%s's state @%s: \n ranger\n
ranges: (%s)\n pose: %s",
+ name.c_str(),
+ t.String().c_str(),
+ res.c_str(),
+ pstr.c_str());
response = buf;
}else if(format == XML){
@@ -448,7 +445,7 @@
sprintf(temp,"%.3f",ranges.at(i));
res.append(temp);
if(i+1 != ranges.size())
- res.append(",");
+ res.append(",");
}
std::string pstr;
@@ -456,7 +453,7 @@
for(unsigned int i=0;i<p.size();i++){
Pose pos = p.at(i);
sprintf(ptmp," (%.3f,%.3f,%.3f) (%.3f,%.3f,%.3f)",
- pos.x,pos.y,pos.x,pos.r,pos.p,pos.a);
+
pos.x,pos.y,pos.x,pos.r,pos.p,pos.a);
pstr.append(ptmp);
}
@@ -496,11 +493,11 @@
void
WebSim::GetFiducialData(const std::string& name,
- Time& t,
- std::vector<Fiducial>& f,
- Format format,
- std::string& response,
- void* xmlnode )
+
Time& t,
+
std::vector<Fiducial>& f,
+
Format format,
+
std::string& response,
+
void* xmlnode )
{
@@ -510,7 +507,7 @@
char temp[512];
for(unsigned int i=0;i<f.size();i++){
sprintf(temp,"((%.3f,%.3f,%.3f),(%.3f,%.3f,%.3f),%d)\n", f.at(i).pos.x,
f.at(i).pos.y, f.at(i).pos.z,
- f.at(i).pos.r, f.at(i).pos.p, f.at(i).pos.a,
f.at(i).id);
+ f.at(i).pos.r,
f.at(i).pos.p, f.at(i).pos.a, f.at(i).id);
res.append(temp);
}
@@ -518,9 +515,9 @@
char buf[2048];
snprintf(buf, sizeof(buf),
- "%s's state @%s: \n Fiducial:\n",
- name.c_str(),
- t.String().c_str());
+ "%s's state @%s: \n
Fiducial:\n",
+ name.c_str(),
+ t.String().c_str());
response = buf;
response.append(res);
@@ -550,7 +547,7 @@
char temp[512];
for(unsigned int i=0;i<f.size();i++){
sprintf(temp,"((%.3f,%.3f,%.3f),(%.3f,%.3f,%.3f),%d)", f.at(i).pos.x,
f.at(i).pos.y, f.at(i).pos.z,
- f.at(i).pos.r, f.at(i).pos.p, f.at(i).pos.a,
f.at(i).id);
+ f.at(i).pos.r,
f.at(i).pos.p, f.at(i).pos.a, f.at(i).id);
res.append(temp);
}
@@ -585,22 +582,22 @@
void
WebSim::GetGeometryData(const std::string& name,
- double& x,
- double& y,
- double& z,
- Pose& center,
- Format format,
- std::string& response,
- void* xmlnode)
+
double& x,
+
double& y,
+
double& z,
+
Pose& center,
+
Format format,
+
std::string& response,
+
void* xmlnode)
{
if(format == TEXT){
char buf[1024];
if(name == "sim")
snprintf(buf, sizeof(buf),"World Size: (%.3f,%.3f,%.3f)\n Origin
(%.3f,%.3f,%.3f,%.3f,%.3f,%.3f)",
- x, y, z, center.x, center.y, center.z, center.r, center.p,
center.a);
+ x, y, z, center.x,
center.y, center.z, center.r, center.p, center.a);
else
snprintf(buf, sizeof(buf),"%s's Size: (%.3f,%.3f,%.3f)\n Origin
(%.3f,%.3f,%.3f,%.3f,%.3f,%.3f)",
- name.c_str(), x, y, z, center.x, center.y, center.z, center.r,
center.p, center.a);
+ name.c_str(), x, y, z,
center.x, center.y, center.z, center.r, center.p, center.a);
response = buf;
}else if(format == XML){
Modified: code/websim/src/req_sim.cc
===================================================================
--- code/websim/src/req_sim.cc 2009-07-11 22:49:28 UTC (rev 7995)
+++ code/websim/src/req_sim.cc 2009-07-11 22:51:21 UTC (rev 7996)
@@ -1,16 +1,20 @@
#include "websim.hh"
using namespace websim;
-// todo: XML format for sim requests
+const double TICK_INTERVAL = 1.0;
+// todo: XML format for more sim requests
+
+
+
bool WebSim::HandleSimRequest(const std::string& prop,
- const std::string& action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+ const std::string&
action,
+ Format format,
+ struct evkeyvalq* kv,
+ std::string& response)
{
printf( "[%s] sim %s %s\n",
- IdentificationString().c_str(), prop.c_str(), action.c_str() );
+ IdentificationString().c_str(), prop.c_str(), action.c_str()
);
if(prop == "factory")
return HandleSimFactoryRequest( action, format, kv, response );
@@ -41,56 +45,68 @@
}
bool WebSim::HandleSimVisualizationRequest( std::string action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+
Format format,
+
struct evkeyvalq* kv,
+
std::string& response)
{
- response = WebSim::vizpage;
-
- return true;
+ response =
+ "<HTML><HEAD><TITLE>Websim Visualization</TITLE></HEAD>"
+ "<BODY><iframe id=\"visualization\" frameborder=0 width=\"1000\"
height=\"1000\" "
+ "src=\"viz.html\"></iframe></BODY></HTML>";
+
+ return true;
}
bool WebSim::HandleSimHomepageRequest( std::string action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+
Format format,
+
struct evkeyvalq* kv,
+
std::string& response)
{
+ response = "<html><head><title>WebSim</title></head>"
+ "<body>"
+ "<h1>Welcome to " + IdentificationString() + "</h1>"
+ "<p>" + package + "-" + version + " HTTP interface to " +
+ IdentificationString() + "-" + VersionString() +
+ "</h1>"
+ "<hr>"
+ "<p><a href=\"http://playerstage.org/index.php?src=websim\">WebSim</a>"
+ " is part of the <a href=\"http://playerstage.org\">Player Project</a>"
+ "</body></html>";
+
+// // replacing 'HOST' by actual 'host:port' term
+// unsigned int i=0;
+// i = response.find("HOST");
+// while(i!=std::string::npos){
- response = WebSim::webpage;
+// response.replace(i, 4, hostportname);
+// i = response.find("HOST");
+// }
- // replacing 'HOST' by actual 'host:port' term
- unsigned int i=0;
- i = response.find("HOST");
- while(i!=std::string::npos){
-
- response.replace(i, 4, hostportname);
- i = response.find("HOST");
- }
- return true;
+ return true;
}
bool WebSim::HandleSimGeometryRequest( std::string action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+
Format format,
+
struct evkeyvalq* kv,
+
std::string& response)
{
- double x,y,z;
- Pose center;
- if(GetModelGeometry("sim", x, y, z, center, response)){
- this->GetGeometryData("sim", x, y, z, center, format, response,
NULL);
- }else{
- response = "Warning: geometry not yet implemented";
- return false;
- }
+ double x,y,z;
+ Pose center;
+ if(GetModelGeometry("sim", x, y, z, center, response)){
+ this->GetGeometryData("sim", x, y, z, center, format, response, NULL);
+ }else{
+ response = "Warning: geometry not yet implemented";
+ return false;
+ }
return true;
}
bool WebSim::HandleSimChildrenRequest( std::string action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+
Format format,
+
struct evkeyvalq* kv,
+
std::string& response)
{
if( action == "" )
action = "get"; // default action
@@ -101,7 +117,7 @@
GetModelChildren("",children);
for(unsigned int i=0;i<children.size();i++)
- response += "-" + children[i];
+ response += "-" + children[i];
return true;
}
@@ -111,9 +127,9 @@
}
bool WebSim::HandleSimTreeRequest( std::string action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+ Format
format,
+ struct
evkeyvalq* kv,
+ std::string&
response)
{
if( action == "" )
action = "get"; // default action
@@ -129,9 +145,9 @@
}
bool WebSim::HandleSimGreetRequest( std::string action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+ Format
format,
+ struct
evkeyvalq* kv,
+
std::string& response)
{
if( action == "" )
action = "get"; // default action
@@ -149,24 +165,24 @@
}
bool WebSim::HandleSimFactoryRequest( std::string action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+
Format format,
+
struct evkeyvalq* kv,
+
std::string& response)
{
if(action == "create")
{
std::string name, type;
if(!GetValue(name, kv, "name"))
- {
- response = "ERROR: Missing name argument for sim/factory/create";
- return false;
- }
+ {
+ response = "ERROR: Missing name argument for
sim/factory/create";
+ return false;
+ }
if( !GetValue(type, kv, "type"))
- {
- response = "ERROR: Missing name type argument for sim/factory/create";
- return false;
- }
+ {
+ response = "ERROR: Missing name type argument for
sim/factory/create";
+ return false;
+ }
return(CreateModel(name, type, response));
}
@@ -175,10 +191,10 @@
{
std::string name, type;
if(!GetValue(name, kv, "name"))
- {
- response = "ERROR: Missing name argument for sim/factory/destroy";
- return false;
- }
+ {
+ response = "ERROR: Missing name argument for
sim/factory/destroy";
+ return false;
+ }
return(DeleteModel(name, response));
}
@@ -188,9 +204,9 @@
}
bool WebSim::HandleSimClockRequest( std::string action,
- Format format,
- struct evkeyvalq* kv,
- std::string& response)
+ Format
format,
+ struct
evkeyvalq* kv,
+
std::string& response)
{
if( action == "" ) // DEFAULT ACTION
action = "get";
@@ -198,35 +214,40 @@
if( action == "get" )
{
if(format == TEXT){
- response = "Current time: " + GetTime().String() + " seconds.";
+ response = "Current time: " + GetTime().String() + " seconds.";
}else if(format == XML){
- response = "<Time value=\""+GetTime().String()+"\" />";
+ response = "<Time value=\""+GetTime().String()+"\" />";
}
return true;
}
if(action == "tick")
{
- ticks_remaining--;
- response = "Ticked the clock";
- return true;
+ if( ClockRunFor( TICK_INTERVAL ) )
+ {
+ ticks_remaining--;
+ response = "Ticked the clock";
+ }
+ else
+ response = "Failed to tick the clock";
+ return true;
}
if(action == "start")
{
if( ClockStart() )
- response = "Started the clock";
+ response = "Started the clock";
else
- response = "Failed to start the clock";
+ response = "Failed to start the clock";
return true;
}
if(action == "stop")
{
if( ClockStop() )
- response = "Stopped the clock";
+ response = "Stopped the clock";
else
- response = "Failed to stop the clock";
+ response = "Failed to stop the clock";
return true;
}
Modified: code/websim/src/websim.cc
===================================================================
--- code/websim/src/websim.cc 2009-07-11 22:49:28 UTC (rev 7995)
+++ code/websim/src/websim.cc 2009-07-11 22:51:21 UTC (rev 7996)
@@ -25,41 +25,19 @@
* SVN: $Id: gazebo.h 7398 2009-03-09 07:21:49Z natepak $
*/
-#include "websim.hh"
#include <boost/lexical_cast.hpp>
-
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <libxml/encoding.h>
-
-
-
+#include "websim.hh"
using namespace websim;
const std::string WebSim::package = "WebSim";
const std::string WebSim::version = "0.1";
-std::string WebSim::webpage =
- "<html><head ><title>WebSim</title></head><body><h3>" + WebSim::package + " "
+ WebSim::version +
- "</h3><p>Welcome to WebSim, an Http-based interface to robot simulations."
- " Through this interface, you can get the state of the robots as well as
sensors' data using URIs. Here are some examples:"
- "</p><p><a href=\"http://HOST/sim/tree/get\"> http://HOST/sim/tree/get
</a></p>"
- "<p><a href=\"http://HOST/position:1/pva/get\">
http://HOST/position:1/pva/get </a></p>"
- "<p><a href=\"http://HOST/position:1/laser:0/data/get\">
http://HOST/position:1.laser:0/data/get </a></p>"
- "<p><a href=\"http://HOST/position:1/ranger:0/data/get\">
http://HOST/position:1/ranger:0:/data/get </a></p>"
- "<p><a href=\"http://HOST/position:1/model:0/fiducial:0/data/get\">
http://HOST/position:1/model:0/fiducial:0/data/get </a></p>"
- "</body></html>";
-
-std::string WebSim::vizpage =
- "<HTML><HEAD><TITLE>Websim Visualization</TITLE></HEAD>"
- "<BODY><iframe id=\"visualization\" frameborder=0 width=\"1000\"
height=\"1000\" "
- "src=\"http://192.168.1.210/viz.html\"></iframe></BODY></HTML>";
-
-
-
std::string Time::String()
{
std::string seconds = boost::lexical_cast<std::string>(sec);
Modified: code/websim/src/websim.hh
===================================================================
--- code/websim/src/websim.hh 2009-07-11 22:49:28 UTC (rev 7995)
+++ code/websim/src/websim.hh 2009-07-11 22:51:21 UTC (rev 7996)
@@ -73,7 +73,7 @@
/** Send go signals to all confederates */
void Go();
- // Interface to be implemented by simulators
+ // Interface to be implemented by simulators
==========================================================
/** Return a string that usefully identifies the simulator for a
human reader, e.g. "MyRobotSimulator" */
@@ -96,6 +96,14 @@
@return true on succes, false on failure.
*/
virtual bool ClockStop()=0;
+
+ /** Run for a specified amount of simulated time, then pause. This should
work
+ whether or not the clock is currently paused. WebSim uses this to
implement
+ clock synchronization in simulator federation, but it can also be used
by end-users.
+
+ @param seconds The amount of simulated time to run until pausing, in
seconds.
+ */
+ virtual bool ClockRunFor( double seconds )=0;
virtual bool CreateModel(const std::string& name,
const
std::string& type,
@@ -230,16 +238,8 @@
struct evhttp* eh;
- // the string which contains the html code of the home page
- static std::string webpage;
-
- // the html code of visualization page
- static std::string vizpage;
-
// Static, so that it can be passed as a callback to libevent
static void EventCallback(evhttp_request* req, void* arg);
-
-
/** Gets the uri parameters.
@@ -556,7 +556,6 @@
};
protected:
-// static const unsigned short DEFAULT_PORT;
static const std::string package;
static const std::string version;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit