CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
VantagePoints.h
Go to the documentation of this file.
1
8#if !defined(_VANTAGEPOINTS_H_)
9#define _VANTAGEPOINTS_H_
10
11#include "MathClasses.h"
12#include "Utils.h"
13#include "xml_parser.h"
14
15namespace cmlabs {
16
18enum PerchState { FREE = 0, RESERVED = 1, OCCUPIED = 2, LEAVING = 3 };
20enum VantageState { IDLE = 0, INMOTION = 1, SETTLED = 2 };
21
23struct PerchPoint {
24 uint32 id;
26 uint32 entityID;
27 uint64 lastVisit;
28 std::string label;
29 std::string data;
30 std::vector<double> overlaps;
31};
32
35public:
38
40 bool init(const char* xml);
42 bool init(XMLNode node);
44 uint32 reserveNextPoint(uint32 entityID);
46 bool occupyPoint(uint32 id, uint32 entityID);
48 bool freePoint(uint32 id, uint32 entityID);
49
51 const char* getPointData(uint32 id);
53 const char* getPointLabel(uint32 id);
54
56 static bool UnitTest();
57
58 uint32 count;
60
61private:
62 std::map<uint32, PerchPoint> points;
63 uint32* inUseMap;
64 uint64 intrinsicTimescaleMS;
65 int32 timeoutMS;
66 uint64 motionStartedTime;
67};
68
69} // namespace cmlabs
70
71#endif //_VANTAGEPOINTS_H_
72
Geometry and 2D/3D math value classes: Color, Size, Point, PointFloat, Line, PolyLine,...
Cross-platform utility toolbox for CMSDK: threading, synchronization, shared memory,...
VantageState state
Current system state.
bool occupyPoint(uint32 id, uint32 entityID)
Mark a reserved point as occupied.
static bool UnitTest()
Self test.
const char * getPointData(uint32 id)
Opaque data string attached to a point in the XML.
const char * getPointLabel(uint32 id)
Label of a point.
uint32 count
Number of perch points.
uint32 reserveNextPoint(uint32 entityID)
Reserve the best available (least-overlapping free) point for an entity.
bool freePoint(uint32 id, uint32 entityID)
Release a point held by entityID.
bool init(const char *xml)
Parse the configuration from XML text.
PerchState
Lifecycle of a perch point: FREE, RESERVED (claimed, not yet reached), OCCUPIED, LEAVING (being vacat...
VantageState
State of the whole vantage system: IDLE, INMOTION (reconfiguring) or SETTLED.
One perch: id, occupancy state, occupying entity, last-visit time, label, opaque data and overlap wei...
std::vector< double > overlaps
Small recursive XML DOM parser (XMLNode) used by CMSDK for all PsySpec XML parsing.