Ticket #1219: clang.patch

File clang.patch, 41.0 KB (added by ales, 2 years ago)
  • source/include/stat.hpp

    # HG changeset patch
    # User Ales Erjavec <ales.erjavec@fri.uni-lj.si>
    # Date 1343748037 -7200
    # Node ID e4a02f9abd660cb5ad5dbf3ef6ed1b419309e1c9
    # Parent  d8f18f743026eb53073a51e05ec1bada028b7227
    Clang compiler support.
    
    diff -r d8f18f743026 -r e4a02f9abd66 source/include/stat.hpp
    a b  
    297297 
    298298 
    299299template<class T> 
     300T middleelement(const vector<T> &med) 
     301{ DEFINE_TYPENAME 
     302  const_iterator medmid(med.begin()+med.size()/2); 
     303  if (med.size()%2) 
     304    return *min_element(medmid, med.end()); 
     305  else 
     306    return (*max_element(med.begin(), medmid) + *min_element(medmid, med.end()))/2.0; 
     307} 
     308 
     309 
     310template<class T> 
    300311T median(const vector<T> &med) 
    301312{ if (!med.size()) 
    302313    throw StatException("median: empty list"); 
     
    319330 
    320331 
    321332template<class T> 
    322 T middleelement(const vector<T> &med) 
    323 { DEFINE_TYPENAME 
    324   const_iterator medmid(med.begin()+med.size()/2); 
    325   if (med.size()%2) 
    326     return *min_element(medmid, med.end()); 
    327   else 
    328     return (*max_element(med.begin(), medmid) + *min_element(medmid, med.end()))/2.0; 
    329 } 
    330  
    331  
    332 template<class T> 
    333333int mode(const vector<T> &flist, vector<T> &mode) 
    334334{ DEFINE_TYPENAME 
    335335  typedef typename map<T, int>::iterator mapiterator; 
     
    394394 
    395395/* *********** MOMENTS ************/ 
    396396 
     397 
     398template<class T> T samplevar(const vector<T>&); 
     399template<class T> T samplestdev(const vector<T>&); 
     400 
     401 
    397402template<class T> 
    398403T moment(const vector<T> &flist, const int &mom) 
    399404{ DEFINE_TYPENAME 
     
    502507 
    503508  min=*min_element(flist.begin(), flist.end()); 
    504509  max=*max_element(flist.begin(), flist.end()); 
    505   T ebw=(max-min)/T(numbins) + 1.0; 
     510  T ebw=(max-min)/T(numbins) + T(1.0); 
    506511  binsize=(max-min+ebw)/T(numbins); 
    507   min-=binsize/2; 
     512  min-=binsize/T(2); 
    508513 
    509514  counts=vector<int>(numbins, 0); 
    510515  extrapoints=0; 
     
    680685{ 
    681686    static T cof[6] = {76.18009173, -86.50532033, 24.01409822, -1.231739516, 0.120858003e-2, -0.536382e-5}; 
    682687 
    683     T x=xx, y=xx, tmp=x+5.5; 
    684     tmp-=(x+0.5)*log(tmp); 
     688    T x=xx, y=xx, tmp=x+T(5.5); 
     689    tmp-=(x+T(0.5))*log(tmp); 
    685690    T ser=1.000000000190015; 
    686691    for(int j=0; j<6; j++) 
    687692     ser+=cof[j]/++y; 
     
    696701  const T EPS=3.0e-7; 
    697702 
    698703  gln = gammln(a); 
    699   T b=x+1.0-a; 
     704  T b=x+T(1.0)-a; 
    700705  T c=T(1.0)/FPMIN; 
    701706  T d=T(1.0)/b; 
    702707  T h=d; 
    703708  for(int i=1; i<=ITMAX; i++) { 
    704     T an=(a-double(i))*i; 
    705     b += 2.0; 
     709    T an=(a-T(double(i)))*i; 
     710    b += T(2.0); 
    706711    d=an*d+b; 
    707712    if (abs(d) < FPMIN) d=FPMIN; 
    708713    c=b+an/c; 
     
    710715    d=T(1.0)/d; 
    711716    T del=d*c; 
    712717    h *= del; 
    713     if (abs(del-1.0) < EPS) 
     718    if (abs(del-T(1.0)) < EPS) 
    714719      return exp(-x+a*log(x)-gln)*h; 
    715720  } 
    716721 
     
    723728{ const int ITMAX=100; 
    724729  const T EPS=3.0e-7; 
    725730  gln=gammln(a); 
    726   if (x<=0.0) 
     731  if (x<=T(0.0)) 
    727732    throw StatException("gser: negative x"); 
    728733 
    729734  T ap=a; 
     
    743748 
    744749template<class T> 
    745750T gammp(const T &a, const T &x) 
    746 { if ((x<0.0) || (a<=0.0)) 
     751{ if ((x<T(0.0)) || (a<=T(0.0))) 
    747752    throw StatException("gammp: invalid arguments"); 
    748753 
    749754  T gln; 
    750   return (x<(a+1.0)) ? gammser(a, x, gln) : -gammcf(a, x, gln)+1.0; 
     755  return (x<(a+T(1.0))) ? gammser(a, x, gln) : -gammcf(a, x, gln)+T(1.0); 
    751756} 
    752757 
    753758 
    754759template<class T> 
    755760T gammq(const T &a, const T &x) 
    756 { if ((x<0.0) || (a<=0.0)) 
     761{ if ((x<T(0.0)) || (a<=T(0.0))) 
    757762    throw StatException("gammp: invalid arguments"); 
    758763 
    759764  T gln; 
    760   return (x<(a+1.0)) ? -gammser(a, x, gln)+1.0 : gammcf(a, x, gln); 
     765  return (x<(a+T(1.0))) ? -gammser(a, x, gln)+T(1.0) : gammcf(a, x, gln); 
    761766} 
    762767 
    763768       
     
    786791    T bm=1.0, az=1.0, am=1.0; 
    787792 
    788793    T qab=a+b; 
    789     T qap=a+1.0; 
    790     T qam=a-1.0; 
    791     T bz= -qab*x/qap + 1.0; 
     794    T qap=a+T(1.0); 
     795    T qam=a-T(1.0); 
     796    T bz= -qab*x/qap + T(1.0); 
    792797    for(int i=0; i<=ITMAX; i++) { 
    793798        T em = i+1; 
    794799        T tem = em*2; 
     
    816821{ if ((x<0.0) || (x>1.0)) 
    817822    throw StatException("betai: bad x"); 
    818823 
    819   T bt= ((x==0.0) || (x==1.0)) ? 0.0 : exp(gammln(a+b)-gammln(a)-gammln(b)+a*log(x)+b*log(- x + 1.0)); 
    820   return (x < (a+1.0)/(a+b+2.0)) ? bt*betacf(a,b,x)/a : -bt*betacf(b,a, -x+1.0)/b + 1.0; 
     824  T bt= ((x==0.0) || (x==1.0)) ? 0.0 : exp(gammln(a+b)-gammln(a)-gammln(b)+a*log(x)+b*log(- x + T(1.0))); 
     825  return (x < (a+T(1.0))/(a+b+T(2.0))) ? bt*betacf(a,b,x)/a : -bt*betacf(b,a, -x+T(1.0))/b + T(1.0); 
    821826} 
    822827 
    823828 
     
    837842    else if (y < 1.0) { 
    838843      T w = sqr(y); 
    839844        x = ((((((((w * 0.000124818987 
    840                   -0.001075204047) * w +0.005198775019) * w 
    841                 -0.019198292004) * w +0.059054035642) * w 
    842               -0.151968751364) * w +0.319152932694) * w 
    843             -0.531923007300) * w +0.797884560593) * y * 2.0; 
     845                  -T(0.001075204047)) * w + T(005198775019.0)) * w 
     846                -T(0.019198292004)) * w + T(0.059054035642)) * w 
     847              -T(0.151968751364)) * w + T(0.319152932694)) * w 
     848            -T(0.531923007300)) * w + T(0.797884560593)) * y * 2.0; 
    844849    } 
    845850      else { 
    846851        y -= 2.0; 
    847         x = (((((((((((((y * -0.000045255659 
    848                        +0.000152529290) * y -0.000019538132) * y 
    849                      -0.000676904986) * y +0.001390604284) * y 
    850                    -0.000794620820) * y -0.002034254874) * y 
    851                  +0.006549791214) * y -0.010557625006) * y 
    852                +0.011630447319) * y -0.009279453341) * y 
    853              +0.005353579108) * y -0.002141268741) * y 
    854            +0.000535310849) * y +0.999936657524; 
     852        x = (((((((((((((y * T(-0.000045255659) 
     853                       +T(0.000152529290)) * y - T(0.000019538132)) * y 
     854                     -T(0.000676904986)) * y + T(0.001390604284)) * y 
     855                   -T(0.000794620820)) * y - T(0.002034254874)) * y 
     856                 +T(0.006549791214)) * y - T(0.010557625006)) * y 
     857               +T(0.011630447319)) * y - T(0.009279453341)) * y 
     858             +T(0.005353579108)) * y - T(0.002141268741)) * y 
     859           +T(0.000535310849)) * y + T(0.999936657524); 
    855860    } 
    856861  } 
    857862 
    858   return (z > 0.0) ? (x+1.0)*0.5 : (-x+1.0)*0.5; 
     863  return (z > 0.0) ? (x+T(1.0))*T(0.5) : (-x+T(1.0))*T(0.5); 
    859864} 
    860865 
    861866 
     
    866871template<class T> 
    867872T erfcc(const T& x) 
    868873{ T z = abs(x); 
    869   T t = T(1.0) / (z*0.5+1.0); 
    870   T ans = t * exp(-z*z-1.26551223 + t*(t*(t*(t*(t*(t*(t*(t*(t*0.17087277-0.82215223)+1.48851587)-1.13520398)+0.27886807)-0.18628806)+0.9678418)+0.37409196)+1.00002368)); 
    871   return (x >= 0.0) ?  ans : -ans +2.0; 
     874  T t = T(1.0) / (z*T(0.5)+T(1.0)); 
     875  T ans = t * exp(-z*z-T(1.26551223) + t*(t*(t*(t*(t*(t*(t*(t*(t*T(0.17087277-0.82215223))+T(1.48851587))-T(1.13520398))+T(0.27886807))-T(0.18628806))+T(0.9678418))+T(0.37409196))+T(1.00002368))); 
     876  return (x >= 0.0) ?  ans : -ans + T(2.0); 
    872877} 
    873878 
    874879 
     
    921926  T r_den = sqrt( (sumx2*n - sqr(sumx) ) * (sumy2*n - sqr(sumy)) ); 
    922927  T r = r_num / r_den; 
    923928  T df=n-2; 
    924   T t = r * sqrt( df / ( (-r+1.0+TINY)*(r+1.0+TINY) ) ); 
     929  T t = r * sqrt( df / ( (-r+T(1.0)+T(TINY))*(r+T(1.0)+T(TINY)) ) ); 
    925930  probrs=betai(df*0.5, T(0.5), df/(df+t*t)); 
    926931  return r; 
    927932} 
     
    10071012  T r_den = sqrt( (sumx2*n - sqr(sumx) ) * (sumy2*n - sqr(sumy)) ); 
    10081013  r = r_num / r_den; 
    10091014  T df=n-2; 
    1010   T t = r * sqrt( df / ( (-r+1.0+TINY)*(r+1.0+TINY) ) ); 
     1015  T t = r * sqrt( df / ( (-r+T(1.0)+T(TINY))*(r+T(1.0)+T(TINY)) ) ); 
    10111016  probrs=betai(df*0.5, T(0.5), df/(df+t*t)); 
    10121017 
    10131018//  T z = log((r+1.0+TINY)/(-r+1.0+TINY)); 
    10141019 
    10151020  slope = r_num / (sumx2*n - sqr(sumx)); 
    10161021  intercepr = meany - slope*meanx; 
    1017   sterrest = sqrt(-sqr(r)+1.0) * samplestdev(flist2); 
     1022  sterrest = sqrt(-sqr(r)+T(1.0)) * samplestdev(flist2); 
    10181023} 
    10191024 
    10201025 
     
    10241029template<class T> 
    10251030T ttest_1samp(const vector<T> &flist, const T &popmean, T &prob) 
    10261031{ 
    1027   T n=flist.size(), df=n-1.0; 
     1032  T n=flist.size(), df=n-T(1.0); 
    10281033  T t= (mean(flist) - popmean) / sqrt(var(flist)/n); 
    10291034  prob=betai(df*0.5, T(0.5), df/(df+t*t)); 
    10301035  return t; 
     
    10331038 
    10341039template<class T> 
    10351040T ttest_ind(const vector<T> &x, const vector<T> &y, T &prob) 
    1036 { T n1=x.size(), n2=y.size(), df=n1+n2-2.0; 
    1037   T svar= ( sqr(stdev(x))*(n1-1.0) + sqr(stdev(y))*(n2-1.0) )  /  df; 
     1041{ T n1=x.size(), n2=y.size(), df=n1+n2-T(2.0); 
     1042  T svar= ( sqr(stdev(x))*(n1-T(1.0)) + sqr(stdev(y))*(n2-T(1.0)) )  /  df; 
    10381043  T t= ( mean(x) - mean(y) ) / sqrt(svar * ( (n1+n2)/(n1*n2) ) ); 
    10391044  prob=betai(df*0.5, T(0.5), df/(df+t*t)); 
    10401045  return t; 
     
    10531058  T cov=0.0; 
    10541059  for(int i=0; i<x.size(); i++) 
    10551060    cov += (x[i]-meanx) * (y[i]-meany); 
    1056   T df=n-1.0; 
     1061  T df=n-T(1.0); 
    10571062  cov /= df; 
    1058   T sd = sqrt((var(x)+var(y) - cov*2.0)/n); 
     1063  T sd = sqrt((var(x)+var(y) - cov*T(2.0))/n); 
    10591064  if (sd==0.0) 
    10601065    throw StatException("ttest_rel: sd==0, can't divide"); 
    10611066  T t = (mean(x)-mean(y))/sd; 
  • source/orange/assoc.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/assoc.cpp
    a b  
    2828#include "spec_gen.hpp" 
    2929#include "table.hpp" 
    3030 
    31 #include "assoc.ppp" 
     31#include "assoc.hpp" 
    3232 
    3333DEFINE_TOrangeVector_classDescription(PAssociationRule, "TAssociationRules", true, ORANGE_API) 
    3434 
     35#include "assoc.ppp" 
    3536 
    3637TItemSetValue::TItemSetValue(int al) 
    3738: value(al), 
  • source/orange/assoc.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/assoc.hpp
    a b  
    2929#include "examples.hpp" 
    3030#include "classify.hpp" 
    3131#include "learn.hpp" 
     32#include "orvector.hpp" 
    3233 
    3334WRAPPER(Example) 
    34 VWRAPPER(IntList) 
    3535WRAPPER(ExampleTable) 
    3636 
    3737class ORANGE_API TAssociationRule : public TOrange { 
  • source/orange/c4.5.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/c4.5.cpp
    a b  
    2727#include "learn.hpp" 
    2828#include "getarg.hpp" 
    2929 
    30 #include "c4.5.ppp" 
     30#include "c4.5.hpp" 
    3131 
    3232DEFINE_TOrangeVector_classDescription(PC45TreeNode, "TC45TreeNodeList", true, ORANGE_API) 
    3333 
     34#include "c4.5.ppp" 
     35 
    3436bool c45Loaded = false; 
    3537 
    3638typedef void *learnFunc(int trials, char gainRatio, char subset, char batch, char probThresh, 
  • source/orange/callback.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/callback.cpp
    a b  
    121121} 
    122122 
    123123PFilter TFilter_Python::deepCopy() const 
    124 {    
     124{ 
     125    const char * method = PyObject_HasAttrString((PyObject *)myWrapper, "deep_copy") ? "deep_copy" : "deepCopy"; 
     126 
    125127    PyObject *result = PyObject_CallMethod((PyObject *) myWrapper, 
    126             PyObject_HasAttrString((PyObject *)myWrapper, "deep_copy") ? "deep_copy" : "deepCopy", 
     128            (char *) method, 
    127129            NULL); 
    128130    if (!result) 
    129131        raiseError("An exception has been thrown in method deepCopy!"); 
  • source/orange/cls_example.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/cls_example.cpp
    a b  
    309309 
    310310PyObject *Example_reference(TPyExample *pex) PYARGS(METH_NOARGS, "unique reference (pointer to) the object") 
    311311{ 
    312   return PyInt_FromLong(int(&PyExample_AS_ExampleReference(pex))); 
     312  return PyInt_FromSize_t(size_t(&PyExample_AS_ExampleReference(pex))); 
    313313} 
    314314 
    315315 
  • source/orange/converts.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/converts.hpp
    a b  
    4141PyObject *convertToPython(const string &); 
    4242PyObject *convertToPython(const float &); 
    4343PyObject *convertToPython(const pair<float, float> &); 
     44PyObject *convertToPython(const pair<int, float> &); 
    4445PyObject *convertToPython(const int &); 
     46PyObject *convertToPython(const long &); 
    4547PyObject *convertToPython(const unsigned char &); 
    4648PyObject *convertToPython(const bool &); 
    4749 
     
    5254string convertToString(const string &); 
    5355string convertToString(const float &); 
    5456string convertToString(const pair<float, float> &); 
     57string convertToString(const pair<int, float> &); 
    5558string convertToString(const int &); 
     59string convertToString(const long &); 
    5660string convertToString(const unsigned char &); 
    5761//string convertToString(const PContingency &); 
    5862 
  • source/orange/domaindepot.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/domaindepot.hpp
    a b  
    2727using namespace std; 
    2828 
    2929#include "getarg.hpp" 
     30#include "orvector.hpp" 
     31#include "vars.hpp" 
     32#include "domain.hpp" 
     33/*VWRAPPER(StringList) 
     34VWRAPPER(VarList)*/ 
    3035 
    31 VWRAPPER(StringList) 
    32 VWRAPPER(VarList) 
    33 WRAPPER(Domain) 
     36//WRAPPER(Domain) 
    3437class TMetaVector; 
    3538 
    3639#define TDomainList TOrangeVector<PDomain>  
  • source/orange/estimateprob.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/estimateprob.cpp
    a b  
    2323#include "contingency.hpp" 
    2424#include "examplegen.hpp" 
    2525 
    26 #include "estimateprob.ppp" 
     26#include "estimateprob.hpp" 
    2727#include "stat.hpp" 
    2828#include "random.hpp" 
    2929 
     
    3131DEFINE_TOrangeVector_classDescription(PProbabilityEstimator, "TProbabilityEstimatorList", true, ORANGE_API) 
    3232DEFINE_TOrangeVector_classDescription(PConditionalProbabilityEstimator, "TConditionalProbabilityEstimatorList", true, ORANGE_API) 
    3333 
     34#include "estimateprob.ppp" 
     35 
    3436TProbabilityEstimator::TProbabilityEstimator(const bool &disc, const bool &cont) 
    3537: supportsDiscrete(disc), 
    3638  supportsContinuous(cont) 
  • source/orange/exampleclustering.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/exampleclustering.hpp
    a b  
    3030 
    3131PClassifier completeTable(PExampleGenerator examples, int completion, int weightID=0); 
    3232 
    33  
    3433WRAPPER(ExampleCluster); 
    3534WRAPPER(Example); 
    3635 
     
    5150}; 
    5251 
    5352 
    54 #define TExampleSets TOrangeVector<PExampleGenerator>  
    55 VWRAPPER(ExampleSets) 
    56  
     53//#define TExampleSets TOrangeVector<PExampleGenerator>  
     54//VWRAPPER(ExampleSets) 
     55#define PExampleSets PExampleGeneratorList 
     56#define TExampleSets TExampleGeneratorList 
    5757 
    5858WRAPPER(Classifier) 
    5959WRAPPER(Variable) 
  • source/orange/examplegen.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/examplegen.hpp
    a b  
    140140  TExampleIterator(TExampleGenerator *agen=NULL, TExample *anexam=NULL, void *adata =NULL); 
    141141  TExampleIterator(const TExample &anexam, TExampleGenerator *agen=NULL, void *adata =NULL); 
    142142  TExampleIterator(PDomain domain, TExampleGenerator *agen=NULL, void *adata =NULL); 
    143   TExampleIterator::TExampleIterator(const TExampleIterator &other); 
     143  TExampleIterator(const TExampleIterator &other); 
    144144  int traverse(visitproc visit, void *arg) const; 
    145145  int dropReferences(); 
    146146  ~TExampleIterator(); 
  • source/orange/filter.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/filter.cpp
    a b  
    3232#include "distvars.hpp" 
    3333#include "examplegen.hpp" 
    3434 
    35 #include "filter.ppp" 
    36  
     35#include "filter.hpp" 
    3736 
    3837DEFINE_TOrangeVector_classDescription(PValueFilter, "TValueFilterList", true, ORANGE_API) 
    3938DEFINE_TOrangeVector_classDescription(PFilter, "TFilterList", true, ORANGE_API) 
    4039 
     40#include "filter.ppp" 
     41 
     42 
    4143// Sets the negate field (default is false) 
    4244TFilter::TFilter(bool anegate, PDomain dom)  
    4345: negate(anegate), 
  • source/orange/filter.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/filter.hpp
    a b  
    2525#include "examples.hpp" 
    2626#include "distvars.hpp" 
    2727#include "trindex.hpp" 
     28#include "orvector.hpp" 
     29#include "vars.hpp" 
    2830 
    2931 
    3032WRAPPER(Filter); 
  • source/orange/garbage.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/garbage.hpp
    a b  
    290290 
    291291  inline bool operator < (const GCPtr<T> &ps) const 
    292292  { return    (!counter && ps.counter) 
    293            || (int(counter->ptr) < int(ps.counter->ptr)); } 
     293           || (counter->ptr < ps.counter->ptr); } 
    294294 
    295295 
    296296  inline T *getUnwrappedPtr() 
  • source/orange/hclust.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/hclust.cpp
    a b  
    3737 
    3838#include "progress.hpp" 
    3939 
     40#include "hclust.hpp" 
     41 
     42DEFINE_TOrangeVector_classDescription(PHierarchicalCluster, "THierarchicalClusterList", true, ORANGE_API) 
     43 
    4044#include "hclust.ppp" 
    4145 
    42 DEFINE_TOrangeVector_classDescription(PHierarchicalCluster, "THierarchicalClusterList", true, ORANGE_API) 
    4346 
    4447class TClusterW { 
    4548public: 
  • source/orange/lib_preprocess.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/lib_preprocess.cpp
    a b  
    329329 
    330330typedef MapMethods<PVariableFilterMap, TVariableFilterMap, PVariable, PValueFilter> TMM_VariableFilterMap; 
    331331 
     332INITIALIZE_MAPMETHODS(TMM_VariableFilterMap, &PyOrVariable_Type, &PyOrValueFilter_Type, _orangeValueFromPython<PVariable>, _orangeValueFromPython<PValueFilter>, _orangeValueToPython<PVariable>, _orangeValueToPython<PValueFilter>) 
     333 
    332334int VariableFilterMap_setitemlow(TVariableFilterMap *aMap, PVariable var, PyObject *pyvalue) 
    333335{ 
    334336  PValueFilter value; 
     
    489491 
    490492 
    491493// modified setitem to accept intervals/names of values 
    492 INITIALIZE_MAPMETHODS(TMM_VariableFilterMap, &PyOrVariable_Type, &PyOrValueFilter_Type, _orangeValueFromPython<PVariable>, _orangeValueFromPython<PValueFilter>, _orangeValueToPython<PVariable>, _orangeValueToPython<PValueFilter>) 
    493494 
    494495PVariableFilterMap PVariableFilterMap_FromArguments(PyObject *arg) { return TMM_VariableFilterMap::P_FromArguments(arg); } 
    495496PyObject *VariableFilterMap_FromArguments(PyTypeObject *type, PyObject *arg) { return TMM_VariableFilterMap::_FromArguments(type, arg); } 
  • source/orange/ormap.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/ormap.hpp
    a b  
    7474{ public: 
    7575    int traverse(visitproc visit, void *arg) const 
    7676    { TRAVERSE(TOrange::traverse); 
    77       for(typename TOrangeMap<K, V>::const_iterator be=begin(), ee=end(); be!=ee; be++) 
     77      for(typename TOrangeMap<K, V>::const_iterator be=this->begin(), ee=this->end(); be!=ee; be++) 
    7878        PVISIT((*be).first); 
    7979      return 0; 
    8080    } 
     
    9191{ public: 
    9292    int traverse(visitproc visit, void *arg) const 
    9393    { TRAVERSE(TOrange::traverse); 
    94       for(typename TOrangeMap<K,V>::const_iterator be=begin(), ee=end(); be!=ee; be++) 
     94      for(typename TOrangeMap<K,V>::const_iterator be=this->begin(), ee=this->end(); be!=ee; be++) 
    9595        if (this->value_is_orange) 
    9696          PVISIT((*be).second); 
    9797      return 0; 
     
    111111 
    112112    int traverse(visitproc visit, void *arg) const 
    113113    { TRAVERSE(TOrange::traverse); 
    114       for(const_iterator be=begin(), ee=end(); be!=ee; be++) { 
     114      for(const_iterator be=this->begin(), ee=this->end(); be!=ee; be++) { 
    115115        PVISIT((*be).first); 
    116116        PVISIT((*be).second); 
    117117      } 
  • source/orange/orvector.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/orvector.cpp
    a b  
    2323  #pragma warning (disable : 4290) 
    2424#endif 
    2525 
    26 #include "orvector.ppp" 
     26#include "orvector.hpp" 
    2727 
    2828DEFINE_TOrangeVector_classDescription(bool, "TBoolList", false, ORANGE_API) 
    2929DEFINE_TOrangeVector_classDescription(char, "TBoolList", false, ORANGE_API) 
     
    3535DEFINE_TOrangeVector_classDescription(PFloatList, "TFloatListList", true, ORANGE_API) 
    3636 
    3737 
    38 DEFINE_AttributedList_classDescription(TAttributedFloatList, TFloatList) 
    39 DEFINE_AttributedList_classDescription(TAttributedBoolList, TBoolList) 
    40  
    41 // TValueList's properties are defined in vars.cpp 
    42  
    4338#define pff pair<float, float> 
    4439DEFINE_TOrangeVector_classDescription(pff, "TFloatFloatList", false, ORANGE_API) 
    4540 
    4641#define pif pair<int, float> 
    4742DEFINE_TOrangeVector_classDescription(pif, "TIntFloatList", false, ORANGE_API) 
    4843 
    49 #ifdef _MSC_VER_60 
    50 TClassDescription template TOrangeVector<TValue, false>::st_classDescription; 
    51 ORANGE_EXTERN template class ORANGE_API TOrangeVector<TValue, false>; 
    52 #else 
    53  DEFINE_TOrangeVector_classDescription(TValue, "TOrangeVector<TValue, false>", false, ORANGE_API) 
    54 //template<> TClassDescription TOrangeVector<TValue, false>::st_classDescription; // =  = { "StringList", &typeid(TValueList), &TOrange::st_classDescription, TOrange_properties, TOrange_components }; 
    55 #endif 
    56  
    57  
    5844 
    5945/* This function is stolen from Python 2.3 (file listobject.c): 
    6046   n between 2^m-1 and 2^m, is round up to a multiple of 2^(m-5) */ 
  • source/orange/orvector.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/orvector.hpp
    a b  
    8484 #pragma warning (disable : 4786 4114 4018 4267) 
    8585#endif 
    8686 
     87#include <cstddef> 
    8788#include <vector> 
    8889#include "root.hpp" 
    8990#include "stladdon.hpp" 
     
    102103#else 
    103104  #define DEFINE_TOrangeVector_classDescription(_TYPE, _NAME, _WRAPPED, _API) \ 
    104105    template<> \ 
    105     TClassDescription TOrangeVector< _TYPE, _WRAPPED >::st_classDescription = { _NAME, &typeid(TOrangeVector< _TYPE, _WRAPPED >), &TOrange::st_classDescription, TOrange_properties, TOrange_components }; 
     106    TClassDescription TOrangeVector< _TYPE, _WRAPPED >::st_classDescription = { \ 
     107      _NAME, \ 
     108      &typeid(TOrangeVector< _TYPE, _WRAPPED >), \ 
     109      &TOrange::st_classDescription, \ 
     110      TOrange_properties, \ 
     111      TOrange_components }; \ 
     112  \ 
     113  template<> \ 
     114  TClassDescription const *TOrangeVector< _TYPE, _WRAPPED >::classDescription() const { \ 
     115      return &st_classDescription; \ 
     116  } 
    106117#endif 
    107118 
    108119 
    109120 
    110   #define DEFINE_AttributedList_classDescription(_NAME, _PARENT) \ 
     121#define DEFINE_AttributedList_classDescription(_NAME, _PARENT) \ 
    111122  TPropertyDescription _NAME##_properties[] = { \ 
    112     {"attributes", "list of attributes (for indexing)", &typeid(POrange), &TVarList::st_classDescription, offsetof(_NAME, attributes), false, false}, \ 
     123    {"attributes", \ 
     124     "list of attributes (for indexing)", \ 
     125     &typeid(POrange), \ 
     126     &TVarList::st_classDescription, \ 
     127     offsetof(_NAME, attributes), \ 
     128     false, \ 
     129     false}, \ 
    113130    {NULL} \ 
    114131  }; \ 
    115    \ 
     132  \ 
    116133  size_t const _NAME##_components[] = { offsetof(_NAME, attributes), 0}; \ 
    117    \ 
    118   TClassDescription _NAME::st_classDescription = { #_NAME, &typeid(_NAME), &_PARENT::st_classDescription, _NAME##_properties, _NAME##_components }; \ 
    119   TClassDescription const *_NAME::classDescription() const { return &_NAME::st_classDescription; } \ 
    120   TOrange *_NAME::clone() const { return mlnew _NAME(*this); } 
    121  
     134  \ 
     135  TClassDescription _NAME::st_classDescription = { \ 
     136     #_NAME, \ 
     137     &typeid(_NAME), \ 
     138     &_PARENT::st_classDescription, \ 
     139     _NAME##_properties, \ 
     140     _NAME##_components \ 
     141  }; \ 
     142  \ 
     143  TClassDescription const *_NAME::classDescription() const { \ 
     144      return &_NAME::st_classDescription; \ 
     145  } \ 
     146  \ 
     147  TOrange *_NAME::clone() const { \ 
     148      return mlnew _NAME(*this); \ 
     149  } 
    122150 
    123151 
    124152int ORANGE_API _RoundUpSize(const int &n); 
     
    132160    iterator _First, _Last, _End; 
    133161 
    134162    static TClassDescription st_classDescription; 
    135     virtual TClassDescription const *classDescription() const     { return &st_classDescription; } 
     163    virtual TClassDescription const *classDescription() const; 
    136164    virtual TOrange *clone() const                                { return mlnew TOrangeVector<T, Wrapped>(*this); } 
    137165 
    138166    class reverse_iterator { 
     
    453481#define TFloatFloatList TOrangeVector<pair<float, float>, false > 
    454482#define TDoubleList TOrangeVector<double, false> 
    455483#define TStringList TOrangeVector<string, false> 
    456  
    457484#define TFloatListList TOrangeVector<PFloatList> 
    458485 
    459486VWRAPPER(BoolList) 
     
    466493VWRAPPER(DoubleList) 
    467494VWRAPPER(StringList) 
    468495 
    469 WRAPPER(Variable) 
    470  
    471 #include "values.hpp" 
    472 #include "vars.hpp" 
    473  
    474 #ifdef _MSC_VER 
    475   #pragma warning(push) 
    476   #pragma warning(disable: 4275) 
    477 #endif 
    478  
    479 /* This is to fool pyprops 
    480 #define TValueList _TOrangeVector<float> 
    481 */ 
    482  
    483  
    484  
    485 #define TVarList TOrangeVector<PVariable>  
    486 VWRAPPER(VarList) 
    487  
    488  
    489 #define __REGISTER_NO_PYPROPS_CLASS __REGISTER_CLASS 
    490  
    491 class ORANGE_API TAttributedFloatList : public TOrangeVector<float, false> 
    492 { 
    493 public: 
    494   __REGISTER_NO_PYPROPS_CLASS 
    495  
    496   PVarList attributes; 
    497  
    498   inline TAttributedFloatList() 
    499   {} 
    500  
    501   inline TAttributedFloatList(PVarList vlist) 
    502   : attributes(vlist) 
    503   {} 
    504  
    505   inline TAttributedFloatList(PVarList vlist, const int &i_N, const float &f = 0.0) 
    506   : TOrangeVector<float, false>(i_N, f), 
    507     attributes(vlist) 
    508   {} 
    509  
    510   inline TAttributedFloatList(PVarList vlist, const vector<float> &i_X) 
    511   : TOrangeVector<float,false>(i_X), 
    512     attributes(vlist) 
    513   {} 
    514 }; 
    515  
    516  
    517 class ORANGE_API TAttributedBoolList : public TOrangeVector<bool, false> 
    518 { 
    519 public: 
    520   __REGISTER_NO_PYPROPS_CLASS 
    521  
    522   PVarList attributes; 
    523  
    524   inline TAttributedBoolList() 
    525   {} 
    526  
    527   inline TAttributedBoolList(PVarList vlist) 
    528   : attributes(vlist) 
    529   {} 
    530  
    531   inline TAttributedBoolList(PVarList vlist, const int &i_N, const bool b= false) 
    532   : TOrangeVector<bool, false>(i_N, b), 
    533     attributes(vlist) 
    534   {} 
    535  
    536   inline TAttributedBoolList(PVarList vlist, const vector<bool> &i_X) 
    537   : TOrangeVector<bool, false>(i_X), 
    538     attributes(vlist) 
    539   {} 
    540 }; 
    541  
    542  
    543  
    544 class ORANGE_API TValueList : public TOrangeVector<TValue, false> 
    545 { 
    546 public: 
    547   __REGISTER_CLASS 
    548  
    549   PVariable variable; //P the variable to which the list applies 
    550  
    551   inline TValueList(PVariable var = PVariable()) 
    552   : TOrangeVector<TValue, false>(), 
    553     variable(var) 
    554   {} 
    555   
    556   inline TValueList(const int &N, const TValue &V = TValue(), PVariable var = PVariable()) 
    557   : TOrangeVector<TValue, false>(N, V), 
    558     variable(var) 
    559   {} 
    560  
    561   inline TValueList(const TOrangeVector<TValue, false> &i_X, PVariable var = PVariable()) 
    562   : TOrangeVector<TValue, false>(i_X), 
    563     variable(var) 
    564   {} 
    565  
    566   inline TValueList(const TValueList &other) 
    567   : TOrangeVector<TValue, false>(other), 
    568     variable(other.variable) 
    569   {} 
    570  
    571   int traverse(visitproc visit, void *arg) const 
    572   {  
    573     TRAVERSE(TOrange::traverse); 
    574  
    575     for(TValue *p = _First; p != _Last; p++) 
    576       if (p->svalV) 
    577         PVISIT(p->svalV); 
    578  
    579     return 0; 
    580   } 
    581  
    582   int dropReferences() 
    583   { DROPREFERENCES(TOrange::dropReferences); 
    584     return 0; 
    585   } 
    586 }; 
    587  
    588  
    589 WRAPPER(ValueList) 
    590  
    591 #ifdef _MSC_VER 
    592   #pragma warning(pop) 
    593 #endif 
    594  
    595 /* This is to fool pyprops.py 
    596 #define TAttributedFloatList _TOrangeVector<float> 
    597 #define TAttributedBoolList _TOrangeVector<bool> 
    598 */ 
    599 WRAPPER(AttributedFloatList) 
    600 WRAPPER(AttributedBoolList) 
    601496 
    602497#ifdef _MSC_VER 
    603498  #pragma warning (push) 
    604499  #pragma warning (disable : 4290) 
    605500  template class ORANGE_API std::vector<int>; 
    606501  template class ORANGE_API std::vector<float>; 
     502 
     503  template class ORANGE_API std::vector<pair<int, int> >; 
     504  template class ORANGE_API std::vector<int>; 
    607505  #pragma warning (pop) 
    608506#endif 
    609507 
    610 /* These are defined as classes, not templates, so that  
    611 class TIntIntPair { 
    612 public: 
    613   int first, second; 
    614   TIntIntPair(const int &f, const int &s) 
    615   : first(f), 
    616     second(s) 
    617   {} 
    618 }; 
    619  
    620 class TIntIntPair { 
    621 public: 
    622   int first, second; 
    623   TIntIntPair(const int &f, const int &s) 
    624   : first(f), 
    625     second(s) 
    626   {} 
    627 }; 
    628  
    629 class TIntIntPair { 
    630 public: 
    631   int first, second; 
    632   TIntIntPair(const int &f, const int &s) 
    633   : first(f), 
    634     second(s) 
    635   {} 
    636 }; 
    637  
    638 class TIntIntPair { 
    639 public: 
    640   int first, second; 
    641   TIntIntPair(const int &f, const int &s) 
    642   : first(f), 
    643     second(s) 
    644   {} 
    645 }; 
    646 */ 
    647  
    648 #ifdef _MSC_VER 
    649   template class ORANGE_API std::vector<pair<int, int> >; 
    650   template class ORANGE_API std::vector<int>; 
    651508#endif 
    652  
    653 #endif 
  • source/orange/pnn.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/pnn.hpp
    a b  
    2222#define __PNN_HPP 
    2323 
    2424#include "classify.hpp" 
     25#include "orvector.hpp" 
     26#include "domain.hpp" 
     27#include "examplegen.hpp" 
    2528 
    26 WRAPPER(Domain) 
    27 WRAPPER(ExampleGenerator) 
    28 VWRAPPER(FloatList) 
     29//WRAPPER(Domain) 
     30//WRAPPER(ExampleGenerator) 
     31//VWRAPPER(FloatList) 
    2932 
    3033class ORANGE_API TPNN : public TClassifierFD { 
    3134public: 
  • source/orange/pq.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/pq.cpp
    a b  
    88 * @summary: Binary heap PQ implementation with 'decrease key' 
    99 */ 
    1010 
     11#include <stdlib.h> 
     12 
    1113#include "pq.hpp" 
    1214 
    1315template <class Key> 
     
    2931} 
    3032 
    3133template <class Key> 
    32 PQHeap<Key>::PQHeap(int size=DEFAULT_SIZE) 
     34PQHeap<Key>::PQHeap(int size) 
    3335  : m_size(size), 
    3436    m_noNodes(0), 
    3537    m_nodes(size) 
  • source/orange/pqueue_i.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/pqueue_i.hpp
    a b  
    2929public: 
    3030  ~TPriorityQueue() 
    3131    { typedef typename vector<TPQNode *>::iterator iterator; 
    32       for(iterator ii(begin()); ii!=end(); mldelete *(ii++));  
     32      for(iterator ii(this->begin()); ii!=this->end(); mldelete *(ii++));  
    3333    } 
    3434 
    3535  void sink(int i) 
    36     { TPQNode *sank=at(i); 
     36    { TPQNode *sank=this->at(i); 
    3737 
    38       int msize = size(); 
     38      int msize = this->size(); 
    3939      for(int newi = 2*i+1; newi < msize; newi = 2*(i=newi)+1) { 
    4040        if (newi+1<msize) { 
    41           int cmp = at(newi)->compare(*at(newi+1)); 
     41          int cmp = this->at(newi)->compare(*this->at(newi+1)); 
    4242          if (cmp<0) 
    4343            newi++; 
    4444        } 
    4545 
    46         int cmp = at(newi)->compare(*sank); 
     46        int cmp = this->at(newi)->compare(*sank); 
    4747        if (cmp>0) 
    48           (at(i) = at(newi))->queueIndex = i; 
     48          (this->at(i) = this->at(newi))->queueIndex = i; 
    4949        else  
    5050          break; 
    5151      } 
    5252 
    53       (operator[](i) = sank)->queueIndex = i; 
     53      (this->operator[](i) = sank)->queueIndex = i; 
    5454    } 
    5555 
    5656 
    5757  void insert(TPQNode *node) 
    58     { push_back((TPQNode *)NULL); 
    59       int down = size()-1; 
     58    { this->push_back((TPQNode *)NULL); 
     59      int down = this->size()-1; 
    6060      for(int up; down; down=up) { 
    6161        up = (down-1)/2; 
    62         int cmp=node->compare(*at(up)); 
     62        int cmp=node->compare(*this->at(up)); 
    6363        if (cmp>0) 
    64           (at(down) = at(up))->queueIndex = down; 
     64          (this->at(down) = this->at(up))->queueIndex = down; 
    6565        else 
    6666          break; 
    6767      } 
    6868 
    69       (at(down) = node)->queueIndex = down; 
     69      (this->at(down) = node)->queueIndex = down; 
    7070    } 
    7171 
    7272 
    7373  void remove(int oldi) 
    74     { mldelete at(oldi); 
    75       if (oldi == int(size()-1)) { 
    76         at(oldi) = NULL; 
    77         erase(end()-1); 
     74    { mldelete this->at(oldi); 
     75      if (oldi == int(this->size()-1)) { 
     76        this->at(oldi) = NULL; 
     77        this->erase(this->end()-1); 
    7878      } 
    7979      else { 
    80         (at(oldi) = back())->queueIndex = oldi; 
    81         back() = NULL; 
    82         erase(end()-1); 
    83         sink(oldi); 
     80        (this->at(oldi) = this->back())->queueIndex = oldi; 
     81        this->back() = NULL; 
     82        this->erase(this->end()-1); 
     83        this->sink(oldi); 
    8484      } 
    8585    } 
    8686}; 
  • source/orange/preprocessors.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/preprocessors.cpp
    a b  
    4040#include "learn.hpp" 
    4141 
    4242#include <string> 
    43 #include "preprocessors.ppp" 
     43#include "preprocessors.hpp" 
    4444 
    4545DEFINE_TOrangeMap_classDescription(TOrangeMap_KV, PVariable, PValueFilter, "VariableFilterMap") 
    4646DEFINE_TOrangeMap_classDescription(TOrangeMap_K, PVariable, float, "VariableFloatMap") 
    4747 
     48#include "preprocessors.ppp" 
     49 
    4850#ifdef _MSC_VER 
    4951  #pragma warning (disable : 4100) // unreferenced local parameter (macros name all arguments) 
    5052#endif 
  • source/orange/preprocessors.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/preprocessors.hpp
    a b  
    3636 
    3737WRAPPER(Filter); 
    3838WRAPPER(ExampleTable); 
    39 VWRAPPER(ExampleGeneratorList); 
     39//VWRAPPER(ExampleGeneratorList); 
    4040 
    4141 
    4242class ORANGE_API TPreprocessor : public TOrange { 
  • source/orange/rule_conditions.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/rule_conditions.hpp
    a b  
    4646  typedef typename vector<TCondition<T> *>::iterator iterator; 
    4747 
    4848  virtual bool operator()(T example) { 
    49     if (!size()) return true; 
    50     iterator ci(begin()), ce(end()); 
     49    if (!this->size()) return true; 
     50    iterator ci(this->begin()), ce(this->end()); 
    5151    for( ; (ci!=ce) && (**ci)(example); ci++); 
    5252    return (ci==ce); 
    5353  } 
     
    6060  typedef typename vector<TCondition<T> *>::iterator iterator; 
    6161 
    6262  virtual bool operator()(T example) { 
    63     if (!size()) return true; 
    64     iterator ci(begin()), ce(end()); 
     63    if (!this->size()) return true; 
     64    iterator ci(this->begin()), ce(this->end()); 
    6565    for( ; (ci!=ce) && !(**ci)(example); ci++); 
    6666    return (ci!=ce); 
    6767  } 
  • source/orange/rulelearner.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/rulelearner.cpp
    a b  
    2626#include "distvars.hpp" 
    2727#include "classfromvar.hpp" 
    2828#include "progress.hpp" 
    29  
    30  
    31 #include "rulelearner.ppp" 
     29#include "rulelearner.hpp" 
    3230 
    3331DEFINE_TOrangeVector_classDescription(PRule, "TRuleList", true, ORANGE_API) 
    3432DEFINE_TOrangeVector_classDescription(PEVDist, "TEVDistList", true, ORANGE_API) 
    3533 
     34#include "rulelearner.ppp" 
     35 
    3636#ifdef _MSC_VER 
    3737#if _MSC_VER < 1300 
    3838template<class T> 
  • source/orange/subsets.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/subsets.hpp
    a b  
    2121 
    2222#include "boolcnt.hpp" 
    2323#include "root.hpp" 
     24#include "vars.hpp" 
    2425 
    25 VWRAPPER(VarList); 
    26 VWRAPPER(VarListList); 
     26//VWRAPPER(VarList); 
     27//VWRAPPER(VarListList); 
    2728 
    2829WRAPPER(SubsetsGenerator_iterator) 
    2930 
  • source/orange/tabdelim.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/tabdelim.hpp
    a b  
    8585 
    8686  static const TIdentifierDeclaration typeIdentifiers[] ; 
    8787 
    88   TTabDelimExampleGenerator::TTabDelimExampleGenerator(const TTabDelimExampleGenerator &old); 
     88  TTabDelimExampleGenerator(const TTabDelimExampleGenerator &old); 
    8989  TTabDelimExampleGenerator(const string &, bool autoDetect, bool csv,  
    9090                            const int createNewOn, vector<int> &status, vector<pair<int, int> > &metaStatus, 
    9191                            const char *aDK = NULL, const char *aDC = NULL, bool noCodedDiscrete = false, bool noClass = false); 
  • source/orange/tdidt.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/tdidt.cpp
    a b  
    3737#include "tdidt_split.hpp" 
    3838#include "tdidt_stop.hpp" 
    3939 
    40 #include "tdidt.ppp" 
    41  
     40#include "tdidt.hpp" 
    4241 
    4342DEFINE_TOrangeVector_classDescription(PTreeNode, "TTreeNodeList", true, ORANGE_API) 
    4443 
     44#include "tdidt.ppp" 
    4545 
    4646/* Default components for split constructor -- split constructors for 
    4747   discrete and continuous attributes and classes, and the corresponding 
  • source/orange/transval.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/transval.hpp
    a b  
    2424 
    2525#include "root.hpp" 
    2626#include "orvector.hpp" 
     27#include "vars.hpp" 
    2728 
    2829WRAPPER(TransformValue); 
    2930WRAPPER(Domain); 
  • source/orange/vars.cpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/vars.cpp
    a b  
    4545#include "orvector.hpp" 
    4646#include "stringvars.hpp" 
    4747 
     48#include "vars.hpp" 
     49 
     50DEFINE_TOrangeVector_classDescription(PVariable, "TVarList", true, ORANGE_API) 
     51DEFINE_TOrangeVector_classDescription(PVarList, "TVarListList", true, ORANGE_API) 
     52 
     53DEFINE_AttributedList_classDescription(TAttributedFloatList, TFloatList) 
     54DEFINE_AttributedList_classDescription(TAttributedBoolList, TBoolList) 
     55 
     56 
     57#ifdef _MSC_VER_60 
     58 TClassDescription template TOrangeVector<TValue, false>::st_classDescription; 
     59 ORANGE_EXTERN template class ORANGE_API TOrangeVector<TValue, false>; 
     60#else 
     61 DEFINE_TOrangeVector_classDescription(TValue, "TOrangeVector<TValue, false>", false, ORANGE_API) 
     62#endif 
    4863 
    4964#include "vars.ppp" 
    5065 
     
    6479    } 
    6580}; 
    6681 
    67 DEFINE_TOrangeVector_classDescription(PVariable, "TVarList", true, ORANGE_API) 
    68 DEFINE_TOrangeVector_classDescription(PVarList, "TVarListList", true, ORANGE_API) 
    6982 
    7083MMV TVariable::allVariablesMap; 
    7184 
     
    856869    vname = buf; 
    857870  } 
    858871} 
     872 
  • source/orange/vars.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/vars.hpp
    a b  
    2727#include <set> 
    2828#include <map> 
    2929#include "orvector.hpp" 
     30#include "values.hpp" 
    3031 
    3132using namespace std; 
    3233 
     
    158159 
    159160WRAPPER(Variable) 
    160161 
    161 #define TVarList TOrangeVector<PVariable>  
     162#define TVarList TOrangeVector<PVariable> 
    162163VWRAPPER(VarList) 
    163164 
    164165#define TVarListList TOrangeVector<PVarList>  
     
    232233  int str2val_low(const string &valname, TValue &valu); 
    233234}; 
    234235 
     236 
     237#ifdef _MSC_VER 
     238  #pragma warning(push) 
     239  #pragma warning(disable: 4275) 
    235240#endif 
     241 
     242/* This is to fool pyprops 
     243#define TValueList _TOrangeVector<float> 
     244*/ 
     245 
     246 
     247 
     248#define __REGISTER_NO_PYPROPS_CLASS __REGISTER_CLASS 
     249 
     250class ORANGE_API TAttributedFloatList : public TOrangeVector<float, false> 
     251{ 
     252public: 
     253  __REGISTER_NO_PYPROPS_CLASS 
     254 
     255  PVarList attributes; 
     256 
     257  inline TAttributedFloatList() 
     258  {} 
     259 
     260  inline TAttributedFloatList(PVarList vlist) 
     261  : attributes(vlist) 
     262  {} 
     263 
     264  inline TAttributedFloatList(PVarList vlist, const int &i_N, const float &f = 0.0) 
     265  : TOrangeVector<float, false>(i_N, f), 
     266    attributes(vlist) 
     267  {} 
     268 
     269  inline TAttributedFloatList(PVarList vlist, const vector<float> &i_X) 
     270  : TOrangeVector<float,false>(i_X), 
     271    attributes(vlist) 
     272  {} 
     273}; 
     274 
     275 
     276class ORANGE_API TAttributedBoolList : public TOrangeVector<bool, false> 
     277{ 
     278public: 
     279  __REGISTER_NO_PYPROPS_CLASS 
     280 
     281  PVarList attributes; 
     282 
     283  inline TAttributedBoolList() 
     284  {} 
     285 
     286  inline TAttributedBoolList(PVarList vlist) 
     287  : attributes(vlist) 
     288  {} 
     289 
     290  inline TAttributedBoolList(PVarList vlist, const int &i_N, const bool b= false) 
     291  : TOrangeVector<bool, false>(i_N, b), 
     292    attributes(vlist) 
     293  {} 
     294 
     295  inline TAttributedBoolList(PVarList vlist, const vector<bool> &i_X) 
     296  : TOrangeVector<bool, false>(i_X), 
     297    attributes(vlist) 
     298  {} 
     299}; 
     300 
     301 
     302 
     303class ORANGE_API TValueList : public TOrangeVector<TValue, false> 
     304{ 
     305public: 
     306  __REGISTER_CLASS 
     307 
     308  PVariable variable; //P the variable to which the list applies 
     309 
     310  inline TValueList(PVariable var = PVariable()) 
     311  : TOrangeVector<TValue, false>(), 
     312    variable(var) 
     313  {} 
     314  
     315  inline TValueList(const int &N, const TValue &V = TValue(), PVariable var = PVariable()) 
     316  : TOrangeVector<TValue, false>(N, V), 
     317    variable(var) 
     318  {} 
     319 
     320  inline TValueList(const TOrangeVector<TValue, false> &i_X, PVariable var = PVariable()) 
     321  : TOrangeVector<TValue, false>(i_X), 
     322    variable(var) 
     323  {} 
     324 
     325  inline TValueList(const TValueList &other) 
     326  : TOrangeVector<TValue, false>(other), 
     327    variable(other.variable) 
     328  {} 
     329 
     330  int traverse(visitproc visit, void *arg) const 
     331  {  
     332    TRAVERSE(TOrange::traverse); 
     333 
     334    for(TValue *p = _First; p != _Last; p++) 
     335      if (p->svalV) 
     336        PVISIT(p->svalV); 
     337 
     338    return 0; 
     339  } 
     340 
     341  int dropReferences() 
     342  { DROPREFERENCES(TOrange::dropReferences); 
     343    return 0; 
     344  } 
     345}; 
     346 
     347 
     348WRAPPER(ValueList) 
     349 
     350#ifdef _MSC_VER 
     351  #pragma warning(pop) 
     352#endif 
     353 
     354/* This is to fool pyprops.py 
     355#define TAttributedFloatList _TOrangeVector<float> 
     356#define TAttributedBoolList _TOrangeVector<bool> 
     357*/ 
     358WRAPPER(AttributedFloatList) 
     359WRAPPER(AttributedBoolList) 
     360 
     361 
     362#endif 
  • source/orange/vectortemplates.hpp

    diff -r d8f18f743026 -r e4a02f9abd66 source/orange/vectortemplates.hpp
    a b  
    7272#endif 
    7373 
    7474#include "orvector.hpp" 
     75#include "cls_orange.hpp" 
     76#include "converts.hpp" 
    7577#include "c2py.hpp" 
    7678 
    7779 
     
    278280 
    279281  static PyObject *_new(PyTypeObject *type, PyObject *args, PyObject *) 
    280282  { if (!args || (PySequence_Check(args) && !PySequence_Size(args))) 
    281       return _CreateEmptyList(type); 
     283      return CommonListMethods<_WrappedListType, _ListType>::_CreateEmptyList(type); 
    282284 
    283285    if (PyTuple_Check(args) && PyTuple_Size(args)==1) { 
    284286      PyObject *arg=PyTuple_GetItem(args, 0); 
     
    734736 
    735737  static PyObject *_new(PyTypeObject *type, PyObject *args, PyObject *) 
    736738  { if (!args || (PySequence_Check(args) && !PySequence_Size(args))) 
    737       return _CreateEmptyList(type); 
     739      return CommonListMethods<_WrappedListType, _ListType>::_CreateEmptyList(type); 
    738740 
    739741    if (PyTuple_Check(args) && PyTuple_Size(args)==1) { 
    740742      PyObject *arg=PyTuple_GetItem(args, 0);