query_plugins.cpp
Go to the documentation of this file.
1 
7 #include "query_plugins.h"
8 #include <argos3/core/simulator/visualization/visualization.h>
9 #include <argos3/core/simulator/physics_engine/physics_engine.h>
10 #include <argos3/core/simulator/entity/entity.h>
11 #include <argos3/core/simulator/actuator.h>
12 #include <argos3/core/simulator/sensor.h>
13 
14 namespace argos {
15 
16  /****************************************/
17  /****************************************/
18 
19  void QueryShowPluginDescription(const std::string& str_query) {
20  LOG << "Plugins matching \"" << str_query << "\":" << std::endl << std::endl;
21  /* Buffer to contain the search results */
22  TQueryResult tResult;
23  /* Search among the plugins */
24  QuerySearchPlugins<CSimulatedActuator>(str_query, tResult);
25  QuerySearchPlugins<CSimulatedSensor> (str_query, tResult);
26  QuerySearchPlugins<CPhysicsEngine> (str_query, tResult);
27  QuerySearchPlugins<CMedium> (str_query, tResult);
28  QuerySearchPlugins<CVisualization> (str_query, tResult);
29  QuerySearchPlugins<CEntity> (str_query, tResult);
30  /* Print the result */
31  if(tResult.empty()) {
32  LOG << " None found." << std::endl << std::endl;
33  }
34  else {
35  LOG << "==============================================================================" << std::endl << std::endl;
36  for(UInt32 i = 0; i < tResult.size(); ++i) {
37  LOG << "[ " << tResult[i].Label << " ] " << std::endl;
38  LOG << tResult[i].BriefDescription << std::endl;
39  LOG << "by " << tResult[i].Author << std::endl;
40  LOG << "Version: " << tResult[i].Version << std::endl;
41  LOG << "Status: " << tResult[i].Status << std::endl << std::endl;
42  LOG << tResult[i].LongDescription << std::endl;
43  LOG << std::endl;
44  LOG << "==============================================================================" << std::endl << std::endl;
45  }
46  }
47  }
48 
49  /****************************************/
50  /****************************************/
51 
52  void QueryPlugins(const std::string& str_query) {
53  bool bIsLogColored = LOG.IsColoredOutput();
56  if(str_query == "actuators") {
57  QueryShowList<CSimulatedActuator>("AVAILABLE ACTUATORS");
58  } else if(str_query == "sensors") {
59  QueryShowList<CSimulatedSensor>("AVAILABLE SENSORS");
60  } else if(str_query == "physics_engines") {
61  QueryShowList<CPhysicsEngine>("AVAILABLE PHYSICS ENGINES");
62  } else if(str_query == "media") {
63  QueryShowList<CMedium>("AVAILABLE MEDIA");
64  } else if(str_query == "visualizations") {
65  QueryShowList<CVisualization>("AVAILABLE VISUALIZATIONS");
66  } else if(str_query == "entities") {
67  QueryShowList<CEntity>("AVAILABLE ENTITIES");
68  } else if(str_query == "all") {
69  QueryShowList<CSimulatedActuator>("AVAILABLE ACTUATORS");
70  QueryShowList<CSimulatedSensor> ("AVAILABLE SENSORS");
71  QueryShowList<CPhysicsEngine> ("AVAILABLE PHYSICS ENGINES");
72  QueryShowList<CMedium> ("AVAILABLE MEDIA");
73  QueryShowList<CVisualization> ("AVAILABLE VISUALIZATIONS");
74  QueryShowList<CEntity> ("AVAILABLE ENTITIES");
75  } else {
76  QueryShowPluginDescription(str_query);
77  }
78  if(bIsLogColored) {
81  }
82  }
83 
84  /****************************************/
85  /****************************************/
86 
87 }
unsigned int UInt32
32-bit unsigned integer.
Definition: datatypes.h:97
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
CARGoSLog LOGERR(std::cerr, SLogColor(ARGOS_LOG_ATTRIBUTE_BRIGHT, ARGOS_LOG_COLOR_RED))
Definition: argos_log.h:180
void QueryPlugins(const std::string &str_query)
CARGoSLog LOG(std::cout, SLogColor(ARGOS_LOG_ATTRIBUTE_BRIGHT, ARGOS_LOG_COLOR_GREEN))
Definition: argos_log.h:179
void QueryShowPluginDescription(const std::string &str_query)
std::vector< SQueryResultItem > TQueryResult
Definition: query_plugins.h:44
bool IsColoredOutput() const
Definition: argos_log.h:118
void DisableColoredOutput()
Definition: argos_log.h:114
void EnableColoredOutput()
Definition: argos_log.h:110