17#ifndef AGXSDK_PROPERTYFILTERS_H
18#define AGXSDK_PROPERTYFILTERS_H
30 class PropertyContainer;
59 using ExecuteFilter::match;
66 std::string m_property_id[2];
75#define MATCH_IMPLEMENTATION( TYPENAME, TYPE ) \
76 int checkMatch( const agx::PropertyContainer* c, size_t numMatch) const \
85 if ( m_is_set[i] && c && c->getProperty ## TYPENAME ( m_property_id[i], data )) \
87 match1 = (m_property_data[i] == data) ? ( i ? 1 : -1) : 0; \
90 } while( !match1 && i < numMatch); \
94 bool matches(const agx::PropertyContainer* c1, const agx::PropertyContainer* c2) const \
96 size_t n1 = c1 ? c1->getNumberOfProperties ## TYPENAME () : 0; \
97 size_t n2 = c2 ? c2->getNumberOfProperties ## TYPENAME () : 0; \
99 size_t numRequiredMatches = (m_is_set[0] ? 1 : 0) + (m_is_set[1] ? 1 : 0); \
105 int match1 = 0, match2 = 0; \
106 match1 = checkMatch( c1, numRequiredMatches ); \
107 match2 = checkMatch( c2, numRequiredMatches ); \
109 bool result = (numRequiredMatches == 1 && (match1 || match2) ) || \
110 (numRequiredMatches == 2 && (match1 && match2) && (match1 != match2) ); \
122 const std::string& property_id1,
const int64_t& data1);
131 int64_t m_property_data[2];
142 const std::string& property_id1,
const int32_t& data1);
151 int32_t m_property_data[2];
161 const std::string& property_id1,
const float& data1);
171 float m_property_data[2];
182 const std::string& property_id1,
const double& data1);
191 double m_property_data[2];
202 const std::string& property_id1,
const bool& data1);
212 bool m_property_data[2];
222 const std::string& property_id1,
const std::string& data1);
231 std::string m_property_data[2];
#define AGXPHYSICS_EXPORT
The geometry representation used by the collision detection engine.
agx::PropertyContainer * getPropertyContainer()
bool hasPropertyContainer() const
Class for matching bool properties.
virtual ~BoolPropertyFilter()
Destructor.
BoolPropertyFilter(const std::string &property_id0, const bool &data0, const std::string &property_id1, const bool &data1)
BoolPropertyFilter(const std::string &property_id, const bool &data)
MATCH_IMPLEMENTATION(Bool, bool)
Class for matching double properties.
DoublePropertyFilter(const std::string &property_id0, const double &data0, const std::string &property_id1, const double &data1)
virtual ~DoublePropertyFilter()
Destructor.
MATCH_IMPLEMENTATION(Double, double)
DoublePropertyFilter(const std::string &property_id, const double &data)
Abstract base class that implements a filter that selects which events should trigger a Listener.
Class for matching float properties.
FloatPropertyFilter(const std::string &property_id0, const float &data0, const std::string &property_id1, const float &data1)
FloatPropertyFilter(const std::string &property_id, const float &data)
virtual ~FloatPropertyFilter()
Destructor.
MATCH_IMPLEMENTATION(Float, float)
Class for matching int properties.
MATCH_IMPLEMENTATION(Int, int32_t)
IntPropertyFilter(const std::string &property_id, const int32_t &data)
IntPropertyFilter(const std::string &property_id0, const int32_t &data0, const std::string &property_id1, const int32_t &data1)
virtual ~IntPropertyFilter()
Destructor.
Class for matching Long int properties.
MATCH_IMPLEMENTATION(Long, int64_t)
virtual ~LongPropertyFilter()
Destructor.
LongPropertyFilter(const std::string &property_id0, const int64_t &data0, const std::string &property_id1, const int64_t &data1)
LongPropertyFilter(const std::string &property_id, const int64_t &data)
A class for filtering contacts based on the geometries' properties (as in: their property container).
PropertyFilter()
This filter will select contacts that contain a string property of value p data.
virtual ~PropertyFilter()
Destructor.
virtual bool matches(const agx::PropertyContainer *c1, const agx::PropertyContainer *c2) const =0
Called when two PropertyContainers should be compared.
virtual bool match(const agxCollide::Geometry *geo0, const agxCollide::Geometry *geo1) const override
This is the function called to filter contacts.
Class for matching bool properties.
virtual ~StringPropertyFilter()
Destructor.
StringPropertyFilter(const std::string &property_id, const std::string &data)
StringPropertyFilter(const std::string &property_id0, const std::string &data0, const std::string &property_id1, const std::string &data1)
MATCH_IMPLEMENTATION(String, std::string)
Class that is a container of named properties.
Smart pointer for handling referenced counted objects.
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
agx::ref_ptr< PropertyFilter > PropertyFilterRef
The agx namespace contains the dynamics/math part of the AGX Dynamics API.