~vanvugt/mir/unique-id

« back to all changes in this revision

Viewing changes to include/shared/mir/unique_id_generator.h

  • Committer: Daniel van Vugt
  • Date: 2013-04-16 08:45:22 UTC
  • Revision ID: daniel.van.vugt@canonical.com-20130416084522-1irr58cuzpbf7vug
Convert Check into Validator and invert the logic... to be more logical.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
{
31
31
public:
32
32
    typedef int Id;  // Should always remain int compatible.
33
 
    typedef std::function<bool(Id)> Check;
 
33
    typedef std::function<bool(Id)> Validator;
34
34
 
35
 
    UniqueIdGenerator(Check const check,
 
35
    UniqueIdGenerator(Validator validator,
36
36
                      Id error = 0,
37
37
                      Id min = 1,
38
38
                      Id max = std::numeric_limits<Id>::max());
43
43
    Id const min_id, max_id, invalid_id;
44
44
 
45
45
private:
46
 
    Check const id_in_use;
 
46
    Validator const is_valid;
47
47
    std::atomic<Id> next_id;
48
48
};
49
49