Package Products :: Package ZenModel :: Module RpnGraphPoint |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenModel.RpnGraphPoint

     1  ##############################################################################
     2  #
     3  # Copyright (C) Zenoss, Inc. 2011, all rights reserved.
     4  #
     5  # This content is made available according to terms specified in
     6  # License.zenoss under the directory where your Zenoss product is installed.
     7  #
     8  ##############################################################################
     9
    10
    11  __doc__="""RpnGraphPoint
    12
    13  Base class for graph points with RPNs. Never directly instantiated.
    14  """
    15
    16  from Globals import InitializeClass
    17
    18  from Products.ZenModel.GraphPoint import GraphPoint
    19  from Products.ZenRRD.utils import rpnStack
    20
    21
    22 -class RpnGraphPoint(GraphPoint):
    23      rpn = ''
    24
    25      _properties = GraphPoint._properties + (
    26          {'id':'rpn', 'type':'string', 'mode':'w'},
    27          )
    28
    29 -    def getDescription(self):
    30          return self.rpn
    31
    32
    33 -    def getRpn(self, multiid=-1, prefix=''):
    34          parts = self.rpn.split(',')
    35          for i, var in enumerate(parts):
    36              try:
    37                  unused = float(var)
    38                  continue
    39              except ValueError:
    40                  pass
    41
    42              if var in rpnStack.opcodes:
    43                  continue
    44
    45              parts[i] = self.getDsName(var, multiid, prefix)
    46
    47          return ','.join(parts)
    48
    49
    50  InitializeClass(RpnGraphPoint)
    51