Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

OwnerBox< Owner, Data > Class Template Reference

#include <OwnerBox.h>

List of all members.

Public Member Functions

 OwnerBox (Owner *o, void(Owner::*fn)())
 ~OwnerBox (void)
void open (Data *d)
void close (void)
Box< Owner, Data > * checkOut (void)
void checkIn (Box< Owner, Data > *box)
int isOpen ()

Friends

class Box<Owner,Data>

template<class Owner, class Data>
class OwnerBox< Owner, Data >


Constructor & Destructor Documentation

template<class Owner, class Data>
OwnerBox< Owner, Data >::OwnerBox Owner *  o,
void(Owner::*)()  fn
[inline]
 

Definition at line 20 of file OwnerBox.h.

00020                                            :
00021       owner(o), callback(fn), data(0),
00022       numberUsers(0), openCount(0), closeCount(0) {};

template<class Owner, class Data>
OwnerBox< Owner, Data >::~OwnerBox void   )  [inline]
 

Definition at line 24 of file OwnerBox.h.

00024                     {
00025       if (numberUsers) {
00026         CkPrintf("OwnerBox::~OwnerBox() - still have boxes out there!\n");
00027       }
00028     }


Member Function Documentation

template<class Owner, class Data>
void OwnerBox< Owner, Data >::checkIn Box< Owner, Data > *  box  )  [inline]
 

Definition at line 63 of file OwnerBox.h.

Referenced by Patch::unregisterAvgPositionPickup(), Patch::unregisterForceDeposit(), Patch::unregisterPositionPickup(), and HomePatch::unregisterProxy().

00063                                                                {
00064   delete box;
00065   if (closeCount != numberUsers || openCount != numberUsers) {
00066     CkPrintf("OwnerBox::checkIn() Tried to checkIn while in use\n");
00067   }
00068   if ( ! numberUsers-- ) {
00069     CkPrintf("OwnerBox::checkIn() - no registrants remaining\n");
00070     numberUsers = 0;
00071   } else {
00072     closeCount--; openCount--;
00073   }
00074 }

template<class Owner, class Data>
Box< Owner, Data > * OwnerBox< Owner, Data >::checkOut void   )  [inline]
 

Definition at line 54 of file OwnerBox.h.

Referenced by Patch::registerAvgPositionPickup(), Patch::registerForceDeposit(), Patch::registerPositionPickup(), and HomePatch::registerProxy().

00054                                                            {
00055   if (closeCount != numberUsers || openCount != numberUsers) {
00056     CkPrintf("OwnerBox::checkOut() Tried to checkOut while in use\n");
00057   }
00058   ++numberUsers; ++closeCount; ++openCount; 
00059   return (new Box<Owner,Data>(this));
00060 }

template<class Owner, class Data>
void OwnerBox< Owner, Data >::close void   )  [inline]
 

Definition at line 77 of file OwnerBox.h.

Referenced by Box< Patch, CompAtom >::close().

00077                                             {
00078   if (!closeCount && !openCount) {
00079     data = 0; closeCount = openCount = numberUsers;
00080     (owner->*callback)();
00081   } else {
00082     CkPrintf("OwnerBox::close() - close called, but \
00083              closeCount %d openCount %d\n", closeCount, openCount);
00084   }
00085 }

template<class Owner, class Data>
int OwnerBox< Owner, Data >::isOpen  )  [inline]
 

Definition at line 42 of file OwnerBox.h.

00042                  {
00043       return (closeCount != numberUsers || openCount != numberUsers);
00044     }

template<class Owner, class Data>
void OwnerBox< Owner, Data >::open Data *  d  )  [inline]
 

Definition at line 30 of file OwnerBox.h.

Referenced by Patch::positionsReady().

00030                        {
00031       closeCount = openCount = numberUsers;
00032       data = d;
00033       if ( ! closeCount ) close();
00034     }


Friends And Related Function Documentation

template<class Owner, class Data>
friend class Box<Owner,Data> [friend]
 

Definition at line 16 of file OwnerBox.h.


The documentation for this class was generated from the following file:
Generated on Mon Nov 23 05:00:03 2009 for NAMD by  doxygen 1.3.9.1