fromClause.h
Go to the documentation of this file.
1 // $Id$
2 // Author: John Wu <John.Wu at acm.org>
3 // Lawrence Berkeley National Laboratory
4 // Copyright (c) 2009-2016 the Regents of the University of California
8 #ifndef IBIS_FROMCLAUSE_H
9 #define IBIS_FROMCLAUSE_H
10 #include "qExpr.h"
11 #include "table.h"
12 
13 namespace ibis {
14  class fromLexer;
15  class fromParser;
16 }
17 
40 class FASTBIT_CXX_DLLSPEC ibis::fromClause {
41 public:
43  explicit fromClause(const char *cl=0);
46  ~fromClause();
47  fromClause(const fromClause&);
48 
49  int parse(const char *cl);
50 
52  const char* getString(void) const {return clause_.c_str();}
54  const char* operator*(void) const {return clause_.c_str();}
55 
57  bool empty() const {return names_.empty();}
59  uint32_t size() const {return names_.size();}
61 
63  const ibis::compRange* getJoinCondition() const {return jcond_;}
64 
65  void print(std::ostream&) const;
66  void clear();
67 
68  const char* realName(const char*) const;
69  const char* alias(const char*) const;
70  size_t position(const char*) const;
71  void reorderNames(const char*, const char*);
72 
75  fromClause tmp(rhs);
76  swap(tmp);
77  return *this;
78  }
80  void swap(fromClause& rhs) {
81  names_.swap(rhs.names_);
82  aliases_.swap(rhs.aliases_);
83  clause_.swap(rhs.clause_);
84  ordered_.swap(rhs.ordered_);
85  ibis::compRange *tmp = jcond_;
86  jcond_ = rhs.jcond_;
87  rhs.jcond_ = tmp;
88  }
89 
90 protected:
92  std::vector<std::string> names_;
94  std::vector<std::string> aliases_;
96  std::map<const char*, size_t, ibis::lessi> ordered_;
105 
106  std::string clause_;
108 
109  friend class ibis::fromParser;
110 }; // class ibis::fromClause
111 
112 namespace std {
113  inline ostream& operator<<(ostream& out, const ibis::fromClause& fc) {
114  fc.print(out);
115  return out;
116  } // std::operator<<
117 }
118 #endif
uint32_t size() const
Returns the number of valid names.
Definition: fromClause.h:59
const char * operator*(void) const
Dereferences to the string form of the from clause.
Definition: fromClause.h:54
const char * alias(const char *) const
Given a name find its alias.
Definition: fromClause.cpp:217
bool empty() const
Is it empty? Returns true or false.
Definition: fromClause.h:57
ibis::compRange * jcond_
The join condition.
Definition: fromClause.h:104
const char * getString(void) const
Return a pointer to the string form of the from clause.
Definition: fromClause.h:52
STL namespace.
The current implementation of FastBit is code named IBIS; most data structures and functions are in t...
Definition: bord.h:16
Defines a new class with the desired lex function for C++ output of bison.
Definition: fromLexer.h:33
const char * realName(const char *) const
Given an alias find its real name.
Definition: fromClause.cpp:187
Define the query expression.
void reorderNames(const char *, const char *)
Reorder the table names.
Definition: fromClause.cpp:262
const ibis::compRange * getJoinCondition() const
Report the join condition.
Definition: fromClause.h:63
std::vector< std::string > aliases_
The aliases.
Definition: fromClause.h:94
int parse(const char *cl)
Parse a new string.
Definition: fromClause.cpp:72
std::vector< std::string > names_
The names of data tables.
Definition: fromClause.h:92
void print(std::ostream &) const
Print the content.
Definition: fromClause.cpp:144
void swap(fromClause &rhs)
Swap the content of two from clauses.
Definition: fromClause.h:80
std::map< const char *, size_t, ibis::lessi > ordered_
The ordered version of the names.
Definition: fromClause.h:96
FastBit Table Interface.
void clear()
Remove the current content.
Definition: fromClause.cpp:61
fromClause & operator=(const fromClause &rhs)
Assignment operator.
Definition: fromClause.h:74
void getNames(ibis::table::stringArray &) const
Fill the array nms with the known names.
Definition: fromClause.cpp:133
fromClause(const char *cl=0)
Parse a new string as a from clause.
Definition: fromClause.cpp:10
A class to represent the from clause.
Definition: fromClause.h:40
ibis::fromLexer * lexer
!< String version of the from clause.
Definition: fromClause.h:107
The class compRange stores computed ranges.
Definition: qExpr.h:1167

Make It A Bit Faster
Contact us
Disclaimers
FastBit source code
FastBit mailing list archive