Miasm2
 All Classes Namespaces Files Functions Variables Typedefs Properties Macros
Public Member Functions | Public Attributes | List of all members
miasm2.jitter.jitload.CallbackHandlerBitflag Class Reference
+ Inheritance diagram for miasm2.jitter.jitload.CallbackHandlerBitflag:
+ Collaboration diagram for miasm2.jitter.jitload.CallbackHandlerBitflag:

Public Member Functions

def call_callbacks
 
def add_callback
 
def set_callback
 
def get_callbacks
 
def remove_callback
 
def has_callbacks
 
def __call__
 

Public Attributes

 callbacks
 

Detailed Description

Definition at line 136 of file jitload.py.

Member Function Documentation

def miasm2.jitter.jitload.CallbackHandler.__call__ (   self,
  name,
  args 
)
inherited

Definition at line 131 of file jitload.py.

132  def __call__(self, name, *args):
133  "Wrapper for call_callbacks"
134  return self.call_callbacks(name, *args)
135 

+ Here is the call graph for this function:

def miasm2.jitter.jitload.CallbackHandler.add_callback (   self,
  name,
  callback 
)
inherited
Add a callback to the key @name, iff the @callback isn't already
assigned to it

Definition at line 82 of file jitload.py.

82 
83  def add_callback(self, name, callback):
84  """Add a callback to the key @name, iff the @callback isn't already
85  assigned to it"""
86  if callback not in self.callbacks.get(name, []):
87  self.callbacks[name] = self.callbacks.get(name, []) + [callback]
def miasm2.jitter.jitload.CallbackHandlerBitflag.call_callbacks (   self,
  bitflag,
  args 
)
Call each callbacks associated with bit set in bitflag. While
callbacks return True, continue with next callback.
Iterator on other results

Definition at line 140 of file jitload.py.

141  def call_callbacks(self, bitflag, *args):
142  """Call each callbacks associated with bit set in bitflag. While
143  callbacks return True, continue with next callback.
144  Iterator on other results"""
145 
146  res = True
147  for b in self.callbacks:
148 
149  if b & bitflag != 0:
150  # If the flag matched
151  for res in super(CallbackHandlerBitflag,
152  self).call_callbacks(b, *args):
153  if res is not True:
154  yield res
155 
def miasm2.jitter.jitload.CallbackHandler.get_callbacks (   self,
  name 
)
inherited

Definition at line 92 of file jitload.py.

92 
93  def get_callbacks(self, name):
94  "Return the list of callbacks associated to key 'name'"
95  return self.callbacks.get(name, [])

+ Here is the caller graph for this function:

def miasm2.jitter.jitload.CallbackHandler.has_callbacks (   self,
  name 
)
inherited

Definition at line 116 of file jitload.py.

117  def has_callbacks(self, name):
118  return name in self.callbacks
def miasm2.jitter.jitload.CallbackHandler.remove_callback (   self,
  callback 
)
inherited
Remove the callback from the list.
Return the list of empty keys (removed)

Definition at line 96 of file jitload.py.

96 
97  def remove_callback(self, callback):
98  """Remove the callback from the list.
99  Return the list of empty keys (removed)"""
100 
101  to_check = set()
102  for key, cb_list in self.callbacks.items():
103  try:
104  cb_list.remove(callback)
105  to_check.add(key)
106  except ValueError:
107  pass
108 
109  empty_keys = []
110  for key in to_check:
111  if len(self.callbacks[key]) == 0:
112  empty_keys.append(key)
113  del(self.callbacks[key])
114 
115  return empty_keys
def miasm2.jitter.jitload.CallbackHandler.set_callback (   self,
  name,
  args 
)
inherited

Definition at line 88 of file jitload.py.

88 
89  def set_callback(self, name, *args):
90  "Set the list of callback for key 'name'"
91  self.callbacks[name] = list(args)

Member Data Documentation

miasm2.jitter.jitload.CallbackHandler.callbacks
inherited

Definition at line 80 of file jitload.py.


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