Conscience Core
CscCommandsProcessor.h
Go to the documentation of this file.
1 #ifndef CscCommandsProcessor_h
2 #define CscCommandsProcessor_h
3 
5 
8 class CscCommand;
9 using namespace result;
10 
12 CSC_DLL_IMPORTEXPORT void withLastCommandExecutionResultOnEntity(const string &entitySerialNumber, const function<void(const CscCommandExecutionResult *result)> &action);
13 CSC_DLL_IMPORTEXPORT void onCommandExecutionStartOnEntity(const CscCommand *command, const string &entitySerialNumber);
14 CSC_DLL_IMPORTEXPORT void onCommandExecutedOnEntity(const CscCommand *command, const string &entitySerialNumber, const CscCommandExecutionResult *result, CscEnvironmentSimulator &environmentSimulator);
16 
17 typedef function<void(const CscCommand *command, const CscCommandExecutionResult *result)> CommandExecutedListener;
18 CSC_DLL_IMPORTEXPORT void addCommandExecutedOnEntityListener(const string &entitySerialNumber, CommandExecutedListener listener);
19 
20 float *getStatusAiObjectives(const char *entitySerialNumber);
21 
22 #define PLACEHOLDER_CURRENT_STATE "CurrentState"
23 #define PLACEHOLDER_SERIAL_NUMBER "SerialNumber"
24 #define PLACEHOLDER_CURRENT_POSITION "CurrentPosition"
25 #define PLACEHOLDER_ENTITY_MODEL_ID "EntityModelId"
26 
31 CSC_DLL_IMPORTEXPORT double *processKnowledgeItemCommandAndEncodeResult(const char *command, const char *entitySerialNumber);
32 
38  const char *commandChars, const unsigned char **outBytes, unsigned long long *outBytesCount, const char *entitySerialNumber,
39  bool addPrefixCommandId = true);
40 
41 // IDE : Should be transformed into commands
42 void EnvironmentSimulator_dump(const char *outPath);
43 
52 typedef void (*OnStatePlayed)(const char *entitySerialNumber, double *encodeState, unsigned long encodedStateSize, int duration, int delay, int areValuesRelative);
53 // TODO tech debt: core should be able to send message to entity when necessary
55 
57 
62 CSC_DLL_IMPORTEXPORT const CscCommandExecutionResult *processKnowledgeItemCommand(const string &command, optional<string> entitySerialNumber, string *outCommandId = nullptr);
63 
67 CSC_DLL_IMPORTEXPORT vector<const CscCommandExecutionResult *> processKnowledgeItemCommands(const vector<string> &commands, optional<string> entitySerialNumber);
68 
73 
75 
80 
81 CSC_DLL_IMPORTEXPORT void interpolateCommandPlaceholders(string &command, const char *entitySerialNumberChars);
82 
83 }
84 
85 #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:179
conscience_core::bridging::commands::EnvironmentSimulator_dump
void EnvironmentSimulator_dump(const char *outPathChars)
Definition: CscCommandsProcessor.cpp:192
CSC_DLL_IMPORTEXPORT
#define CSC_DLL_IMPORTEXPORT
Definition: os.h:34
conscience_core::bridging::commands::CommandExecutedListener
function< void(const CscCommand *command, const CscCommandExecutionResult *result)> CommandExecutedListener
Definition: CscCommandsProcessor.h:17
conscience_core::bridging::commands::EnvironmentSimulator_setOnStatePlayedListener
void EnvironmentSimulator_setOnStatePlayedListener(OnStatePlayed listener)
Definition: CscCommandsProcessor.cpp:199
conscience_core::bridging::commands
Definition: cartographyCommands.cpp:29
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:436
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:183
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:349
conscience_core::bridging::commands::interpolateCommandPlaceholders
void interpolateCommandPlaceholders(string &command, const char *entitySerialNumberChars)
Definition: CscCommandsProcessor.cpp:205
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:380
CscEnvironmentSimulator
Definition: CscEnvironmentSimulator.h:31
conscience_core::bridging::commands::checkIfCommandUsesEntityPlaceholders
bool checkIfCommandUsesEntityPlaceholders(const string &command)
Definition: CscCommandsProcessor.cpp:336
conscience_core::bridging::commands::getEnvironmentSimulator
CscEnvironmentSimulator & getEnvironmentSimulator()
Definition: CscCommandsProcessor.cpp:170
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:274
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:357
conscience_core::bridging::commands::OnStatePlayed
void(* OnStatePlayed)(const char *entitySerialNumber, double *encodeState, unsigned long encodedStateSize, int duration, int delay, int areValuesRelative)
Definition: CscCommandsProcessor.h:52
conscience_core::bridging::commands::onCommandExecutedOnEntity
void onCommandExecutedOnEntity(const CscCommand *command, const string &entitySerialNumber, const CscCommandExecutionResult *result, CscEnvironmentSimulator &environmentSimulator)
Definition: CscCommandsProcessor.cpp:60