#include <bin.h>
Inheritance diagram for Bin:
A Bin is implemented as a TreeNode with two data members: a size and a count.
Public Member Functions | |
Bin () | |
Bin (const LargeIndex &index) | |
virtual | ~Bin () |
double | SetSize (double size) |
Sets the size of the bin; returns the old size. | |
double | GetSize () const |
Get the size of the bin. | |
double | IncrementCount () |
Increase the count by 1. Returns the final count. | |
double | DecrementCount () |
Decrease the count by 1. Returns the final count. | |
double | SetCount (double count) |
Set the count. Returns the new count. | |
double | GetCount () const |
Get the current count. | |
virtual void | ReadData (istream &input_stream) |
Read the data, excluding the index, from a stream. | |
virtual void | WriteData (ostream &output_stream) const |
Write the data, excluding the index, to a stream. | |
virtual void | Combine (const TreeNode &other) |
Combine data from two Bins. | |
const LargeIndex & | GetIndex () const |
TreeNode * | GetParent () |
TreeNode * | GetPreviousSibling () |
TreeNode * | GetNextSibling () |
TreeNode * | GetFirstChild () |
TreeNode * | GetLastChild () |
void | SetParent (TreeNode *parent) |
void | SetPreviousSibling (TreeNode *sibling) |
void | SetNextSibling (TreeNode *sibling) |
void | SetFirstChild (TreeNode *child) |
void | SetLastChild (TreeNode *child) |
void | SetIndex (const LargeIndex &index) |
bool | HasParent () const |
bool | HasPreviousSibling () const |
bool | HasNextSibling () const |
bool | HasChild () const |
void | ReadFromStream (istream &input_stream) |
Read the data, including the index, from a stream. | |
void | WriteToStream (ostream &output_stream) const |
Write the data, including the index, to a stream. | |
bool | operator< (const TreeNode &other) const |
Returns true if this node's index is smaller than that of <other>. | |
Static Public Member Functions | |
static bool | CompareNodes (const TreeNode *one, const TreeNode *two) |
Returns true if <one>'s index is smaller than that of <two>. |
Bin | ( | ) |
Bin | ( | const LargeIndex & | index | ) |
virtual ~Bin | ( | ) | [inline, virtual] |
double SetSize | ( | double | size | ) |
Sets the size of the bin; returns the old size.
double GetSize | ( | ) | const |
Get the size of the bin.
double IncrementCount | ( | ) |
Increase the count by 1. Returns the final count.
double DecrementCount | ( | ) |
Decrease the count by 1. Returns the final count.
double SetCount | ( | double | count | ) |
Set the count. Returns the new count.
double GetCount | ( | ) | const |
Get the current count.
void ReadData | ( | istream & | input_stream | ) | [virtual] |
void WriteData | ( | ostream & | output_stream | ) | const [virtual] |
void Combine | ( | const TreeNode & | other | ) | [virtual] |
Combine data from two Bins.
To combine bins, we take the max of the sizes, and add the counts.
Implements TreeNode.
const LargeIndex & GetIndex | ( | ) | const [inherited] |
TreeNode * GetParent | ( | ) | [inherited] |
TreeNode * GetPreviousSibling | ( | ) | [inherited] |
TreeNode * GetNextSibling | ( | ) | [inherited] |
TreeNode * GetFirstChild | ( | ) | [inherited] |
TreeNode * GetLastChild | ( | ) | [inherited] |
void SetParent | ( | TreeNode * | parent | ) | [inherited] |
void SetPreviousSibling | ( | TreeNode * | sibling | ) | [inherited] |
void SetNextSibling | ( | TreeNode * | sibling | ) | [inherited] |
void SetFirstChild | ( | TreeNode * | child | ) | [inherited] |
void SetLastChild | ( | TreeNode * | child | ) | [inherited] |
void SetIndex | ( | const LargeIndex & | index | ) | [inherited] |
bool HasParent | ( | ) | const [inherited] |
bool HasPreviousSibling | ( | ) | const [inherited] |
bool HasNextSibling | ( | ) | const [inherited] |
bool HasChild | ( | ) | const [inherited] |
void ReadFromStream | ( | istream & | input_stream | ) | [inherited] |
Read the data, including the index, from a stream.
Calling this will override the node's current index. The format is:
void WriteToStream | ( | ostream & | output_stream | ) | const [inherited] |
Write the data, including the index, to a stream.
This will simply write the index to the stream, followed by WriteData().
bool operator< | ( | const TreeNode & | other | ) | const [inherited] |
Returns true if this node's index is smaller than that of <other>.
Returns true if <one>'s index is smaller than that of <two>.