Skip to content

Commit

Permalink
AURORA: Add GFF3File::getMutableList()
Browse files Browse the repository at this point in the history
Return a mutable list within a GFF3File.

No GFF3List methods that can add/remove structs exist yet, though.
  • Loading branch information
DrMcCoy committed Mar 3, 2016
1 parent 549cf58 commit 49ea6fa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/aurora/gff3file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ GFF3Struct &GFF3File::getMutableStruct(const GFF3Struct &strct) {
return *s->second;
}

GFF3List &GFF3File::getMutableList(const GFF3List &list) {
if (list._parent != this)
throw Common::Exception("GFF3: That list does not belong to this GFF3");

ListMap::iterator l = _lists.find(list.getUID());
if (l == _lists.end())
throw Common::Exception("GFF3: This GFF3 does not know about that list?!?");

return l->second;
}

// --- Loader ---

void GFF3File::load(uint32 id) {
Expand Down
8 changes: 8 additions & 0 deletions src/aurora/gff3file.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ class GFF3File : public AuroraFile {
*/
GFF3Struct &getMutableStruct(const GFF3Struct &strct);

/** Return a mutable struct.
*
* Given a read-only list, this returns a reference to a mutable version
* of the same struct within the GFF3. This means, structs in this mutable
* version can be removed and now structs added.
*/
GFF3List &getMutableList(const GFF3List &list);


private:
/** A GFF3 header. */
Expand Down

0 comments on commit 49ea6fa

Please sign in to comment.