options.py
Go to the documentation of this file.
1 # -*- Python -*-
2 # -*- coding: utf-8 -*-
3 
4 '''rtctree
5 
6 Copyright (C) 2009-2014
7  Geoffrey Biggs
8  RT-Synthesis Research Group
9  Intelligent Systems Research Institute,
10  National Institute of Advanced Industrial Science and Technology (AIST),
11  Japan
12  All rights reserved.
13 Licensed under the Eclipse Public License -v 1.0 (EPL)
14 http://www.opensource.org/licenses/eclipse-1.0.txt
15 
16 Singleton containing option values.
17 
18 '''
19 
20 
21 import sys
22 
23 from rtctree.exceptions import NoSuchOptionError
24 
25 
26 ##############################################################################
27 ## Options object
28 
29 class Options(object):
30  def __new__(cls, *p, **k):
31  if not '_the_instance' in cls.__dict__:
32  cls._the_instance = object.__new__(cls)
33  return cls._the_instance
34 
35  def init_options(self):
36  self.options = {'max_bindings': 100}
37 
38  def set_option(self, option, value):
39  if not hasattr(self, 'options'):
40  self.init_options()
41  self.options[option] = value
42 
43  def get_option(self, option):
44  if not hasattr(self, 'options'):
45  self.init_options()
46  if not option in self.options:
47  raise NoSuchOptionError(option)
48  return self.options[option]
49 
50 
51 # vim: tw=79
52 
def __new__(cls, p, k)
Definition: options.py:30
def get_option(self, option)
Definition: options.py:43
def init_options(self)
Definition: options.py:35
def set_option(self, option, value)
Definition: options.py:38
Options object.
Definition: options.py:29


rtctree
Author(s): Geoffrey Biggs
autogenerated on Fri Jun 7 2019 21:56:24