CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
PsyAPI.h
Go to the documentation of this file.
1
25#if !defined(_PSYAPI_H_)
26#define _PSYAPI_H_
27
28#include "MemoryManager.h"
29#include "PsyTime.h"
30#include "xml_parser.h"
31#include "DataMessage.h"
32#include "Subscriptions.h"
33#include "PsySpace.h"
34
38#define CRANKAPI_FAILED 1
39#define CRANKAPI_INUSE 2
40#define CRANKAPI_RUNNING 3
41#define CRANKAPI_IDLE 4
43
47#define POST_FAILED -1
48#define POST_NOSPEC -2
49#define POST_OUTOFCONTEXT -3
51
55#define QUERY_FAILED 1
56#define QUERY_TIMEOUT 2
57#define QUERY_NAME_UNKNOWN 3
58#define QUERY_COMPONENT_UNKNOWN 4
59#define QUERY_QUERYFAILED 5
60#define QUERY_SUCCESS 6
61#define QUERY_NOT_AVAILABLE 7
62#define QUERY_NOT_REACHABLE 8
64
65namespace cmlabs {
66
68#define LOG_COMPONENT 8
69
71typedef std::pair<DataMessage*, DataMessage*> TriggerAndMessage;
72
82class PsyAPI {
83 friend class PsySpace;
84public:
85
90 static struct PsyType CTRL_SYSTEM_READY;
97 static struct PsyType CTRL_TRIGGER;
99 static struct PsyType CTRL_QUERY;
100 static struct PsyType CTRL_QUERY_REPLY;
108
109 // ***************** Constructors *****************
110 // Create and destroy resources
111
121 PsyAPI(PsySpace* space);
129 ~PsyAPI();
130
138 static PsyAPI* fromPython(unsigned long long ptr);
140 static const char* fromPythonAddressOf(unsigned long long ptr);
141
145 bool setAutoDelete(bool autodel);
146
147 // ***************** System & Status *****************
148 // All system calls
149 // Get or set status info
150
154 bool isRunning();
155
178 bool shouldContinue();
185 bool getModuleName(char* name, uint32 maxSize);
190 std::string getCommandlineBasedir();
194 bool setCommandlineBasedir(const char* cmdlineBasedir);
200 std::string getModuleName();
206 std::string getOtherModuleName(uint32 id);
212 uint32 getInputQueueSize();
218 std::string typeToText(PsyType type);
224 std::string contextToText(PsyContext context);
228 bool getCurrentScriptLanguage(char* language, uint32 maxSize);
232 bool getCurrentScript(char* script, uint32 maxSize);
236 bool getCurrentScriptFilename(char* filename, uint32 maxSize);
240 std::string getCurrentScriptLanguage();
244 std::string getCurrentScript();
248 std::string getCurrentScriptFilename();
253 std::set<std::string> getCurrentPostNames();
254
259 bool hasCurrentSignalName(const char* name);
260
265 bool hasCurrentQueryName(const char* name);
266
271 bool hasCurrentRetrieveName(const char* name);
272
277 bool hasCurrentPostName(const char* name);
278
279 // ***************** Subscription *****************
280 // Get or delete current subscriptions
281 // Create new subscription
282 // *** Not implemented yet
283
284
285
286 // ***************** Tags *****************
287 // Create, destroy or get info about tags
288 // *** Not implemented yet
289
290
291
292
293 // ***************** Messaging *****************
337 DataMessage* waitForNewMessage(uint32 ms);
338
349 std::map<std::string, DataMessage*> waitForNewMessageGroup(uint32 ms, std::string& groupName);
350
351
357 std::string getCurrentTriggerName();
358
364
365
381 DataMessage* waitForNewMessage(uint32 ms, const char* &triggerName);
394
396
397 // Post output messages
435 int32 postOutputMessage(const char* postName = NULL, DataMessage* msg = NULL);
436
437 // Post output messages
452 int32 postOutputMessage(PsyType msgType, DataMessage* msg = NULL);
453
454
455 // ***************** Signals *****************
474 bool emitSignal(const char* name, DataMessage* msg = NULL);
500 DataMessage* waitForSignal(const char* name, uint32 timeout, uint64 lastReceivedTime = 0);
501
502
509 return space->manager->retrieveAllSystemIDs();
510 }
511
512
520 bool addSubscription(const char* xml);
521
522
523 // ***************** PsyProbe plugins *****************
534 bool addPsyProbeCustomView(const char* name, const char* templateURL);
544 bool removePsyProbeCustomView(const char* name) {
545 return addPsyProbeCustomView(name, "");
546 }
547
548 // ***************** Own Data *****************
549 // Load, save or delete own persistent data
577
578 bool setPrivateData(const char* name, const char* data, uint64 size, const char* mimetype = NULL) {
579 return space->manager->componentMemory->setPrivateData(currentCompID, name, data, size, mimetype);
580 }
581
589 uint64 getPrivateDataSize(const char* name) {
590 return space->manager->componentMemory->getPrivateDataSize(currentCompID, name);
591 }
592
599 char* getPrivateDataCopy(const char* name, uint64 &size) {
600 return space->manager->componentMemory->getPrivateDataCopy(currentCompID, name, size);
601 }
602
612 bool getPrivateData(const char* name, char* data, uint64 maxSize) {
613 return space->manager->componentMemory->getPrivateData(currentCompID, name, data, maxSize);
614 }
615
623 bool deletePrivateData(const char* name) {
624 return space->manager->componentMemory->deletePrivateData(currentCompID, name);
625 }
626
627 // ***************** Own Parameters *****************
628 // Get, set, reset, create or destroy own parameters
651 bool createParameter(const char* name, const char* val, const char* defaultValue = NULL) {
652 return space->manager->componentMemory->createParameter(currentCompID, name, val, defaultValue);
653 }
654
665 bool createParameter(const char* name, const char* val, uint32 count, uint32 defaultIndex) {
666 return space->manager->componentMemory->createParameter(currentCompID, name, val, count, defaultIndex);
667 }
668
678 bool createParameter(const char* name, std::vector<std::string> values, const char* defaultValue = NULL) {
679 return space->manager->componentMemory->createParameter(currentCompID, name, values, defaultValue);
680 }
681
692 bool createParameter(const char* name, int64* val, uint32 count, uint32 defaultIndex) {
693 return space->manager->componentMemory->createParameter(currentCompID, name, val, count, defaultIndex);
694 }
695
705 bool createParameter(const char* name, std::vector<std::string> values, int64 defaultValue) {
706 return space->manager->componentMemory->createParameter(currentCompID, name, values, defaultValue);
707 }
708
718 bool createParameter(const char* name, std::vector<int64> values, int64 defaultValue = 0) {
719 return space->manager->componentMemory->createParameter(currentCompID, name, values, defaultValue);
720 }
721
732 bool createParameter(const char* name, float64* val, uint32 count, uint32 defaultIndex) {
733 return space->manager->componentMemory->createParameter(currentCompID, name, val, count, defaultIndex);
734 }
735
745 bool createParameter(const char* name, std::vector<std::string> values, float64 defaultValue) {
746 return space->manager->componentMemory->createParameter(currentCompID, name, values, defaultValue);
747 }
748
758 bool createParameter(const char* name, std::vector<float64> values, float64 defaultValue = 0) {
759 return space->manager->componentMemory->createParameter(currentCompID, name, values, defaultValue);
760 }
761
773 bool createParameter(const char* name, int64 val, int64 min = 0, int64 max = 0, int64 interval = 0) {
774 return space->manager->componentMemory->createParameter(currentCompID, name, val, min, max, interval);
775 }
776
788 bool createParameter(const char* name, float64 val, float64 min = 0, float64 max = 0, float64 interval = 0) {
789 return space->manager->componentMemory->createParameter(currentCompID, name, val, min, max, interval);
790 }
791
799 bool hasParameter(const char* name) {
800 return space->manager->componentMemory->hasParameter(currentCompID, name);
801 }
802
810 bool deleteParameter(const char* name) {
811 return space->manager->componentMemory->deleteParameter(currentCompID, name);
812 }
813
835 uint8 getParameterDataType(const char* name) {
836 return space->manager->componentMemory->getParameterDataType(currentCompID, name);
837 }
838
846 uint32 getParameterValueSize(const char* name) {
847 return space->manager->componentMemory->getParameterValueSize(currentCompID, name);
848 }
849
859 bool getParameter(const char* name, char* val, uint32 maxSize) {
860 return space->manager->componentMemory->getParameter(currentCompID, name, val, maxSize);
861 }
862
870 std::string getParameterString(const char* name) {
871 return space->manager->componentMemory->getParameterString(currentCompID, name);
872 }
873
883 bool getParameterAsBool(const char* name) {
884 return space->manager->componentMemory->getParameterAsBool(currentCompID, name);
885 }
886
894 int64 getParameterInt(const char* name) {
895 return space->manager->componentMemory->getParameterInt(currentCompID, name);
896 }
897
905 float64 getParameterFloat(const char* name) {
906 return space->manager->componentMemory->getParameterFloat(currentCompID, name);
907 }
908
917 bool getParameter(const char* name, int64& val) {
918 return space->manager->componentMemory->getParameter(currentCompID, name, val);
919 }
920
929 bool getParameter(const char* name, float64& val) {
930 return space->manager->componentMemory->getParameter(currentCompID, name, val);
931 }
932
941 bool setParameter(const char* name, const char* val) {
942 return space->manager->componentMemory->setParameter(currentCompID, name, val);
943 }
944
953 bool setParameter(const char* name, int64 val) {
954 return space->manager->componentMemory->setParameter(currentCompID, name, val);
955 }
956
965 bool setParameter(const char* name, float64 val) {
966 return space->manager->componentMemory->setParameter(currentCompID, name, val);
967 }
968
976 bool resetParameter(const char* name) {
977 return space->manager->componentMemory->resetParameter(currentCompID, name);
978 }
979
989 bool tweakParameter(const char* name, int32 tweak) {
990 return space->manager->componentMemory->tweakParameter(currentCompID, name, tweak);
991 }
992
993 // ***************** Other Modules' Parameters *****************
994 // Get, set or reset other module's parameters
995 // *** Not implemented yet
996
997
998
999 // ***************** Queries *****************
1000 // Query a Data storage devices (Whiteboard, Stream, Catalogue) for data
1001 // Named queries in PsySpec may be used
1031 uint8 retrieve(std::list<DataMessage*> &result, const char* name, uint32 maxcount = 0, uint32 maxage = 0, uint32 timeout = 5000);
1046 uint8 retrieveTimeParam(std::list<DataMessage*> &result, const char* name, uint64 startTime, uint64 endTime = 0, uint32 maxcount = 0, uint32 maxage = 0, uint32 timeout = 5000);
1061 uint8 retrieveStringParam(std::list<DataMessage*> &result, const char* name, const char* startString, const char* endString = NULL, uint32 maxcount = 0, uint32 maxage = 0, uint32 timeout = 5000);
1076 uint8 retrieveIntegerParam(std::list<DataMessage*> &result, const char* name, int64 startInteger, int64 endInteger = INT64_NOVALUE, uint32 maxcount = 0, uint32 maxage = 0, uint32 timeout = 5000);
1091 uint8 retrieveFloatParam(std::list<DataMessage*> &result, const char* name, float64 startFloat, float64 endFloat = FLOAT64_NOVALUE, uint32 maxcount = 0, uint32 maxage = 0, uint32 timeout = 5000);
1100 uint8 retrieve(std::list<DataMessage*> &result, RetrieveSpec* spec, uint32 timeout = 5000);
1101
1133 uint8 queryCatalog(char** result, uint32 &resultsize, const char* name, const char* query, const char* operation = NULL, const char* data = NULL, uint32 datasize = 0, uint32 timeout = 5000);
1134
1161 uint8 queryCatalog(DataMessage** resultMsg, const char* name, DataMessage* msg, uint32 timeout = 5000);
1162
1179 uint8 queryRemoteCatalog(DataMessage** resultMsg, const char* componentName, const char* ipAddress, uint16 port, DataMessage* msg, uint32 timeout = 5000);
1180
1193 uint8 queryRemoteCatalog(DataMessage** resultMsg, const char* componentName, uint32 ipAddress, uint16 port, DataMessage* msg, uint32 timeout = 5000);
1194
1215 uint8 queryRemoteCatalog(DataMessage** resultMsg, uint32& chosenAddress, const char* componentName, uint32* ipAddresses, uint32 numAddresses, uint16 port, DataMessage* msg, uint32 timeout = 5000);
1216
1246 bool queryReply(uint32 id, uint8 status, char* data, uint32 size, uint32 count);
1255 bool queryReply(uint32 id, uint8 status, DataMessage* msg = NULL);
1256
1257 // ***************** Performance *****************
1258 // For querying about performance
1259 // *** Not implemented yet
1260
1261
1262
1263 // ***************** Monitoring *****************
1264 // For providing custom data to monitoring tools
1265 // *** Not implemented yet
1266
1267
1268
1269 // ***************** Supervisor *****************
1270 // API for supervisor modules
1271 // *** Not implemented yet
1272
1273
1283 bool logPrint(int level, const char *formatstring, ... );
1284
1285private:
1286 PsySpace* space;
1287 utils::Mutex apiMutex;
1288 uint64 startedRunning;
1289 bool shouldContinueRunning;
1290 uint32 currentCrankID;
1291 uint32 currentCompID;
1292 uint32 msgReceivedCount;
1293 uint32 msgInputCount;
1294 uint32 msgSentCount;
1295 uint32 msgPostedCount;
1296 uint64 lastCPUTicks;
1297 uint64 lastWallTime;
1298 uint32 chainCPUTicks;
1299 uint32 chainWallTime;
1300 uint32 chainCount;
1301
1302 std::queue<TriggerAndMessage> inputQueue;
1303 utils::Semaphore inputQueueSemaphore;
1304
1305 bool autoDelete;
1306 DataMessage* currentTriggerMsg;
1307 DataMessage* currentMsg;
1308 std::map<std::string, DataMessage*> currentGroupMap; // T1.6: member messages of the current joined set (owned; freed on next wait)
1309 DataMessage* currentSignalMsg;
1310 TriggerSpec* currentTriggerSpec;
1311 char currentTriggerName[MAXKEYNAMELEN+1];
1312 char commandlineBasedir[MAXCOMMANDLINELEN + 1];
1313
1314 // Only called by PsySpace
1318 uint64 checkLastWaitForMessage();
1322 uint8 addInputTrigger(uint32 crankID, uint32 compID, DataMessage* trigger, DataMessage* msg);
1325 uint8 claimForWake(uint32 crankID, uint32 compID);
1329 bool begin();
1333 bool finish();
1337 bool stop();
1338
1339 // added at the end (16 Nov 2026) so that the offsets of the members above stay the same for module libraries
1340 // built against an older PsyAPI.h (their inline methods read them)
1341 uint64 lastPauseCheck; // when shouldContinue() last read the component's COMPONENT_PAUSED flag
1342 bool pausedSeen;
1343};
1344
1345} // namespace cmlabs
1346
1347#endif //_PSYAPI_H_
1348
The binary DataMessage container — the central data-exchange object of Psyclone/CMSDK.
Central shared-memory manager for a Psyclone node: master segment, per-subsystem shared maps and the ...
The PsySpace process/node context: the runtime container in which Psyclone components (cranks) live a...
CMSDK time: µs-resolution 64-bit timestamps and the Time Mapping Constant (TMC).
Subscription, trigger, retrieval, query, post and signal specifications — the declarative wiring of a...
#define FLOAT64_NOVALUE
Definition Types.h:81
#define INT64_NOVALUE
Definition Types.h:80
#define MAXKEYNAMELEN
Definition Utils.h:85
#define MAXCOMMANDLINELEN
Definition Utils.h:88
The central Psyclone data container: a self-contained binary message with typed, named user entries.
bool setAutoDelete(bool autodel)
Internal use only.
Definition PsyAPI.cpp:586
static struct PsyType CTRL_CONTEXT_CHANGE
Announces a system context change.
Definition PsyAPI.h:94
static struct PsyType CTRL_PROCESS_INITIALISE
Sent to a process to initialise it.
Definition PsyAPI.h:91
bool createParameter(const char *name, std::vector< std::string > values, float64 defaultValue)
Creates a new string parameter with list of float values (?).
Definition PsyAPI.h:745
static const char * fromPythonAddressOf(unsigned long long ptr)
Internal use only — debug helper returning a printable address string for a Python-held pointer.
Definition PsyAPI.cpp:80
PsyContext getCurrentTriggerContext()
Get the context of the current trigger, just retrieved using waitForNewMessage().
Definition PsyAPI.cpp:426
bool removePsyProbeCustomView(const char *name)
Remove a custom module view tab for the PsyProbe 1.x web interface.
Definition PsyAPI.h:544
bool deleteParameter(const char *name)
Deletes a named parameter.
Definition PsyAPI.h:810
PsyAPI(PsySpace *space)
Constructor from a PsySpace.
Definition PsyAPI.cpp:30
uint8 retrieveIntegerParam(std::list< DataMessage * > &result, const char *name, int64 startInteger, int64 endInteger=INT64_NOVALUE, uint32 maxcount=0, uint32 maxage=0, uint32 timeout=5000)
Used by a module to retrieve messages from a whiteboard.
Definition PsyAPI.cpp:910
bool createParameter(const char *name, const char *val, uint32 count, uint32 defaultIndex)
Creates a new string list parameter with room for count entries.
Definition PsyAPI.h:665
bool resetParameter(const char *name)
Reset parameter to its default (or initial) value.
Definition PsyAPI.h:976
bool tweakParameter(const char *name, int32 tweak)
Step up or down list or range parameter value.
Definition PsyAPI.h:989
bool isRunning()
Internal use only.
Definition PsyAPI.cpp:84
std::string getParameterString(const char *name)
Read and return value of parameter by name.
Definition PsyAPI.h:870
bool createParameter(const char *name, std::vector< std::string > values, int64 defaultValue)
Creates a new String parameter with list of integer values (?).
Definition PsyAPI.h:705
std::string contextToText(PsyContext context)
Get textual representation of the context.
Definition PsyAPI.cpp:272
static struct PsyType CTRL_PROCESS_SHUTDOWN
Orders a single process to shut down.
Definition PsyAPI.h:93
bool createParameter(const char *name, float64 *val, uint32 count, uint32 defaultIndex)
Creates a new float parameter.
Definition PsyAPI.h:732
uint8 retrieve(std::list< DataMessage * > &result, const char *name, uint32 maxcount=0, uint32 maxage=0, uint32 timeout=5000)
Retrieve stored messages from a whiteboard, by named <retrieve> spec entry.
Definition PsyAPI.cpp:813
int64 getParameterInt(const char *name)
Read and return value of parameter by name.
Definition PsyAPI.h:894
static struct PsyType CTRL_PULLCOMPONENTDATA
Requests component data from another node.
Definition PsyAPI.h:101
static struct PsyType CTRL_TRIGGER_GROUP
T1.6: wraps a <triggergroup> joined-set delivery (member map) to a component.
Definition PsyAPI.h:98
static PsyAPI * fromPython(unsigned long long ptr)
Internal use only.
Definition PsyAPI.cpp:76
bool addSubscription(const char *xml)
This function adds triggers and posts to an existing registration.
Definition PsyAPI.cpp:1026
bool addPsyProbeCustomView(const char *name, const char *templateURL)
Add a custom module view tab for the PsyProbe 1.x web interface by providing a template file.
Definition PsyAPI.cpp:337
static struct PsyType CTRL_TRIGGER
Wraps a trigger delivery to a component.
Definition PsyAPI.h:97
~PsyAPI()
Destructor for the PsyAPI.
Definition PsyAPI.cpp:56
bool getParameter(const char *name, char *val, uint32 maxSize)
Read string parameter into existing data chunk val, maximum size maxSize.
Definition PsyAPI.h:859
std::string getCommandlineBasedir()
Get the base dir that Psyclone is running from.
Definition PsyAPI.cpp:120
int32 postOutputMessage(const char *postName=NULL, DataMessage *msg=NULL)
Post the crank's output according to the spec's post entries.
Definition PsyAPI.cpp:616
static struct PsyType CTRL_PROCESS_GREETING
Handshake from a newly joined process.
Definition PsyAPI.h:92
float64 getParameterFloat(const char *name)
Read and return value of parameter by name.
Definition PsyAPI.h:905
bool setPrivateData(const char *name, const char *data, uint64 size, const char *mimetype=NULL)
Store a named chunk of data centrally, in the system's shared component memory.
Definition PsyAPI.h:578
bool shouldContinue()
Check whether the crank should keep running, or exit its loop.
Definition PsyAPI.cpp:97
bool hasCurrentRetrieveName(const char *name)
Check to see if the retrieve name is currently active - i.e.
Definition PsyAPI.cpp:187
bool createParameter(const char *name, int64 val, int64 min=0, int64 max=0, int64 interval=0)
Creates a new integer parameter.
Definition PsyAPI.h:773
bool emitSignal(const char *name, DataMessage *msg=NULL)
Emit a signal by its spec name.
Definition PsyAPI.cpp:749
bool hasCurrentPostName(const char *name)
Check to see if the post name is currently active - i.e.
Definition PsyAPI.cpp:227
bool queryReply(uint32 id, uint8 status, char *data, uint32 size, uint32 count)
Used by a module to reply to an incoming query by id.
Definition PsyAPI.cpp:1245
static struct PsyType CTRL_SYSTEM_SHUTTINGDOWN
Broadcast while shutdown is in progress.
Definition PsyAPI.h:96
bool hasParameter(const char *name)
Checks if a named parameter exists.
Definition PsyAPI.h:799
std::map< std::string, DataMessage * > waitForNewMessageGroup(uint32 ms, std::string &groupName)
T1.6: Wait for the next <triggergroup> joined-set delivery from the input queue.
Definition PsyAPI.cpp:558
static struct PsyType CTRL_RETRIEVESYSTEMIDS
Requests the full id/name tables.
Definition PsyAPI.h:104
std::string getCurrentScript()
Internal use only.
Definition PsyAPI.cpp:161
static struct PsyType CTRL_QUERY_REPLY
Carries a query reply back to the asker.
Definition PsyAPI.h:100
bool setCommandlineBasedir(const char *cmdlineBasedir)
Internal use only.
Definition PsyAPI.cpp:124
std::string getOtherModuleName(uint32 id)
Get the name of another module by id.
Definition PsyAPI.cpp:138
DataMessage * waitForSignal(const char *name, uint32 timeout, uint64 lastReceivedTime=0)
Wait for a signal (latest-value broadcast) by its spec name.
Definition PsyAPI.cpp:781
bool setParameter(const char *name, int64 val)
Set integer parameter value.
Definition PsyAPI.h:953
static struct PsyType CTRL_SYSTEM_READY
Broadcast when the system has fully started.
Definition PsyAPI.h:90
uint8 queryCatalog(char **result, uint32 &resultsize, const char *name, const char *query, const char *operation=NULL, const char *data=NULL, uint32 datasize=0, uint32 timeout=5000)
Send a query to another module or catalog by named <query> spec entry, receiving raw bytes back.
Definition PsyAPI.cpp:1166
uint32 getInputQueueSize()
Get the size of the input queue, i.e.
Definition PsyAPI.cpp:259
static struct PsyType CTRL_INTERSYSTEM_QUERY_REPLY
Reply from a different Psyclone system.
Definition PsyAPI.h:106
uint64 getCurrentMessageReceiveTime()
Get the time the current trigger (or, failing that, the current message) was received by the system,...
Definition PsyAPI.cpp:592
bool getParameter(const char *name, int64 &val)
Read integer parameter value.
Definition PsyAPI.h:917
bool setParameter(const char *name, float64 val)
Set float parameter value.
Definition PsyAPI.h:965
DataMessage * retrieveAllSystemIDs()
This function retrieves all names for types, contexts and components.
Definition PsyAPI.h:508
bool getPrivateData(const char *name, char *data, uint64 maxSize)
Reads a private chunk from the system into existing data space, maximum size is maxSize.
Definition PsyAPI.h:612
uint8 retrieveStringParam(std::list< DataMessage * > &result, const char *name, const char *startString, const char *endString=NULL, uint32 maxcount=0, uint32 maxage=0, uint32 timeout=5000)
Used by a module to retrieve messages from a whiteboard.
Definition PsyAPI.cpp:875
bool getParameterAsBool(const char *name)
Read and interpret value of parameter by name as boolean True: String 'Yes', Integer and Float non-ze...
Definition PsyAPI.h:883
DataMessage * waitForNewMessage(uint32 ms)
Wait for the next trigger message from the component's input queue.
Definition PsyAPI.cpp:417
static struct PsyType CTRL_SYSTEM_SHUTDOWN
Orders a full system shutdown.
Definition PsyAPI.h:95
uint8 queryRemoteCatalog(DataMessage **resultMsg, const char *componentName, const char *ipAddress, uint16 port, DataMessage *msg, uint32 timeout=5000)
Send a query to a component in a different Psyclone system by hostname/IP.
Definition PsyAPI.cpp:1110
bool logPrint(int level, const char *formatstring,...)
Write a printf-style entry to the component's log (and the console when level is below the logging th...
Definition PsyAPI.cpp:1266
bool createParameter(const char *name, std::vector< float64 > values, float64 defaultValue=0)
Creates a new float parameter with list of float values (?).
Definition PsyAPI.h:758
uint64 getPrivateDataSize(const char *name)
This returns the size of the private data chunk previously saved by the crank.
Definition PsyAPI.h:589
static struct PsyType CTRL_QUERY
Carries a query to a component/catalog.
Definition PsyAPI.h:99
bool setParameter(const char *name, const char *val)
Set string parameter value.
Definition PsyAPI.h:941
std::set< std::string > getCurrentPostNames()
Get a list of post names currently active - i.e.
Definition PsyAPI.cpp:240
bool createParameter(const char *name, float64 val, float64 min=0, float64 max=0, float64 interval=0)
Creates a new float parameter with min, max and interval limits for allowed values.
Definition PsyAPI.h:788
bool createParameter(const char *name, std::vector< std::string > values, const char *defaultValue=NULL)
Creates a new string parameter with a list of values.
Definition PsyAPI.h:678
static struct PsyType CTRL_ADDSUBSCRIPTION
Adds triggers/posts to a registration at runtime.
Definition PsyAPI.h:103
friend class PsySpace
Definition PsyAPI.h:83
bool createParameter(const char *name, std::vector< int64 > values, int64 defaultValue=0)
Creates a new integer parameter with list of values.
Definition PsyAPI.h:718
bool deletePrivateData(const char *name)
Deletes a private data chunk by name.
Definition PsyAPI.h:623
bool hasCurrentQueryName(const char *name)
Check to see if the query name is currently active - i.e.
Definition PsyAPI.cpp:214
std::string getCurrentTriggerName()
Get the name of the current trigger, i.e.
Definition PsyAPI.cpp:422
uint32 getParameterValueSize(const char *name)
Return the amount of memory in bytes used by the parameter.
Definition PsyAPI.h:846
std::string getCurrentScriptFilename()
Internal use only.
Definition PsyAPI.cpp:176
static struct PsyType CTRL_INTERSYSTEM_QUERY
Query crossing to a different Psyclone system.
Definition PsyAPI.h:105
std::string typeToText(PsyType type)
Get textual representation of the type.
Definition PsyAPI.cpp:268
bool createParameter(const char *name, const char *val, const char *defaultValue=NULL)
Creates a new string parameter.
Definition PsyAPI.h:651
uint8 getParameterDataType(const char *name)
Gets the parameter type.
Definition PsyAPI.h:835
char * getPrivateDataCopy(const char *name, uint64 &size)
Returns a newly allocated copy of a private data entry, with the size written into size.
Definition PsyAPI.h:599
bool createParameter(const char *name, int64 *val, uint32 count, uint32 defaultIndex)
Creates a new integer list parameter with room for count entries.
Definition PsyAPI.h:692
uint8 retrieveFloatParam(std::list< DataMessage * > &result, const char *name, float64 startFloat, float64 endFloat=FLOAT64_NOVALUE, uint32 maxcount=0, uint32 maxage=0, uint32 timeout=5000)
Used by a module to retrieve messages from a whiteboard.
Definition PsyAPI.cpp:945
std::string getModuleName()
Get the module name.
Definition PsyAPI.cpp:134
uint8 retrieveTimeParam(std::list< DataMessage * > &result, const char *name, uint64 startTime, uint64 endTime=0, uint32 maxcount=0, uint32 maxage=0, uint32 timeout=5000)
Used by a module to retrieve messages from a whiteboard.
Definition PsyAPI.cpp:841
bool hasCurrentSignalName(const char *name)
Check to see if the signal name is currently active - i.e.
Definition PsyAPI.cpp:200
static struct PsyType CTRL_CREATECUSTOMPAGE
Registers a custom PsyProbe view.
Definition PsyAPI.h:102
std::string getCurrentScriptLanguage()
Internal use only.
Definition PsyAPI.cpp:146
bool getParameter(const char *name, float64 &val)
Read float parameter value.
Definition PsyAPI.h:929
The runtime container (one OS process/node context) hosting Psyclone components.
Definition PsySpace.h:164
Recursive mutual-exclusion lock, optionally named for cross-process use.
Definition Utils.h:480
Counting semaphore, optionally named for cross-process use.
Definition Utils.h:536
std::pair< DataMessage *, DataMessage * > TriggerAndMessage
Pairing of a trigger message and its accompanying data message, as queued for a crank's input.
Definition PsyAPI.h:71
Hierarchical execution-context identifier.
Definition Types.h:284
Hierarchical message type identifier — the key used for publish/subscribe matching in Psyclone.
Definition Types.h:123
Specification of a whiteboard retrieval attached to a TriggerSpec.
A complete trigger definition: what fires a component's crank and what happens then.
Small recursive XML DOM parser (XMLNode) used by CMSDK for all PsySpec XML parsing.