Skip to content

Commit

Permalink
changed function to insert data; function overloading... with/and wit…
Browse files Browse the repository at this point in the history
…hout data
  • Loading branch information
riasc committed Nov 18, 2024
1 parent 61a82eb commit 91c86b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
22 changes: 16 additions & 6 deletions include/genogrove/IBPTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,31 @@ namespace genogrove {
*/
Node* insertRoot(std::string key);


/*
* @brief insert a new data element into the IBPTree
* @param chromosome to be inserted
* @param interval to be inserted
* @param strand to be inserted
* @param data to be inserted
*/
template<typename T>
void insertData(std::string chrom, Interval intvl, T data) {
Key key(intvl, '\0', data);
insert(chrom, key);
}

template<typename T>
void insertData(std::string chrom, Interval intvl, char strand, T data) {
Key key(intvl, strand, data);
insert(chrom, key);
}

/*
* @brief insert a new data element into the IBPTree (without data)
* @param chromosome to be inserted
* @param interval to be inserted
* @param strand to be inserted
*/
void insertData(std::string chrom, Interval intvl, char strand) {
Key key(intvl, strand, nullptr);
}


/*
* @brief insert a new data element into the IBPTree (sorted)
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ namespace genogrove {
/**
* @details The default constructor create an empty Key object
*/
Key::Key() : interval(std::string::npos, std::string::npos), strand('\0'), data(nullptr),
Key::Key() : interval(std::string::npos, std::string::npos), strand('.'), data(nullptr),
singleLink(nullptr), multiLink(std::vector<Key*>()) {}
Key::Key(Interval intvl) : interval(intvl), strand('\0'), data(nullptr),
Key::Key(Interval intvl) : interval(intvl), strand('.'), data(nullptr),
singleLink(nullptr), multiLink(std::vector<Key*>()) {}
Key::~Key() {}

Expand Down

0 comments on commit 91c86b2

Please sign in to comment.