Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 24, 2006, 10:50:47 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: more functionality: getObject, getObjectList, and many new doxy-tags

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/lang/new_object_list.cc

    r9685 r9696  
    113113
    114114/**
     115 * @brief Searches for a ObjectList with the ID classID
     116 * @param classID the ID to search for.
     117 * @return The NewObjectList if found, NULL otherwise.
     118 */
     119const NewObjectListBase* const NewObjectListBase::getObjectList(int classID)
     120{
     121  assert (NewObjectListBase::_classesByID != NULL);
     122  NewObjectListBase::classIDMap::iterator it = NewObjectListBase::_classesByID->find(classID);
     123  if (it != NewObjectListBase::_classesByID->end())
     124    return (*it).second;
     125  else
     126    return NULL;
     127}
     128
     129/**
     130 * @brief Searches for a ObjectList with the Name className
     131 * @param className the Name to search for.
     132 * @return The NewObjectList if found, NULL otherwise.
     133 */
     134const NewObjectListBase* const NewObjectListBase::getObjectList(const std::string& className)
     135{
     136  assert (NewObjectListBase::_classesByName != NULL);
     137  NewObjectListBase::classNameMap::iterator it = NewObjectListBase::_classesByName->find(className);
     138  if (it != NewObjectListBase::_classesByName->end())
     139    return (*it).second;
     140  else
     141    return NULL;
     142}
     143
     144/**
     145 * @brief Searches for a ObjectList with the NewClassID classID
     146 * @param classID the ID to search for.
     147 * @return The NewObjectList if found, NULL otherwise.
     148 */
     149const NewObjectListBase* const NewObjectListBase::getObjectList(const NewClassID& classID)
     150{
     151  return NewObjectListBase::getObjectList(classID.id());
     152}
     153
     154/**
     155 * @brief Retrieves the first BaseObject matching the name objectName from the List matching classID.
     156 * @param classID the ID of the List.
     157 * @param objectName the Name of the Object to search for
     158 */
     159BaseObject* NewObjectListBase::getObject(int classID, const std::string& objectName)
     160{
     161  const NewObjectListBase* const base = NewObjectListBase::getObjectList(classID);
     162
     163  if (base != NULL)
     164    return base->getBaseObject(objectName);
     165  else
     166    return NULL;
     167}
     168
     169/**
     170 * @brief Retrieves the first BaseObject matching the name objectName from the List matching className.
     171 * @param className the Name of the List.
     172 * @param objectName the Name of the Object to search for
     173 */
     174BaseObject* NewObjectListBase::getObject(const std::string& className, const std::string& objectName)
     175{
     176  const NewObjectListBase* const base = NewObjectListBase::getObjectList(className);
     177
     178  if (base != NULL)
     179    return base->getBaseObject(objectName);
     180  else
     181    return NULL;
     182}
     183
     184/**
     185 * @brief Retrieves the first BaseObject matching the name objectName from the List matching classID.
     186 * @param classID The NewClassID of the List.
     187 * @param objectName the Name of the Object to search for
     188 */
     189BaseObject* NewObjectListBase::getObject(const NewClassID& classID, const std::string& objectName)
     190{
     191  const NewObjectListBase* const base = NewObjectListBase::getObjectList(classID);
     192
     193  if (base != NULL)
     194    return base->getBaseObject(objectName);
     195  else
     196    return NULL;
     197}
     198
     199
     200/**
    115201 * @brief Converts an ID into a ClassName String.
    116202 * @param classID The ID to convert.
     
    119205const std::string& NewObjectListBase::IDToString(int classID)
    120206{
    121   assert (NewObjectListBase::_classesByID != NULL);
    122   NewObjectListBase::classIDMap::iterator it = NewObjectListBase::_classesByID->find(classID);
    123   if (it != NewObjectListBase::_classesByID->end())
    124     return (*it).second->name();
     207  const NewObjectListBase* const base = NewObjectListBase::getObjectList(classID);
     208
     209  if (base != NULL)
     210    return base->name();
    125211  else
    126212  {
     
    138224int NewObjectListBase::StringToID(const std::string& className)
    139225{
    140   assert (NewObjectListBase::_classesByName != NULL);
    141   NewObjectListBase::classNameMap::iterator it = NewObjectListBase::_classesByName->find(className);
    142   if (it != NewObjectListBase::_classesByName->end())
    143     return (*it).second->id();
     226  const NewObjectListBase* const base = NewObjectListBase::getObjectList(className);
     227
     228  if (base != NULL)
     229    return base->id();
    144230  else
    145231    return -1;
Note: See TracChangeset for help on using the changeset viewer.