Browse Source

tower backend: add attrProxy definition to Attr.hs.template

Pat Hickey 8 years ago
parent
commit
197ce335ee
1 changed files with 10 additions and 0 deletions
  1. 10 0
      support/tower/Attr.hs.template

+ 10 - 0
support/tower/Attr.hs.template

@@ -167,3 +167,13 @@ readwritableAttrServer val_lbl snum_lbl p get set = do
   return (snd get_response, snd set_response)
   where
   named n = attrName p ++ n
+
+attrProxy :: (AttrWritable w, AttrNamed w, IvoryArea a, IvoryZero a)
+          => w a
+          -> ChanOutput a
+          -> Tower e ()
+attrProxy attr chan = do
+  monitor (attrName attr ++ "Proxy") \$ do
+    handler chan ("write_" ++ attrName attr) \$ do
+      e <- attrEmitter attr
+      callback \$ \\v -> emit e v