Contains the source code from the course work throughout my undergraduate Computer Engineering degree at Brigham Young University. There is a mixture of Go, Python, C, C++, Java, VHDL, Verilog, Matlab, Bash, Assembly, etc..
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

db.h 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef __DB_H__
  2. #define __DB_H__
  3. #include "parser/parser.h"
  4. #include "relation.h"
  5. class db {
  6. public:
  7. db(parser incoming) {
  8. p = incoming;
  9. setup();
  10. }
  11. parser p;
  12. vector<relation> relations;
  13. void setup() {
  14. for(unsigned int i = 0; i < p.schemelist.size(); i++) {
  15. relation r;
  16. r.name = p.schemelist[i].id;
  17. for(unsigned int j = 0; j < p.schemelist[i].pred_list.size(); j++) {
  18. r.schemas.s.push_back(p.schemelist[i].pred_list[j].param);
  19. }
  20. for(unsigned int k = 0; k < p.factlist.size(); k++) {
  21. if(r.name == p.factlist[k].id) {
  22. Tuple t;
  23. for(unsigned int l = 0; l < p.factlist[k].pred_list.size(); k++) {
  24. t.push_back(p.factlist[k].pred_list[l].param);
  25. }
  26. r.tuples.insert(t);
  27. }
  28. }
  29. }
  30. }
  31. //set<string> domain;
  32. //vector<predicate> schemelist;
  33. //vector<predicate> factlist;
  34. //vector<predicate> querylist;
  35. //vector<predicate> predlist;
  36. //vector<rule> rulelist;
  37. };
  38. #endif