ld2daps/ld2dap/Output.py

38 lines
921 B
Python

#!/usr/bin/python
# -*- coding: utf-8 -*-
# \file Output.py
# \brief TODO
# \author Florent Guiotte <florent.guiotte@gmail.com>
# \version 0.1
# \date 03 avril 2018
#
# TODO details
from Node import Node
from Input import Input
class Output(Node):
def __init__(self, name='__CHILD__'):
super().__init__('Output:{}'.format(name))
self.__dict__['input'] = None
def __setattr__(self, name, value):
if name == 'input':
self._input(value)
else:
self.__dict__[name] = value
def _input(self, inode):
if not isinstance(inode, (Input)):
raise NotImplementedError('{} is not an Input'.format(inode))
self.__dict__['input'] = inode
inode.register(self)
def process(self, data):
self._process(data)
def _process(self, data):
raise NotImplementedError('{} should override _process()'.format(self))