apavlenko / vmf

http://01org.github.io/vmf/
Apache License 2.0
0 stars 3 forks source link

[WIP] Statistics object #25

Closed avershov closed 8 years ago

avershov commented 8 years ago

core, sample (no Median, no tests, no save/load)

Please review, do not merge

apavlenko commented 8 years ago

Let's discuss the following design modification proposal:

StatOp(name) //~SOp
SOp -> MinOp, MaxOp, AvgOp, MedianOp, CntOp, SumOp, LastOp
  :: create(name), handle(M.id, action), reset(), getVal(), registerUserOp(SOp)

//FD+FV
StatFieldDesc(name, &MSchema+&MD+&FD [], &SOp) // ~SFD
StatField(&SD, SOp, state) // ~SF
  :: getDesc(),
     getState(),
     update(doRescan = false), //manual
     handle(M.id, action) -> newState,
     getVal() -> const Variant&

//MD+M
StatDesc(name, SFD[]) // ~SD, aka 'config'
Stat(&SD, update_mode, state) // ~S, (runtime, not saved)
  :: getDesc(),
     getState(),
     get/set-UpdateMode(),
     update(doRescan = false), //manual
     notify(M.id, action),
     getField(name) -> SF,
     operator[name] -> const Variant& // ~ getField(name).getVal()

MStream(... SD[], S[])
:: addStat(SD), getStat(name), getStats()

   //update_mode : update_disabled, update_manual, update_on_add, update_on_timer
   //action : add, remove, change
   //state : up-to-date, need-update, need-rescan

NOTE: don't modify your code until we talk

apavlenko commented 8 years ago

replaced with #33