|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Registry of perch points parsed from PsySpec XML, with reserve/occupy/free bookkeeping. More...
#include <VantagePoints.h>
Public Member Functions | |
| VantagePoints () | |
| ~VantagePoints () | |
| bool | init (const char *xml) |
| Parse the configuration from XML text. | |
| bool | init (XMLNode node) |
| Parse the configuration from an already-parsed XML node. | |
| uint32 | reserveNextPoint (uint32 entityID) |
| Reserve the best available (least-overlapping free) point for an entity. | |
| bool | occupyPoint (uint32 id, uint32 entityID) |
| Mark a reserved point as occupied. | |
| bool | freePoint (uint32 id, uint32 entityID) |
Release a point held by entityID. | |
| const char * | getPointData (uint32 id) |
| Opaque data string attached to a point in the XML. | |
| const char * | getPointLabel (uint32 id) |
| Label of a point. | |
Static Public Member Functions | |
| static bool | UnitTest () |
| Self test. | |
Public Attributes | |
| uint32 | count |
| Number of perch points. | |
| VantageState | state |
| Current system state. | |
Registry of perch points parsed from PsySpec XML, with reserve/occupy/free bookkeeping.
Definition at line 34 of file VantagePoints.h.
| cmlabs::VantagePoints::VantagePoints | ( | ) |
Definition at line 7 of file VantagePoints.cpp.
References count, cmlabs::IDLE, and state.
Referenced by UnitTest().
| cmlabs::VantagePoints::~VantagePoints | ( | ) |
Definition at line 16 of file VantagePoints.cpp.
| bool cmlabs::VantagePoints::freePoint | ( | uint32 | id, |
| uint32 | entityID ) |
Release a point held by entityID.
| id | Point id. |
| entityID | Holder. |
Definition at line 223 of file VantagePoints.cpp.
References count, cmlabs::PerchPoint::entityID, cmlabs::FREE, cmlabs::RESERVED, cmlabs::SETTLED, cmlabs::PerchPoint::state, and state.
Referenced by UnitTest().
| const char * cmlabs::VantagePoints::getPointData | ( | uint32 | id | ) |
Opaque data string attached to a point in the XML.
| id | Point id. |
Definition at line 117 of file VantagePoints.cpp.
References count, and cmlabs::PerchPoint::data.
Referenced by UnitTest().
| const char * cmlabs::VantagePoints::getPointLabel | ( | uint32 | id | ) |
Label of a point.
| id | Point id. |
Definition at line 124 of file VantagePoints.cpp.
References count, and cmlabs::PerchPoint::label.
Referenced by UnitTest().
| bool cmlabs::VantagePoints::init | ( | const char * | xml | ) |
Parse the configuration from XML text.
| xml | PsySpec XML. |
Definition at line 19 of file VantagePoints.cpp.
References cmlabs::XMLResults::error, cmlabs::eXMLErrorNone, and init().
Referenced by init(), and UnitTest().
| bool cmlabs::VantagePoints::init | ( | XMLNode | node | ) |
Parse the configuration from an already-parsed XML node.
| node | Configuration node. |
Definition at line 38 of file VantagePoints.cpp.
References cmlabs::utils::Ascii2Float64(), cmlabs::utils::Ascii2Uint32(), count, cmlabs::PerchPoint::data, cmlabs::PerchPoint::entityID, cmlabs::FREE, cmlabs::XMLNode::getAttribute(), cmlabs::XMLNode::getChildNode(), cmlabs::GetTimeNow(), cmlabs::PerchPoint::id, cmlabs::PerchPoint::label, cmlabs::PerchPoint::lastVisit, LogPrint, cmlabs::XMLNode::nChildNode(), cmlabs::PerchPoint::overlaps, cmlabs::PerchPoint::state, and cmlabs::utils::TextListSplit().
| bool cmlabs::VantagePoints::occupyPoint | ( | uint32 | id, |
| uint32 | entityID ) |
Mark a reserved point as occupied.
| id | Point id. |
| entityID | Must match the reserving entity. |
Definition at line 207 of file VantagePoints.cpp.
References count, cmlabs::PerchPoint::entityID, cmlabs::OCCUPIED, cmlabs::RESERVED, cmlabs::SETTLED, cmlabs::PerchPoint::state, and state.
Referenced by UnitTest().
| uint32 cmlabs::VantagePoints::reserveNextPoint | ( | uint32 | entityID | ) |
Reserve the best available (least-overlapping free) point for an entity.
| entityID | Claiming entity. |
Definition at line 132 of file VantagePoints.cpp.
References count, cmlabs::PerchPoint::entityID, cmlabs::FREE, cmlabs::GetTimeAgeMS(), cmlabs::GetTimeNow(), cmlabs::PerchPoint::id, cmlabs::IDLE, cmlabs::INMOTION, cmlabs::PerchPoint::lastVisit, cmlabs::PerchPoint::overlaps, cmlabs::RESERVED, cmlabs::PerchPoint::state, and state.
Referenced by UnitTest().
|
static |
Self test.
Definition at line 242 of file VantagePoints.cpp.
References count, cmlabs::unittest::detail(), cmlabs::unittest::fail(), freePoint(), getPointData(), getPointLabel(), cmlabs::GetTimeNow(), cmlabs::IDLE, init(), cmlabs::INMOTION, cmlabs::unittest::metric(), occupyPoint(), cmlabs::unittest::progress(), reserveNextPoint(), cmlabs::SETTLED, state, and VantagePoints().
Referenced by cmlabs::Register_VantagePoints_Tests().
| uint32 cmlabs::VantagePoints::count |
Number of perch points.
Definition at line 58 of file VantagePoints.h.
Referenced by freePoint(), getPointData(), getPointLabel(), init(), occupyPoint(), reserveNextPoint(), UnitTest(), and VantagePoints().
| VantageState cmlabs::VantagePoints::state |
Current system state.
Definition at line 59 of file VantagePoints.h.
Referenced by freePoint(), occupyPoint(), reserveNextPoint(), UnitTest(), and VantagePoints().