PyANGKernel.GKNetworkAttributesOverride

class GKNetworkAttributesOverride

Encapsulates a set of object / attribute pair redefinitions that will be used inside an experiment.

Details

The class will allow the user to “override” the value of one or more column for any object inside the model.

The information stored by this class will be then assigned to one or more experiments, so the override data specified here will be applied to the affected objects before running the experiment.

The override values are be stored as QVariant, and they are interpreted in different ways according to its type and column type:

  • For numerical columns (Int, UInt, & Double), the override data can be specified either as a new numerical value that will replace the existing one, or either as an string specifying a “variation” over the object value, like i.e. “10%”, “-5”, “+15%”, etc…

  • For _GKEnum columns, the override data can be specified either as the ‘name’ of one of the enum values, or either its associated value.

  • For string (String / CString) columns, the override data must be specified as a string which will simply overwrite the existing one.

  • For Bool columns, the override data will also be converted to a boolean value and assigned to the column.

  • For _GKObject columns, teh override data will specify the ID of the new object to use

Right now, these are the only column types supported by the class. In a future we might also support overriding time-related columns (Date / Time / DateTime), etc…

The class registers a ‘connection’ into the model for any referenced object, so it gets properly warned whenever such object is removed.

Inheritance diagram of PyANGKernel.GKNetworkAttributesOverride

Synopsis

Methods

Static functions

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

__init__()
add(obj, data)
Parameters:
  • objGKObject

  • data – Dictionary with keys of type .GKColumn and values of type QVariant.

Stores the given override values for object. UnknownCommand obj: object for which the column will be overriden UnknownCommand data: override data

add(obj, col, newValue)
Parameters:

Stores the given override value for the given object and column. The new value must be specified according to the rules mentioned in class documentation. UnknownCommand obj: object for which the column will be overriden UnknownCommand col: column to override UnknownCommand newValue: the new value (or variation) to be used

addSection(section)
Parameters:

sectionGKSection

Adds the given section to the override set. The class then stores the current lane parameters internally, which can be changed later through setSectionLaneData() , etc…

static apply(lane, data)
Parameters:
Return type:

GKSectionLane

Applies the override data to the given section lane and returns it

static apply(colType, oldValue, newValue)
Parameters:
  • colTypeType

  • oldValue – object

  • newValue – object

Return type:

object

Core function which modifies a column’s value by applying the given override to it, and returns the modified value. UnknownCommand colType : column to modify UnknownCommand oldValue : current value for the column UnknownCommand newValue : value to use for overriding UnknownCommand : modified value for the column

clear()

Removes all overrides from the class

getColumnData(col)
Parameters:

colGKColumn

Return type:

Dictionary with keys of type .GKObject and values of type QVariant.

Returns the current overrides for a given column. UnknownCommand col: column to query about UnknownCommand a QHash specifying the existing overrides for this column

getColumns()
Return type:

.list of GKColumn

Returns the set of columns for which we currently have any overriden defined

getObjectData(obj)
Parameters:

objGKObject

Return type:

Dictionary with keys of type .GKColumn and values of type QVariant.

Returns the current overrides for a given object. UnknownCommand obj: object to query about UnknownCommand a QHash specifying the overrides for this object

getObjects()
Return type:

.list of GKObject

Returns the list of objects for which we currently have any column overriden

getSectionData(section)
Parameters:

sectionGKSection

Return type:

.list of GKNetworkAttributesOverrideLaneData

Returns the lane attribute overrides for this section

getSectionLaneData(section, lanepos, data)
Parameters:
Return type:

bool

Returns the lane type assigned to the given section & lane

getSections()
Return type:

.list of GKSection

Returns the list of sections whose lane attributes are currently overriden

hasObject(obj)
Parameters:

objGKObject

Return type:

bool

Returns true if the class contains attribute overrides for the given object

hasSection(section)
Parameters:

sectionGKSection

Return type:

bool

Returns true if the lane attributes of this section are overriden

static isColumnTypeValid(type)
Parameters:

typeType

Return type:

bool

Returns true if the given column type is overridable by this class (not all types are supported)

static isColumnValid(col)
Parameters:

colGKColumn

Return type:

bool

Returns true if the given column is overridable by this class (not all column types are supported)

remove(obj, col)
Parameters:
removeSection(section)
Parameters:

sectionGKSection

Removes the given section from the override set

setSectionData(section, data)
Parameters:
  • sectionGKSection

  • data – .list of GKNetworkAttributesOverrideLaneData

Adds the given section & lane attribute overrides to the class.

setSectionLaneData(section, lanepos, data)
Parameters:

Changes the lane type for the given section & lane