Skip to content
Snippets Groups Projects
Commit 50c7f37a authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

tag all messages with version number

parent 63f0611b
No related branches found
No related tags found
No related merge requests found
......@@ -113,10 +113,11 @@ namespace onelab{
if(out[i] == charSep()) out[i] = ' ';
return out;
}
std::string getOnelabVersion() const { return "1.0"; }
virtual std::string toChar() const
{
std::ostringstream sstream;
sstream << getType() << charSep()
sstream << getOnelabVersion() << charSep() << getType() << charSep()
<< sanitize(getName()) << charSep()
<< sanitize(getShortHelp()) << charSep()
<< sanitize(getHelp()) << charSep()
......@@ -134,6 +135,7 @@ namespace onelab{
virtual std::string::size_type fromChar(const std::string &msg)
{
std::string::size_type pos = 0;
if(getNextToken(msg, pos) != getOnelabVersion()) return 0;
if(getNextToken(msg, pos) != getType()) return 0;
setName(getNextToken(msg, pos));
setShortHelp(getNextToken(msg, pos));
......@@ -159,10 +161,11 @@ namespace onelab{
first = (last == std::string::npos) ? last : last + 1;
return next;
}
static void getTypeAndNameFromChar(const std::string &msg, std::string &type,
std::string &name)
static void getInfoFromChar(const std::string &msg, std::string &version,
std::string &type, std::string &name)
{
std::string::size_type first = 0;
version = getNextToken(msg, first);
type = getNextToken(msg, first);
name = getNextToken(msg, first);
}
......
......@@ -164,8 +164,8 @@ bool onelab::localNetworkClient::run(const std::string &what)
break;
case GmshSocket::GMSH_PARAMETER:
{
std::string type, name;
onelab::parameter::getTypeAndNameFromChar(message, type, name);
std::string version, type, name;
onelab::parameter::getInfoFromChar(message, version, type, name);
if(type == "number"){
onelab::number p;
p.fromChar(message);
......@@ -182,8 +182,8 @@ bool onelab::localNetworkClient::run(const std::string &what)
break;
case GmshSocket::GMSH_PARAMETER_QUERY:
{
std::string type, name, reply;
onelab::parameter::getTypeAndNameFromChar(message, type, name);
std::string version, type, name, reply;
onelab::parameter::getInfoFromChar(message, version, type, name);
if(type == "number"){
std::vector<onelab::number> par;
get(par, name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment