COIN-OR::LEMON - Graph Library

Opened 10 years ago

Closed 10 years ago

#82 closed enhancement (fixed)

Doc review needed for time_measure.h and counter.h

Reported by: alpar Owned by: kpeter
Priority: major Milestone: LEMON 1.0 release
Component: documentation Version: hg main
Keywords: Cc:
Revision id:

Description

See ticket:52 for a longish discussion on it.

Attachments (2)

counter.patch (5.1 KB) - added by kpeter 10 years ago.
counter-reset.patch (1.4 KB) - added by kpeter 10 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 10 years ago by kpeter

  • Status changed from new to assigned

Changed 10 years ago by kpeter

comment:2 follow-ups: Changed 10 years ago by kpeter

I uploaded a patch with improved documentation for counters.

I see only one problem with the current counter-nocounter concept.
The following code

Counter a("a=");
Counter::SubCounter b(a, "b=");
++a;
++b;
b.reset();

prints out

b=0
a=1

However if the SubCounter is replaced with NoSubCounter it prints out

a=2

What do you think about it? It could be fixed using an implementation like SubCounter for NoSubCounter (but without printing report), however then NoSubCounters would generate code even if they are used for a NoCounter.

comment:3 in reply to: ↑ 2 ; follow-up: Changed 10 years ago by alpar

Replying to kpeter:

What do you think about it? It could be fixed using an implementation like SubCounter for NoSubCounter (but without printing report)

I don't like this idea.
What about just removing the reset() functions from the subcounters? Or even from the main counters? (I would expect that reset() also resets the sub-counters, but I can't see any reasonable implementation for that.)

Alternatively, we can leave it as is, but also write a documentation note about when will the reset() do what the user might expect.

comment:4 in reply to: ↑ 2 Changed 10 years ago by alpar

Replying to kpeter:

I uploaded a patch with improved documentation for counters.

The patch went to the main branch, see [b1bd0c2a7f57].

comment:5 in reply to: ↑ 3 ; follow-up: Changed 10 years ago by kpeter

I support removing reset() from subcounters.
For Counter we have two options:

  • Remove the reset() functuion to keep the current concpet that the subcounters can be used exactly the same way as Counter and to avoid the following confusing meaning.
  • Add a note to the doc of reset() that it does not resets the values of SubCounters but it do resets NoSubCounters.

comment:6 in reply to: ↑ 5 Changed 10 years ago by alpar

Replying to kpeter:

I support removing reset() from subcounters.

Let's do that.

For Counter we have two options:

  • Remove the reset() functuion to keep the current concpet that the subcounters can be used exactly the same way as Counter and to avoid the following confusing meaning.
  • Add a note to the doc of reset() that it does not resets the values of SubCounters but it do resets NoSubCounters.

I prefer the latter one.

Changed 10 years ago by kpeter

comment:7 follow-up: Changed 10 years ago by kpeter

I attached a patch about the reset() functions. As it goes to the main branch, this ticket can be closed.

comment:8 in reply to: ↑ 7 Changed 10 years ago by alpar

  • Resolution set to fixed
  • Status changed from assigned to closed

Replying to kpeter:

I attached a patch about the reset() functions. As it goes to the main branch, this ticket can be closed.

It went there, see [8ceb318224b1].

Note: See TracTickets for help on using tickets.