00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef AG_h
00010 #define AG_h
00011
00012 #include <list>
00013
00014 #include "AGTypes.h"
00015 #include "Identifiers.h"
00016 #include "Anchor.h"
00017 #include "Annotation.h"
00018 #include "AnnotationIndex.h"
00019 #include "Timeline.h"
00020
00021 typedef set<FeatureName> FeatureNameSet;
00022
00023 using namespace std;
00024
00031 class AG : public AnnotationSeq {
00032 private:
00034 const Id id;
00035
00037 string type;
00038
00040 Timeline* timeline;
00041
00043 Metadata metadata;
00044
00046 AnnotationIndex I;
00047
00049 Identifiers* anchorIds;
00050
00052 Identifiers* annotationIds;
00053
00054 public:
00055
00057 AG(Id id, Timeline* timeline=NULL, string type="");
00058
00060 ~AG();
00061
00063 Id getId() const { return id; }
00064
00066 void setType(string type) { this->type = type; }
00067
00069 string getType() const { return type; }
00070
00072 Timeline* getTimeline() const { return timeline; }
00073
00075 void addAnchor(Anchor* a);
00076
00078 void deleteAnchor(Anchor* a) throw (AGException);
00079
00081 void setAnchorOffset(Anchor*, Offset);
00082
00091 Anchor* splitAnchor(Anchor* original);
00092
00094 void add(Annotation* anchor);
00095
00104 Id createAnnotation(Id id, Anchor* anchor1, Anchor* anchor2,
00105 AnnotationType annotationType) throw(AGException);
00106
00113 void setFeature(Id id, FeatureName featureName, FeatureValue featureValue);
00114
00115
00122 bool existsFeature(Id id, FeatureName featureName);
00123
00130 void deleteFeature(Id id, FeatureName featureName);
00131
00137 string getFeature(Id id, FeatureName featureName);
00138
00146 StringSet getFeatureNames(Id id);
00147
00156 void getAnnotationFeatureNames(StringSet& S);
00157
00166 void getAnnotationTypes(StringSet& S);
00167
00178 void setFeatures(Id id, Features features);
00179
00187 Features getFeatures(Id id);
00188
00196 void unsetFeatures(Id id);
00197
00205 AnchorId createAnchor(Id id, Offset offset, Unit unit, string signals);
00206
00214 AnchorId createAnchor(Id id, Unit unit, string signals);
00215
00217 Offset getAnchorOffset(Anchor* anchor);
00218
00225 Annotation* copyAnnotation(const Annotation* annotation);
00226
00238 Annotation* splitAnnotation(Annotation* original);
00239
00250 AnnotationSet nSplitAnnotation(Annotation* original, int n);
00251
00253 void deleteAnnotation(Annotation* annotation);
00254
00256 void setStartAnchor(Annotation* annotation, Anchor* anchor);
00257
00259 void setEndAnchor(Annotation* annotation, Anchor* anchor);
00260
00262 void unsetAnchorOffset(Anchor* a);
00263
00265 void setFeature(Annotation*, const String&, const String&);
00266
00268 AnchorSeq* getAnchorSet() { return &I.anchorSet; }
00269
00271 Annotation* getById(const Id& id) throw (AGException);
00272
00274 Anchor* getAnchorById(const Id& id) throw (AGException);
00275
00277 AnchorSet getAnchorSetByOffset(Offset offset, double epsilon=0.0);
00278
00280 AnnotationSet getAnnotationSetByType(const String& t) {return I.byType[t];}
00281
00288 AnnotationSet getAnnotationSetByOffset(Offset o) {return I.getByOffset(o);}
00289
00291 AnnotationSet getAnnotationSetByFeature(const String& f, const String& v) {return I.byFeature[make_pair(f,v)];}
00292
00294 AnnotationSet getIncomingAnnotationSet(Anchor* a) {return I.incoming[a];}
00295
00297 AnnotationSet getIncomingAnnotationSetByType(Anchor* a, AnnotationType t);
00298
00300 AnnotationSet getOutgoingAnnotationSet(Anchor* a) {return I.outgoing[a];}
00301
00303 AnnotationSet getOutgoingAnnotationSetByType(Anchor* a, AnnotationType t);
00304
00306 Offset getNearestOffset(Offset o) {return I.getNearestOffset(o);}
00307
00316 AnnotationSeq getAnnotationSeqByOffset(Offset begin=0.0, Offset end=0.0);
00317
00326 Annotation* getAnnotationByOffset(Offset offset) { return I.getAnnotationByOffset(offset); }
00327
00329 AnchorSet getAnchorSetNearestOffset(Offset offset);
00330
00332 list<string> storeSQLs(AGSetId agSetId,FeatureNameSet features);
00333
00335 string toString();
00336
00337 };
00338
00339
00340 #endif
00341