instance-filter.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2022 INRIA
3 //
4 
5 #ifndef __pinocchio_multibody_instance_filter_hpp__
6 #define __pinocchio_multibody_instance_filter_hpp__
7 
8 #include <vector>
9 
10 namespace pinocchio
11 {
12 
14  template<typename T>
16  {
24  virtual bool operator()(const T & obj) const = 0;
25 
34  template<typename Allocator>
35  std::vector<size_t> apply(const std::vector<T, Allocator> & object_vector) const
36  {
37  std::vector<size_t> res;
38  res.reserve(object_vector.size());
39 
40  for (size_t k = 0; k < object_vector.size(); ++k)
41  {
42  if ((*this)(object_vector[k]))
43  res.push_back(k);
44  }
45 
46  res.reserve(res.size());
47  return res;
48  }
49  };
50 
51 } // namespace pinocchio
52 
53 #endif // #ifndef __pinocchio_multibody_instance_filter_hpp__
simulation-contact-dynamics.T
int T
Definition: simulation-contact-dynamics.py:89
pinocchio::res
ReturnType res
Definition: spatial/classic-acceleration.hpp:57
pinocchio::InstanceFilterBase
Instance filter base class.
Definition: instance-filter.hpp:15
pinocchio::InstanceFilterBase::apply
std::vector< size_t > apply(const std::vector< T, Allocator > &object_vector) const
Apply the filter on the given vector of objects and returns the list of indexes of the objects matchi...
Definition: instance-filter.hpp:35
pinocchio::InstanceFilterBase::operator()
virtual bool operator()(const T &obj) const =0
Returns true if the input obj matches the filter conditions.
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:29