Loading...
Searching...
No Matches
pappso::spectree::Bucket Class Reference

`#include <bucket.h>`

## Public Member Functions

| Bucket (std::size_t val)
| Bucket (const Bucket &other)
std::size_t | getId () const
void | push_back (std::size_t cart)
std::size_t | size () const
bool | operator< (const Bucket &bucket_two) const
const std::vector< std::size_t > & | getCartList () const
std::size_t | front () const
| get the first cart id of the list
std::size_t | back () const
| get the last cart id of the list

## Private Attributes

std::size_t | m_itemId
std::vector< std::size_t > | m_cartList

## Detailed Description

Definition at line 55 of file bucket.h.

## Constructor & Destructor Documentation

## Bucket() [1/2]

pappso::spectree::Bucket::Bucket | ( | std::size_t | val | ) |

Bucket creation with appropriated initialisation for the identifiers and the mass value.

Parameters

  val | the mass value (item id) associated to the bucket

Returns
  b a bucket object properly instanciated

Since
  0.1

Definition at line 45 of file bucket.cpp.

{
m_itemId = val;
}
pappso::spectree::Bucket::m_itemId
std::size_t m_itemId
Definition bucket.h:118

References m_itemId.

## Bucket() [2/2]

pappso::spectree::Bucket::Bucket | ( | const Bucket & | other | ) |

Definition at line 50 of file bucket.cpp.

: m_cartList(other.m_cartList)
{
m_itemId = other.m_itemId;
}
pappso::spectree::Bucket::m_cartList
std::vector< std::size_t > m_cartList
Definition bucket.h:127

References m_itemId.

## Member Function Documentation

## back()

std::size_t pappso::spectree::Bucket::back | ( |  | ) | const

get the last cart id of the list

Definition at line 103 of file bucket.cpp.

{
return m_cartList.back();
}

References m_cartList.

## front()

std::size_t pappso::spectree::Bucket::front | ( |  | ) | const

get the first cart id of the list

Definition at line 97 of file bucket.cpp.

{
return m_cartList.front();
}

References m_cartList.

## getCartList()

const std::vector< std::size_t > & pappso::spectree::Bucket::getCartList | ( |  | ) | const

Definition at line 109 of file bucket.cpp.

{
return m_cartList;
}

References m_cartList.

## getId()

std::size_t pappso::spectree::Bucket::getId | ( |  | ) | const

Accessor to the mass value (item id) associated to the bucket.

Returns
  the mass value

Since
  0.1

Definition at line 68 of file bucket.cpp.

{
return m_itemId;
}

References m_itemId.

## operator<()

bool pappso::spectree::Bucket::operator< | ( | const Bucket & | bucket_two | ) | const

Implementation of the comparable interface in order to be able to compare two buckets and sort a collection of buckets lexicographically.

Parameters

  b | The bucket to compare with the current one

Returns
  -x if the bucket is lexicographically smaller, +x if the bucket is lexicographically bigger and 0 if they have the same content, where x is a non-zero integer.

Since
  0.1

Definition at line 74 of file bucket.cpp.

{
auto it_bucket_end = m_cartList.end();
auto it_bucket_b_end = bucket_b.m_cartList.end();
auto it_bucket = m_cartList.begin();
auto it_bucket_b = bucket_b.m_cartList.begin();
for(; it_bucket != it_bucket_end && it_bucket_b != it_bucket_b_end;
it_bucket++, it_bucket_b++)
{
if(*it_bucket != *it_bucket_b)
return (*it_bucket < *it_bucket_b);
}
// When the buckets have an equal content until the limit, the shortest one
// is returned first
return (m_cartList.size() < bucket_b.m_cartList.size());
}

References m_cartList.

## push_back()

void pappso::spectree::Bucket::push_back | ( | std::size_t | cart | ) |

Insertion of a new identifier in the bucket. Insertion happen to the end.

Parameters

  cart | The cart identifier to add in the bucket

Since
  0.1

Definition at line 56 of file bucket.cpp.

{
m_cartList.push_back(cart);
}

References m_cartList.

## size()

std::size_t pappso::spectree::Bucket::size | ( |  | ) | const

Return the number of identifiers contained in the bucket.

Returns
  the number of identifiers

Since
  0.1

Definition at line 62 of file bucket.cpp.

{
return m_cartList.size();
}

References m_cartList.

## Member Data Documentation

## m_cartList

std::vector<std::size_t> pappso::spectree::Bucket::m_cartList

private

Spectrum identifiers stored in an optimized array to reduce the memory occupation (fastutils). This list can only be filled, sorted or accessed in read-only.

Since
  0.1

Definition at line 127 of file bucket.h.

Referenced by back(), front(), getCartList(), operator<(), push_back(), and size().

## m_itemId

std::size_t pappso::spectree::Bucket::m_itemId

private

The mass value associated to the bucket. This value cannot be modified.

Since
  0.1

Definition at line 118 of file bucket.h.

Referenced by Bucket(), Bucket(), and getId().

The documentation for this class was generated from the following files:

- pappsomspp/processing/spectree/bucket.h
- pappsomspp/processing/spectree/bucket.cpp