Skip to content

Commit

Permalink
change pattern for easy access
Browse files Browse the repository at this point in the history
  • Loading branch information
riasc committed Nov 3, 2024
1 parent 517f99b commit 855bbf4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions include/genogrove/Key.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@ namespace genogrove {
* @param data element of the key
*/
template<typename T>
Key(Interval intvl, T&& data) :
Key(Interval intvl, char strand, T&& data) :
interval(intvl),
strand(strand),
data(std::make_shared<AnyType<std::decay_t<T>>>(data)),
singleLink(nullptr),
multiLink(std::vector<Key*>()) {}


/**
* @brief Destructor of the Key class
*/
Expand All @@ -58,10 +61,10 @@ namespace genogrove {
bool operator>(const Key& other) const;

// getter & setter
void setStrand(char strand);
char getStrand();
Interval getInterval();
void setInterval(Interval interval);
char getStrand();
void setStrand(char strand);
std::shared_ptr<AnyBase> getData();
void setData(std::shared_ptr<AnyBase> data);
Key* getSingleLink();
Expand All @@ -74,8 +77,8 @@ namespace genogrove {
static Key deserialize(std::istream& is);

private:
char strand;
Interval interval;
char strand;
std::shared_ptr<AnyBase> data;
Key* singleLink;
std::vector<Key*> multiLink;
Expand Down
4 changes: 2 additions & 2 deletions src/Key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ namespace genogrove {
bool Key::operator>(const Key& other) const { return this->interval > other.interval; }

// getter & setter
void Key::setStrand(char strand) { this->strand = strand; }
char Key::getStrand() { return this->strand; }
Interval Key::getInterval() { return this->interval; }
void Key::setInterval(Interval interval) { this->interval = interval; }
char Key::getStrand() { return this->strand; }
void Key::setStrand(char strand) { this->strand = strand; }
std::shared_ptr<AnyBase> Key::getData() { return this->data; }
void Key::setData(std::shared_ptr<AnyBase> data) {this->data = data;}
Key* Key::getSingleLink() { return this->singleLink; }
Expand Down

0 comments on commit 855bbf4

Please sign in to comment.