void declareBaseWrapperManager()

in src/esp/bindings/PhysicsWrapperManagerBindings.cpp [39:190]


void declareBaseWrapperManager(py::module& m,
                               const std::string& objType,
                               const std::string& classStrPrefix) {
  using MgrClass = PhysicsObjectBaseManager<T>;
  using WrapperPtr = std::shared_ptr<U>;
  // Most, but not all, of these methods are from ManagedContainer class
  // template.  However, we use PHysicsObjectBaseManager as the base class
  // because we wish to have appropriate (wrapper-related) access, argument
  // nomenclature and documentation.
  std::string pyclass_name =
      classStrPrefix + std::string("_PhysWrapperManager");
  py::class_<MgrClass, std::shared_ptr<MgrClass>>(m, pyclass_name.c_str())
      .def("get_object_handle_by_id", &MgrClass::getObjectHandleByID,
           ("Returns string handle for the " + objType +
            " corresponding to passed ID.")
               .c_str(),
           "object_id"_a)
      .def(
          "get_object_id_by_handle",
          py::overload_cast<const std::string&>(&MgrClass::getObjectIDByHandle),
          ("Returns integer ID for the " + objType + " with the passed handle.")
              .c_str(),
          "handle"_a)
      .def("get_object_handles",
           static_cast<std::vector<std::string> (MgrClass::*)(
               const std::string&, bool, bool) const>(
               &MgrClass::getObjectHandlesBySubstring),
           ("Returns a potentially sorted list of " + objType +
            " handles that either contain or explicitly do not contain the "
            "passed search_str, based on the value of boolean contains.")
               .c_str(),
           "search_str"_a = "", "contains"_a = true, "sorted"_a = true)
      .def("get_objects_info", &MgrClass::getObjectInfoStrings,
           ("Returns a list of CSV strings describing each " + objType +
            " whose handles either contain or explicitly do not contain the "
            "passed search_str, based on the value of boolean contains.")
               .c_str(),
           "search_str"_a = "", "contains"_a = true)

      .def("get_objects_CSV_info", &MgrClass::getObjectInfoCSVString,
           ("Returns a comma-separated string describing each " + objType +
            " whose handles either contain or explicitly do not "
            "contain the passed search_str, based on the value of boolean "
            "contains.  Each " +
            objType + "'s info is separated by a newline.")
               .c_str(),
           "search_str"_a = "", "contains"_a = true)

      .def("get_num_objects", &MgrClass::getNumObjects,
           ("Returns the number of existing " + objType + "s being managed.")
               .c_str())
      .def("get_random_object_handle", &MgrClass::getRandomObjectHandle,
           ("Returns the handle for a random " + objType +
            " chosen from the existing " + objType + " being managed.")
               .c_str())
      .def("get_undeletable_handles", &MgrClass::getUndeletableObjectHandles,
           ("Returns a list of  " + objType + " handles for " + objType +
            "s that have been marked undeletable by the system. These " +
            objType + "s can still be modified.")
               .c_str())
      .def("get_user_locked_handles", &MgrClass::getUserLockedObjectHandles,
           ("Returns a list of handles for " + objType +
            "s that have been marked locked by the user. These will be "
            "undeletable until unlocked by the user. These " +
            objType + " can still be modified.")
               .c_str())
      .def("get_library_has_handle", &MgrClass::getObjectLibHasHandle,
           ("Returns whether the passed handle describes an existing " +
            objType + " in the library.")
               .c_str(),
           "handle"_a)
      .def("get_library_has_id", &MgrClass::getObjectLibHasID,
           ("Returns whether the passed object ID describes an existing " +
            objType + " in the library.")
               .c_str(),
           "object_id"_a)
      .def("set_object_lock", &MgrClass::setLock,
           ("This sets the lock state for the  " + objType +
            " that has the passed name. Lock == True makes the  " + objType +
            " unable to be deleted. Note : Locked  " + objType +
            "s can still be modified.")
               .c_str(),
           "handle"_a, "lock"_a)
      .def("set_lock_by_substring", &MgrClass::setLockBySubstring,
           ("This sets the lock state for all  " + objType +
            "s whose handles either contain or explicitly do not contain the "
            "passed search_str. Returns a list of handles for  " +
            objType +
            "s locked by this function call. Lock == True makes the  " +
            objType + " unable to be deleted. Note : Locked  " + objType +
            "s can still be modified.")
               .c_str(),
           "lock"_a, "search_str"_a = "", "contains"_a = true)
      .def("set_object_list_lock", &MgrClass::setLockByHandles,
           ("This sets the lock state for all  " + objType +
            "s whose handles are passed in list. Returns a list of handles "
            "for " +
            objType +
            "s locked by this function call. Lock == True makes the  " +
            objType + " unable to be deleted. Note : Locked  " + objType +
            "s can still be modified.")
               .c_str(),
           "handles"_a, "lock"_a)
      .def("remove_all_objects", &MgrClass::removeAllObjects,
           ("This removes a list of all the  " + objType +
            "s referenced in the library that have not been marked undeletable "
            "by the system or read-only by the user.")
               .c_str())
      .def("remove_objects_by_str", &MgrClass::removeObjectsBySubstring,
           ("This removes a list of all the  " + objType +
            "s referenced in the library that have not been marked undeletable "
            "by the system or read-only by the user and whose handles either "
            "contain or explicitly do not contain the passed search_str.")
               .c_str(),
           "search_str"_a = "", "contains"_a = true)
      .def("remove_object_by_id", &MgrClass::removeObjectByID,
           ("This removes the " + objType +
            " referenced by the passed ID from the library.")
               .c_str(),
           "object_id"_a)
      .def("remove_object_by_handle", &MgrClass::removeObjectByHandle,
           ("This removes the " + objType +
            " referenced by the passed handle from the library.")
               .c_str(),
           "handle"_a)
      .def(
          "get_object_by_id",
          static_cast<WrapperPtr (MgrClass::*)(int)>(
              &MgrClass::template getObjectOrCopyByID<U>),
          ("This returns a copy of the  " + objType +
           " specified by the passed ID if it exists, and NULL if it does not.")
              .c_str(),
          "object_id"_a)
      .def("get_object_by_handle",
           static_cast<WrapperPtr (MgrClass::*)(const std::string&)>(
               &MgrClass::template getObjectOrCopyByHandle<U>),
           ("This returns a copy of the  " + objType +
            " specified by the passed handle if it exists, and NULL if it does "
            "not.")
               .c_str(),
           "handle"_a)
      .def("get_objects_by_handle_substring",
           static_cast<std::unordered_map<std::string, WrapperPtr> (
               MgrClass::*)(const std::string&, bool)>(
               &MgrClass::template getObjectsByHandleSubstring<U>),
           ("Returns a dictionary of " + objType +
            " objects, keyed by their handles, for all handles that either "
            "contain or explicitly do not contain the passed search_str, based "
            "on the value of boolean contains.")
               .c_str(),
           "search_str"_a = "", "contains"_a = true);
}  // declareBaseWrapperManager