CVBpy 15.0
IntSwissKnifeNode Class Reference

Read only node to calculate formulas on the client side with integer arithmetic. More...

Inherits IntegerBaseNode.

Public Member Functions

cvb.gevserver.Int32RegNode create (str name, Optional[int] namespace, Optional[int] address)
 Creates a new int Swiss knife node. More...
 
- Public Member Functions inherited from ValueNode
None from_string (self, str value)
 Sets the value of the node from the string value. More...
 
cvb.EventCookie register_event_on_read_updated (self, Callable[[cvb.gevserver.Node], None] handler)
 Registers a listener to node on read event. More...
 
cvb.EventCookie register_event_written_updated (self, Callable[[cvb.gevserver.Node], None] handler)
 Registers a listener to node written event. More...
 
None unregister_event_on_read_updated (self, cvb.EventCookie event_cookie)
 Manually unregister a listener from the node on read event. More...
 
None unregister_event_written_updated (self, cvb.EventCookie event_cookie)
 Manually unregister a listener from the node written event. More...
 
- Public Member Functions inherited from Node
None add (self, cvb.gevserver.Node node, int kind)
 Adds a node to this node. More...
 
cvb.EventCookie register_event_updated (self, Callable[[cvb.gevserver.Node], None] handler)
 Register a listener to node updated event. More...
 
bool remove (self, cvb.gevserver.Node node, int kind)
 Removes a node from this node. More...
 
None unregister_event_updated (self, cvb.EventCookie event_cookie)
 Manually unregister a listener to the node updated event. More...
 

Properties

 formula = property
 str: Gets or sets a string containing the formula; the formula is evaluated when the value is read. More...
 
 variables = property
 List[cvb.gevserver.IntegerBaseNode]: Gets a dictionary containing all variables of this node. More...
 
- Properties inherited from IntegerBaseNode
 increment = property
 int: Gets the increment of this value. More...
 
 max = property
 int: Gets the maximal allowed number for this value.
 
 min = property
 int: Gets the minimal allowed number for this value.
 
 representation = property
 int: Gets or sets how the value is to be represented (see cvb.NumberRepresentation).
 
 unit = property
 str: Gets the unit of this node's value.
 
 value = property
 int: Gets or sets the value of this node.
 
- Properties inherited from SelectorNode
 is_selector = property
 bool: Gets whether this node selects at least one other. More...
 
 selected_nodes = property
 List[cvb.gevserver.ValueNode]: Gets all nodes selected by this node.
 
- Properties inherited from ValueNode
 is_streamable = property
 bool: Gets whether this node should be used, when the camera settings are stared. More...
 
 polling_time = property
 int: Gets the polling time of this value in milliseconds. More...
 
- Properties inherited from Node
 access_mode = property
 int: Gets the access mode of this node (see cvb.AccessMode).
 
 alias_node = property
 cvb.gevserver.Node: Gets or sets the node that is an alias value for this node. More...
 
 cache_mode = property
 int: Gets the cache mode of this node (see cvb.CacheMode). More...
 
 description = property
 str: Gets or sets the long descriptive text of this node. More...
 
 display_name = property
 str: Gets or sets the display name of this node. More...
 
 event_id = property
 str: Nodes with an event identifier may become invalidated if an event/message is delivered from the device.
 
 imposed_access_mode = property
 int: Gets or sets the default access mode of this node (see cvb.AccessMode). More...
 
 is_available_config = property
 cvb.gevserver.IntegerBaseNode: Gets or sets the node that specifies whether a node is currently available or not. More...
 
 is_deprecated = property
 bool: Gets whether this node is considered deprecated. More...
 
 is_feature = property
 bool: Gets whether this node is considered a feature node. More...
 
 is_implemented = property
 bool: Gets whether the node is implemented.
 
 is_implemented_config = property
 cvb.gevserver.IntegerBaseNode: Gets or sets the node that specifies whether a node is implemented in the device or not. More...
 
 is_locked_config = property
 cvb.gevserver.IntegerBaseNode: Gets or sets the node that specifies whether a node is currently read only or not. More...
 
 is_readable = property
 bool: Helper to check whether this node is readable.
 
 is_writable = property
 bool: Helper to check whether this node is writable.
 
 name = property
 str: Gets the full name of this node. More...
 
 name_only = property
 str: Gets the full name of this node without namespace. More...
 
 name_space = property
 int: Gets the namespace this node is in (see cvb.gevserver.NameSpace). More...
 
 node_map = property
 cvb.gevserver.NodeMap: Gets the node map of this GevServer node.
 
 tool_tip = property
 str: Gets or sets the short descriptive text of this node. More...
 
 visibility = property
 int: Gets the complexity level of this node (see cvb.Visibility).
 

Detailed Description

Read only node to calculate formulas on the client side with integer arithmetic.

Due to the integer arithmetic used in this node a System.Math.Floor(double) operation is performed after each calculation: The computation 2 * (3 / 2) results to two and not three. See the Formula property for available operations.

Member Function Documentation

◆ create()

cvb.gevserver.Int32RegNode create ( str  name,
Optional[int]  namespace,
Optional[int]  address 
)

Creates a new int Swiss knife node.

The node can be created using only the name with namespace or using the name only and an extra namespace parameter. You must add this node to a node map before most operations are possible.

Parameters

name : str Node name with or without namespace prefix. If the name does not contain a namespace prefix and no namespace is specified separately, cvb.gevserver.NameSpace.Custom is used.

namespace : Optional[int] Namespace to place the node in if not part of the name (see cvb.gevserver.NameSpace).

address : Optional[int] Address for this register; -1 for auto assignment.

Returns

cvb.gevserver.Int32RegNode The int swiss knife node.

Property Documentation

◆ formula

formula = property
static

str: Gets or sets a string containing the formula; the formula is evaluated when the value is read.

Add the Variables before setting the formula as the formula's validity is checked on set. The following operations are supported: table (, ) brackets for grouping/overriding operator precedence: 3 * (2 / 3) results to 15. +, -, *, / addition, subtraction, multiplication and division: 3 * 7 + 4 / 2 results to 23. % remainder: 7 % 4 results to 3. ** power: 2 ** 3 results to 8. &, |, ^, ~ bitwise AND; OR, XOR and NOT: 2 | 1 results to 3. &&, || logical AND and OR: 1 && 0 results to 0. <>, =, >, <, <=, >= logical UNEQUAL, EQUAL, GREATER, LESS, LESS OR EQUAL and GREATER OR EQUAL: 3 >= 2 results to 1. <<, >> shift left and shift right: 1 << 2 results to 4. ? : conditional operator <condition> ? <true case> : <false case>. SGN Signum function: -1 if value smaller than 0; 0 if value equal to 0; 1 if value greater than 0: SGN(42) results to 1. NEG Negative function: NEG(-42) results to 42. Keep in mind that a Math.Floor(double) operation is executed after each calculation. Logical operations result in 1 for true and 0 for false. Any number that is evaluated in a logical condition is true as long as it is not 0.

◆ variables

variables = property
static

List[cvb.gevserver.IntegerBaseNode]: Gets a dictionary containing all variables of this node.

The variable names (the key of the dictionary) must consist only of capitalized alphabetical characters. The key of the returned dictionary is the variable name and the value is the node holding the variables value.