lanes.h

Go to the documentation of this file.
00001 /*
00002         Author: Marco Costalba (C) 2005-2006
00003 
00004         Copyright: See COPYING file that comes with this distribution
00005 
00006 */
00007 #ifndef LANES_H
00008 #define LANES_H
00009 
00010 #include <qstring.h>
00011 #include <qstringlist.h>
00012 #include <qvaluevector.h>
00013 
00014 class Lanes {
00015 public:
00016         Lanes() {} // init() will setup us later, when data is available
00017         bool isEmpty() { return typeVec.empty(); }
00018         void init(const QString& expectedSha);
00019         void clear();
00020         bool isFork(const QString& sha, bool& isDiscontinuity);
00021         void setBoundary(bool isBoundary);
00022         void setFork(const QString& sha);
00023         void setMerge(const QStringList& parents);
00024         void setInitial();
00025         void setApplied();
00026         void changeActiveLane(const QString& sha);
00027         void afterMerge();
00028         void afterFork();
00029         bool isBranch();
00030         void afterBranch();
00031         void afterApplied();
00032         void nextParent(const QString& sha);
00033         void getLanes(QValueVector<int> &ln) { ln = typeVec; } // O(1) vector is implicitly shared
00034 
00035 private:
00036         int findNextSha(const QString& next, int pos);
00037         int findType(int type, int pos);
00038         int add(int type, const QString& next, int pos);
00039 
00040         int activeLane;
00041         QValueVector<int> typeVec;
00042         QValueVector<QString> nextShaVec;
00043         bool boundary;
00044         int NODE, NODE_L, NODE_R;
00045 };
00046 
00047 #endif

Generated on Fri Dec 7 21:57:37 2007 for QGit by  doxygen 1.5.3