StarBlock

Search for usage in LXR

#include <starblock.h>

Public Types

typedef StarObject StarBlockEntry
 

Public Member Functions

 StarBlock (int nstars=100)
 
StarBlockEntryaddStar (const DeepStarData &data)
 
StarBlockEntryaddStar (const StarData &data)
 
QVector< StarBlockEntry > & contents ()
 
float getBrightMag () const
 
float getFaintMag () const
 
int getStarCount () const
 
bool isFull () const
 
void reset ()
 
int size () const
 
StarBlockEntrystar (int i)
 

Public Attributes

float brightMag { 0 }
 
quint32 drawID { 0 }
 
float faintMag { 0 }
 
std::shared_ptr< StarBlocknext
 
StarBlockListparent
 
std::shared_ptr< StarBlockprev
 

Detailed Description

Holds a block of stars and various peripheral variables to mark its place in data structures.

Author
Akarsh Simha
Version
1.0

Definition at line 42 of file starblock.h.

Member Typedef Documentation

◆ StarBlockEntry

Definition at line 49 of file starblock.h.

Constructor & Destructor Documentation

◆ StarBlock()

StarBlock::StarBlock ( int nstars = 100)
explicit

Constructor.

Initializes values of various parameters and creates nstars number of stars

Parameters
nstarsNumber of stars to hold in this StarBlock

Definition at line 33 of file starblock.cpp.

Member Function Documentation

◆ addStar() [1/2]

StarObject * StarBlock::addStar ( const DeepStarData & data)

Definition at line 99 of file starblock.cpp.

◆ addStar() [2/2]

StarObject * StarBlock::addStar ( const StarData & data)

Initialize another star with data.

FIXME: StarObject::init doesn't reset object name(s). It shouldn't be issue since stars which are swapped in/out do not have names.

Parameters
datadata to initialize star with.
Returns
pointer to star initialized with data. nullptr if block is full.

Definition at line 85 of file starblock.cpp.

◆ contents()

QVector< StarBlockEntry > & StarBlock::contents ( )
inline
Returns
a reference to the internal container of this
Note
This is bad – is there a way of providing non-const access to the list's elements without allowing altering of the list alone?

Definition at line 108 of file starblock.h.

◆ getBrightMag()

float StarBlock::getBrightMag ( ) const
inline

Return the magnitude of the brightest star in this StarBlock.

Returns
Magnitude of the brightest star

Definition at line 116 of file starblock.h.

◆ getFaintMag()

float StarBlock::getFaintMag ( ) const
inline

Return the magnitude of the faintest star in this StarBlock.

Returns
Magnitude of the faintest star

Definition at line 123 of file starblock.h.

◆ getStarCount()

int StarBlock::getStarCount ( ) const
inline

Return the number of stars currently filled in this StarBlock.

Returns
Number of stars filled in this StarBlock

Definition at line 130 of file starblock.h.

◆ isFull()

bool StarBlock::isFull ( ) const
inline

Returns true if the StarBlock is full.

Returns
true if full, false if not full

Definition at line 81 of file starblock.h.

◆ reset()

void StarBlock::reset ( )

Reset this StarBlock's data, for reuse of the StarBlock.

Definition at line 43 of file starblock.cpp.

◆ size()

int StarBlock::size ( ) const
inline

Return the capacity of this StarBlock.

This is different from nStars. While nStars indicates the number of stars that this StarBlock actually holds, this method returns the number of stars for which we have allocated memory. Thus, this method should return a number >= nStars.

Returns
The number of stars that this StarBlock can hold

Definition at line 92 of file starblock.h.

◆ star()

StarBlockEntry * StarBlock::star ( int i)
inline

Return the i-th star in this StarBlock.

Parameters
iIndex of StarBlock to return
Returns
A pointer to the i-th StarObject

Definition at line 100 of file starblock.h.

Member Data Documentation

◆ brightMag

float StarBlock::brightMag { 0 }

Definition at line 136 of file starblock.h.

◆ drawID

quint32 StarBlock::drawID { 0 }

Definition at line 140 of file starblock.h.

◆ faintMag

float StarBlock::faintMag { 0 }

Definition at line 135 of file starblock.h.

◆ next

std::shared_ptr<StarBlock> StarBlock::next

Definition at line 139 of file starblock.h.

◆ parent

StarBlockList* StarBlock::parent

Definition at line 137 of file starblock.h.

◆ prev

std::shared_ptr<StarBlock> StarBlock::prev

Definition at line 138 of file starblock.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:48:28 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.