Skyscraper 2.0
SBS::DispatchController Class Reference

#include <controller.h>

Inheritance diagram for SBS::DispatchController:
Collaboration diagram for SBS::DispatchController:

Classes

struct  Call
 
struct  ElevMap
 
struct  Route
 

Public Member Functions

 DispatchController (Object *parent, int number)
 
 ~DispatchController ()
 
void Loop ()
 
bool RequestRoute (CallStation *station, int starting_floor, int destination_floor)
 
bool AddElevator (int elevator)
 
bool RemoveElevator (int elevator)
 
bool ServicesElevator (int elevator)
 
void Report (const std::string &message)
 
bool ReportError (const std::string &message)
 
void ElevatorArrived (int number, int floor, bool direction)
 
void ResetArrival (int number)
 
bool IsElevatorAssigned (int number, int destination_floor, int direction)
 
bool IsElevatorAssignedToOther (int number, int destination_floor, int direction)
 
void AssignElevator (int number, int destination_floor, int direction)
 
void RegisterCallStation (CallStation *station)
 
void UnregisterCallStation (CallStation *station)
 
int GetElevatorArrived (int starting_floor, int destination_floor)
 
int GetElevatorArrivedStandard (int floor, bool direction)
 
bool IsServicedFloor (int floor)
 
bool FireService (int value)
 
bool AtMaxRequests (int elevator, int destination_floor)
 
int GetRecallFloor ()
 
bool CallElevator (CallStation *station, bool direction)
 
int GetBottomFloor ()
 
int GetTopFloor ()
 
bool ServesFloor (int floor)
 
int GetElevator (int index)
 
bool SameElevators (const std::vector< int > &elevators)
 
bool GetCallStatus (int elevator, int floor, bool &up, bool &down)
 
std::vector< CallStation * > GetCallStations (int floor)
 
- Public Member Functions inherited from SBS::Object
 Object (Object *parent)
 
virtual ~Object ()
 
void SetValues (const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
 
bool IsPermanent ()
 
bool IsMovable ()
 
const std::string & GetType ()
 
int GetNumber ()
 
void AddChild (Object *object)
 
ObjectGetChild (int index)
 
int GetChildrenCount ()
 
void RemoveChild (Object *object)
 
SceneNodeGetSceneNode ()
 
void ShowBoundingBox (bool value)
 
virtual void Move (const Vector3 &vector, Real speed=1.0)
 
virtual void Move (Real X, Real Y, Real Z, Real speed=1.0)
 
virtual void SetPosition (const Vector3 &position)
 
void SetPositionRelative (const Vector3 &position)
 
virtual void SetPosition (Real X, Real Y, Real Z)
 
void SetPositionRelative (Real X, Real Y, Real Z)
 
virtual void SetPositionY (Real value)
 
virtual Vector3 GetPosition (bool relative=false)
 
virtual void Rotate (const Vector3 &vector, Real speed=1.0)
 
virtual void Rotate (Real X, Real Y, Real Z, Real speed=1.0)
 
virtual void SetRotation (const Vector3 &rotation)
 
virtual void SetRotation (Real X, Real Y, Real Z)
 
virtual Vector3 GetRotation ()
 
Quaternion GetOrientation (bool relative=false)
 
void SetOrientation (const Quaternion &q, bool relative=false)
 
virtual void OnMove (bool parent)
 
virtual void OnRotate (bool parent)
 
virtual void OnClick (Vector3 &position, bool shift, bool ctrl, bool alt, bool right)
 
virtual void OnUnclick (bool right)
 
virtual void OnHit ()
 
void NotifyMove (bool parent=false)
 
void NotifyRotate (bool parent=false)
 
virtual void ResetState ()
 
void ChangeParent (Object *new_parent)
 
bool IsGlobal ()
 
void Init (bool children=true)
 
virtual void OnInit ()
 
void RegisterLoop (Object *object)
 
void UnregisterLoop (Object *object)
 
virtual void Enabled (bool value)
 
std::string GetNameBase ()
 
template<typename T >
bool IsType ()
 
template<typename T >
T * ConvertTo ()
 
- Public Member Functions inherited from SBS::ObjectBase
 ObjectBase (Object *parent)
 
virtual ~ObjectBase ()
 
ObjectGetParent ()
 
SBSGetRoot ()
 
void SetName (const std::string &name)
 
const std::string & GetName ()
 
std::string GetNameBase ()
 

Public Attributes

int Number
 
std::string Name
 
bool DestinationDispatch
 
bool Hybrid
 
int Range
 
int MaxPassengers
 
bool Reprocess
 
- Public Attributes inherited from SBS::Object
std::string command
 
std::string command_processed
 
std::string context
 
int linenum
 
std::string includefile
 
bool parent_deleting
 

Private Member Functions

int FindClosestElevator (bool &busy, bool destination, int starting_floor, int destination_floor, int direction=0)
 
void DispatchElevator (bool destination, int number, int destination_floor, int direction, bool call)
 
void RemoveRoute (const Route &route)
 
void ProcessRoutes ()
 
void GetFloorRange ()
 
bool ElevatorUnavailable (int elevator)
 
void CheckArrivals ()
 

Private Attributes

int bottom_floor
 
int top_floor
 
std::vector< ElevMapElevators
 
std::vector< RouteRoutes
 
std::vector< CallStation * > CallStations
 
int recheck
 

Additional Inherited Members

- Protected Member Functions inherited from SBS::Object
void EnableLoop (bool value)
 
void LoopChildren ()
 
bool SelfDestruct ()
 
- Protected Attributes inherited from SBS::ObjectBase
SBSsbs
 

Detailed Description

Definition at line 29 of file controller.h.

Constructor & Destructor Documentation

◆ DispatchController()

SBS::DispatchController::DispatchController ( Object * parent,
int number )

◆ ~DispatchController()

SBS::DispatchController::~DispatchController ( )

Definition at line 57 of file controller.cpp.

References SBS::SBS::FastDelete, SBS::Object::parent_deleting, SBS::SBS::RemoveController(), and SBS::ObjectBase::sbs.

Here is the call graph for this function:

Member Function Documentation

◆ AddElevator()

◆ AssignElevator()

void SBS::DispatchController::AssignElevator ( int number,
int destination_floor,
int direction )

Definition at line 1021 of file controller.cpp.

References Elevators, SBS::SBS::GetPower(), Report(), and SBS::ObjectBase::sbs.

Referenced by ProcessRoutes().

Here is the call graph for this function:

◆ AtMaxRequests()

bool SBS::DispatchController::AtMaxRequests ( int elevator,
int destination_floor )

Definition at line 1218 of file controller.cpp.

References DestinationDispatch, Elevators, SBS::SBS::GetElevator(), SBS::SBS::GetPower(), MaxPassengers, Routes, and SBS::ObjectBase::sbs.

Referenced by FindClosestElevator().

Here is the call graph for this function:

◆ CallElevator()

◆ CheckArrivals()

void SBS::DispatchController::CheckArrivals ( )
private

Definition at line 79 of file controller.cpp.

References DispatchElevator(), Elevators, SBS::SBS::GetElevator(), RemoveRoute(), Routes, SBS::ObjectBase::sbs, and SBS_PROFILE.

Referenced by Loop().

Here is the call graph for this function:

◆ DispatchElevator()

void SBS::DispatchController::DispatchElevator ( bool destination,
int number,
int destination_floor,
int direction,
bool call )
private

◆ ElevatorArrived()

void SBS::DispatchController::ElevatorArrived ( int number,
int floor,
bool direction )

◆ ElevatorUnavailable()

bool SBS::DispatchController::ElevatorUnavailable ( int elevator)
private

◆ FindClosestElevator()

int SBS::DispatchController::FindClosestElevator ( bool & busy,
bool destination,
int starting_floor,
int destination_floor,
int direction = 0 )
private

◆ FireService()

bool SBS::DispatchController::FireService ( int value)

Definition at line 1197 of file controller.cpp.

References Elevators, SBS::Elevator::EnableFireService1(), SBS::SBS::GetElevator(), SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.

Referenced by SBS::CallStation::FireService().

Here is the call graph for this function:

◆ GetBottomFloor()

int SBS::DispatchController::GetBottomFloor ( )

Definition at line 1327 of file controller.cpp.

References bottom_floor.

Referenced by SBS::CallStation::CreateCallButtons().

◆ GetCallStations()

std::vector< CallStation * > SBS::DispatchController::GetCallStations ( int floor)

Definition at line 1095 of file controller.cpp.

References CallStations.

Referenced by SBS::CallStation::SetLightsGroup().

◆ GetCallStatus()

bool SBS::DispatchController::GetCallStatus ( int elevator,
int floor,
bool & up,
bool & down )

Definition at line 1368 of file controller.cpp.

References Elevators, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.

Referenced by SBS::Elevator::GetCallStatus().

Here is the call graph for this function:

◆ GetElevator()

int SBS::DispatchController::GetElevator ( int index)

Definition at line 1337 of file controller.cpp.

References Elevators.

◆ GetElevatorArrived()

int SBS::DispatchController::GetElevatorArrived ( int starting_floor,
int destination_floor )

Definition at line 1111 of file controller.cpp.

References Elevators, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.

Referenced by SBS::CallStation::GetElevatorArrived().

Here is the call graph for this function:

◆ GetElevatorArrivedStandard()

int SBS::DispatchController::GetElevatorArrivedStandard ( int floor,
bool direction )

Definition at line 1131 of file controller.cpp.

References Elevators, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.

Referenced by SBS::CallStation::GetElevatorArrivedStandard().

Here is the call graph for this function:

◆ GetFloorRange()

void SBS::DispatchController::GetFloorRange ( )
private

◆ GetRecallFloor()

int SBS::DispatchController::GetRecallFloor ( )

Definition at line 1279 of file controller.cpp.

References Elevators, SBS::SBS::GetElevator(), SBS::Elevator::GetRecallFloor(), and SBS::ObjectBase::sbs.

Referenced by SBS::CallStation::GetRecallFloor().

Here is the call graph for this function:

◆ GetTopFloor()

int SBS::DispatchController::GetTopFloor ( )

Definition at line 1332 of file controller.cpp.

References top_floor.

Referenced by SBS::CallStation::CreateCallButtons().

◆ IsElevatorAssigned()

bool SBS::DispatchController::IsElevatorAssigned ( int number,
int destination_floor,
int direction )

Definition at line 944 of file controller.cpp.

References Elevators, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.

Here is the call graph for this function:

◆ IsElevatorAssignedToOther()

bool SBS::DispatchController::IsElevatorAssignedToOther ( int number,
int destination_floor,
int direction )

Definition at line 980 of file controller.cpp.

References Elevators, SBS::SBS::GetPower(), Range, and SBS::ObjectBase::sbs.

Referenced by FindClosestElevator().

Here is the call graph for this function:

◆ IsServicedFloor()

bool SBS::DispatchController::IsServicedFloor ( int floor)

Definition at line 1181 of file controller.cpp.

References Elevators, SBS::SBS::GetElevator(), SBS::Elevator::IsServicedFloor(), and SBS::ObjectBase::sbs.

Referenced by CallElevator(), and RequestRoute().

Here is the call graph for this function:

◆ Loop()

void SBS::DispatchController::Loop ( )
virtual

Reimplemented from SBS::Object.

Definition at line 64 of file controller.cpp.

References CheckArrivals(), SBS::SBS::GetPower(), ProcessRoutes(), and SBS::ObjectBase::sbs.

Here is the call graph for this function:

◆ ProcessRoutes()

◆ RegisterCallStation()

void SBS::DispatchController::RegisterCallStation ( CallStation * station)

Definition at line 1059 of file controller.cpp.

References CallStations, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.

Referenced by SBS::CallStation::SetController().

Here is the call graph for this function:

◆ RemoveElevator()

bool SBS::DispatchController::RemoveElevator ( int elevator)

◆ RemoveRoute()

void SBS::DispatchController::RemoveRoute ( const Route & route)
private

◆ Report()

void SBS::DispatchController::Report ( const std::string & message)
virtual

◆ ReportError()

bool SBS::DispatchController::ReportError ( const std::string & message)
virtual

Reimplemented from SBS::ObjectBase.

Definition at line 839 of file controller.cpp.

References Number, SBS::ObjectBase::ReportError(), and SBS::ToString().

Referenced by CallElevator(), and RequestRoute().

Here is the call graph for this function:

◆ RequestRoute()

◆ ResetArrival()

void SBS::DispatchController::ResetArrival ( int number)

Definition at line 1259 of file controller.cpp.

References Elevators, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.

Referenced by SBS::Elevator::MoveElevatorToFloor(), and SBS::Elevator::SameFloorArrival().

Here is the call graph for this function:

◆ SameElevators()

bool SBS::DispatchController::SameElevators ( const std::vector< int > & elevators)

Definition at line 1349 of file controller.cpp.

References Elevators, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.

Referenced by Skyscraper::ScriptProcessor::FloorSection::Run().

Here is the call graph for this function:

◆ ServesFloor()

bool SBS::DispatchController::ServesFloor ( int floor)

Definition at line 1404 of file controller.cpp.

References Elevators, SBS::SBS::GetElevator(), SBS::SBS::GetPower(), SBS::Elevator::IsServicedFloor(), and SBS::ObjectBase::sbs.

Referenced by SBS::Floor::AddCallButtons().

Here is the call graph for this function:

◆ ServicesElevator()

bool SBS::DispatchController::ServicesElevator ( int elevator)

Definition at line 657 of file controller.cpp.

References Elevators, SBS::SBS::GetPower(), Report(), SBS::ObjectBase::sbs, SBS::ToString(), and SBS::SBS::Verbose.

Referenced by SBS::CallStation::ServicesElevator().

Here is the call graph for this function:

◆ UnregisterCallStation()

void SBS::DispatchController::UnregisterCallStation ( CallStation * station)

Definition at line 1077 of file controller.cpp.

References CallStations, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.

Referenced by SBS::CallStation::~CallStation().

Here is the call graph for this function:

Member Data Documentation

◆ bottom_floor

int SBS::DispatchController::bottom_floor
private

Definition at line 85 of file controller.h.

Referenced by DispatchController(), GetBottomFloor(), and GetFloorRange().

◆ CallStations

std::vector<CallStation*> SBS::DispatchController::CallStations
private

Definition at line 123 of file controller.h.

Referenced by GetCallStations(), RegisterCallStation(), and UnregisterCallStation().

◆ DestinationDispatch

◆ Elevators

◆ Hybrid

bool SBS::DispatchController::Hybrid

◆ MaxPassengers

int SBS::DispatchController::MaxPassengers

◆ Name

std::string SBS::DispatchController::Name

◆ Number

int SBS::DispatchController::Number

◆ Range

int SBS::DispatchController::Range

◆ recheck

int SBS::DispatchController::recheck
private

Definition at line 125 of file controller.h.

Referenced by DispatchController(), and ProcessRoutes().

◆ Reprocess

bool SBS::DispatchController::Reprocess

◆ Routes

std::vector<Route> SBS::DispatchController::Routes
private

◆ top_floor

int SBS::DispatchController::top_floor
private

Definition at line 86 of file controller.h.

Referenced by DispatchController(), GetFloorRange(), and GetTopFloor().


The documentation for this class was generated from the following files: