Conscience Core
CscCommandsProcessor.h
Go to the documentation of this file.
1 #ifndef CscCommandsProcessor_h
2 #define CscCommandsProcessor_h
3 
6 #include <string>
7 #include <vector>
8 
10 class CscCommand;
11 using namespace result;
12 
14 CSC_DLL_IMPORTEXPORT void withLastCommandExecutionResultOnEntity(const string &entitySerialNumber, const function<void(const CscCommandExecutionResult *result)> &action);
15 CSC_DLL_IMPORTEXPORT void onCommandExecutionStartOnEntity(const CscCommand *command, const string &entitySerialNumber);
16 CSC_DLL_IMPORTEXPORT void onCommandExecutedOnEntity(const CscCommand *command, const string &entitySerialNumber, const CscCommandExecutionResult *result, CscEnvironmentSimulator &environmentSimulator);
18 
19 typedef function<void(const CscCommand *command, const CscCommandExecutionResult *result)> CommandExecutedListener;
20 CSC_DLL_IMPORTEXPORT void addCommandExecutedOnEntityListener(const string &entitySerialNumber, CommandExecutedListener listener);
21 
22 float *getStatusAiObjectives(const char *entitySerialNumber);
23 
24 #define PLACEHOLDER_CURRENT_STATE "CurrentState"
25 #define PLACEHOLDER_SERIAL_NUMBER "SerialNumber"
26 #define PLACEHOLDER_CURRENT_POSITION "CurrentPosition"
27 #define PLACEHOLDER_ENTITY_MODEL_ID "EntityModelId"
28 
33 CSC_DLL_IMPORTEXPORT double *processKnowledgeItemCommandAndEncodeResult(const char *command, const char *entitySerialNumber);
34 
40  const char *commandChars, const unsigned char **outBytes, unsigned long long *outBytesCount, const char *entitySerialNumber,
41  bool addPrefixCommandId = true);
42 
43 // IDE : Should be transformed into commands
44 void EnvironmentSimulator_dump(const char *outPath);
45 
54 typedef void (*OnStatePlayed)(const char *entitySerialNumber, double *encodeState, unsigned long encodedStateSize, int duration, int delay, int areValuesRelative);
55 // TODO tech debt: core should be able to send message to entity when necessary
57 
59 
64 CSC_DLL_IMPORTEXPORT const CscCommandExecutionResult *processKnowledgeItemCommand(const string &command, optional<string> entitySerialNumber, string *outCommandId = nullptr);
65 
69 CSC_DLL_IMPORTEXPORT vector<const CscCommandExecutionResult *> processKnowledgeItemCommands(const vector<string> &commands, optional<string> entitySerialNumber);
70 
75 
77 
82 
83 CSC_DLL_IMPORTEXPORT void interpolateCommandPlaceholders(string &command, const char *entitySerialNumberChars);
84 
85 }
86 
87 #endif /* ConscienceInteraction_h */
conscience_core::bridging::commands::getCommandResultByCommandIndex
optional< string > getCommandResultByCommandIndex(const string &commandIndex)
Definition: CscCommandsProcessor.cpp:124
conscience_core::bridging::commands::setEnvironmentSimulator
void setEnvironmentSimulator(CscEnvironmentSimulator *newGlobalEnvironmentSimulator)
Definition: CscCommandsProcessor.cpp:177
conscience_core::bridging::commands::EnvironmentSimulator_dump
void EnvironmentSimulator_dump(const char *outPathChars)
Definition: CscCommandsProcessor.cpp:190
CSC_DLL_IMPORTEXPORT
#define CSC_DLL_IMPORTEXPORT
Definition: os.h:31
conscience_core::bridging::commands::CommandExecutedListener
function< void(const CscCommand *command, const CscCommandExecutionResult *result)> CommandExecutedListener
Definition: CscCommandsProcessor.h:19
conscience_core::bridging::commands::EnvironmentSimulator_setOnStatePlayedListener
void EnvironmentSimulator_setOnStatePlayedListener(OnStatePlayed listener)
Definition: CscCommandsProcessor.cpp:197
conscience_core::bridging::commands
Definition: cartographyCommands.cpp:4
conscience_core::bridging::commands::withLastCommandExecutionResultOnEntity
void withLastCommandExecutionResultOnEntity(const string &entitySerialNumber, const function< void(const CscCommandExecutionResult *result)> &action)
Definition: CscCommandsProcessor.cpp:54
conscience_core::bridging::commands::CscCommand
Definition: Command.h:40
conscience_core::bridging::commands::getListLastExecutedCommands
const vector< string > getListLastExecutedCommands()
Definition: CscCommandsProcessor.cpp:434
CommandExecutionResult.h
nlohmann::detail::void
j template void())
Definition: json.hpp:4189
conscience_core::bridging::commands::onApplicationStarted
void onApplicationStarted()
Definition: CscCommandsProcessor.cpp:143
conscience_core::bridging::commands::result::CscCommandExecutionResult
Definition: CommandExecutionResult.h:44
conscience_core::bridging::commands::getStatusAiObjectives
float * getStatusAiObjectives(const char *entitySerialNumber)
Definition: CscCommandsProcessor.cpp:181
conscience_core::bridging::commands::globalEnvironmentSimulator
CscEnvironmentSimulator * globalEnvironmentSimulator
Definition: CscCommandsProcessor.cpp:34
conscience_core::bridging::commands::processKnowledgeItemCommands
vector< const CscCommandExecutionResult * > processKnowledgeItemCommands(const vector< string > &commands, optional< string > entitySerialNumber)
Definition: CscCommandsProcessor.cpp:347
conscience_core::bridging::commands::interpolateCommandPlaceholders
void interpolateCommandPlaceholders(string &command, const char *entitySerialNumberChars)
Definition: CscCommandsProcessor.cpp:203
CscEnvironmentSimulator.h
conscience_core::bridging::commands::processKnowledgeItemCommandAndEncodeResultToBytes
void processKnowledgeItemCommandAndEncodeResultToBytes(const char *commandChars, const unsigned char **outBytes, unsigned long long *outBytesCount, const char *entitySerialNumberChars, bool addPrefixCommandId)
Definition: CscCommandsProcessor.cpp:378
CscEnvironmentSimulator
Definition: CscEnvironmentSimulator.h:35
conscience_core::bridging::commands::checkIfCommandUsesEntityPlaceholders
bool checkIfCommandUsesEntityPlaceholders(const string &command)
Definition: CscCommandsProcessor.cpp:334
conscience_core::bridging::commands::getEnvironmentSimulator
CscEnvironmentSimulator & getEnvironmentSimulator()
Definition: CscCommandsProcessor.cpp:168
conscience_core::bridging::commands::onCommandExecutionStartOnEntity
void onCommandExecutionStartOnEntity(const CscCommand *command, const string &entitySerialNumber)
Definition: CscCommandsProcessor.cpp:49
conscience_core::bridging::commands::environment_objects::optional< string >
const ptr< CscObjectModel > const string const CscPoint3d const CscPoint3d optional< string >
Definition: environmentObjectsCommands.h:373
conscience_core::bridging::commands::processKnowledgeItemCommand
const CscCommandExecutionResult * processKnowledgeItemCommand(const string &commandStringRef, optional< string > entitySerialNumber, string *outCommandId)
Definition: CscCommandsProcessor.cpp:272
conscience_core::bridging::commands::addCommandExecutedOnEntityListener
void addCommandExecutedOnEntityListener(const string &entitySerialNumber, CommandExecutedListener listener)
Definition: CscCommandsProcessor.cpp:132
conscience_core::bridging::commands::processKnowledgeItemCommandAndEncodeResult
double * processKnowledgeItemCommandAndEncodeResult(const char *commandChars, const char *entitySerialNumberChars)
Definition: CscCommandsProcessor.cpp:355
conscience_core::bridging::commands::OnStatePlayed
void(* OnStatePlayed)(const char *entitySerialNumber, double *encodeState, unsigned long encodedStateSize, int duration, int delay, int areValuesRelative)
Definition: CscCommandsProcessor.h:54
conscience_core::bridging::commands::onCommandExecutedOnEntity
void onCommandExecutedOnEntity(const CscCommand *command, const string &entitySerialNumber, const CscCommandExecutionResult *result, CscEnvironmentSimulator &environmentSimulator)
Definition: CscCommandsProcessor.cpp:60