# 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
FORCEINLINE | SpecializedStation (TileIndex tile)
| Set station type correctly.
## Static Public Member Functions
static FORCEINLINE bool | IsExpected (const BaseStation *st)
| Helper for checking whether the given station is of this type.
static FORCEINLINE bool | IsValidID (size_t index)
| Tests whether given index is a valid index for station of this type.
static FORCEINLINE T * | Get (size_t index)
| Gets station with given index.
static FORCEINLINE T * | GetIfValid (size_t index)
| Returns station if the index is a valid index for this station type.
static FORCEINLINE T * | GetByTile (TileIndex tile)
| Get the station belonging to a specific tile.
static FORCEINLINE T * | From (BaseStation *st)
| Converts a BaseStation to SpecializedStation with type checking.
static FORCEINLINE 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 167 of file base_station_base.h.

## Constructor & Destructor Documentation

template<class T, bool Tis_waypoint>

FORCEINLINE 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 FORCEINLINE 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 244 of file base_station_base.h.

template<class T, bool Tis_waypoint>

static FORCEINLINE 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 233 of file base_station_base.h.

template<class T, bool Tis_waypoint>

static FORCEINLINE 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, Tcache, Tzero >::PoolItem<&_station_pool >.

Definition at line 204 of file base_station_base.h.

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

template<class T, bool Tis_waypoint>

static FORCEINLINE 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 223 of file base_station_base.h.

template<class T, bool Tis_waypoint>

static FORCEINLINE 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, Tcache, Tzero >::PoolItem<&_station_pool >.

Definition at line 213 of file base_station_base.h.

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

template<class T, bool Tis_waypoint>

static FORCEINLINE 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 185 of file base_station_base.h.

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

template<class T, bool Tis_waypoint>

static FORCEINLINE 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, Tcache, Tzero >::PoolItem<&_station_pool >.

Definition at line 195 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