2 * Copyright 1995, 1996 Perforce Software. All rights reserved.
4 * This file is part of Perforce - the FAST SCM System.
8 * handler.h - last chance handlers to keep track of loose objects
10 * Handlers provide a way of associating an object with a string so
11 * context can be retained across RPC dispatched function calls.
12 * This is used for file transfers, which are carried out in a series
13 * of RPC calls. The sender picks a handle name and then uses that
14 * consistenly during the transfer. The receiver uses the provided handle
15 * name to stash and retrieve the object the represents the open file.
17 * Handlers also provide a means of tracking across objects. If any
18 * object encounters an error, it can mark the handle so that a subsequent
19 * call to AnyErrors() can report so.
23 * Handlers - a list of LastChance objects
24 * LastChance - a virtual base class that gets deleted with the
33 LastChance
*lastChance
;
45 virtual ~LastChance();
47 void Install( Handler
*h
)
50 handler
->lastChance
= this;
58 void SetError( Error
*e
)
60 if( e
->Test() ) isError
= 1;
74 const int maxHandlers
= 3;
82 void Install( const StrPtr
*name
,
83 LastChance
*lastChance
,
86 LastChance
* Get( const StrPtr
*name
, Error
*e
);
88 int AnyErrors( const StrPtr
*nane
);
93 Handler table
[maxHandlers
];
94 Handler
*Find( const StrPtr
*handle
, Error
*e
= 0 );