Skyscraper 2.0
SBS::Person Class Reference

#include <person.h>

Inheritance diagram for SBS::Person:
Collaboration diagram for SBS::Person:

Classes

struct  RouteEntry
 
class  Timer
 

Public Member Functions

 Person (Object *parent, const std::string &name, int floor, bool service_access=false)
 
 ~Person ()
 
void GotoFloor (int floor)
 
void Loop ()
 
void ProcessRoute ()
 
void Report (const std::string &message)
 
bool ReportError (const std::string &message)
 
int GetRandomFloor ()
 
bool IsRouteActive ()
 
bool IsRandomActivityEnabled ()
 
void EnableRandomActivity (bool value)
 
void SetFloor (int value)
 
int GetFloor ()
 
int GetDestinationFloor ()
 
void SetServiceAccess (bool value)
 
bool GetServiceAccess ()
 
void Stop ()
 
std::string GetStatus ()
 
- 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

RandomGenrnd_time
 
RandomGenrnd_dest
 
- 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 Attributes

int current_floor
 
int dest_floor
 
bool service_access
 
std::vector< RouteEntryroute
 
Timerrandom_timer
 
int RandomProbability
 
Real RandomFrequency
 

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 person.h.

Constructor & Destructor Documentation

◆ Person()

SBS::Person::Person ( Object * parent,
const std::string & name,
int floor,
bool service_access = false )

◆ ~Person()

SBS::Person::~Person ( )

Definition at line 75 of file person.cpp.

References SBS::SBS::FastDelete, SBS::Object::parent_deleting, random_timer, SBS::SBS::RemovePerson(), rnd_dest, rnd_time, SBS::ObjectBase::sbs, and Stop().

Here is the call graph for this function:

Member Function Documentation

◆ EnableRandomActivity()

void SBS::Person::EnableRandomActivity ( bool value)

Definition at line 101 of file person.cpp.

References random_timer, RandomFrequency, Report(), SBS::TimerObject::Start(), and SBS::TimerObject::Stop().

Referenced by SBS::SBS::EnableRandomActivity(), and Skyscraper::PeopleManager::On_chkRandom_Click().

Here is the call graph for this function:

◆ GetDestinationFloor()

int SBS::Person::GetDestinationFloor ( )
inline

Definition at line 49 of file person.h.

Referenced by Skyscraper::PeopleManager::Loop().

◆ GetFloor()

int SBS::Person::GetFloor ( )
inline

Definition at line 48 of file person.h.

Referenced by Skyscraper::PeopleManager::Loop().

◆ GetRandomFloor()

int SBS::Person::GetRandomFloor ( )

Definition at line 116 of file person.cpp.

References SBS::SBS::Basements, SBS::RandomGen::Get(), SBS::SBS::GetTotalFloors(), rnd_dest, and SBS::ObjectBase::sbs.

Referenced by SBS::Person::Timer::Notify().

Here is the call graph for this function:

◆ GetServiceAccess()

bool SBS::Person::GetServiceAccess ( )
inline

Definition at line 51 of file person.h.

Referenced by Skyscraper::PeopleManager::Loop().

◆ GetStatus()

std::string SBS::Person::GetStatus ( )

◆ GotoFloor()

◆ IsRandomActivityEnabled()

bool SBS::Person::IsRandomActivityEnabled ( )

Definition at line 508 of file person.cpp.

References SBS::TimerObject::IsRunning(), and random_timer.

Referenced by Skyscraper::PeopleManager::Loop().

Here is the call graph for this function:

◆ IsRouteActive()

bool SBS::Person::IsRouteActive ( )
inline

◆ Loop()

void SBS::Person::Loop ( )
virtual

Reimplemented from SBS::Object.

Definition at line 172 of file person.cpp.

References ProcessRoute(), and SBS_PROFILE.

Here is the call graph for this function:

◆ ProcessRoute()

◆ Report()

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

Reimplemented from SBS::ObjectBase.

Definition at line 401 of file person.cpp.

References SBS::ObjectBase::GetName(), and SBS::ObjectBase::Report().

Referenced by EnableRandomActivity(), GotoFloor(), ProcessRoute(), and SetFloor().

Here is the call graph for this function:

◆ ReportError()

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

Reimplemented from SBS::ObjectBase.

Definition at line 407 of file person.cpp.

References SBS::ObjectBase::GetName(), and SBS::ObjectBase::ReportError().

Here is the call graph for this function:

◆ SetFloor()

void SBS::Person::SetFloor ( int value)

Definition at line 425 of file person.cpp.

References current_floor, SBS::SBS::GetFloor(), IsRouteActive(), Report(), SBS::ObjectBase::sbs, and SBS::ToString().

Referenced by Skyscraper::PeopleManager::On_bSetFloor_Click(), and Person().

Here is the call graph for this function:

◆ SetServiceAccess()

void SBS::Person::SetServiceAccess ( bool value)
inline

Definition at line 50 of file person.h.

Referenced by Skyscraper::PeopleManager::On_chkService_Click().

◆ Stop()

void SBS::Person::Stop ( )

Definition at line 437 of file person.cpp.

References route.

Referenced by Skyscraper::PeopleManager::On_bStop_Click(), ProcessRoute(), and ~Person().

Member Data Documentation

◆ current_floor

int SBS::Person::current_floor
private

Definition at line 67 of file person.h.

Referenced by GetStatus(), GotoFloor(), Person(), ProcessRoute(), and SetFloor().

◆ dest_floor

int SBS::Person::dest_floor
private

Definition at line 68 of file person.h.

Referenced by GotoFloor(), Person(), and ProcessRoute().

◆ random_timer

Timer* SBS::Person::random_timer
private

Definition at line 75 of file person.h.

Referenced by EnableRandomActivity(), IsRandomActivityEnabled(), Person(), and ~Person().

◆ RandomFrequency

Real SBS::Person::RandomFrequency
private

Definition at line 78 of file person.h.

Referenced by EnableRandomActivity(), and Person().

◆ RandomProbability

int SBS::Person::RandomProbability
private

Definition at line 77 of file person.h.

Referenced by SBS::Person::Timer::Notify(), and Person().

◆ rnd_dest

RandomGen * SBS::Person::rnd_dest

Definition at line 33 of file person.h.

Referenced by GetRandomFloor(), Person(), and ~Person().

◆ rnd_time

RandomGen* SBS::Person::rnd_time

Definition at line 33 of file person.h.

Referenced by SBS::Person::Timer::Notify(), Person(), and ~Person().

◆ route

std::vector<RouteEntry> SBS::Person::route
private

Definition at line 70 of file person.h.

Referenced by GetStatus(), GotoFloor(), ProcessRoute(), and Stop().

◆ service_access

bool SBS::Person::service_access
private

Definition at line 69 of file person.h.

Referenced by GotoFloor(), and Person().


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