~ubuntu-branches/ubuntu/trusty/libecap/trusty-proposed

« back to all changes in this revision

Viewing changes to src/libecap/common/name.cc

  • Committer: Package Import Robot
  • Author(s): Luigi Gangitano
  • Date: 2012-12-05 20:11:04 UTC
  • Revision ID: package-import@ubuntu.com-20121205201104-i0lk2ymbdre6k4dl
Tags: upstream-0.2.0
ImportĀ upstreamĀ versionĀ 0.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <libecap/common/name.h>
 
2
#include <libecap/common/errors.h>
 
3
#include <climits>
 
4
 
 
5
libecap::Name::Id libecap::Name::TheLastId = libecap::Name::nameUnidentified;
 
6
 
 
7
libecap::Name::Name(): id_(libecap::Name::nameUnknown), hostId_(INT_MIN) {
 
8
}
 
9
 
 
10
libecap::Name::Name(const Name::Image &image): image_(image),
 
11
        id_(libecap::Name::nameUnidentified), hostId_(INT_MIN) {
 
12
}
 
13
 
 
14
libecap::Name::Name(const Name::Image &image, Id id): image_(image), id_(id),
 
15
        hostId_(INT_MIN) {
 
16
}
 
17
 
 
18
libecap::Name::Id libecap::Name::NextId() {
 
19
        return ++TheLastId;
 
20
}
 
21
 
 
22
bool libecap::Name::assignedHostId() const {
 
23
        return hostId_ != INT_MIN;
 
24
}
 
25
 
 
26
void libecap::Name::assignHostId(int id) const {
 
27
        Must(hostId_ == INT_MIN && id != INT_MIN);
 
28
        hostId_ = id;
 
29
}