config_set.py
Go to the documentation of this file.
00001 # -*- Python -*-
00002 # -*- coding: utf-8 -*-
00003 
00004 '''rtctree
00005 
00006 Copyright (C) 2009-2014
00007     Geoffrey Biggs
00008     RT-Synthesis Research Group
00009     Intelligent Systems Research Institute,
00010     National Institute of Advanced Industrial Science and Technology (AIST),
00011     Japan
00012     All rights reserved.
00013 Licensed under the Eclipse Public License -v 1.0 (EPL)
00014 http://www.opensource.org/licenses/eclipse-1.0.txt
00015 
00016 Object representing a configuration set.
00017 
00018 '''
00019 
00020 
00021 from rtctree.utils import dict_to_nvlist
00022 
00023 ##############################################################################
00024 ## Configuration set object
00025 
00026 class ConfigurationSet(object):
00027     '''A class representing a configuration set.'''
00028     def __init__(self, owner=None, object=None, description=None, data=None,
00029                  *args, **kwargs):
00030         '''Constructor.
00031 
00032         @param owner The owner of this configuration set, if any. Should be a
00033                      Component object or None.
00034         @param object The CORBA ConfigurationSet object to wrap.
00035         @param description A description of this configuration set.
00036         @param data The dictionary containing the parameters and their values
00037                     of this configuration set.
00038 
00039         '''
00040         super(ConfigurationSet, self).__init__(*args, **kwargs)
00041         self._owner = owner
00042         self._object = object
00043         self._description = description
00044         self._data = data
00045 
00046     def has_param(self, param):
00047         '''Check if this configuration set has the given parameter.'''
00048         return param in self.data
00049 
00050     def set_param(self, param, value):
00051         '''Set a parameter in this configuration set.'''
00052         self.data[param] = value
00053         self._object.configuration_data = dict_to_nvlist(self.data)
00054 
00055     @property
00056     def data(self):
00057         '''Read-only access to the configuration set's parameters.'''
00058         return self._data
00059 
00060     @property
00061     def description(self):
00062         '''Read-only access to the configuration set's description.'''
00063         return self._description
00064 
00065     @property
00066     def object(self):
00067         '''The CORBA ConfigurationSet object this object wraps.'''
00068         return self._object
00069 
00070     def _reload(self, object, description, data):
00071         '''Reload the configuration set data.'''
00072         self._object = object
00073         self._description = description
00074         self._data = data
00075 
00076 
00077 # vim: tw=79
00078 


rtctree
Author(s): Geoffrey Biggs
autogenerated on Wed Aug 26 2015 16:13:08