# 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 172 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 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 190 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< Tpool >.

Definition at line 200 of file base_station_base.h.

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

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< Tpool >.

Definition at line 209 of file base_station_base.h.

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

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< Tpool >.

Definition at line 218 of file base_station_base.h.

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

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 228 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 238 of file base_station_base.h.

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

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

- src/base_station_base.h