문제

I am trying to write a module to wrap a generic Timer, but I would like to use this module to be able to wrap timers with arbitrary precision, without writing duplicated code.

I wrote the module like that, but it complains that precision_tag is missing a type, but also giving it a type it won't compile.

generic module TimerLoggerP(precision_tag) {
    provides {
        interface Timer<precision_tag> as Timer;
        interface LoggerComponent;
    }

    uses {
        interface Timer<precision_tag> as RTimer;
    }
}

Does anyone know how to make it work in the generic way I am trying to achieve?

도움이 되었습니까?

해결책

Just needs the special typedef type.

generic module TimerLoggerP(typedef precision_tag) {
    provides {
        interface Timer<precision_tag> as Timer;
        interface LoggerComponent;
    }

    uses {
        interface Timer<precision_tag> as RTimer;
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top