TReK C++  5.3.2
Telemetry/Command API
trek::TrackItemArray Class Reference

This class provides a wrapper for std::vector so different versions of the standard template library don't cause problems. The array is zero based. More...

#include <track_item_array.h>

Public Member Functions

void Clear ()
 Removes all of the items from the array.
 
uint32_t Size ()
 Returns the number of items in the array.
 
TrackItemGetAt (uint32_t index)
 Returns the item at the given location. More...
 
void Add (TrackItem *item)
 Adds the item to the end of the array. More...
 
int32_t Replace (uint32_t index, TrackItem *item)
 Replaces the item at the given location. More...
 
void Resize (uint32_t input)
 Rezies the array to the input size.
 
Constructors, Destructor, and Other Basic Methods
 TrackItemArray ()
 Default constructor of the class.
 
 TrackItemArray (TrackItemArray &input)
 Copy constructor of the class.
 
virtual ~TrackItemArray ()
 Class destructor. More...
 
void operator= (TrackItemArray &right_side)
 Provides the equal operator.
 
TrackItemArrayClone ()
 Returns an exact copy of the object;.
 

Detailed Description

This class provides a wrapper for std::vector so different versions of the standard template library don't cause problems. The array is zero based.

Constructor & Destructor Documentation

◆ ~TrackItemArray()

trek::TrackItemArray::~TrackItemArray ( )
virtual

Class destructor.

Removes all resources created with this instance of the class.

Member Function Documentation

◆ Add()

void trek::TrackItemArray::Add ( TrackItem item)

Adds the item to the end of the array.

Parameters
[in]itemThe item to add to the end of the array. A copy of the item is made.

Example:

TrackItemArray my_array;
TrackItem item;
my_array.Add( &item );
This class provides a wrapper for std::vector so different versions of the standard template library ...
Definition: track_item_array.h:20
void Add(TrackItem *item)
Adds the item to the end of the array.
Definition: track_item_array.cpp:113
This class holds all of the responses associated with a single command uplink. Only methods that are ...
Definition: track_item.h:30

◆ GetAt()

TrackItem * trek::TrackItemArray::GetAt ( uint32_t  index)

Returns the item at the given location.

If the index does not exists, a NULL pointer is returned.

Parameters
[in]indexThe index to get the item for

Example:

TrackItemArray my_array;
char *my_ptr;
my_ptr = my_array.GetAt(2);
if( my_ptr ) // otherwise index doesn't exist
printf( "%s\n", my_ptr->GetCommandName() );
TrackItem * GetAt(uint32_t index)
Returns the item at the given location.
Definition: track_item_array.cpp:92

◆ Replace()

int32_t trek::TrackItemArray::Replace ( uint32_t  index,
TrackItem item 
)

Replaces the item at the given location.

If the specified index does not exist, an error is returned and no changes are made to the array. A copy of the item is made.

Parameters
[in]indexThe location to change
[in]itemThe new item for the location
Returns
SUCCESS
FAIL
TREK_DATA_NULL_PTR

Example:

TrackItemArray my_array;
TrackItem new_item;
// set the attributes of the TrackItem
// assuming you've added 3 items.
my_array.Replace( 2, &new_item );
int32_t Replace(uint32_t index, TrackItem *item)
Replaces the item at the given location.
Definition: track_item_array.cpp:146