Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# ACE_Token_Collection Class Reference

Allows atomic token group operations AND provides a ACE_Token manager interface. More...

`#include <Token_Collection.h>`

Inheritance diagram for ACE_Token_Collection:

[legend]
Collaboration diagram for ACE_Token_Collection:

[legend]
List of all members.

## Public Methods
| ACE_Token_Collection (int debug=0, const ACE_TCHAR *name=0)
| <debug> print out verbose debugging messages. More...
int | insert (ACE_Token_Proxy &token)
int | extract (const ACE_TCHAR *token_name, ACE_Token_Proxy *&proxy)
| removes the ACE_Token matching the given token_name from the collection. More...
ACE_Token_Proxy * | is_member (const ACE_TCHAR *token_name)
| returns the proxy if true. 0 otherwise. More...
int | is_member (const ACE_Token_Proxy &token)
| Is the specified token in the collection? 1, yes. More...
virtual int | acquire (int notify=0, void(*sleep_hook)(void *)=0, ACE_Synch_Options &options=ACE_Synch_Options::defaults)
| Acquire "atomically" all resources in the collection. More...
virtual int | acquire (const ACE_TCHAR *token_name, int notify=0, void(*sleep_hook)(void *)=0, ACE_Synch_Options &options=ACE_Synch_Options::defaults)
| Acquire the token corresponding to <token_name>. The other parameters are passed to <token>acquire. More...
virtual int | tryacquire (void(*sleep_hook)(void *)=0)
| Try to acquire all tokens in collection. More...
virtual int | tryacquire (const ACE_TCHAR *token_name, void(*sleep_hook)(void *)=0)
| Try to acquire <token_name>. More...
virtual int | renew (int requeue_position=0, ACE_Synch_Options &options=ACE_Synch_Options::defaults)
| Renews "atomically" all resources in the collection. More...
virtual int | renew (const ACE_TCHAR *token_name, int requeue_position=0, ACE_Synch_Options &options=ACE_Synch_Options::defaults)
| Renew the token corresponding to <token_name>. The other parameters are passed to <token>renew. More...
virtual int | release (ACE_Synch_Options &options=ACE_Synch_Options::defaults)
| Releases "atomically" all resources in the collection. More...
virtual int | release (const ACE_TCHAR *token_name, ACE_Synch_Options &options=ACE_Synch_Options::defaults)
| Release the token corresponding to <token_name>. The other parameters are passed to <token>release. More...
| ~ACE_Token_Collection (void)
void | dump (void) const
| Dump the state of the class. More...
virtual const ACE_TCHAR * | name (void) const
| Return the name of the collection. Not very functionally important, but sometimes a useful debugging tool. More...
## Protected Types
typedef ACE_Token_Name | TOKEN_NAME
typedef ACE_Map_Manager< TOKEN_NAME, ACE_Token_Proxy *, ACE_Null_Mutex > | COLLECTION
| COLLECTION maintains a mapping from token names to ACE_Tokens*. More...
typedef ACE_Map_Iterator< TOKEN_NAME, ACE_Token_Proxy *, ACE_Null_Mutex > | COLLECTION_ITERATOR
| Allows iterations through collection_. More...
typedef ACE_Map_Entry< TOKEN_NAME, ACE_Token_Proxy *> | COLLECTION_ENTRY
| Allows iterations through collection_. More...
## Protected Methods
virtual ACE_Token_Proxy * | clone (void) const
| Return a dynamically allocated clone of the derived class. More...
virtual ACE_Tokens * | create_token (const ACE_TCHAR *name)
| Make the correct type of ACE_Tokens. This is called by the Token Manager. More...
## Protected Attributes
COLLECTION | collection_
| COLLECTION maintains a mapping from token names to ACE_Tokens*. More...
int | debug_
| Whether to print out debug messages or not. More...
ACE_TCHAR | name_ [ACE_MAXTOKENNAMELEN]
| Name of the collection. More...

## Detailed Description

Allows atomic token group operations AND provides a ACE_Token manager interface.

There are two types of operations offered by ACE_Token_Collection. The first is atomic operations on collections of Token_Proxies. In this respect, the ACE_Token_Collection can be thought of as a single token consisting of multiple Token_Proxies. The second role of the ACE_Token_Collection is as a ACE_Token manager. ACE_Token_Collection allows individual operations on single members of a collection of Token_Proxies. This provides a single access point for operations on multiple tokens.

## Member Typedef Documentation

typedef ACE_Map_Manager<TOKEN_NAME, ACE_Token_Proxy *, ACE_Null_Mutex> ACE_Token_Collection::COLLECTION`[protected]`

| COLLECTION maintains a mapping from token names to ACE_Tokens*.

typedef ACE_Map_Entry<TOKEN_NAME, ACE_Token_Proxy *> ACE_Token_Collection::COLLECTION_ENTRY`[protected]`

| Allows iterations through collection_.

typedef ACE_Map_Iterator<TOKEN_NAME, ACE_Token_Proxy *, ACE_Null_Mutex> ACE_Token_Collection::COLLECTION_ITERATOR`[protected]`

| Allows iterations through collection_.

typedef ACE_Token_Name ACE_Token_Collection::TOKEN_NAME`[protected]`

## Constructor & Destructor Documentation

ACE_Token_Collection::ACE_Token_Collection | ( | int | debug = 0,
|  | const ACE_TCHAR * | name = 0
| ) |

| <debug> print out verbose debugging messages. <name> will give a name to the collection. Collections don't really need names, but are sometimes useful for debugging.

ACE_Token_Collection::~ACE_Token_Collection | ( | void |  | ) |

## Member Function Documentation

int ACE_Token_Collection::acquire | ( | const ACE_TCHAR * | token_name,
|  | int | notify = 0,
|  | void(* | sleep_hook)(void *) = 0,
|  | ACE_Synch_Options & | options = ACE_Synch_Options::defaults
| ) | `[virtual]`

| Acquire the token corresponding to <token_name>. The other parameters are passed to <token>acquire.

int ACE_Token_Collection::acquire | ( | int | notify = 0,
|  | void(* | sleep_hook)(void *) = 0,
|  | ACE_Synch_Options & | options = ACE_Synch_Options::defaults
| ) | `[virtual]`

| Acquire "atomically" all resources in the collection. This is only successfull if all tokens in the collection could be acquired. options contains the blocking semantics, timeout value, etc. Returns: 0 on success, -1 on failure with <errno> == problem. If and error or deadlock occurs for one of the tokens, all the tokens will be released and the method will return -1. Note that returning on detection of deadlock prevents livelock between competing collections. If a collection returns after detecting deadlock, it is the application's responsibility to not to blindly loop on the collection::acquire operation. In other words, once the collection reports deadlock, it is out of our hands. Reimplemented from ACE_Token_Proxy.

ACE_Token_Proxy * ACE_Token_Collection::clone | ( | void |  | ) | const`[protected, virtual]`

| Return a dynamically allocated clone of the derived class. Reimplemented from ACE_Token_Proxy.

ACE_Tokens * ACE_Token_Collection::create_token | ( | const ACE_TCHAR * | name | ) | `[protected, virtual]`

| Make the correct type of ACE_Tokens. This is called by the Token Manager. Reimplemented from ACE_Token_Proxy.

void ACE_Token_Collection::dump | ( | void |  | ) | const

| Dump the state of the class. Reimplemented from ACE_Token_Proxy.

int ACE_Token_Collection::extract | ( | const ACE_TCHAR * | token_name,
|  | ACE_Token_Proxy *& | proxy
| ) |

| removes the ACE_Token matching the given token_name from the collection. On success, extract returns 0. On failure (token_name was not in the collection,) extract returns -1. On success, the state of the token found is copied into proxy. The returned ACE_Token_Proxy* must be deleted by the user.

int ACE_Token_Collection::insert | ( | ACE_Token_Proxy & | new_token | ) |

int ACE_Token_Collection::is_member | ( | const ACE_Token_Proxy & | token | ) |

| Is the specified token in the collection? 1, yes. 0, no.

ACE_Token_Proxy * ACE_Token_Collection::is_member | ( | const ACE_TCHAR * | token_name | ) |

| returns the proxy if true. 0 otherwise.

virtual const ACE_TCHAR* ACE_Token_Collection::name | ( | void |  | ) | const`[virtual]`

| Return the name of the collection. Not very functionally important, but sometimes a useful debugging tool. Reimplemented from ACE_Token_Proxy.

int ACE_Token_Collection::release | ( | const ACE_TCHAR * | token_name,
|  | ACE_Synch_Options & | options = ACE_Synch_Options::defaults
| ) | `[virtual]`

| Release the token corresponding to <token_name>. The other parameters are passed to <token>release.

int ACE_Token_Collection::release | ( | ACE_Synch_Options & | options = ACE_Synch_Options::defaults | ) | `[virtual]`

| Releases "atomically" all resources in the collection. This is only successfull if all tokens in the collection could be released. options contains the blocking semantics, timeout value, etc. Returns: 0 on success, -1 on failure with <errno> == problem. Reimplemented from ACE_Token_Proxy.

int ACE_Token_Collection::renew | ( | const ACE_TCHAR * | token_name,
|  | int | requeue_position = 0,
|  | ACE_Synch_Options & | options = ACE_Synch_Options::defaults
| ) | `[virtual]`

| Renew the token corresponding to <token_name>. The other parameters are passed to <token>renew.

int ACE_Token_Collection::renew | ( | int | requeue_position = 0,
|  | ACE_Synch_Options & | options = ACE_Synch_Options::defaults
| ) | `[virtual]`

| Renews "atomically" all resources in the collection. This is only successfull if all tokens in the collection could be renewed. options contains the blocking semantics, timeout value, etc. Returns: 0 on success, -1 on failure with <errno> == problem. Reimplemented from ACE_Token_Proxy.

int ACE_Token_Collection::tryacquire | ( | const ACE_TCHAR * | token_name,
|  | void(* | sleep_hook)(void *) = 0
| ) | `[virtual]`

| Try to acquire <token_name>.

int ACE_Token_Collection::tryacquire | ( | void(* | sleep_hook)(void *) = 0 | ) | `[virtual]`

| Try to acquire all tokens in collection. Reimplemented from ACE_Token_Proxy.

## Member Data Documentation

COLLECTION ACE_Token_Collection::collection_`[protected]`

| COLLECTION maintains a mapping from token names to ACE_Tokens*.

int ACE_Token_Collection::debug_`[protected]`

| Whether to print out debug messages or not. Reimplemented from ACE_Token_Proxy.

ACE_TCHAR ACE_Token_Collection::name_[ACE_MAXTOKENNAMELEN]`[protected]`

| Name of the collection.

The documentation for this class was generated from the following files:

- Token_Collection.h
- Token_Collection.cpp