YAMI4 Python Library 2.0.0
Messaging Solution for Distributed Systems
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
yami.Parameters Class Reference
Inheritance diagram for yami.Parameters:

Classes

class  __EntryIterator
 

Public Member Functions

def __init__ (self)
 
def __setitem__ (self, name, value)
 
def __getitem__ (self, name)
 
def __delitem__ (self, name)
 
def __len__ (self)
 
def __in__ (self, name)
 
def __iter__ (self)
 
def keys (self)
 
def values (self)
 
def items (self)
 
def serialize (self)
 
def deserialize (self, buf)
 
def __str__ (self)
 

Detailed Description

Collection of message parameters.

A collection of message parameters is a list of typed {name, value} pairs.
Each entry in this collection has a unique name and can have
one of the following types:
    - bool or bool array
    - int or int array
    - long or long array
    - float or float array
    - string or string array
    - binary buffers or their arrays
    - nested Parameters entry, which provides its own scope for naming.
    - nested Parameters arrays

The names of entries are searched for using
case-sensitive comparisons.

Note:
The instances of this class should not be used from multiple threads
without synchronization;
it is safe to use separate instances in separate threads.

Note:
The entries are ordered - the order in which they are created
influences the final serialized form of the message payload.
Newly created entries are appended to the end of the collection unless
there is an existing empty slot that can be reused - the appropriate
slot is searched for from the beginning to the end of the collection
and if no free slot is found the collection is extended at the end.
The above guarantee concerns the user code that relies on
predictable serialization.

Constructor & Destructor Documentation

◆ __init__()

def yami.Parameters.__init__ (   self)
Default constructor, creates an empty collection of parameters.

Member Function Documentation

◆ __delitem__()

def yami.Parameters.__delitem__ (   self,
  name 
)
Removes the given entry from the collection.

Note: The removed entry leaves a hole (empty slot) in
the collection that can be reused by newly added entries.

◆ __getitem__()

def yami.Parameters.__getitem__ (   self,
  name 
)
Returns the value of the named slot.

◆ __in__()

def yami.Parameters.__in__ (   self,
  name 
)
Checks if the entry with the given name (key) exists.

◆ __iter__()

def yami.Parameters.__iter__ (   self)
Gets the iterator over the list of keys.

The iterator visits only those entries which are used
(in other words, it skips unused slots).

◆ __len__()

def yami.Parameters.__len__ (   self)
Gets the current size of the collection.

◆ __setitem__()

def yami.Parameters.__setitem__ (   self,
  name,
  value 
)
Sets the given value in the named slot.

If the given slot is already used, its value is replaced.

◆ __str__()

def yami.Parameters.__str__ (   self)
Returns a string representation of the content.

This function is supposed to be used by unit tests and for
simple debugging.

◆ deserialize()

def yami.Parameters.deserialize (   self,
  buf 
)
Deserializes from the given buffer.

Note: The current content of this object is not cleared
before attempting deserialization and each retrieved data element
is merged into the current content as if done by inserting entries
individually.
In most cases deserialization will be performed to the empty
Parameters object (to reconstruct it to the form that was used
for serialization), but deserialization onto non-empty object
might be occasionally useful as a way of merging two collections.

◆ items()

def yami.Parameters.items (   self)
Gets the iterator over the list of items.

The iterator visits only those entries which are used
(in other words, it skips unused slots).

◆ keys()

def yami.Parameters.keys (   self)
Gets the iterator over the list of keys.

The iterator visits only those entries which are used
(in other words, it skips unused slots).

◆ serialize()

def yami.Parameters.serialize (   self)
Serializes the content of the whole collection.

Returns the binary string with the serialized content.

◆ values()

def yami.Parameters.values (   self)
Gets the iterator over the list of values.

The iterator visits only those entries which are used
(in other words, it skips unused slots).

The documentation for this class was generated from the following file: