36 #include <argos3/core/config.h>
37 #include <argos3/core/utility/math/rng.h>
38 #include <argos3/core/utility/configuration/argos_configuration.h>
39 #include <argos3/core/utility/datatypes/datatypes.h>
40 #include <argos3/core/simulator/physics_engine/physics_engine.h>
41 #include <argos3/core/simulator/medium/medium.h>
120 return m_vecPhysicsEngines;
128 template <
typename T>
130 CMedium::TMap::const_iterator it = m_mapMedia.find(str_id);
131 if(it != m_mapMedia.end()) {
132 T* pcMedium =
dynamic_cast<T*
>(it->second);
133 if(pcMedium != NULL) {
158 ARGOS_ASSERT(m_pcVisualization != NULL,
"No visualization specified in the XML file.");
159 return *m_pcVisualization;
167 return m_tConfigurationRoot;
175 return *m_pcProfiler;
183 return m_pcProfiler != NULL;
192 return m_unRandomSeed;
201 m_unRandomSeed = un_random_seed;
202 m_bWasRandomSeedSet =
true;
220 return m_strExperimentConfigFileName;
229 m_strExperimentConfigFileName = str_file_name;
237 return *m_pcLoopFunctions;
245 m_pcLoopFunctions = &c_loop_functions;
253 return m_unMaxSimulationClock;
269 return m_bRealTimeClock;
277 m_bRealTimeClock = b_real_time;
284 m_bTerminated =
true;
293 return ARGOS_INSTALL_PREFIX;
306 void Load(ticpp::Document& t_tree);
387 typedef std::map<std::string, TConfigurationNode*> TControllerConfigurationMap;
394 TControllerConfigurationMap m_mapControllerConfig;
434 std::string m_strExperimentConfigFileName;
439 UInt32 m_unMaxSimulationClock;
456 bool m_bWasRandomSeedSet;
461 ticpp::Document m_tConfiguration;
481 bool m_bHumanReadableProfile;
486 bool m_bRealTimeClock;
#define ARGOS_ASSERT(condition, message)
When code is compiled in debug, this macro throws an ARGoS exception with the passed message if the s...
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
unsigned int UInt32
32-bit unsigned integer.
The namespace containing all the ARGoS related code.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
A set of hook functions to customize an experimental run.
std::vector< CMedium * > TVector
std::map< std::string, CMedium * > TMap
std::map< std::string, CPhysicsEngine *, std::less< std::string > > TMap
std::vector< CPhysicsEngine * > TVector
T & GetMedium(const std::string &str_id)
Returns a reference to a medium.
CRandom::CRNG * GetRNG()
Returns the random generator of the "argos" category.
CProfiler & GetProfiler()
Returns a reference to the profiler.
void Destroy()
Undoes whatever was done by Init().
CLoopFunctions & GetLoopFunctions()
Returns a reference to the loop functions associated to the current experiment.
void Terminate()
Puts an end to the simulation.
const std::string & GetExperimentFileName() const
Returns the name of the XML configuration file parsed by Load().
~CSimulator()
Class destructor.
CSpace & GetSpace() const
Returns a reference to the simulated space.
void SetExperimentFileName(const std::string &str_file_name)
Sets the name of the XML configuration file parsed by Load().
void Load(ticpp::Document &t_tree)
Loads an already-parsed XML configuration tree.
CVisualization & GetVisualization()
Returns a reference to the visualization.
void Init()
Initializes the experiment.
static CSimulator & GetInstance()
Returns the instance to the CSimulator class.
UInt32 GetNumThreads() const
Returns the number of threads used during the experiment.
UInt32 GetMaxSimulationClock() const
Returns the time limit on this experiment.
TConfigurationNode & GetConfigurationRoot()
Returns a reference to the root node of the parsed XML configuration file.
bool IsExperimentFinished() const
Returns true if the experiment has finished.
CMedium::TVector & GetMedia()
Returns the list of currently existing media.
CPhysicsEngine & GetPhysicsEngine(const std::string &str_id) const
Returns a reference to a physics engine.
void Execute()
Executes the simulation loop.
void SetRealTimeClock(bool b_real_time)
When passed true, the clock tick follows the real time.
bool IsProfiling() const
Returns true if ARGoS is being profiled.
void LoadExperiment()
Loads the XML configuration file.
std::string GetInstallationDirectory() const
Returns the base directory in which the ARGoS core was installed.
bool IsRealTimeClock() const
Returns true if the clock tick follows the real time.
void SetRandomSeed(UInt32 un_random_seed)
Sets the random seed of the "argos" category of the random seed.
void Reset(UInt32 un_new_random_seed)
Resets the experiment.
UInt32 GetRandomSeed() const
Returns the random seed of the "argos" category of the random seed.
void UpdateSpace()
Performs an update step of the space.
TConfigurationNode & GetConfigForController(const std::string &str_id)
Returns the XML portion relative to the controller with the given ID.
void SetLoopFunctions(CLoopFunctions &c_loop_functions)
Asociates loop functions to the current experiment.
void Reset()
Resets the experiment.
CPhysicsEngine::TVector & GetPhysicsEngines()
Returns the list of currently existing physics engines.