File: int-bag.hpp

package info (click to toggle)
macaulay2 1.21%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 133,096 kB
  • sloc: cpp: 110,377; ansic: 16,306; javascript: 4,193; makefile: 3,821; sh: 3,580; lisp: 764; yacc: 590; xml: 177; python: 140; perl: 114; lex: 65; awk: 3
file content (37 lines) | stat: -rw-r--r-- 997 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// (c) 1994  Michael E. Stillman
#ifndef _int_bag_hh_
#define _int_bag_hh_

#include "newdelete.hpp"
#include "intarray.hpp"

class int_bag : public our_new_delete
{
  union
  {
    int b_elem;
    void *b_ptr;
  } val;
  intarray mon;  // varpower representation

 public:
  int_bag() : mon() { memset(&val, 0, sizeof(val)); }
  int_bag(int b, const intarray &m) : mon(m) { val.b_elem = b; }
  int_bag(void *b, const intarray &m) : mon(m) { val.b_ptr = b; }
  int_bag(int b) : mon() { val.b_elem = b; }
  int_bag(void *b) : mon() { val.b_ptr = b; }
  int_bag(const int_bag &gcb) : val(gcb.val), mon(gcb.mon) {}
  int_bag(const int_bag *gcb) : val(gcb->val), mon(gcb->mon) {}
  const intarray &monom() const { return mon; }
  intarray &monom() { return mon; }
  int basis_elem() const { return val.b_elem; }
  void *basis_ptr() const { return val.b_ptr; }
};

typedef int_bag Bag;
#endif

// Local Variables:
// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
// indent-tabs-mode: nil
// End: