示例#1
0
int main(int argc, const char* argv[])
{
    // insert code here...
    std::cout << "Hello, World!\n";
    
    int v{};
    std::cout << "v is " << v << std::endl;
    foo f;
    std::cout << "f is " << f.v << std::endl;
    bar b{2};
    std::cout << "b is " << b.v << std::endl;
    
    constexpr static int num = 10;
    static_assert(0x2 == 2, "foobar");
    //static_assert(0x2 == 0x20, "barfoo");
    
    structDeclarations();
    libthing();
    inheritance();
    with_type<Bodyless>(5);
    ctors();
    ownership();
    static_func_wrapping();
    
    return 0;
}
示例#2
0
文件: nuc_fam.c 项目: cran/tdthap
void hap_transmit(int *n, int *ped, int *id, int *father, int *mother,
		  int *sex, int *aff, int *if_qt, double *qt, 
		  int *m, int *markers, 
		  int *multiple_cases, int *impute_using_affected,
		  char **ofname) {
  Family *first, *f, *prev;
  FILE *outfile;
  int nn, mm, hr, iqt;
  char *tmp;
  nn = *n;
  mm = *m;
  iqt = *if_qt;
  if (!*if_qt) qt = (double *) 0;
  first = nuclear(nn, ped, id, father, mother, sex, aff, qt, mm, markers);
  /* Multiple case treatment */
  if (*multiple_cases) {
    for (f=first; f; f=f->next) {
      if (*multiple_cases == 1) {
	prev = f;
	f = expand_family(f, mm);
	if (!f) goto overflow;
      }
      else if (*multiple_cases == 2) {
	use_only_first(f);
      }
    }
  }

  /* Do remaining computations on families */
  
  prev = (Family *) 0;
  for (f=first; f; f=f->next) {
    /* Impute missing parental genotypes */
    impute_parent(f, mm, (int) *impute_using_affected);
    /* Compute inheritance vectors */
    inheritance(f, mm);
    /* Resolve haplotype phase and transmission */
    hr = haplotype(f, mm, 1);
    /* If recombination, write error message */
    if (hr<0) {
      REprintf("*** Recombination/expaternity at locus %d *** ", -hr);
      show_family(f);
    }
    /* If no information or recombination, omit family */
    if (hr!=0) {
      if (prev)
	prev->next = f->next;
      else
	first = f->next;
    }
    else {
      prev = f;
    }
  } 

  /* Write haplotypes to disk */

  tmp = *ofname;
  /* If no file name supplied, generate one */
  if (!*tmp) {
    tmp = tmpnam((char *) 0);
    *ofname = tmp;
  }
  outfile = fopen(tmp, "wb");
  if (outfile) {
    *n = hap_write(first, mm, iqt, outfile);
    fclose(outfile);
  }
  else {
    REprintf("*** Couldn't open temporary file %s\n", tmp);
    *n = 0;
  }

  /* Now return memory to system */

  while (first) {
    f = first;
    first = first->next;
    del_family(f);
  }
  return;

  /* Memory overflow */

overflow:
  warn("Memory overflow while or after expanding family", f);

}