deleted label from graphical info
[nepi.git] / src / nepi / util / guid.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 class GuidGenerator(object):
5     def __init__(self):
6         self._guids = list()
7
8     def next(self, guid = None):
9         if guid != None:
10             if guid in self._guids:
11                 raise RuntimeError("guid %d is already assigned" % guid)
12         else:
13             last_guid = 0 if len(self._guids) == 0 else self._guids[-1]
14             guid = last_guid + 1 
15         self._guids.append(guid)
16         self._guids.sort()
17         return guid
18