NAME

ACE_Token_Invariant_Manager - Token Invariants

SYNOPSIS


#include <ace/Token_Invariants>


class ACE_Token_Invariant_Manager
{
  public:
    static ACE_Token_Invariant_Manager *instance (void);
    int acquired (const ACE_Token_Proxy *proxy);
    void releasing (const ACE_Token_Proxy *proxy);
    int mutex_acquired (const char *token_name);
    void mutex_releasing (const char *token_name);
    int reader_acquired (const char *token_name);
    int writer_acquired (const char *token_name);
    void rwlock_releasing (const char *token_name);
    void dump (void) const;
  protected:
    int get_mutex (
        const char *token_name,
        ACE_Mutex_Invariants *&inv
        );
    int get_rwlock (
        const char *token_name,
        ACE_RWLock_Invariants *&inv
        );
    ACE_Token_Invariant_Manager (void);
    ~ACE_Token_Invariant_Manager (void);
    ACE_TOKEN_CONST::MUTEX lock_;
    typedef ACE_Token_Name TOKEN_NAME;
        typedef ACE_Map_Manager<TOKEN_NAME, ACE_Mutex_Invariants *, ACE_Null_Mutex> MUTEX_COLLECTION;
        
        typedef ACE_Map_Iterator<TOKEN_NAME, ACE_Mutex_Invariants *, ACE_Null_Mutex> MUTEX_COLLECTION_ITERATOR;
        
        typedef ACE_Map_Entry<TOKEN_NAME, ACE_Mutex_Invariants *> MUTEX_COLLECTION_ENTRY;
        
    MUTEX_COLLECTION mutex_collection_;
        typedef ACE_Map_Manager<TOKEN_NAME, ACE_RWLock_Invariants *, ACE_Null_Mutex> RWLOCK_COLLECTION;
        
        typedef ACE_Map_Iterator<TOKEN_NAME, ACE_RWLock_Invariants *, ACE_Null_Mutex> RWLOCK_COLLECTION_ITERATOR;
        
        typedef ACE_Map_Entry<TOKEN_NAME, ACE_RWLock_Invariants *> RWLOCK_COLLECTION_ENTRY;
        
    RWLOCK_COLLECTION rwlock_collection_;
};

DESCRIPTION

Allows applications to test that invariants are always satisfied. Can test mutexes and readers/writer locks. Does not test recursive acquisition.

Polymorphic methods. Just pass in the proxy and the method

figures out the type of the token.
int acquired (const ACE_Token_Proxy *proxy);
void releasing (const ACE_Token_Proxy *proxy);

Explicit methods. These to not require actual proxies in order

to test a scenario.
int mutex_acquired (const char *token_name);
void mutex_releasing (const char *token_name);
int reader_acquired (const char *token_name);
int writer_acquired (const char *token_name);
void rwlock_releasing (const char *token_name);
void dump (void) const;

AUTHOR

Tim Harrison (harrison@cs.wustl.edu)

BUGS

This class does not ever clean its database. Until destroyed, it's size will forever increase.

LIBRARY

ace