Main MRPT website > C++ reference for MRPT 1.5.6
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 
16 
18 {
19  for (const_iterator it=begin();it!=end();++it)
20  if ( (*it)->derivedFrom(id) )
21  return true;
22  return false;
23 }
24 
26 {
27  std::string s;
28  for (const_iterator it=begin();it!=end();++it)
29  {
30  if (it!=begin()) s+=", ";
31  s+=std::string( (*it)->className );
32  }
33  return s;
34 }
35 
37 {
39 
40  this->clear();
41  std::vector<std::string> lstClasses;
42  mrpt::system::tokenize(s," ,",lstClasses);
43 
44  for (size_t i=0;i<lstClasses.size();i++)
45  {
47  ASSERTMSG_(id!=NULL, format("Unknown class name: %s",lstClasses[i].c_str()))
48  this->insert(id);
49  }
50 
52 }
53 
void insert(const mrpt::utils::TRuntimeClassId *id)
Insert a class in the list.
bool containsDerivedFrom(const mrpt::utils::TRuntimeClassId *id) const
Does the list contains a class derived from...?
void clear()
Empty the list.
TSet::const_iterator const_iterator
const mrpt::utils::TRuntimeClassId * lstClasses[]
#define MRPT_TRY_END
GLdouble s
Definition: glew.h:1295
const TRuntimeClassId BASE_IMPEXP * findRegisteredClass(const std::string &className)
Return info about a given class by its name, or NULL if the class is not registered.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:21
void fromString(const std::string &s)
Return a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
GLsizei const GLcharARB ** string
Definition: glew.h:3293
#define MRPT_TRY_START
A structure that holds runtime class type information.
Definition: CObject.h:46
std::string toString() const
Return a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
#define ASSERTMSG_(f, __ERROR_MSG)
void BASE_IMPEXP tokenize(const std::string &inString, const std::string &inDelimiters, std::deque< std::string > &outTokens, bool skipBlankTokens=true) MRPT_NO_THROWS
Tokenizes a string according to a set of delimiting characters.



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018