|
Yate
|
Random number matching. More...
#include <yateclass.h>
Public Member Functions | |
| MatchingItemRandom (uint32_t val, uint32_t maxVal, bool negated=false, const char *name=0) | |
| uint32_t | value () const |
| uint32_t | maxValue () const |
| bool | randomMatch () const |
| virtual bool | runMatchString (const String &str, MatchingParams *params=0) const |
| virtual bool | runMatchListParam (const NamedList &list, MatchingParams *params=0) const |
| virtual MatchingItemBase * | copy () const |
| virtual const MatchingItemRandom * | itemRandom () const |
| Public Member Functions inherited from MatchingItemBase | |
| MatchingItemBase (const char *name, bool negated=false) | |
| const String & | name () const |
| bool | negated () const |
| bool | matchString (const String &str, MatchingParams *params=0) const |
| bool | matchListParam (const NamedList &list, MatchingParams *params=0) const |
| virtual const MatchingItemString * | itemString () const |
| virtual const MatchingItemRegexp * | itemRegexp () const |
| virtual const MatchingItemList * | itemList () const |
| virtual const MatchingItemCustom * | itemCustom () const |
| virtual String & | dump (String &buf, const MatchingItemDump *dump=0, const String &indent=String::empty(), const String &origIndent=String::empty(), unsigned int depth=0) const |
| virtual String & | dumpValue (String &buf, const MatchingItemDump *dump=0, const String &indent=String::empty(), const String &origIndent=String::empty(), unsigned int depth=0) const |
| virtual GenObject * | dumpXml (const MatchingItemDump *dump=0, unsigned int depth=0) const |
| virtual const String & | toString () const |
| Public Member Functions inherited from GenObject | |
| GenObject () | |
| virtual | ~GenObject () |
| virtual bool | alive () const |
| virtual void | destruct () |
| virtual const String & | traceId () const |
| virtual void * | getObject (const String &name) const |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (NamedCounter *counter) |
Additional Inherited Members | |
| Static Public Member Functions inherited from GenObject | |
| static void * | getObject (const String &name, const GenObject *obj) |
| static bool | getObjCounting () |
| static void | setObjCounting (bool enable) |
| static NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
Random number matching.
Match using a random number Implements a matching of a reference value greater than RANDOM[0..MAX - 1] List match and item name set: Parameter present: use random match Parameter not present: no match (return false)
|
inline |
Constructor Random percent match: val=[PERCENT] maxVal=100
| val | Reference value. 0: never match, 'maxVal' is ignored |
| maxVal | Upper interval value. 0, 1, less than / equal to 'val': always match |
| negated | True if matching is negated (return the opposite of match in public methods), false otherwise |
| name | Item name |
References MatchingItemBase::MatchingItemBase(), MatchingItemBase::name(), and MatchingItemBase::negated().
Referenced by copy(), and itemRandom().
|
inlinevirtual |
Copy this item
Reimplemented from MatchingItemBase.
References MatchingItemBase::MatchingItemBase(), MatchingItemRandom(), maxValue(), MatchingItemBase::name(), MatchingItemBase::negated(), and value().
|
inlinevirtual |
Check if this item is a MatchingItemRandom one
Reimplemented from MatchingItemBase.
References MatchingItemRandom().
|
inline |
Retrieve the maximum value for random number
Referenced by copy(), and randomMatch().
|
inline |
Run the match. Ignore the 'negated' property
References maxValue(), Random::random(), and value().
Referenced by runMatchListParam(), and runMatchString().
|
inlinevirtual |
NamedList parameter match
| list | List to search for parameter match |
| params | Optional parameters used during match |
Reimplemented from MatchingItemBase.
References NamedList::getParam(), MatchingItemBase::name(), and randomMatch().
|
inlinevirtual |
String match
| str | String to match |
| params | Optional parameters used during match |
Reimplemented from MatchingItemBase.
References randomMatch().
|
inline |
Retrieve the reference value used to make a decision
Referenced by copy(), and randomMatch().