X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=src%2Fmisc.h;h=76f722f05ad75212af17613999cdf8a1aeae75c9;hb=5d72c22c72f7f7438d491373a9685aa8a790b1d2;hp=b9fb777b7cc319da4583b9bdaccf6f5a73df8e83;hpb=d356446464fbb04cb38588d65e72821e44ad0926;p=germs.git diff --git a/src/misc.h b/src/misc.h index b9fb777..76f722f 100644 --- a/src/misc.h +++ b/src/misc.h @@ -21,6 +21,25 @@ #ifndef __MISC_H__ #define __MISC_H__ +/** + * The type we use for genes, has to be a signed integer type. + */ typedef int Gene; +/** + * Simple struct for components. Holds the indexes, the first and last genes + * + information if the component is unoriented. + */ +struct Component{ + Component(int b = 0,int e = 0,int s = 0,size_t i1 = 0, size_t i2 = 0):begin(b),end(e),sign(s),i1(i1), i2(i2){} + bool operator==(const Component& c){ + return begin == c.begin && end == c.end && sign == c.sign && i1 == c.i1 && i2 == c.i2; + } + int begin; + int end; + int sign; + size_t i1; + size_t i2; +}; + #endif