Client
reels.Clients
Clients(binary_image=None)
Interface to the c++ container object to hold clients.
The purpose of this object is to be filled (via successive add_client_id() calls) and passed to a Clips (and indirectly to Targets objects). The content can just be serialized as a pickle to make it pythonic, checked for size and iterated by calling client_hashes().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
binary_image |
list
|
An optional binary image (returned by save_as_binary_image()) to initialize the object with data copied from another Clients object. |
None
|
Source code in reels/Clients.py
68 69 70 71 72 |
|
__getstate__()
Used by pickle.dump() (See https://docs.python.org/3/library/pickle.html)
Source code in reels/Clients.py
86 87 88 |
|
__setstate__(state)
Used by pickle.load() (See https://docs.python.org/3/library/pickle.html)
Source code in reels/Clients.py
90 91 92 93 |
|
add_client_id(client)
Define clients explicitly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client |
str
|
The "client". A string representing "the actor". |
required |
Returns:
Type | Description |
---|---|
bool
|
True on success. |
Source code in reels/Clients.py
106 107 108 109 110 111 112 113 114 115 |
|
client_hashes()
Return an iterator to iterate over all the hashed client ids.
Returns:
Type | Description |
---|---|
ClientsHashes
|
An iterator (a ClientsHashes object) |
Source code in reels/Clients.py
117 118 119 120 121 122 123 |
|
hash_client_id(client)
Convert a client id into a hash (as stored buy the internal C** Clients object).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client |
str
|
The "client". A string representing "the actor". |
required |
Returns:
Type | Description |
---|---|
str
|
The hash as a decimal python string starting with 'h' to prevent numeric conversion. |
Source code in reels/Clients.py
95 96 97 98 99 100 101 102 103 104 |
|
load_from_binary_image(binary_image)
Load the state of the c++ Clients object from a binary_image returned by a previous save_as_binary_image() call.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
binary_image |
list
|
A list of strings returned by save_as_binary_image() |
required |
Returns:
Type | Description |
---|---|
bool
|
True on success, destroys, initializes and returns false on failure. |
Source code in reels/Clients.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
num_clients()
Return the number of clients in the object.
The container will add one client per add_client_id() call and keep the order.
Returns:
Type | Description |
---|---|
int
|
The number of clients stored in the object which may include repeated ids. |
Source code in reels/Clients.py
125 126 127 128 129 130 131 132 133 |
|
save_as_binary_image()
Saves the state of the c++ Clients object as a Python list of strings referred to a binary_image.
Returns:
Type | Description |
---|---|
list
|
The binary_image containing the state of the Clients. There is not much you can do with it except serializing it as a Python (e.g., pickle) object and loading it into another Clients object. Pass it to the constructor to create an initialized object, |
Source code in reels/Clients.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
ClientsHashes(cl_id, size)
Iterator over the hashes of a Clients container.
Source code in reels/Clients.py
38 39 40 41 |
|