Main MRPT website > C++ reference for MRPT 1.9.9
CListOfClasses.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #include "base-precomp.h" // Precompiled headers
10 
12 
13 using namespace mrpt;
14 using namespace mrpt::utils;
15 
17  const mrpt::utils::TRuntimeClassId* id) const
18 {
19  for (const_iterator it = begin(); it != end(); ++it)
20  if ((*it)->derivedFrom(id)) return true;
21  return false;
22 }
23 
25 {
26  std::string s;
27  for (const_iterator it = begin(); it != end(); ++it)
28  {
29  if (it != begin()) s += ", ";
30  s += std::string((*it)->className);
31  }
32  return s;
33 }
34 
36 {
38 
39  this->clear();
40  std::vector<std::string> lstClasses;
42 
43  for (size_t i = 0; i < lstClasses.size(); i++)
44  {
47  ASSERTMSG_(
48  id != nullptr,
49  format("Unknown class name: %s", lstClasses[i].c_str()))
50  this->insert(id);
51  }
52 
54 }
void insert(const mrpt::utils::TRuntimeClassId *id)
Insert a class in the list.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
bool containsDerivedFrom(const mrpt::utils::TRuntimeClassId *id) const
Does the list contains a class derived from...?
std::string toString() const
Return a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
void clear()
Empty the list.
GLdouble s
Definition: glext.h:3676
TSet::const_iterator const_iterator
const mrpt::utils::TRuntimeClassId * lstClasses[]
#define MRPT_TRY_END
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:19
GLsizei const GLchar ** string
Definition: glext.h:4101
void fromString(const std::string &s)
Return a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
void tokenize(const std::string &inString, const std::string &inDelimiters, std::deque< std::string > &outTokens, bool skipBlankTokens=true) noexcept
Tokenizes a string according to a set of delimiting characters.
const TRuntimeClassId * findRegisteredClass(const std::string &className)
Return info about a given class by its name, or nullptr if the class is not registered.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define MRPT_TRY_START
A structure that holds runtime class type information.
Definition: CObject.h:31
#define ASSERTMSG_(f, __ERROR_MSG)



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019