Commit c04080bd authored by Nathalie Rousse's avatar Nathalie Rousse
Browse files

[recordweb/vle-x/trunk/erecord] :

Some modifications, that had been done manually into the source code of the
production Virtual Machine, have been taken into account.
parent 93897cd7
......@@ -129,10 +129,10 @@ def run_simulation(runvle_path, vlehome_path, vle_usr_path, pkgname, vpzname) :
for line in msg :
if line is '' :
pass
elif "debug:" in line :
elif "debug" in line or "Debug" in line or "DEBUG" in line :
pass
elif "warning" in line or "Warning" in line or "WARNING" in line :
pass
#elif "warning" in line or "Warning" in line or "WARNING" in line :
# pass
else :
filtered_stderr = filtered_stderr + line
msg_stderr = filtered_stderr
......
# -*- coding: utf-8 -*-
"""factory.docs
Workspace for docs
Contains the built documentation
See :ref:`index`
"""
......@@ -121,7 +121,9 @@ std::string get_type_to_be_returned(std::string type_a_priori, json& object){
}
} else if (type_a_priori == "DOUBLE"){
if (jtype == "number"){
if (object.is_number_float()){
if ((object.is_number_float()) ||
(object.is_number_integer()) ||
(object.is_number_unsigned())){
type_to_be_returned = type_a_priori;
}
}
......@@ -360,7 +362,7 @@ void vlevalue_to_json(const value::Value& value, json& object){
}
case value::Value::SET:{
//json jtype = {"type", "SET"};
json jset;
json jset(json::value_t::array);
for (value::Set::const_iterator it = value.toSet().begin();
it != value.toSet().end(); ++it) {
json v;
......@@ -372,7 +374,7 @@ void vlevalue_to_json(const value::Value& value, json& object){
}
case value::Value::MAP:{
//json jtype = {"type", "MAP"};
json jmap;
json jmap(json::value_t::object);
for (value::Map::const_iterator it = value.toMap().begin();
it != value.toMap().end(); ++it) {
json v;
......@@ -384,7 +386,7 @@ void vlevalue_to_json(const value::Value& value, json& object){
}
case value::Value::TUPLE:{
//json jtype = {"type", "TUPLE"};
json jval;
json jval(json::value_t::array);
std::vector<double>::const_iterator itb =
value.toTuple().value().begin();
std::vector<double>::const_iterator ite =
......@@ -397,7 +399,7 @@ void vlevalue_to_json(const value::Value& value, json& object){
}
case value::Value::TABLE:{
//json jtype = {"type", "TABLE"};
json jval;
json jval(json::value_t::array);
const value::Table& t = value.toTable();
for(unsigned int i=0; i<t.height(); i++){
json jr;
......@@ -411,7 +413,7 @@ void vlevalue_to_json(const value::Value& value, json& object){
}
case value::Value::MATRIX:{
//json jtype = {"type", "MATRIX"};
json jval;
json jval(json::value_t::array);
const value::Matrix& t = value.toMatrix();
for(unsigned int i=0; i<t.rows(); i++){
json jr;
......@@ -445,6 +447,9 @@ void vlevalue_to_json(const value::Value& value, json& object){
* Note : returns "" for unknown vle::value::Value::type value or for
* vle::value::Value::USER that is treated as unknown
*/
std::string vle_getTypeNameDefaultValue(){
return "";
}
std::string vle_getTypeName(value::Value::type type){
switch (type){
case value::Value::BOOLEAN:
......@@ -470,7 +475,7 @@ std::string vle_getTypeName(value::Value::type type){
case value::Value::NIL:
return "NIL";
default: // default or case vle::value::Value::USER:
return ""; // "" added
return vle_getTypeNameDefaultValue();
}
}
......@@ -507,14 +512,14 @@ void vle_parameter_set_values(vpz::Vpz* file, std::string condname,
assert(file);
vpz::Condition& c(file->project().experiment().conditions().get(condname));
// Reference Value (read at indice 0)
std::string type_vref = vle_getTypeNameDefaultValue(); // default
value::Value* Vref = NULL; // default
value::VectorValue& v(c.getSetValues(parname).value());
value::Value* Vref = v.at(0)->clone();
// vle::value::Value::type t = Vref->getType(); // Vref->toDouble().value()
// size of v : v.size()
if (v.size() > 0){
Vref = v.at(0)->clone(); // Reference Value (read at indice 0)
type_vref = vle_getTypeName(Vref->getType());
}
vle_parameter_clear_values(c, parname);
std::string type_vref = vle_getTypeName(Vref->getType());
if (std::string(jvalues->type_name()) == "array"){
for (auto& values : jvalues->items()){
......@@ -728,7 +733,10 @@ void vle_read_vpz_input(vpz::Vpz *file, json& object){
if (size > 0){
type_0 = vle_getTypeName(values[0]->getType());
} else {
type_0 = "";
type_0 = vle_getTypeNameDefaultValue();
std::cerr << "\nWarning in vle_read_vpz_input: ";
std::cerr << "missing parameter value. Be careful while ";
std::cerr << "using/parametrizing the simulator." << "\n";
}
json par_object;
......
......@@ -130,7 +130,9 @@ std::string get_type_to_be_returned(std::string type_a_priori, json& object){
}
} else if (type_a_priori == "DOUBLE"){
if (jtype == "number"){
if (object.is_number_float()){
if ((object.is_number_float()) ||
(object.is_number_integer()) ||
(object.is_number_unsigned())){
type_to_be_returned = type_a_priori;
}
}
......@@ -369,7 +371,7 @@ void vlevalue_to_json(const value::Value& value, json& object){
}
case value::Value::SET:{
//json jtype = {"type", "SET"};
json jset;
json jset(json::value_t::array);
for (value::Set::const_iterator it = value.toSet().begin();
it != value.toSet().end(); ++it) {
json v;
......@@ -381,7 +383,7 @@ void vlevalue_to_json(const value::Value& value, json& object){
}
case value::Value::MAP:{
//json jtype = {"type", "MAP"};
json jmap;
json jmap(json::value_t::object);
for (value::Map::const_iterator it = value.toMap().begin();
it != value.toMap().end(); ++it) {
json v;
......@@ -393,7 +395,7 @@ void vlevalue_to_json(const value::Value& value, json& object){
}
case value::Value::TUPLE:{
//json jtype = {"type", "TUPLE"};
json jval;
json jval(json::value_t::array);
std::vector<double>::const_iterator itb =
value.toTuple().value().begin();
std::vector<double>::const_iterator ite =
......@@ -406,7 +408,7 @@ void vlevalue_to_json(const value::Value& value, json& object){
}
case value::Value::TABLE:{
//json jtype = {"type", "TABLE"};
json jval;
json jval(json::value_t::array);
const value::Table& t = value.toTable();
for(unsigned int i=0; i<t.height(); i++){
json jr;
......@@ -420,7 +422,7 @@ void vlevalue_to_json(const value::Value& value, json& object){
}
case value::Value::MATRIX:{
//json jtype = {"type", "MATRIX"};
json jval;
json jval(json::value_t::array);
const value::Matrix& t = value.toMatrix();
for(unsigned int i=0; i<t.rows(); i++){
json jr;
......@@ -454,6 +456,9 @@ void vlevalue_to_json(const value::Value& value, json& object){
* Note : returns "" for unknown vle::value::Value::type value or for
* vle::value::Value::USER that is treated as unknown
*/
std::string vle_getTypeNameDefaultValue(){
return "";
}
std::string vle_getTypeName(value::Value::type type){
switch (type){
case value::Value::BOOLEAN:
......@@ -479,7 +484,7 @@ std::string vle_getTypeName(value::Value::type type){
case value::Value::NIL:
return "NIL";
default: // default or case vle::value::Value::USER:
return ""; // "" added
return vle_getTypeNameDefaultValue();
}
}
......@@ -518,15 +523,14 @@ void vle_parameter_set_values(vpz::Vpz* file, std::string condname,
assert(file);
vpz::Condition& c(file->project().experiment().conditions().get(condname));
std::string type_vref = vle_getTypeNameDefaultValue(); // default
value::Value* Vref = NULL; // default
std::vector<std::shared_ptr<value::Value>>& inplace =
c.getSetValues(parname);
value::Value* Vref = inplace[0]->clone().get();
// vle::value::Value::type t = Vref->getType(); // Vref->toDouble().value()
// size of v : v.size()
//std::string type_vref = vle_getTypeName(Vref->getType());
std::string type_vref = vle_getTypeName(inplace[0]->getType());
if (inplace.size() > 0){
Vref = inplace[0]->clone().get();
type_vref = vle_getTypeName(inplace[0]->getType());
}
vle_parameter_clear_values(c, parname);
if (std::string(jvalues->type_name()) == "array"){
......@@ -742,7 +746,10 @@ void vle_read_vpz_input(vpz::Vpz *file, json& object){
if (size > 0){
type_0 = vle_getTypeName(inplace[0]->getType());
} else {
type_0 = "";
type_0 = vle_getTypeNameDefaultValue();
std::cerr << "\nWarning in vle_read_vpz_input: ";
std::cerr << "missing parameter value. Be careful while ";
std::cerr << "using/parametrizing the simulator." << "\n";
}
json par_object;
......
Markdown is supported
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