Public Member Functions | Static Public Member Functions | Static Public Attributes

# SpecializedStation< T, Tis_waypoint > Struct Template Reference

Class defining several overloaded accessors so we don't have to cast base stations that often. More...

`#include <base_station_base.h>`

Inheritance diagram for SpecializedStation< T, Tis_waypoint >:

## Public Member Functions
| SpecializedStation (TileIndex tile)
| Set station type correctly.
## Static Public Member Functions
static bool | IsExpected (const BaseStation *st)
| Helper for checking whether the given station is of this type.
static bool | IsValidID (size_t index)
| Tests whether given index is a valid index for station of this type.
static T * | Get (size_t index)
| Gets station with given index.
static T * | GetIfValid (size_t index)
| Returns station if the index is a valid index for this station type.
static T * | GetByTile (TileIndex tile)
| Get the station belonging to a specific tile.
static T * | From (BaseStation *st)
| Converts a BaseStation to SpecializedStation with type checking.
static const T * | From (const BaseStation *st)
| Converts a const BaseStation to const SpecializedStation with type checking.
## Static Public Attributes
static const StationFacility | EXPECTED_FACIL = Tis_waypoint ? FACIL_WAYPOINT : FACIL_NONE
| Specialized type.

## Detailed Description

### template<class T, bool Tis_waypoint>
struct SpecializedStation< T, Tis_waypoint >

Class defining several overloaded accessors so we don't have to cast base stations that often.

Definition at line 168 of file base_station_base.h.

## Constructor & Destructor Documentation

template<class T, bool Tis_waypoint>

SpecializedStation< T, Tis_waypoint >::SpecializedStation | ( | TileIndex | tile | ) | `[inline]`

Set station type correctly.

Parameters:

  | tile | The base tile of the station.

## Member Function Documentation

template<class T, bool Tis_waypoint>

static T* SpecializedStation< T, Tis_waypoint >::From | ( | BaseStation * | st | ) | `[inline, static]`

Converts a BaseStation to SpecializedStation with type checking.

Parameters:

  | st | BaseStation pointer

Returns:
  pointer to SpecializedStation

Definition at line 234 of file base_station_base.h.

template<class T, bool Tis_waypoint>

static const T* SpecializedStation< T, Tis_waypoint >::From | ( | const BaseStation * | st | ) | `[inline, static]`

Converts a const BaseStation to const SpecializedStation with type checking.

Parameters:

  | st | BaseStation pointer

Returns:
  pointer to SpecializedStation

Definition at line 245 of file base_station_base.h.

template<class T, bool Tis_waypoint>

static T* SpecializedStation< T, Tis_waypoint >::Get | ( | size_t | index | ) | `[inline, static]`

Gets station with given index.

Returns:
  pointer to station with given index casted to T *

Reimplemented from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >.

Definition at line 205 of file base_station_base.h.

Referenced by SpecializedStation< Waypoint, true >::Get(), and SpecializedStation< Waypoint, true >::GetIfValid().

template<class T, bool Tis_waypoint>

static T* SpecializedStation< T, Tis_waypoint >::GetByTile | ( | TileIndex | tile | ) | `[inline, static]`

Get the station belonging to a specific tile.

Parameters:

  | tile | The tile to get the station from.

Returns:
  the station associated with that tile.

Reimplemented from BaseStation.

Definition at line 224 of file base_station_base.h.

template<class T, bool Tis_waypoint>

static T* SpecializedStation< T, Tis_waypoint >::GetIfValid | ( | size_t | index | ) | `[inline, static]`

Returns station if the index is a valid index for this station type.

Returns:
  pointer to station with given index if it's a station of this type

Reimplemented from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >.

Definition at line 214 of file base_station_base.h.

Referenced by SpecializedStation< Waypoint, true >::GetByTile().

template<class T, bool Tis_waypoint>

static bool SpecializedStation< T, Tis_waypoint >::IsExpected | ( | const BaseStation * | st | ) | `[inline, static]`

Helper for checking whether the given station is of this type.

Parameters:

  | st | the station to check.

Returns:
  true if the station is the type we expect it to be.

Definition at line 186 of file base_station_base.h.

Referenced by SpecializedStation< Waypoint, true >::From(), and SpecializedStation< Waypoint, true >::IsValidID().

template<class T, bool Tis_waypoint>

static bool SpecializedStation< T, Tis_waypoint >::IsValidID | ( | size_t | index | ) | `[inline, static]`

Tests whether given index is a valid index for station of this type.

Parameters:

  | index | tested index

Returns:
  is this index valid index of T?

Reimplemented from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >.

Definition at line 196 of file base_station_base.h.

Referenced by SpecializedStation< Waypoint, true >::GetIfValid(), and SpecializedStation< Waypoint, true >::IsValidID().

The documentation for this struct was generated from the following file:

- src/base_station_base.h