fromClause.h
Go to the documentation of this file.
00001 // $Id$
00002 // Author: John Wu <John.Wu at acm.org>
00003 //      Lawrence Berkeley National Laboratory
00004 // Copyright 2009-2012 the Regents of the University of California
00008 #ifndef IBIS_FROMCLAUSE_H
00009 #define IBIS_FROMCLAUSE_H
00010 #include "qExpr.h"
00011 #include "table.h"
00012 
00013 namespace ibis {
00014     class fromLexer;
00015     class fromParser;
00016 }
00017 
00040 class FASTBIT_CXX_DLLSPEC ibis::fromClause {
00041 public:
00043     explicit fromClause(const char *cl=0);
00045     fromClause(const ibis::table::stringList&);
00046     ~fromClause();
00047     fromClause(const fromClause&);
00048 
00049     int parse(const char *cl);
00050 
00052     const char* getString(void) const {return clause_.c_str();}
00054     const char* operator*(void) const {return clause_.c_str();}
00055 
00057     bool empty() const {return names_.empty();}
00059     uint32_t size() const {return names_.size();}
00060     void getNames(ibis::table::stringList&) const;
00061 
00063     const ibis::compRange* getJoinCondition() const {return jcond_;}
00064 
00065     void print(std::ostream&) const;
00066     void clear();
00067 
00068     const char* realName(const char*) const;
00069     const char* alias(const char*) const;
00070     size_t position(const char*) const;
00071     void reorderNames(const char*, const char*);
00072 
00074     fromClause& operator=(const fromClause& rhs) {
00075         fromClause tmp(rhs);
00076         swap(tmp);
00077         return *this;
00078     }
00080     void swap(fromClause& rhs) {
00081         names_.swap(rhs.names_);
00082         aliases_.swap(rhs.aliases_);
00083         clause_.swap(rhs.clause_);
00084         ordered_.swap(rhs.ordered_);
00085         ibis::compRange *tmp = jcond_;
00086         jcond_ = rhs.jcond_;
00087         rhs.jcond_ = tmp;
00088     }
00089 
00090 protected:
00092     std::vector<std::string> names_;
00094     std::vector<std::string> aliases_;
00096     std::map<const char*, size_t, ibis::lessi> ordered_;
00104     ibis::compRange* jcond_;
00105 
00106     std::string clause_;        
00107     ibis::fromLexer *lexer;     
00108 
00109     friend class ibis::fromParser;
00110 }; // class ibis::fromClause
00111 
00112 namespace std {
00113     inline ostream& operator<<(ostream& out, const ibis::fromClause& fc) {
00114         fc.print(out);
00115         return out;
00116     } // std::operator<<
00117 }
00118 #endif

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