14 template <
class Owner, 
class Data> 
class Box { 
    22       state(CLOSED), user(n),
    29     enum box_state {OPEN, CLOSED} state;
    40       ownerBox->openCount--;
    42       if (ownerBox->openCount < 0) 
NAMD_bug(
"too many boxes opened");
    43       if (state != CLOSED) 
NAMD_bug(
"box re-opened");
    46       return ownerBox->data;
    51       ownerBox->closeCount--;
    53       if (ownerBox->closeCount < 0) 
NAMD_bug(
"too many boxes closed");
    54       if (state != OPEN) 
NAMD_bug(
"box re-closed");
    58       if ( ! ownerBox->closeCount ) {
    64       ownerBox->openCount--;
    65       ownerBox->closeCount--;
    67       if (state != CLOSED) 
NAMD_bug(
"box skipped while open");
    68       if (ownerBox->openCount < 0) 
NAMD_bug(
"too many boxes opened");
    69       if (ownerBox->closeCount < 0) 
NAMD_bug(
"too many boxes closed");
    71       if ( ! ownerBox->closeCount ) {
 
void NAMD_bug(const char *err_msg)
 
void close(Data **const t)