//
// Copyright 2003, Juan Segarra Flor
//
// This is part of videocache
//
// Videocache is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Videocache is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Foobar; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//

#include "config.h"

// function to obtain the size of each cache in Mb
long sizefunction(int treedepth,int level) {
  if ((level<1)||(level>treedepth)) {
    cerr<<"Incorrect parameters calling sizefunction"<<endl;
    exit(-2);
  }
  if (level==treedepth) {
    return 100000000;
  }
  else {
    if (level==1) return 0;
    else if (level==2) return (long)(200000/8*2.5) ;
    else if (level==3) return (long)(400000/4*2.5) ;
    else if (level==4) return (long)(800000/2*2.5) ;
    //return CACHESIZE;
    else {
      cerr<<"Undefined level size"<<endl;
      exit(-2);
    }
  }
}

// function to calculate weight values
// output MUST be >=0
double weightfunction(double popularity,int duration,long rate) {
  //popularity*=1000;
  return popularity;
}

