Changeset 7665:3aede63f569f in orange


Ignore:
Timestamp:
02/14/11 13:04:18 (3 years ago)
Author:
markotoplak
Branch:
default
Convert:
0926d5f056a1a20cc4b72cf0b1138f753c23967f
Message:

Replaced Variable->name with setter and getter. Interface to Python remained the same.

Location:
source
Files:
42 edited

Legend:

Unmodified
Added
Removed
  • source/orange/assoc.cpp

    r6531 r7665  
    299299  PITERATE(TVarList, vi, examples->domain->variables) 
    300300    if ((*vi)->varType != TValue::INTVAR) 
    301       raiseError("cannot induce rules with non-discrete attributes (such as '%s')", (*vi)->name.c_str()); 
     301      raiseError("cannot induce rules with non-discrete attributes (such as '%s')", (*vi)->get_name().c_str()); 
    302302 
    303303  TItemSetNode *tree = NULL; 
     
    386386        const int exv = (*exi).intV; 
    387387        if (exv >= (int)(ip->values.size())) 
    388           raiseError("invalid value of attribute '%s'", gen->domain->variables->at(exi-(*ei).begin())->name.c_str()); 
     388          raiseError("invalid value of attribute '%s'", gen->domain->variables->at(exi-(*ei).begin())->get_name().c_str()); 
    389389        ip->values[(*exi).intV].examples.push_back(TExWei(index, wex)); 
    390390      } 
  • source/orange/basket.cpp

    r6531 r7665  
    213213        if ((*mi).second.floatV == 1.0) 
    214214          if (comma) 
    215             fprintf(fle, ", %s", metaVar->name.c_str()); 
     215            fprintf(fle, ", %s", metaVar->get_name().c_str()); 
    216216          else { 
    217             fprintf(fle, metaVar->name.c_str()); 
     217            fprintf(fle, metaVar->get_name().c_str()); 
    218218            comma = true; 
    219219          } 
    220220        else 
    221221          if (comma) 
    222             fprintf(fle, ", %s=%5.3f", metaVar->name.c_str(), (*mi).second.floatV); 
     222            fprintf(fle, ", %s=%5.3f", metaVar->get_name().c_str(), (*mi).second.floatV); 
    223223          else { 
    224             fprintf(fle, "%5s=%5.3f", metaVar->name.c_str(), (*mi).second.floatV); 
     224            fprintf(fle, "%5s=%5.3f", metaVar->get_name().c_str(), (*mi).second.floatV); 
    225225            comma = true; 
    226226          } 
  • source/orange/c4.5.cpp

    r6531 r7665  
    281281    *(SpecialStatusi++) = NULL; 
    282282 
    283     *AttNamei = mlnew char[(*vi)->name.length()+1]; 
    284     strcpy(*(AttNamei++), (*vi)->name.c_str()); 
     283    *AttNamei = mlnew char[(*vi)->get_name().length()+1]; 
     284    strcpy(*(AttNamei++), (*vi)->get_name().c_str()); 
    285285 
    286286    if ((*vi)->varType==TValue::INTVAR) { 
     
    705705  newNode->branchSizes = branchSizes; 
    706706     
    707   TEnumVariable *dummyVar = mlnew TEnumVariable(tested->name); 
     707  TEnumVariable *dummyVar = mlnew TEnumVariable(tested->get_name()); 
    708708  PVariable wdummyVar = dummyVar; 
    709709 
  • source/orange/c45inter.cpp

    r6884 r7665  
    161161    raiseErrorWho("c45_writeDomain", "C4.5 format cannot store data sets without a class attribute"); 
    162162 
    163   fprintf(file, "| Names file for %s\n", dom->classVar->name.c_str()); 
     163  fprintf(file, "| Names file for %s\n", dom->classVar->get_name().c_str()); 
    164164  if (!writeValues(file, dom->classVar)) 
    165165    raiseErrorWho("c45_writeDomain", "C4.5 format cannot store a data set with non-discrete class attribute"); 
    166166   
    167167  const_PITERATE(TVarList, vi, dom->attributes) { 
    168     fprintf(file, "%s: ", (*vi)->name.c_str()); 
     168    fprintf(file, "%s: ", (*vi)->get_name().c_str()); 
    169169    writeValues(file, *vi, true); 
    170170  } 
  • source/orange/cartesian.cpp

    r6531 r7665  
    5858  for(TVarList::reverse_iterator vi(domain->attributes->rbegin()), ve(domain->attributes->rend()); vi!=ve; vi++) { 
    5959    if ((*vi)->varType!=TValue::INTVAR) 
    60       raiseError("invalid attribute '%s' (discrete attributes expected)", (*vi)->name.c_str()); 
     60      raiseError("invalid attribute '%s' (discrete attributes expected)", (*vi)->get_name().c_str()); 
    6161 
    6262    *li = (*vi)->noOfValues(); 
    6363    if (!*li) 
    64       raiseError("invalid attribute '%s' (no values)", (*vi)->name.c_str()); 
     64      raiseError("invalid attribute '%s' (no values)", (*vi)->get_name().c_str()); 
    6565 
    6666    (*(mi++)) = mult; 
  • source/orange/cls_example.cpp

    r7663 r7665  
    7474    if (PyOrValue_Check(li)) 
    7575      if (PyValue_AS_Variable(li) ? (PyValue_AS_Variable(li) != *vi) : (PyValue_AS_Value(li).varType=!(*vi)->varType) ) { 
    76         PyErr_Format(PyExc_TypeError, "wrong value type for attribute no. %i (%s)", pos, (*vi)->name.c_str()); 
     76        PyErr_Format(PyExc_TypeError, "wrong value type for attribute no. %i (%s)", pos, (*vi)->get_name().c_str()); 
    7777        return false; 
    7878      } 
     
    9292          *(ei++)=TValue(int(PyInt_AsLong(li))); 
    9393        else { 
    94           PyErr_Format(PyExc_TypeError, "attribute no. %i (%s) is ordinal, string value expected", pos, (*vi)->name.c_str()); 
     94          PyErr_Format(PyExc_TypeError, "attribute no. %i (%s) is ordinal, string value expected", pos, (*vi)->get_name().c_str()); 
    9595          return false; 
    9696        } 
     
    101101          *(ei++) = TValue(f); 
    102102        else { 
    103           PyErr_Format(PyExc_TypeError, "attribute no. %i (%s) is continuous, float value expected", pos, (*vi)->name.c_str()); 
     103          PyErr_Format(PyExc_TypeError, "attribute no. %i (%s) is continuous, float value expected", pos, (*vi)->get_name().c_str()); 
    104104          return false; 
    105105        } 
     
    436436            continue; 
    437437          if (keytype == &PyString_Type) 
    438             key = PyString_FromString(variable->name.c_str()); 
     438            key = PyString_FromString(variable->get_name().c_str()); 
    439439          else 
    440440            key = WrapOrange(variable); 
     
    542542      else { 
    543543        TMetaDescriptor *desc=example->domain->metas[ 
    544             PyOrVariable_Check(par1) ? PyOrange_AsVariable(par1)->name 
     544            PyOrVariable_Check(par1) ? PyOrange_AsVariable(par1)->get_name() 
    545545                                     : string(PyString_AsString(par1))]; 
    546546        if (!desc) 
     
    962962    TMetaDescriptor *desc=example->domain->metas[(*mi).first]; 
    963963    if (desc) { 
    964       res+="\""+desc->variable->name+"\":"; 
     964      res+="\""+desc->variable->get_name()+"\":"; 
    965965      addValue(res, (*mi).second, desc->variable); 
    966966    } 
  • source/orange/cls_value.cpp

    r7654 r7665  
    152152  if (PyOrValue_Check(args)) { 
    153153    if (var && PyValue_AS_Variable(args) && (PyValue_AS_Variable(args)!=var)) { 
    154       PyErr_Format(PyExc_TypeError, "wrong attribute value (expected value of '%s', got value of '%s')", var->name.c_str(), PyValue_AS_Variable(args)->name.c_str()); 
     154      PyErr_Format(PyExc_TypeError, "wrong attribute value (expected value of '%s', got value of '%s')", var->get_name().c_str(), PyValue_AS_Variable(args)->get_name().c_str()); 
    155155      return false; 
    156156    } 
     
    163163    if (var) { 
    164164      if ((var->varType==TValue::INTVAR) && !PyOrDiscDistribution_Check(args)) { 
    165         PyErr_Format(PyExc_TypeError, "attribute '%s' expects DiscDistribution, '%s' given", var->name.c_str(), args->ob_type->tp_name); 
     165        PyErr_Format(PyExc_TypeError, "attribute '%s' expects DiscDistribution, '%s' given", var->get_name().c_str(), args->ob_type->tp_name); 
    166166        return false; 
    167167      } 
    168168      if ((var->varType==TValue::FLOATVAR) && !PyOrContDistribution_Check(args)) { 
    169         PyErr_Format(PyExc_TypeError, "attribute '%s' expects ContDistribution, '%s' given", var->name.c_str(), args->ob_type->tp_name); 
     169        PyErr_Format(PyExc_TypeError, "attribute '%s' expects ContDistribution, '%s' given", var->get_name().c_str(), args->ob_type->tp_name); 
    170170        return false; 
    171171      } 
     
    235235      } 
    236236 
    237       PyErr_Format(PyExc_TypeError,  "cannot convert an integer to a value of attribute '%s'", var->name.c_str()); 
     237      PyErr_Format(PyExc_TypeError,  "cannot convert an integer to a value of attribute '%s'", var->get_name().c_str()); 
    238238      return false; 
    239239    } 
     
    245245  if (PyFloat_Check(args)) { 
    246246    if (var && (var->varType != TValue::FLOATVAR)) { 
    247       PyErr_Format(PyExc_TypeError,  "cannot convert a float to a value of attribute '%s'", var->name.c_str()); 
     247      PyErr_Format(PyExc_TypeError,  "cannot convert a float to a value of attribute '%s'", var->get_name().c_str()); 
    248248      return false; 
    249249    } 
     
    256256    PyObject *pyfloat = PyNumber_Float(args); 
    257257    if (!pyfloat) { 
    258       PyErr_Format(PyExc_TypeError, "cannot convert an object of type '%s' to value of attribute '%s'", args->ob_type->tp_name, var->name.c_str()); 
     258      PyErr_Format(PyExc_TypeError, "cannot convert an object of type '%s' to value of attribute '%s'", args->ob_type->tp_name, var->get_name().c_str()); 
    259259      return false; 
    260260    } 
     
    266266 
    267267  if (var) 
    268     PyErr_Format(PyExc_TypeError,  "cannot convert an object of type '%s' to value of attribute '%s'", args->ob_type->tp_name, var->name.c_str()); 
     268    PyErr_Format(PyExc_TypeError,  "cannot convert an object of type '%s' to value of attribute '%s'", args->ob_type->tp_name, var->get_name().c_str()); 
    269269  else 
    270270    PyErr_Format(PyExc_TypeError,  "cannot convert an object of type '%s' to value of attribute", args->ob_type->tp_name); 
     
    623623{ PyTRY 
    624624    if (self->variable) 
    625       return PyString_FromFormat("<orange.Value '%s'='%s'>", self->variable->name.c_str(), TPyValue2string(self)); 
     625      return PyString_FromFormat("<orange.Value '%s'='%s'>", self->variable->get_name().c_str(), TPyValue2string(self)); 
    626626    else 
    627627      return PyString_FromFormat("<orange.Value '%s'>", TPyValue2string(self));  
     
    633633{ 
    634634  if (self->value.isSpecial()) { 
    635     if (self->variable && self->variable->name.length()) 
    636       PyErr_Format(PyExc_TypeError, "value of '%s' is unknown and cannot be %s", self->variable->name.c_str(), casttype); 
     635    if (self->variable && self->variable->get_name().length()) 
     636      PyErr_Format(PyExc_TypeError, "value of '%s' is unknown and cannot be %s", self->variable->get_name().c_str(), casttype); 
    637637    else 
    638638      PyErr_Format(PyExc_TypeError, "attribute value is unknown and cannot be %s", casttype); 
     
    748748{ PyTRY 
    749749    if (self->value.isSpecial()) 
    750       if (self->variable && self->variable->name.length()) { 
    751         PyErr_Format(PyExc_TypeError, "cannot compute an absolute value of '%s' since its value is unknown", self->variable->name.c_str()); 
     750      if (self->variable && self->variable->get_name().length()) { 
     751        PyErr_Format(PyExc_TypeError, "cannot compute an absolute value of '%s' since its value is unknown", self->variable->get_name().c_str()); 
    752752        return PYNULL; 
    753753      } 
  • source/orange/contingency.cpp

    r6531 r7665  
    414414  else { 
    415415    if (!innerVariable->getValueFrom) 
    416       raiseError("attribute '%s' is not in the domain and its 'getValueFrom' is not defined", innerVariable->name.c_str()); 
     416      raiseError("attribute '%s' is not in the domain and its 'getValueFrom' is not defined", innerVariable->get_name().c_str()); 
    417417 
    418418    TVariable &vfe = innerVariable.getReference(); 
     
    490490  else { 
    491491    if (!outerVariable->getValueFrom) 
    492       raiseError("attribute '%s' is not in the domain and its value cannot be computed", outerVariable->name.c_str()); 
     492      raiseError("attribute '%s' is not in the domain and its value cannot be computed", outerVariable->get_name().c_str()); 
    493493 
    494494    TVariable &vfe = outerVariable.getReference(); 
  • source/orange/cost.cpp

    r6531 r7665  
    5757  TEnumVariable *dcv = classVar.AS(TEnumVariable); 
    5858  if (!dcv) 
    59     raiseError("attribute '%s' is not discrete", classVar->name.c_str()); 
     59    raiseError("attribute '%s' is not discrete", classVar->get_name().c_str()); 
    6060 
    6161  dimension = dcv->noOfValues(); 
    6262  if (!dimension) 
    63     raiseError("attribute '%s' has no values", classVar->name.c_str()); 
     63    raiseError("attribute '%s' has no values", classVar->get_name().c_str()); 
    6464 
    6565  init(inside); 
  • source/orange/decomposition.cpp

    r6531 r7665  
    7171        if (*bi) { 
    7272          if ((*attr)->varType!=TValue::INTVAR) 
    73             raiseError("bound attribute '%s' is not discrete", (*attr)->name.c_str()); 
     73            raiseError("bound attribute '%s' is not discrete", (*attr)->get_name().c_str()); 
    7474 
    7575          int values=(*attr)->noOfValues(); 
    7676          if (values<=0) 
    77             raiseError("attribute '%s' has invalid number of values", (*attr)->name.c_str()); 
     77            raiseError("attribute '%s' has invalid number of values", (*attr)->get_name().c_str()); 
    7878 
    7979          sortByAttr_Mult(bi-bound.begin(), sorting, values); 
     
    9090        if (*fi) { 
    9191          if ((*attr)->varType != TValue::INTVAR) 
    92             raiseError("free attribute '%s' is not discrete", (*attr)->name.c_str()); 
     92            raiseError("free attribute '%s' is not discrete", (*attr)->get_name().c_str()); 
    9393          sortByAttr(fi-free.begin(), sorting, (*attr)->noOfValues()); 
    9494        } 
     
    127127    TValue &val = (*ii)->example->operator[](attrNo); 
    128128    if (val.isSpecial()) 
    129       raiseError("attribute '%s' has undefined values", (*ii)->example->domain->getVar(attrNo)->name.c_str()); 
     129      raiseError("attribute '%s' has undefined values", (*ii)->example->domain->getVar(attrNo)->get_name().c_str()); 
    130130    valf[val.intV]++; 
    131131  } 
     
    151151    TValue &val = (*ii)->example->operator[](attrNo); 
    152152    if (val.isSpecial()) 
    153       raiseError("attribute '%s' has undefined values", (*ii)->example->domain->getVar(attrNo)->name.c_str()); 
     153      raiseError("attribute '%s' has undefined values", (*ii)->example->domain->getVar(attrNo)->get_name().c_str()); 
    154154    valf[val.intV]++; 
    155155  } 
     
    746746      for (int i = 0, vsize = values.size(); i<vsize; i++) 
    747747        if (boundExample[i].isSpecial()) 
    748           raiseError("attribute '%s' has undefined values", aboundSet[i]->name.c_str()); 
     748          raiseError("attribute '%s' has undefined values", aboundSet[i]->get_name().c_str()); 
    749749        else 
    750750          ci = ci*values[i]+boundExample[i].intV; 
     
    951951      TValue &val=(*ii)->example->operator[](attr); 
    952952      if (val.isSpecial()) 
    953         raiseError("attribute '%s' has undefined values", attributes[attr]->name.c_str()); 
     953        raiseError("attribute '%s' has undefined values", attributes[attr]->get_name().c_str()); 
    954954      valf[val.intV]++; 
    955955    } 
  • source/orange/discretize.cpp

    r6782 r7665  
    112112    raiseError("invalid attribute type (continuous attribute expected)"); 
    113113 
    114   TEnumVariable *evar=mlnew TEnumVariable("D_"+var->name); 
     114  TEnumVariable *evar=mlnew TEnumVariable("D_"+var->get_name()); 
    115115  PVariable revar(evar); 
    116116 
     
    184184{  
    185185  mindiff = 1.0; // Ignores the given mindiff; see http://www.ailab.si/orange/trac/ticket/576 
    186   TEnumVariable *evar = mlnew TEnumVariable("D_"+var->name); 
     186  TEnumVariable *evar = mlnew TEnumVariable("D_"+var->get_name()); 
    187187  PVariable revar(evar); 
    188188 
     
    235235    raiseError("invalid attribute type (continuous attribute expected)"); 
    236236 
    237   TEnumVariable *evar = mlnew TEnumVariable("D_"+var->name); 
     237  TEnumVariable *evar = mlnew TEnumVariable("D_"+var->get_name()); 
    238238  PVariable revar(evar); 
    239239 
     
    314314    raiseError("invalid attribute type (continuous attribute expected)"); 
    315315 
    316   TEnumVariable *evar=mlnew TEnumVariable("D_"+var->name); 
     316  TEnumVariable *evar=mlnew TEnumVariable("D_"+var->get_name()); 
    317317  PVariable revar(evar); 
    318318 
    319   TEnumVariable *cl_evar=mlnew TEnumVariable("D_"+var->name); 
     319  TEnumVariable *cl_evar=mlnew TEnumVariable("D_"+var->get_name()); 
    320320  PVariable cl_revar(cl_evar); 
    321321 
     
    395395PVariable TEquiDistDiscretization::operator()(PExampleGenerator gen, PVariable var, const long &) 
    396396{ if (var->varType!=TValue::FLOATVAR) 
    397     raiseError("attribute '%s' is not continuous", var->name.c_str()); 
     397    raiseError("attribute '%s' is not continuous", var->get_name().c_str()); 
    398398 
    399399  if (numberOfIntervals<=0) 
     
    406406    ++first; 
    407407  if (!first) 
    408     raiseError("attribute '%s' has no known values", var->name.c_str()); 
     408    raiseError("attribute '%s' has no known values", var->get_name().c_str()); 
    409409 
    410410  float max, min; 
     
    604604PVariable TEquiNDiscretization::operator()(PExampleGenerator gen, PVariable var, const long &weightID) 
    605605{ if (var->varType!=TValue::FLOATVAR) 
    606     raiseError("attribute '%s' is not continuous", var->name.c_str()); 
     606    raiseError("attribute '%s' is not continuous", var->get_name().c_str()); 
    607607 
    608608  int varPos=gen->domain->getVarNum(var); 
     
    613613 
    614614  if (!first) 
    615     raiseError("attribute '%s' has no known values.", var->name.c_str()); 
     615    raiseError("attribute '%s' has no known values.", var->get_name().c_str()); 
    616616 
    617617  TContDistribution distr(var); 
     
    642642 
    643643  if (gen->domain->classVar!=TValue::INTVAR) 
    644     raiseError("class '%s' is not discrete", gen->domain->classVar->name.c_str()); 
     644    raiseError("class '%s' is not discrete", gen->domain->classVar->get_name().c_str()); 
    645645 
    646646  if (var->varType!=TValue::FLOATVAR) 
    647     raiseError("attribute '%s' is not continuous", var->name.c_str()); 
     647    raiseError("attribute '%s' is not continuous", var->get_name().c_str()); 
    648648 
    649649  int varPos=gen->domain->getVarNum(var); 
     
    679679 
    680680  if (!k) 
    681     raiseError("no examples or all values of attribute '%s' are unknown", var->name.c_str()); 
     681    raiseError("no examples or all values of attribute '%s' are unknown", var->get_name().c_str()); 
    682682 
    683683  float mindiff = 1.0; 
     
    789789PVariable TBiModalDiscretization::operator()(PExampleGenerator gen, PVariable var, const long &weightID) 
    790790{ if (var->varType!=TValue::FLOATVAR) 
    791     raiseError("attribute '%s' is not continuous", var->name.c_str()); 
     791    raiseError("attribute '%s' is not continuous", var->get_name().c_str()); 
    792792  if (gen->domain->classVar!=TValue::INTVAR) 
    793     raiseError("class '%s' is not discrete", gen->domain->classVar->name.c_str()); 
     793    raiseError("class '%s' is not discrete", gen->domain->classVar->get_name().c_str()); 
    794794   
    795795  TContingencyAttrClass ccont(gen, var, weightID); 
  • source/orange/dist_clustering.cpp

    r6531 r7665  
    107107  { ITERATE(TVarList, evi, aboundSet) { 
    108108      if ((*evi)->varType != TValue::INTVAR) 
    109         raiseError("attribute '%s' is not discrete", (*evi)->name.c_str()); 
     109        raiseError("attribute '%s' is not discrete", (*evi)->get_name().c_str()); 
    110110      bound.push_back(gen->domain->getVarNum(*evi)); 
    111111    } 
     
    317317 
    318318  quality = clusters->quality; 
    319   feat->name = name; 
     319  feat->get_name()= name; 
    320320 
    321321  return feat; 
  • source/orange/distance.cpp

    r6690 r7665  
    492492  PVariable otherAttribute = domain.hasOtherAttributes(); 
    493493  if (otherAttribute) 
    494     raiseError("domain has attributes whose type is not supported by ReliefF (e.g. '%s')", otherAttribute->name.c_str()); 
     494    raiseError("domain has attributes whose type is not supported by ReliefF (e.g. '%s')", otherAttribute->get_name().c_str()); 
    495495 
    496496  // for continuous attributes BasicAttrStat suffices; for discrete it does not 
  • source/orange/distvars.cpp

    r6531 r7665  
    238238{ if (val.isSpecial()) { 
    239239    if (variable) 
    240       raiseError("undefined value of attribute '%s'", variable->name.c_str()); 
     240      raiseError("undefined value of attribute '%s'", variable->get_name().c_str()); 
    241241    else 
    242242      raiseError("undefined attribute value"); 
     
    250250{ if (val.isSpecial()) { 
    251251    if (variable) 
    252       raiseError("undefined value of attribute '%s'", variable->name.c_str()); 
     252      raiseError("undefined value of attribute '%s'", variable->get_name().c_str()); 
    253253    else 
    254254      raiseError("undefined attribute value"); 
     
    367367{ if (val.isSpecial()) { 
    368368    if (variable) 
    369       raiseError("undefined value of attribute '%s'", variable->name.c_str()); 
     369      raiseError("undefined value of attribute '%s'", variable->get_name().c_str()); 
    370370    else 
    371371      raiseError("undefined attribute value"); 
     
    385385: TDistribution(var) 
    386386{ if (var->varType!=TValue::INTVAR) 
    387      raiseError("attribute '%s' is not discrete", var->name.c_str()); 
     387     raiseError("attribute '%s' is not discrete", var->get_name().c_str()); 
    388388  distribution = vector<float>(var->noOfValues(), 0.0); 
    389389  supportsDiscrete = true; 
     
    435435  variable = gen->domain->variables->at(position); 
    436436  if (variable->varType != TValue::INTVAR) 
    437     raiseError("attribute '%s' is not discrete", variable->name.c_str()); 
     437    raiseError("attribute '%s' is not discrete", variable->get_name().c_str()); 
    438438 
    439439  distribution = vector<float>(variable->noOfValues(), 0.0); 
     
    450450 
    451451  if (variable->varType != TValue::INTVAR) 
    452     raiseError("attribute '%s' is not discrete", variable->name.c_str()); 
     452    raiseError("attribute '%s' is not discrete", variable->get_name().c_str()); 
    453453 
    454454  distribution = vector<float>(var->noOfValues(), 0.0); 
     
    463463        add(variable->computeValue(*ei), WEIGHT(*ei)); 
    464464    else 
    465       raiseError("attribute '%s' not in domain and cannot be computed", variable->name.c_str()); 
     465      raiseError("attribute '%s' not in domain and cannot be computed", variable->get_name().c_str()); 
    466466} 
    467467 
     
    946946  sum2(0.0) 
    947947{ if (var->varType!=TValue::FLOATVAR) 
    948      raiseError("attribute '%s' is not continuous", var->name.c_str()); 
     948     raiseError("attribute '%s' is not continuous", var->get_name().c_str()); 
    949949  supportsContinuous = true;  
    950950} 
     
    962962  variable = gen->domain->variables->at(position); 
    963963  if (variable->varType != TValue::FLOATVAR) 
    964     raiseError("attribute '%s' is not continuous", variable->name.c_str()); 
     964    raiseError("attribute '%s' is not continuous", variable->get_name().c_str()); 
    965965 
    966966  PEITERATE(ei, gen) 
     
    977977 
    978978  if (variable->varType != TValue::FLOATVAR) 
    979     raiseError("attribute '%s' is not continuous", variable->name.c_str()); 
     979    raiseError("attribute '%s' is not continuous", variable->get_name().c_str()); 
    980980 
    981981  int position = gen->domain->getVarNum(variable, false); 
     
    988988        add(variable->computeValue(*ei), WEIGHT(*ei)); 
    989989    else 
    990       raiseError("attribute '%s' not in domain and cannot be computed", variable->name.c_str()); 
     990      raiseError("attribute '%s' not in domain and cannot be computed", variable->get_name().c_str()); 
    991991} 
    992992 
     
    11521152{ if (!abs) 
    11531153    if (variable) 
    1154       raiseError("cannot compute average ('%s' has no defined values)", variable->name.c_str()); 
     1154      raiseError("cannot compute average ('%s' has no defined values)", variable->get_name().c_str()); 
    11551155    else 
    11561156      raiseError("cannot compute average (attribute has no defined values)"); 
     
    11641164  if (abs<=1e-7) 
    11651165    if (variable) 
    1166       raiseError("cannot compute standard deviation ('%s' has no defined values)", variable->name.c_str()); 
     1166      raiseError("cannot compute standard deviation ('%s' has no defined values)", variable->get_name().c_str()); 
    11671167    else 
    11681168      raiseError("cannot compute standard deviation (attribute has no defined values)"); 
     
    11761176  if (!abs) 
    11771177    if (variable) 
    1178       raiseError("cannot compute variance ('%s' has no defined values)", variable->name.c_str()); 
     1178      raiseError("cannot compute variance ('%s' has no defined values)", variable->get_name().c_str()); 
    11791179    else 
    11801180      raiseError("cannot compute variance (attribute has no defined values)"); 
  • source/orange/domain.cpp

    r7663 r7665  
    210210  pos = getMetaNum(var, false); 
    211211  if ((pos == ILLEGAL_INT) && throwExc) 
    212     raiseError("attribute '%s' not found", var->name.c_str()); 
     212    raiseError("attribute '%s' not found", var->get_name().c_str()); 
    213213 
    214214  return pos; 
     
    219219{ int pos = 0; 
    220220  for(TVarList::const_iterator vi(variables->begin()), ve(variables->end()); vi!=ve; vi++, pos++) 
    221     if ((*vi)->name == name) 
     221    if ((*vi)->get_name()== name) 
    222222      return pos; 
    223223 
     
    292292PVariable TDomain::getVar(const string &name, bool takeMetas, bool throwExc) 
    293293{ PITERATE(TVarList, vi, variables) 
    294     if ((*vi)->name==name) 
     294    if ((*vi)->get_name()==name) 
    295295      return *vi; 
    296296 
    297297  if (takeMetas) 
    298298    ITERATE(TMetaVector, mi, metas) 
    299       if ((*mi).variable->name==name) 
     299      if ((*mi).variable->get_name()==name) 
    300300        return (*mi).variable; 
    301301 
     
    309309PVariable TDomain::getVar(const string &name, bool takeMetas, bool throwExc) const 
    310310{ const_PITERATE(TVarList, vi, variables) 
    311     if ((*vi)->name==name) 
     311    if ((*vi)->get_name()==name) 
    312312      return *vi; 
    313313 
    314314  if (takeMetas) 
    315315    const_ITERATE(TMetaVector, mi, metas) 
    316       if ((*mi).variable->name==name) 
     316      if ((*mi).variable->get_name()==name) 
    317317        return (*mi).variable; 
    318318 
     
    326326const TMetaDescriptor *TDomain::getMetaDescriptor(const string &wname, bool throwExc) const 
    327327{ const_ITERATE(TMetaVector, mi, metas) 
    328     if ((*mi).variable->name==wname) 
     328    if ((*mi).variable->get_name()==wname) 
    329329      return &*mi; 
    330330 
     
    341341 
    342342  if (throwExc) 
    343     raiseError("meta attribute '%s' not found", var->name.c_str()); 
     343    raiseError("meta attribute '%s' not found", var->get_name().c_str()); 
    344344   
    345345  return NULL; 
     
    372372 
    373373  if (throwExc) 
    374     raiseError("meta attribute '%s' not found", var->name.c_str()); 
     374    raiseError("meta attribute '%s' not found", var->get_name().c_str()); 
    375375 
    376376  return ILLEGAL_INT; 
     
    404404PVariable TDomain::getMetaVar(const string &wname, bool throwExc) const 
    405405{ const_ITERATE(TMetaVector, mi, metas) 
    406     if ((*mi).variable->name==wname) 
     406    if ((*mi).variable->get_name()==wname) 
    407407      return (*mi).variable; 
    408408 
     
    416416PVariable TDomain::getMetaVar(const string &wname, bool throwExc) 
    417417{ ITERATE(TMetaVector, mi, metas) 
    418     if ((*mi).variable->name==wname) 
     418    if ((*mi).variable->get_name()==wname) 
    419419      return (*mi).variable; 
    420420 
     
    583583{ 
    584584  const_PITERATE(TVarList, vi, variables) { 
    585     add_CRC((*vi)->name.c_str(), crc); 
     585    add_CRC((*vi)->get_name().c_str(), crc); 
    586586    add_CRC((const unsigned char)(*vi)->varType, crc); 
    587587    if ((*vi)->varType == TValue::INTVAR) 
  • source/orange/domaindepot.cpp

    r7663 r7665  
    132132      else 
    133133        if (metavar != (*mi).variable) 
    134           raiseError("Id %i represents two different attributes ('%s' and '%s')", (*mi).id, metavar->name.c_str(), (*mi).variable->name.c_str()); 
     134          raiseError("Id %i represents two different attributes ('%s' and '%s')", (*mi).id, metavar->get_name().c_str(), (*mi).variable->get_name().c_str()); 
    135135    } 
    136136 
     
    242242  TPAttributeDescriptions::const_iterator ai(attributes->begin()), ae(attributes->end()); 
    243243  for(; ai != ae; ai++, vi++) 
    244     if (    ((**ai).name != (*vi)->name) 
     244    if (    ((**ai).name != (*vi)->get_name()) 
    245245         || ((**ai).varType>0) && ((**ai).varType != (*vi)->varType) 
    246246         || (((**ai).varType==PYTHONVAR) && !pythonDeclarationMatches((**ai).typeDeclaration, *vi)) 
     
    315315  if (typeDeclaration.size() == 6) { 
    316316    TPythonVariable *var = mlnew TPythonVariable(); 
    317     var->name = name; 
     317    var->set_name(name); 
    318318    return var; 
    319319  } 
     
    361361  Py_DECREF(var); 
    362362 
    363   pvar->name = name; 
     363  pvar->set_name(name); 
    364364  return pvar; 
    365365} 
  • source/orange/estimateprob.cpp

    r6765 r7665  
    263263  if (!cdist) 
    264264    if (frequencies && frequencies->variable) 
    265       raiseError("attribute '%s' is not continuous", frequencies->variable->name.c_str()); 
     265      raiseError("attribute '%s' is not continuous", frequencies->variable->get_name().c_str()); 
    266266    else 
    267267      raiseError("continuous distribution expected"); 
     
    407407  if (frequencies->varType != TValue::INTVAR) 
    408408    if (frequencies->outerVariable) 
    409       raiseError("attribute '%s' is not discrete", frequencies->outerVariable->name.c_str()); 
     409      raiseError("attribute '%s' is not discrete", frequencies->outerVariable->get_name().c_str()); 
    410410    else 
    411411      raiseError("discrete attribute for condition expected"); 
     
    458458{ if (frequencies->varType != TValue::FLOATVAR) 
    459459    if (frequencies->outerVariable) 
    460       raiseError("attribute '%s' is not continuous", frequencies->outerVariable->name.c_str()); 
     460      raiseError("attribute '%s' is not continuous", frequencies->outerVariable->get_name().c_str()); 
    461461    else 
    462462      raiseError("continuous attribute expected for condition"); 
  • source/orange/examples.cpp

    r6531 r7665  
    108108    if (position >= 0) { 
    109109      if (!mergeTwoValues(values[position], srcval, defined[position])) 
    110         raiseError("ambiguous value of attribute '%s'", var->name.c_str()); 
     110        raiseError("ambiguous value of attribute '%s'", var->get_name().c_str()); 
    111111      else 
    112112        defined[position] = true; 
     
    117117      if (hasMeta(position)) { 
    118118        if (!mergeTwoValues(meta[metaID], srcval, true)) 
    119           raiseError("ambiguous value for meta-attribute '%s'", var->name.c_str()); 
     119          raiseError("ambiguous value for meta-attribute '%s'", var->get_name().c_str()); 
    120120      } 
    121121      else 
     
    291291      return md->variable->DK(); 
    292292    else 
    293       if (md->variable->name.size()) 
    294         raiseError("the value of meta attribute '%s' is missing", md->variable->name.c_str()); 
     293      if (md->variable->get_name().size()) 
     294        raiseError("the value of meta attribute '%s' is missing", md->variable->get_name().c_str()); 
    295295 
    296296  // no descriptor or no name 
  • source/orange/filter.cpp

    r6785 r7665  
    516516 
    517517  if (condi==conditions->end()) 
    518     raiseError("there is no condition on value of '%s' in the filter", var->name.c_str()); 
     518    raiseError("there is no condition on value of '%s' in the filter", var->get_name().c_str()); 
    519519 
    520520  conditions->erase(condi); 
  • source/orange/functions.cpp

    r6531 r7665  
    259259  for(vi = g1->domain->attributes->begin(), ve = g1->domain->attributes->end(); vi!=ve; vi++) 
    260260    if ((*vi)->varType != TValue::FLOATVAR) { 
    261       PyErr_Format(PyExc_TypeError, "attribute %s is not continuous", (*vi)->name.c_str()); 
     261      PyErr_Format(PyExc_TypeError, "attribute %s is not continuous", (*vi)->get_name().c_str()); 
    262262      return PYNULL; 
    263263    } 
     
    265265  for(vi = g2->domain->attributes->begin(), ve = g2->domain->attributes->end(); vi!=ve; vi++) 
    266266    if ((*vi)->varType != TValue::FLOATVAR) { 
    267       PyErr_Format(PyExc_TypeError, "attribute %s is not continuous", (*vi)->name.c_str()); 
     267      PyErr_Format(PyExc_TypeError, "attribute %s is not continuous", (*vi)->get_name().c_str()); 
    268268      return PYNULL; 
    269269    } 
  • source/orange/gslconversions.cpp

    r6531 r7665  
    145145 
    146146            default: 
    147               raiseErrorWho("parseMatrixContents", "attribute '%s' is multinomial", (*vi)->name.c_str()); 
     147              raiseErrorWho("parseMatrixContents", "attribute '%s' is multinomial", (*vi)->get_name().c_str()); 
    148148          } 
    149149      } 
     
    151151        attrs_in++; 
    152152        include.push_back(true); 
    153         raiseWarning(PyExc_OrangeKernelWarning, "attribute '%s' is of unsupported type", (*vi)->name.c_str()); 
     153        raiseWarning(PyExc_OrangeKernelWarning, "attribute '%s' is of unsupported type", (*vi)->get_name().c_str()); 
    154154      } 
    155155    } 
  • source/orange/imputation.cpp

    r6531 r7665  
    127127        if ((*mi)->classVar) { 
    128128          if ((*mi)->classVar != *di) 
    129             raiseError("wrong domain (wrong model for '%s')", (*di)->name.c_str()); 
     129            raiseError("wrong domain (wrong model for '%s')", (*di)->get_name().c_str()); 
    130130          *ei = (*mi)->call(example); 
    131131        } 
     
    133133          TValue val = (*mi)->call(example); 
    134134          if (val.varType != (*di)->varType) 
    135             raiseError("wrong domain (wrong model for '%s')", (*di)->name.c_str()); 
     135            raiseError("wrong domain (wrong model for '%s')", (*di)->get_name().c_str()); 
    136136          *ei = val; 
    137137        } 
     
    288288{ 
    289289  if (var->varType == TValue::INTVAR) { 
    290     TEnumVariable *newvar = mlnew TEnumVariable(var->name); 
     290    TEnumVariable *newvar = mlnew TEnumVariable(var->get_name()); 
    291291    PVariable res = newvar; 
    292292    newvar->values = mlnew TStringList(var.AS(TEnumVariable)->values.getReference()); 
     
    303303 
    304304  if (var->varType == TValue::FLOATVAR) { 
    305     TEnumVariable *newvar = mlnew TEnumVariable(var->name + "_def"); 
     305    TEnumVariable *newvar = mlnew TEnumVariable(var->get_name()+ "_def"); 
    306306    PVariable res = newvar; 
    307307    newvar->values->push_back("def"); 
  • source/orange/lib_components.cpp

    r7663 r7665  
    426426    char *s=PyString_AsString(args); 
    427427    PITERATE(TDomainBasicAttrStat, ci, bas) 
    428         if (*ci && (*ci)->variable && ((*ci)->variable->name==s)) 
     428        if (*ci && (*ci)->variable && ((*ci)->variable->get_name()==s)) 
    429429            return ci - bas->begin(); 
    430430 
     
    439439            return ci - bas->begin(); 
    440440 
    441     PyErr_Format(PyExc_IndexError, "attribute '%s' not found", var->name.length() ? var->name.c_str() : "<no name>"); 
     441    PyErr_Format(PyExc_IndexError, "attribute '%s' not found", var->get_name().length() ? var->get_name().c_str() : "<no name>"); 
    442442    return -1; 
    443443} 
     
    12501250    char *s=PyString_AsString(args); 
    12511251    PITERATE(TDomainContingency, ci, cont) 
    1252         if (couter ? (*ci)->innerVariable && ((*ci)->innerVariable->name==s) 
    1253             : (*ci)->outerVariable && ((*ci)->outerVariable->name==s)) 
     1252        if (couter ? (*ci)->innerVariable && ((*ci)->innerVariable->get_name()==s) 
     1253            : (*ci)->outerVariable && ((*ci)->outerVariable->get_name()==s)) 
    12541254            return ci - cont->begin(); 
    12551255  PyErr_Format(PyExc_IndexError, "Domain contingency has no variable '%s'", s); 
     
    12631263            : (*ci)->outerVariable && ((*ci)->outerVariable==var)) 
    12641264            return ci - cont->begin(); 
    1265   PyErr_Format(PyExc_IndexError, "Domain contingency has no variable '%s'", var->name.c_str()); 
     1265  PyErr_Format(PyExc_IndexError, "Domain contingency has no variable '%s'", var->get_name().c_str()); 
    12661266  return -1; 
    12671267} 
     
    13061306    const_PITERATE(TDomainContingency, di, cont) { 
    13071307        if (di!=cont->begin()) res+=", "; 
    1308         res += (*di)->outerVariable->name+": "+convertToString(*di); 
     1308        res += (*di)->outerVariable->get_name()+": "+convertToString(*di); 
    13091309    } 
    13101310    return res+"}"; 
     
    17901790                for(; (di!=de) && (fci!=fce); di++, fci++) 
    17911791                    if (*di!=*fci) { 
    1792                         PyErr_Format(PyExc_AttributeError, "attribute %s in the list does not match the filter's domain", (*fci)->name.c_str()); 
     1792                        PyErr_Format(PyExc_AttributeError, "attribute %s in the list does not match the filter's domain", (*fci)->get_name().c_str()); 
    17931793                        return -1; 
    17941794                    } 
     
    18751875            float f; 
    18761876            if (!PyNumber_ToFloat(args, f)) { 
    1877                 PyErr_Format(PyExc_TypeError, "Filter_values.__setitem__: invalid condition for attribute '%s'", var->name.c_str()); 
     1877                PyErr_Format(PyExc_TypeError, "Filter_values.__setitem__: invalid condition for attribute '%s'", var->get_name().c_str()); 
    18781878                return -1; 
    18791879            } 
     
    19051905 
    19061906        else { 
    1907             PyErr_Format(PyExc_TypeError, "Filter_values.__setitem__: invalid condition for attribute '%s'", var->name.c_str()); 
     1907            PyErr_Format(PyExc_TypeError, "Filter_values.__setitem__: invalid condition for attribute '%s'", var->get_name().c_str()); 
    19081908            return -1; 
    19091909        } 
     
    19301930    TValueFilterList::iterator condi = filter->findCondition(var, 0, position); 
    19311931    if (condi == filter->conditions->end()) { 
    1932         PyErr_Format(PyExc_IndexError, "no condition on '%s'", var->name.c_str()); 
     1932        PyErr_Format(PyExc_IndexError, "no condition on '%s'", var->get_name().c_str()); 
    19331933        return PYNULL; 
    19341934    } 
     
    26672667 
    26682668                    if (ci==ce) { 
    2669                         PyErr_Format(PyExc_IndexError, "attribute '%s' not in the given DomainContingency", var->name.c_str()); 
     2669                        PyErr_Format(PyExc_IndexError, "attribute '%s' not in the given DomainContingency", var->get_name().c_str()); 
    26702670                        return PYNULL; 
    26712671                    } 
     
    26742674                else if (PyString_Check(arg1)) { 
    26752675                    char *attrName = PyString_AsString(arg1); 
    2676                     for(attrNo = 0; (ci!=ce) && (couter ? ((*ci)->innerVariable->name != attrName) : ((*ci)->outerVariable->name!=attrName)); ci++, attrNo++); 
     2676                    for(attrNo = 0; (ci!=ce) && (couter ? ((*ci)->innerVariable->get_name()!= attrName) : ((*ci)->outerVariable->get_name()!=attrName)); ci++, attrNo++); 
    26772677 
    26782678                    if (ci==ce) { 
     
    58685868} 
    58695869 
     5870 
    58705871#include "lib_components.px" 
  • source/orange/lib_kernel.cpp

    r7663 r7665  
    303303} 
    304304 
     305//set and get name 
     306int Variable_set_name(PyObject *self, PyObject *name) 
     307{  
     308   char *varName; 
     309   if (!PyString_Check(name)) 
     310       PYERROR(PyExc_AttributeError, "string expected", PYNULL); 
     311    varName = PyString_AsString(name); 
     312    PVariable var = PyOrange_AsVariable(self); 
     313    var->set_name(string(varName)); 
     314    return 0; 
     315} 
     316 
     317 
     318PyObject *Variable_get_name(PyObject *self)  
     319{ 
     320    PVariable var = PyOrange_AsVariable(self); 
     321    return Py_BuildValue("s", var->get_name().c_str()); 
     322} 
     323 
    305324 
    306325#include "stringvars.hpp" 
     
    479498  PVariable newVar = PyOrange_AsVariable(pyvar); 
    480499  TEnumVariable *enewVar = newVar.AS(TEnumVariable); 
    481   TVariable *oldVar = TVariable::getExisting(newVar->name, newVar->varType, enewVar ? enewVar->values.getUnwrappedPtr() : NULL, NULL, TVariable::Incompatible); 
     500  TVariable *oldVar = TVariable::getExisting(newVar->get_name(), newVar->varType, enewVar ? enewVar->values.getUnwrappedPtr() : NULL, NULL, TVariable::Incompatible); 
    482501  if (oldVar && oldVar->isEquivalentTo(newVar.getReference())) { 
    483502    if (newVar->sourceVariable) 
     
    613632      const_PITERATE(TVarList, vi, variables) 
    614633        if (!domain || (domain->getVarNum(*vi, false)==ILLEGAL_INT)) { 
    615           PyErr_Format(PyExc_IndexError, "variable '%s' does not exist in the domain", (*vi)->name.c_str()); 
     634          PyErr_Format(PyExc_IndexError, "variable '%s' does not exist in the domain", (*vi)->get_name().c_str()); 
    616635          return false; 
    617636        } 
     
    700719        for(; (fi!=fe) && (*fi != *vi); fi++); 
    701720        if (fi==fe) { 
    702           PyErr_Format(PyExc_IndexError, "variable '%s' does not exist in the domain", (*vi)->name.c_str()); 
     721          PyErr_Format(PyExc_IndexError, "variable '%s' does not exist in the domain", (*vi)->get_name().c_str()); 
    703722          return false; 
    704723        } 
     
    741760        char *s = PyString_AS_STRING(obj); 
    742761        TVarList::const_iterator fi(varlist->begin()), fe(varlist->end()); 
    743         for(; (fi!=fe) && ((*fi)->name != s); fi++); 
     762        for(; (fi!=fe) && ((*fi)->get_name() != s); fi++); 
    744763        if (fi==fe) { 
    745764          PyErr_Format(PyExc_IndexError, "variable '%s' does not exist in the domain", s); 
     
    888907 
    889908      if (vi == ve) { 
    890         PyErr_Format(PyExc_AttributeError, "attribute '%s' not found in the list", var->name.c_str()); 
     909        PyErr_Format(PyExc_AttributeError, "attribute '%s' not found in the list", var->get_name().c_str()); 
    891910        return ILLEGAL_INT; 
    892911      } 
     
    898917      int ind = 0; 
    899918      for(; vi!=ve; vi++, ind++) 
    900         if ((*vi)->name == name) { 
     919        if ((*vi)->get_name() == name) { 
    901920          res = ind; 
    902921          break; 
     
    10171036 
    10181037  else if (PyOrVariable_Check(rar)) 
    1019     desc = domain.metas[PyOrange_AsVariable(rar)->name]; 
     1038    desc = domain.metas[PyOrange_AsVariable(rar)->get_name()]; 
    10201039 
    10211040  else if (PyInt_Check(rar)) 
     
    10611080 
    10621081    else if (PyOrVariable_Check(rar)) 
    1063       desc = domain->metas[PyOrange_AsVariable(rar)->name]; 
     1082      desc = domain->metas[PyOrange_AsVariable(rar)->get_name()]; 
    10641083 
    10651084    else if (PyInt_Check(rar)) 
     
    11941213  else if (PyString_Check(rar)) { 
    11951214    char *metaname = PyString_AsString(rar); 
    1196     while((mvi!=mve) && ((*mvi).variable->name!=metaname)) 
     1215    while((mvi!=mve) && ((*mvi).variable->get_name()!=metaname)) 
    11971216      mvi++; 
    11981217  } 
     
    15641583  int added=0; 
    15651584  PITERATE(TVarList, vi, domain->variables) 
    1566     res+=(added++ ? ", " : "[") + namefrom((*vi)->name); 
     1585    res+=(added++ ? ", " : "[") + namefrom((*vi)->get_name()); 
    15671586 
    15681587  if (added) { 
     
    15781597  ITERATE(TMetaVector, mi, domain->metas) { 
    15791598    char pls[256]; 
    1580     sprintf(pls, "%s%i:%s", (added++) ? ", " : "", int((*mi).id), namefrom((*mi).variable->name).c_str()); 
     1599    sprintf(pls, "%s%i:%s", (added++) ? ", " : "", int((*mi).id), namefrom((*mi).variable->get_name()).c_str()); 
    15811600    res+=pls; 
    15821601  } 
     
    31963215    } 
    31973216    else { 
    3198       PyErr_Format(PyExc_TypeError, "value of attribute '%s' in example '%i' is undefined", attr->name.c_str(), row); 
     3217      PyErr_Format(PyExc_TypeError, "value of attribute '%s' in example '%i' is undefined", attr->get_name().c_str(), row); 
    31993218      return false; 
    32003219    } 
     
    51135132    char *s=PyString_AsString(args); 
    51145133    PITERATE(TDomainDistributions, ci, bas) 
    5115       if ((*ci)->variable && ((*ci)->variable->name==s)) 
     5134      if ((*ci)->variable && ((*ci)->variable->get_name()==s)) 
    51165135        return ci - bas->begin(); 
    51175136 
     
    51265145        return ci - bas->begin(); 
    51275146 
    5128     PyErr_Format(PyExc_IndexError, "attribute '%s' not found in domain", var->name.length() ? var->name.c_str() : "<no name>"); 
     5147    PyErr_Format(PyExc_IndexError, "attribute '%s' not found in domain", var->get_name().length() ? var->get_name().c_str() : "<no name>"); 
    51295148    return -1; 
    51305149  } 
  • source/orange/lib_learner.cpp

    r7654 r7665  
    458458      if (res.length()) 
    459459        res += " "; 
    460       res += ex->domain->getMetaVar((*mi).first)->name; 
     460      res += ex->domain->getMetaVar((*mi).first)->get_name(); 
    461461    } 
    462462 
     
    470470          res += " "; 
    471471        (*vi)->val2str(*ei, val); 
    472         res += (*vi)->name + "=" + val; 
     472        res += (*vi)->get_name() + "=" + val; 
    473473      } 
    474474  } 
  • source/orange/logistic.cpp

    r6531 r7665  
    7676 
    7777  if (error >= TLogRegFitter::Constant) 
    78     raiseError("%s in %s", error==TLogRegFitter::Constant ? "constant" : "singularity", var->name.c_str()); 
     78    raiseError("%s in %s", error==TLogRegFitter::Constant ? "constant" : "singularity", var->get_name().c_str()); 
    7979 
    8080  return cl; 
     
    190190    for (; (b!=be) && (ei!=ee); ei++, b++, vi++) { 
    191191      if ((*ei).isSpecial()) 
    192         raiseError("unknown value in attribute '%s'", (*vi)->name.c_str()); 
     192        raiseError("unknown value in attribute '%s'", (*vi)->get_name().c_str()); 
    193193      prob1 += (*ei).floatV * (*b);  
    194194    } 
  • source/orange/measures.cpp

    r6783 r7665  
    5050{ if (cont->varType!=TValue::INTVAR) 
    5151    if (cont->outerVariable) 
    52       raiseErrorWho(measure, "cannot evaluate the non-discrete attribute '%s'", cont->outerVariable->name.c_str()); 
     52      raiseErrorWho(measure, "cannot evaluate the non-discrete attribute '%s'", cont->outerVariable->get_name().c_str()); 
    5353    else 
    5454      raiseErrorWho(measure, "cannot evaluate continuous attributes"); 
     
    5656  if (cont->innerVariable) { 
    5757    if (cont->innerVariable->varType != TValue::INTVAR) 
    58       raiseErrorWho(measure, "cannot work with continuous outcome '%s'", cont->innerVariable->name.c_str()); 
     58      raiseErrorWho(measure, "cannot work with continuous outcome '%s'", cont->innerVariable->get_name().c_str()); 
    5959  } 
    6060  else 
     
    6767{ if (cont->varType!=TValue::INTVAR) 
    6868    if (cont->outerVariable) 
    69       raiseErrorWho(measure, "cannot evaluate the non-discrete attribute '%s'", cont->outerVariable->name.c_str()); 
     69      raiseErrorWho(measure, "cannot evaluate the non-discrete attribute '%s'", cont->outerVariable->get_name().c_str()); 
    7070    else 
    7171      raiseErrorWho(measure, "cannot evaluate continuous attributes"); 
     
    7373  if (cont->innerVariable) { 
    7474    if (cont->innerVariable->varType != TValue::FLOATVAR) 
    75       raiseErrorWho(measure, "cannot work with discrete outcome '%s'", cont->innerVariable->name.c_str()); 
     75      raiseErrorWho(measure, "cannot work with discrete outcome '%s'", cont->innerVariable->get_name().c_str()); 
    7676  } 
    7777  else 
  • source/orange/meta.cpp

    r6531 r7665  
    7878TMetaDescriptor *TMetaVector::operator[](const string &sna)  
    7979{ this_ITERATE(mi) 
    80     if ((*mi).variable->name==sna) 
     80    if ((*mi).variable->get_name()==sna) 
    8181      return &*mi; 
    8282  return (TMetaDescriptor *)NULL;  
     
    8686TMetaDescriptor const *TMetaVector::operator[](const string &sna) const 
    8787{ const_this_ITERATE(mi) 
    88     if ((*mi).variable->name==sna) 
     88    if ((*mi).variable->get_name()==sna) 
    8989      return &*mi; 
    9090  return (TMetaDescriptor const *)NULL;  
  • source/orange/minimal_complexity.cpp

    r6531 r7665  
    431431    return PVariable(); 
    432432 
    433   feat->name = name; 
     433  feat->set_name(name); 
    434434 
    435435  quality = -feat->noOfValues(); 
  • source/orange/minimal_error.cpp

    r6531 r7665  
    821821 
    822822  quality = clusters->quality; 
    823   feat->name=name; 
     823  feat->set_name(name); 
    824824 
    825825  return feat; 
  • source/orange/preprocessors.cpp

    r6531 r7665  
    9999        outDomain->removeClass(); 
    100100      else 
    101         raiseError("attribute '%s' not found", (*vi)->name.c_str()); 
     101        raiseError("attribute '%s' not found", (*vi)->get_name().c_str()); 
    102102 
    103103  newWeight = weightID; 
     
    285285    const int idx = gen->domain->getVarNum(*vi, false); 
    286286    if (idx == ILLEGAL_INT) 
    287       raiseError("attribute '%s' not found", (*vi)->name.c_str()); 
     287      raiseError("attribute '%s' not found", (*vi)->get_name().c_str()); 
    288288    indices.push_back(idx); 
    289289  } 
     
    414414      const PVariable &var = domain.variables->at(idx); 
    415415      if (var->varType != TValue::INTVAR) 
    416         raiseError("Cannot add noise to non-discrete attribute '%s'", var->name.c_str()); 
     416        raiseError("Cannot add noise to non-discrete attribute '%s'", var->get_name().c_str()); 
    417417      addNoise(idx, *pi, makerind, table); 
    418418    } 
     
    461461      PVariable var = (*vi).first; 
    462462      if (var->varType != TValue::FLOATVAR) 
    463         raiseError("attribute '%s' is not continuous", var->name.c_str()); 
     463        raiseError("attribute '%s' is not continuous", var->get_name().c_str()); 
    464464 
    465465      const int pos = domain.getVarNum(var); 
     
    553553    raiseError("Class-less domain"); 
    554554  if (classVar->varType != TValue::FLOATVAR) 
    555     raiseError("Class '%s' is not continuous", gen->domain->classVar->name.c_str()); 
     555    raiseError("Class '%s' is not continuous", gen->domain->classVar->get_name().c_str()); 
    556556 
    557557  newWeight = weightID; 
     
    889889        long varNum = domain.getVarNum(*ai); 
    890890        if (varNum == ILLEGAL_INT) 
    891           raiseError("Attribute '%s' is not found", (*ai)->name.c_str()); 
     891          raiseError("Attribute '%s' is not found", (*ai)->get_name().c_str()); 
    892892        else if ((varNum >= 0) || ((*ai)->varType != TValue::FLOATVAR)) 
    893           raiseError("Attribute '%s' is not continuous", (*ai)->name.c_str()); 
     893          raiseError("Attribute '%s' is not continuous", (*ai)->get_name().c_str()); 
    894894        else { 
    895895          PVariable evar = method->operator()(gen, *ai); 
  • source/orange/rconversions.cpp

    r6531 r7665  
    6464              if (*bi) { 
    6565                if ((*eei).isSpecial()) 
    66                   raiseErrorWho("exampleGenerator2r", "value of attribute '%s' in example '%i' is undefined", (*vi)->name.c_str(), row); 
     66                  raiseErrorWho("exampleGenerator2r", "value of attribute '%s' in example '%i' is undefined", (*vi)->get_name().c_str(), row); 
    6767                *Xi = (*vi)->varType == TValue::FLOATVAR ? (*eei).floatV : float((*eei).intV); 
    6868                Xi += rows; 
  • source/orange/redundancy.cpp

    r6531 r7665  
    106106            boundSet.push_back(attr); 
    107107            float foo; 
    108             newVar = featureReducer->operator()(PExampleGenerator(*newGen), boundSet, attr->name+"_r", foo); 
     108            newVar = featureReducer->operator()(PExampleGenerator(*newGen), boundSet, attr->get_name()+"_r", foo); 
    109109          } 
    110110 
     
    160160        boundSet.push_back(attr); 
    161161        float foo; 
    162         PVariable newVar(featureReducer->operator()(PExampleGenerator(*newGen), boundSet, attr->name+"_r", foo)); 
     162        PVariable newVar(featureReducer->operator()(PExampleGenerator(*newGen), boundSet, attr->get_name()+"_r", foo)); 
    163163 
    164164        if (   newVar 
     
    381381  TEnumVariable *evar = var.AS(TEnumVariable); 
    382382  if (!evar) 
    383     raiseError("'%s' is not a discrete attribute", var->name.c_str()); 
     383    raiseError("'%s' is not a discrete attribute", var->get_name().c_str()); 
    384384 
    385385  TDiscDistribution dist(gen, var, weightID); 
     
    397397    return var; 
    398398 
    399   TEnumVariable *enewVar = mlnew TEnumVariable("R_"+evar->name); 
     399  TEnumVariable *enewVar = mlnew TEnumVariable("R_"+evar->get_name()); 
    400400  enewVar->values = PStringList(mlnew TStringList(nonull, "")); 
    401401  PVariable newVar(enewVar); 
  • source/orange/spec_contingency.cpp

    r6531 r7665  
    4545        si++; 
    4646      if (si==be) 
    47         raiseError("the transformed domain misses the attribute '%s'", (*bi)->name.c_str()); 
     47        raiseError("the transformed domain misses the attribute '%s'", (*bi)->get_name().c_str()); 
    4848      orderedList.push_back(*si); 
    4949    } 
     
    173173        sci++; 
    174174      if (dci==dce) 
    175         raiseError("preprocessed examples miss the attribute '%s'", (*dci)->outerVariable->name.c_str()); 
     175        raiseError("preprocessed examples miss the attribute '%s'", (*dci)->outerVariable->get_name().c_str()); 
    176176      else if ((*sci)->outerVariable->sourceVariable==(*dci)->outerVariable) { 
    177177        (*sci)->outerVariable = (*dci)->outerVariable; 
  • source/orange/spec_gen.cpp

    r6531 r7665  
    261261      if (((*pi).second>0) && (randomGenerator->randfloat() < (*pi).second)) 
    262262        if ( ( example[(*pi).first] = varlist[(*pi).first]->randomValue(randomGenerator->randint()) ).isDC()) 
    263           raiseError("attribute '%s' cannot give randomValues.", varlist[(*pi).first]->name.c_str()); 
     263          raiseError("attribute '%s' cannot give randomValues.", varlist[(*pi).first]->get_name().c_str()); 
    264264    } 
    265265  } 
     
    307307            raiseError("attribute index %i out of range", pos); 
    308308          if (domain->variables->at(pos)->varType != TValue::FLOATVAR) 
    309             raiseError("attribute '%s' is not continuous", domain->variables->at(pos)->name.c_str()); 
     309            raiseError("attribute '%s' is not continuous", domain->variables->at(pos)->get_name().c_str()); 
    310310        } 
    311311      } 
     
    318318        if (val.varType != TValue::FLOATVAR) 
    319319          if ((*pi).first > 0) 
    320             raiseError("attribute '%s' is not continuous", domain->variables->at((*pi).first)->name.c_str()); 
     320            raiseError("attribute '%s' is not continuous", domain->variables->at((*pi).first)->get_name().c_str()); 
    321321          else 
    322322            raiseError("attribute with id %i is not continuous", (*pi).first); 
  • source/orange/tabdelim.cpp

    r7164 r7665  
    908908 
    909909            if (mval.floatV == 1.0) 
    910               fprintf(file, checkCtrl(var.name.c_str())); 
     910              fprintf(file, checkCtrl(var.get_name().c_str())); 
    911911            else { 
    912912              var.val2filestr(mval, st, *ex); 
    913               fprintf(file, "%s=%s", checkCtrl(var.name.c_str()), checkCtrl(st.c_str())); 
     913              fprintf(file, "%s=%s", checkCtrl(var.get_name().c_str()), checkCtrl(st.c_str())); 
    914914            } 
    915915          } 
     
    10011001  for(vi = vb; vi!=ve; vi++) { 
    10021002    PUTDELIM; 
    1003     fprintf(file, "%s", checkCtrl((*vi)->name.c_str())); 
     1003    fprintf(file, "%s", checkCtrl((*vi)->get_name().c_str())); 
    10041004  } 
    10051005  for(mi = mb; mi!=me; mi++) { 
     
    10101010    else { 
    10111011      PUTDELIM; 
    1012       fprintf(file, "%s", checkCtrl((*mi).variable->name.c_str())); 
     1012      fprintf(file, "%s", checkCtrl((*mi).variable->get_name().c_str())); 
    10131013    } 
    10141014  } 
     
    11231123  const_PITERATE(TVarList, vi, dom->attributes) { 
    11241124    PUTDELIM; 
    1125     fprintf(file, "%s%s", (tabDelim_checkNeedsD(*vi) ? "D#" : ""), checkCtrl((*vi)->name.c_str())); 
     1125    fprintf(file, "%s%s", (tabDelim_checkNeedsD(*vi) ? "D#" : ""), checkCtrl((*vi)->get_name().c_str())); 
    11261126  } 
    11271127   
    11281128  if (dom->classVar) { 
    11291129    PUTDELIM; 
    1130     fprintf(file, "%s%s", (tabDelim_checkNeedsD(dom->classVar) ? "cD#" : "c#"), checkCtrl(dom->classVar->name.c_str())); 
     1130    fprintf(file, "%s%s", (tabDelim_checkNeedsD(dom->classVar) ? "cD#" : "c#"), checkCtrl(dom->classVar->get_name().c_str())); 
    11311131  } 
    11321132 
     
    11411141    else { 
    11421142      PUTDELIM; 
    1143       fprintf(file, "%s%s", (tabDelim_checkNeedsD((*mi).variable) ? "mD#" : "m#"), checkCtrl((*mi).variable->name.c_str())); 
     1143      fprintf(file, "%s%s", (tabDelim_checkNeedsD((*mi).variable) ? "mD#" : "m#"), checkCtrl((*mi).variable->get_name().c_str())); 
    11441144    } 
    11451145  } 
  • source/orange/table.cpp

    r6531 r7665  
    119119      for(vector<pair<int, int> >::const_iterator sdmmi((*dmmi).begin()), sdmme((*dmmi).end()); sdmmi!=sdmme; sdmmi++) { 
    120120        if (!mergeTwoValues(*ei, (*iterators[(*sdmmi).first])[(*sdmmi).second], notfirst++ != 0)) 
    121           raiseError("mismatching value of attribute '%s' in example #%i", (*vi)->name.c_str(), exno); 
     121          raiseError("mismatching value of attribute '%s' in example #%i", (*vi)->get_name().c_str(), exno); 
    122122      } 
    123123    } 
     
    129129          if (!mergeTwoValues(example->getMeta((*mvi).first), (*mvi).second, true)) { 
    130130            PVariable metavar = domain->getMetaVar((*mvi).first, false); 
    131             if (metavar && metavar->name.length()) 
    132               raiseError("Meta attribute '%s' has ambiguous values on example #%i", metavar->name.c_str(), exno); 
     131            if (metavar && metavar->get_name().length()) 
     132              raiseError("Meta attribute '%s' has ambiguous values on example #%i", metavar->get_name().c_str(), exno); 
    133133            else 
    134134              raiseError("Meta attribute %i has ambiguous values on example #%i", (*mvi).first, exno); 
     
    753753          if (intV > noVal) { 
    754754            free(temp); 
    755             raiseError("value out attribute '%s' of range", domain->variables->operator[](*bi)->name.c_str()); 
     755            raiseError("value out attribute '%s' of range", domain->variables->operator[](*bi)->get_name().c_str()); 
    756756          } 
    757757          valf[intV]++; 
  • source/orange/tdidt_split.cpp

    r6531 r7665  
    401401 
    402402        if (distr.size()>16) 
    403           raiseError("'%s' has more than 16 values, cannot exhaustively binarize", gen->domain->attributes->at(thisAttr)->name.c_str()); 
     403          raiseError("'%s' has more than 16 values, cannot exhaustively binarize", gen->domain->attributes->at(thisAttr)->get_name().c_str()); 
    404404 
    405405        // If the attribute is binary, we check subsetSizes and assess the quality if they are OK 
     
    543543  descriptions->push_back(ns1>1 ? "in ["+s1+"]" : s1); 
    544544 
    545   bvar->name = gen->domain->attributes->at(bestAttr)->name; 
     545  bvar->set_name(gen->domain->attributes->at(bestAttr)->get_name()); 
    546546  spentAttribute = (ns0==1) && (ns1==1) ? bestAttr : -1; 
    547547  return mlnew TClassifierFromVarFD(bvar, gen->domain, bestAttr, subsetSizes, mlnew TMapIntValue(bestMapping)); 
     
    750750  descriptions->push_back(bestValueS); 
    751751   
    752   bvar->name = gen->domain->attributes->at(bestAttr)->name; 
     752  bvar->set_name(gen->domain->attributes->at(bestAttr)->get_name()); 
    753753 
    754754  TIntList *bestMapping = mlnew TIntList(attribute.AS(TEnumVariable)->values->size(), 0); 
     
    862862  descriptions->push_back(str); 
    863863 
    864   bvar->name = gen->domain->attributes->at(bestAttr)->name; 
     864  bvar->set_name(gen->domain->attributes->at(bestAttr)->get_name()); 
    865865  spentAttribute = -1; 
    866866  return mlnew TClassifierFromVarFD(bvar, gen->domain, bestAttr, subsetSizes, mlnew TThresholdDiscretizer(bestThreshold)); 
  • source/orange/transval.cpp

    r6886 r7665  
    152152PVariable TDomainContinuizer::discrete2continuous(TEnumVariable *evar, PVariable wevar, const int &val, bool inv) const 
    153153{ 
    154   PVariable newvar = mlnew TFloatVariable(evar->name+"="+evar->values->at(val)); 
     154  PVariable newvar = mlnew TFloatVariable(evar->get_name()+"="+evar->values->at(val)); 
    155155  TClassifierFromVar *cfv = mlnew TClassifierFromVar(newvar, wevar); 
    156156  cfv->transformer = mlnew TDiscrete2Continuous(val, inv, zeroBased); 
     
    162162PVariable TDomainContinuizer::ordinal2continuous(TEnumVariable *evar, PVariable wevar, const float &factor) const 
    163163{ 
    164   PVariable newvar = mlnew TFloatVariable("C_"+evar->name); 
     164  PVariable newvar = mlnew TFloatVariable("C_"+evar->get_name()); 
    165165  TClassifierFromVar *cfv = mlnew TClassifierFromVar(newvar, wevar); 
    166166  TOrdinal2Continuous *transf = mlnew TOrdinal2Continuous(1.0/evar->values->size()); 
     
    193193        return; 
    194194      } 
    195       raiseError("attribute '%s' is multinomial", var->name.c_str()); 
     195      raiseError("attribute '%s' is multinomial", var->get_name().c_str()); 
    196196 
    197197    case AsOrdinal: 
     
    223223PVariable TDomainContinuizer::continuous2normalized(PVariable var, const float &avg, const float &span) const 
    224224{  
    225   PVariable newvar = mlnew TFloatVariable("N_"+var->name); 
     225  PVariable newvar = mlnew TFloatVariable("N_"+var->get_name()); 
    226226  TClassifierFromVar *cfv = mlnew TClassifierFromVar(newvar, var); 
    227227  cfv->transformer = mlnew TNormalizeContinuous(avg, span); 
     
    240240        raiseError("base class value out of range"); 
    241241 
    242     PVariable newClassVar = mlnew TFloatVariable(eclass->name+"="+eclass->values->at(classBase)); 
     242    PVariable newClassVar = mlnew TFloatVariable(eclass->get_name()+"="+eclass->values->at(classBase)); 
    243243    TClassifierFromVar *cfv = mlnew TClassifierFromVar(newClassVar, classVar); 
    244244    cfv->transformer = mlnew TDiscrete2Continuous(classBase, false, zeroBased); 
     
    259259    return ordinal2continuous(eclass, classVar, 1.0 / (eclass->values->size() - 1)); 
    260260 
    261   raiseError("class '%s' is multinomial", eclass->name.c_str()); 
     261  raiseError("class '%s' is multinomial", eclass->get_name().c_str()); 
    262262  return PVariable(); 
    263263} 
     
    268268  PVariable otherAttr = dom->hasOtherAttributes((targetClass>=0) || (classTreatment != Ignore)); 
    269269  if (otherAttr) 
    270     raiseError("attribute '%s' is of a type that cannot be converted to continuous", otherAttr->name.c_str()); 
     270    raiseError("attribute '%s' is of a type that cannot be converted to continuous", otherAttr->get_name().c_str()); 
    271271   
    272272  if (continuousTreatment) 
     
    308308  PVariable otherAttr = domain.hasOtherAttributes(convertClass); 
    309309  if (otherAttr) 
    310     raiseError("attribute '%s' is of a type that cannot be converted to continuous", otherAttr->name.c_str()); 
     310    raiseError("attribute '%s' is of a type that cannot be converted to continuous", otherAttr->get_name().c_str()); 
    311311 
    312312 
  • source/orange/vars.cpp

    r6955 r7665  
    2121 
    2222// to include Python.h before STL defines a template set (doesn't work with VC 6.0) 
    23 #include "garbage.hpp" 
     23#include "garbage.hpp"  
    2424 
    2525#include <set> 
     
    8080 
    8181  ITERATE(list<TVariable *>, vi, TVariable::allVariables) { 
    82     if (((*vi)->varType == varType) && ((*vi)->name == name)) { 
     82    if (((*vi)->varType == varType) && ((*vi)->get_name() == name)) { 
    8383      int tempStat = TVariable::OK; 
    8484 
     
    248248TValue  TVariable::specialValue(int spec) const 
    249249{ return TValue(varType, spec); } 
    250  
    251250 
    252251/*  Converts a human-readable string, representing the value (as read from the file, for example) to TValue. 
     
    464463 
    465464      if (vi==ve) 
    466         raiseWarning("is '%s' a continuous attribute unintentionally defined by '%s'?", name.c_str(), values->front().c_str()); 
     465        raiseWarning("is '%s' a continuous attribute unintentionally defined by '%s'?", get_name().c_str(), values->front().c_str()); 
    467466    } 
    468467  } 
     
    525524      valu = TValue(vi->second); 
    526525    else if (!str2special(valname, valu)) 
    527       raiseError("attribute '%s' does not have value '%s'", name.c_str(), valname.c_str()); 
     526      raiseError("attribute '%s' does not have value '%s'", get_name().c_str(), valname.c_str()); 
    528527  } 
    529528 
     
    533532      valu = TValue(int(vi - values->begin())); 
    534533    else if (!str2special(valname, valu)) 
    535       raiseError("attribute '%s' does not have value '%s'", name.c_str(), valname.c_str()); 
     534      raiseError("attribute '%s' does not have value '%s'", get_name().c_str(), valname.c_str()); 
    536535  } 
    537536} 
     
    787786{ 
    788787  switch (str2val_low(valname, valu)) { 
    789     case -1: raiseError("'%s' is not a legal value for continuous attribute '%s'", valname.c_str(), name.c_str()); 
     788    case -1: raiseError("'%s' is not a legal value for continuous attribute '%s'", valname.c_str(), get_name().c_str()); 
    790789    case -2: raiseError("value %5.3f out of range %5.3f-%5.3f", valu.floatV, startValue, endValue); 
    791790  } 
  • source/orange/vars.hpp

    r6531 r7665  
    5959  CLASSCONSTANTS(Type: None=(int)TValue::NONE; Discrete=(int)TValue::INTVAR; Continuous=(int)TValue::FLOATVAR; Other=(int)(TValue::FLOATVAR+1); String=(int)STRINGVAR); 
    6060   
    61   string name; //P variable's name 
     61  //string name; //variable's name - hiding it! 
     62 
    6263  int  varType; //P(&Variable_Type) variable type 
    6364  bool ordered; //P variable values are ordered 
     
    7576  TValue DK_value; 
    7677 
    77 public: 
     78private: 
     79  string name; 
     80 
     81public: 
     82 
     83  string get_name() const { 
     84    return name; 
     85  } 
     86 
     87  void set_name(const string &a) { 
     88    //update the map 
     89    name = a; 
     90  } 
     91 
    7892  static list<TVariable *> allVariables; 
    7993 
  • source/orangene/heatmap.cpp

    r6531 r7665  
    275275  PITERATE(TVarList, ai, etable.domain->attributes) 
    276276    if ((*ai)->varType != TValue::FLOATVAR) 
    277       raiseError("data contains a discrete attribute '%s'", (*ai)->name.c_str()); 
     277      raiseError("data contains a discrete attribute '%s'", (*ai)->get_name().c_str()); 
    278278 
    279279  if (etable.domain->classVar && !disregardClass) { 
Note: See TracChangeset for help on using the changeset viewer.