void DataSegment::Dump
    (
    )
{
    std::cout << "Found Variables:" << std::endl;
    DictionaryIter<std::string, Variable> it(mVars);
    while (it.HasNext()) {
        Tuple<std::string, Variable> entry = it.GetNext();
        std::cout << "Var: " << entry.GetKey() << " at " << entry.GetValue().GetAddress() << std::endl;
    }
}
Example #2
0
bool Tuple::EqualsNoSchemaCheck(const Tuple &other,
                                const std::vector<oid_t> &columns) const {
  for (auto column_itr : columns) {
    const Value lhs = GetValue(column_itr);
    const Value rhs = other.GetValue(column_itr);
    if (lhs.OpNotEquals(rhs).IsTrue()) {
      return false;
    }
  }

  return true;
}
Example #3
0
bool Tuple::EqualsNoSchemaCheck(const Tuple &other,
                                const std::vector<oid_t> &columns) const {
  for (auto column_itr : columns) {
    std::unique_ptr<common::Value> lhs(GetValue(column_itr));
    std::unique_ptr<common::Value> rhs(other.GetValue(column_itr));
    std::unique_ptr<common::Value> res(lhs->CompareNotEquals(*rhs));
    if (res->IsTrue()) {
      return false;
    }
  }

  return true;
}
Example #4
0
bool Tuple::EqualsNoSchemaCheck(const Tuple &other) const {
  const int column_count = tuple_schema->GetColumnCount();

  for (int column_itr = 0; column_itr < column_count; column_itr++) {
    const Value lhs = GetValue(column_itr);
    const Value rhs = other.GetValue(column_itr);
    if (lhs.OpNotEquals(rhs).IsTrue()) {
      return false;
    }
  }

  return true;
}
Example #5
0
bool Tuple::EqualsNoSchemaCheck(const Tuple &other) const {
  const int column_count = tuple_schema->GetColumnCount();

  for (int column_itr = 0; column_itr < column_count; column_itr++) {
    std::unique_ptr<common::Value> lhs(GetValue(column_itr));
    std::unique_ptr<common::Value> rhs(other.GetValue(column_itr));
    std::unique_ptr<common::Value> res(lhs->CompareNotEquals(*rhs));
    if (res->IsTrue()) {
      return false;
    }
  }

  return true;
}
Byte *DataSegment::GetContents
    (
    )
{
    UInt offset = 0;
    Byte *contents = new Byte[mVars.GetSize() * 4];
    DictionaryIter<std::string, Variable> it(mVars);
    while (it.HasNext()) {
        Tuple<std::string, Variable> tuple = it.GetNext();
        Int32 initValue = tuple.GetValue().GetInitValue();
        memcpy(&contents[offset], reinterpret_cast<Byte *>(&initValue), 4);
        offset += 4;
    }
    return contents;
}
Example #7
0
int Tuple::Compare(const Tuple &other,
                   const std::vector<oid_t> &columns) const {
  for (auto column_itr : columns) {
    type::Value lhs = (GetValue(column_itr));
    type::Value rhs = (other.GetValue(column_itr));
    if (lhs.CompareGreaterThan(rhs) == CmpBool::TRUE) {
      return 1;
    }
    if (lhs.CompareLessThan(rhs) == CmpBool::TRUE) {
      return -1;
    }
  }

  return 0;
}
Example #8
0
int Tuple::Compare(const Tuple &other) const {
  const int column_count = tuple_schema_->GetColumnCount();

  for (int column_itr = 0; column_itr < column_count; column_itr++) {
    type::Value lhs = (GetValue(column_itr));
    type::Value rhs = (other.GetValue(column_itr));
    if (lhs.CompareGreaterThan(rhs) == CmpBool::TRUE) {
      return 1;
    }
    if (lhs.CompareLessThan(rhs) == CmpBool::TRUE) {
      return -1;
    }
  }

  return 0;
}
Example #9
0
int Tuple::Compare(const Tuple &other,
                   const std::vector<oid_t> &columns) const {
  int diff;

  for (auto column_itr : columns) {
    const Value lhs = GetValue(column_itr);
    const Value rhs = other.GetValue(column_itr);
    diff = lhs.Compare(rhs);

    if (diff) {
      return diff;
    }
  }

  return 0;
}
Example #10
0
int Tuple::Compare(const Tuple &other) const {
  int diff;
  const int column_count = tuple_schema->GetColumnCount();

  for (int column_itr = 0; column_itr < column_count; column_itr++) {
    const Value lhs = GetValue(column_itr);
    const Value rhs = other.GetValue(column_itr);
    diff = lhs.Compare(rhs);

    if (diff) {
      return diff;
    }
  }

  return 0;
}
Example #11
0
int Tuple::Compare(const Tuple &other,
                   const std::vector<oid_t> &columns) const {
  for (auto column_itr : columns) {
    std::unique_ptr<common::Value> lhs(GetValue(column_itr));
    std::unique_ptr<common::Value> rhs(other.GetValue(column_itr));
    std::unique_ptr<common::Value> res_gt(lhs->CompareGreaterThan(*rhs));
    if (res_gt->IsTrue()) {
      return 1;
    }
    std::unique_ptr<common::Value> res_lt(lhs->CompareLessThan(*rhs));
    if (res_lt->IsTrue()) {
      return -1;
    }
  }

  return 0;
}
void TextSegment::Dump
    (
    )
{
    std::cout << "Found Labels:" << std::endl;
    DictionaryIter<std::string, Label> itLabels(mLabels);
    while (itLabels.HasNext()) {
        Tuple<std::string, Label> entry = itLabels.GetNext();
        std::cout << "Lab: " << entry.GetKey() << " at " << entry.GetValue().GetAddress() << std::endl;
    }
    std::cout << "Instructions:" << std::endl;
    VectorIter<Instr> itInstrs(mInstrs);
    while (itInstrs.HasNext()) {
        Instr instr = itInstrs.GetNext();
        std::cout << "Instr: " << instr.GetMnemonic() << ", Encoding = " << instr.GetEncoding() << std::endl;
    }
}
Example #13
0
int Tuple::Compare(const Tuple &other) const {
  const int column_count = tuple_schema->GetColumnCount();

  for (int column_itr = 0; column_itr < column_count; column_itr++) {
    std::unique_ptr<common::Value> lhs(GetValue(column_itr));
    std::unique_ptr<common::Value> rhs(other.GetValue(column_itr));
    std::unique_ptr<common::Value> res_gt(lhs->CompareGreaterThan(*rhs));
    if (res_gt->IsTrue()) {
      return 1;
    }
    std::unique_ptr<common::Value> res_lt(lhs->CompareLessThan(*rhs));
    if (res_lt->IsTrue()) {
      return -1;
    }
  }

  return 0;
}