3.14.8 Option Inheritance
Analog Insydes employs an option inheritance scheme that allows you to change the values of shared options both globally and locally in a convenient way. If the value of an option optname is specified as Inherited[symbol], then the actual value of optname will be retrieved from Options[symbol] as soon as it is needed.
For example, the Analog Insydes functions ExpandSubcircuits and ReadNetlist both inherit the options InstanceNameSeparator and Protocol from Options[AnalogInsydes]. You can change the settings for both functions simultaneously by specifying new values for Options[AnalogInsydes]. You can also change any of these options locally for either function in Options[ExpandSubcircuits] or Options[ReadNetlist]. See example below.
Examples
Load Analog Insydes.
In[1]:= <<AnalogInsydes`
Display the options of ExpandSubcircuits.
In[2]:= Options[ExpandSubcircuits]
Out[2]=
Note that some of the option values are marked as Inherited[AnalogInsydes]. The values of these options will be retrieved from Options[AnalogInsydes] when they are neeeded.
Display the options of ReadNetlist.
In[3]:= Options[ReadNetlist]
Out[3]=
Change the value of InstanceNameSeparator globally.
In[4]:= SetOptions[AnalogInsydes, InstanceNameSeparator -> "$$"]
Out[4]=
Change the value of Protocol locally for ExpandSubcircuits.
In[5]:= SetOptions[ExpandSubcircuits, Protocol -> None]
Out[5]=
Internally, Analog Insydes resolves inherited options by means of the function ResolveOptions. We use ResolveOptions here for documentation purposes only. Option inheritance is taken care of automatically by Analog Insydes. Below, ResolveOptions is used to determine the final values of the options for ExpandSubcircuits. Note that the local value of the Protocol option overrides the value from Options[AnalogInsydes].
Get option settings for ExpandSubcircuits.
In[6]:= ResolveOptions[{}, ExpandSubcircuits, {InstanceNameSeparator, Protocol}] // InputForm
Out[6]//InputForm= {"$$", None}
For ReadNetlist, the values of both options are retrieved from Options[AnalogInsydes].
Get option settings for ReadNetlist.
In[7]:= ResolveOptions[{}, ReadNetlist, {InstanceNameSeparator, Protocol}] // InputForm
Out[7]//InputForm= {"$$", StatusLine}
|