This file is indexed.

/usr/include/Ice/OutgoingAsync.h is in libzeroc-ice-dev 3.7.0-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
// **********************************************************************
//
// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

#ifndef ICE_OUTGOING_ASYNC_H
#define ICE_OUTGOING_ASYNC_H

#include <IceUtil/Timer.h>
#include <IceUtil/Monitor.h>
#include <Ice/OutgoingAsyncF.h>
#include <Ice/CommunicatorF.h>
#include <Ice/ConnectionIF.h>
#include <Ice/ObjectAdapterF.h>
#include <Ice/RequestHandlerF.h>
#include <Ice/ConnectionF.h>
#include <Ice/OutputStream.h>
#include <Ice/InputStream.h>
#include <Ice/ObserverHelper.h>
#include <Ice/LocalException.h>
#include <Ice/UniquePtr.h>

#ifndef ICE_CPP11_MAPPING
#    include <Ice/AsyncResult.h>
#endif

#include <exception>

namespace IceInternal
{

class RetryException;
class CollocatedRequestHandler;

class ICE_API OutgoingAsyncCompletionCallback
{
public:
    virtual ~OutgoingAsyncCompletionCallback();

protected:

    virtual bool handleSent(bool, bool) = 0;
    virtual bool handleException(const Ice::Exception&) = 0;
    virtual bool handleResponse(bool) = 0;

    virtual void handleInvokeSent(bool, OutgoingAsyncBase*) const = 0;
    virtual void handleInvokeException(const Ice::Exception&, OutgoingAsyncBase*) const = 0;
    virtual void handleInvokeResponse(bool, OutgoingAsyncBase*) const = 0;
};

//
// Base class for handling asynchronous invocations. This class is
// responsible for the handling of the output stream and the child
// invocation observer.
//
class ICE_API OutgoingAsyncBase : public virtual OutgoingAsyncCompletionCallback,
#ifdef ICE_CPP11_MAPPING
                                  public std::enable_shared_from_this<OutgoingAsyncBase>
#else
                                  public Ice::AsyncResult
#endif
{
public:

    virtual bool sent();
    virtual bool exception(const Ice::Exception&);
    virtual bool response();

    void invokeSentAsync();
    void invokeExceptionAsync();
    void invokeResponseAsync();

    void invokeSent();
    void invokeException();
    void invokeResponse();

    virtual void cancelable(const IceInternal::CancellationHandlerPtr&);
    void cancel();

#ifndef ICE_CPP11_MAPPING
    virtual Ice::Int getHash() const;

    virtual Ice::CommunicatorPtr getCommunicator() const;
    virtual Ice::ConnectionPtr getConnection() const;
    virtual Ice::ObjectPrx getProxy() const;

    virtual Ice::LocalObjectPtr getCookie() const;
    virtual const std::string& getOperation() const;

    virtual bool isCompleted() const;
    virtual void waitForCompleted();

    virtual bool isSent() const;
    virtual void waitForSent();

    virtual bool sentSynchronously() const;

    virtual void throwLocalException() const;

    virtual bool _waitForResponse();
    virtual Ice::InputStream* _startReadParams();
    virtual void _endReadParams();
    virtual void _readEmptyParams();
    virtual void _readParamEncaps(const ::Ice::Byte*&, ::Ice::Int&);
    virtual void _throwUserException();

    virtual void _scheduleCallback(const CallbackPtr&);
#endif

    void attachRemoteObserver(const Ice::ConnectionInfoPtr& c, const Ice::EndpointPtr& endpt, Ice::Int requestId)
    {
        const Ice::Int size = static_cast<Ice::Int>(_os.b.size() - headerSize - 4);
        _childObserver.attach(getObserver().getRemoteObserver(c, endpt, requestId, size));
    }

    void attachCollocatedObserver(const Ice::ObjectAdapterPtr& adapter, Ice::Int requestId)
    {
        const Ice::Int size = static_cast<Ice::Int>(_os.b.size() - headerSize - 4);
        _childObserver.attach(getObserver().getCollocatedObserver(adapter, requestId, size));
    }

    Ice::OutputStream* getOs()
    {
        return &_os;
    }

    Ice::InputStream* getIs()
    {
        return &_is;
    }

protected:

    OutgoingAsyncBase(const InstancePtr&);

    bool sentImpl(bool);
    bool exceptionImpl(const Ice::Exception&);
    bool responseImpl(bool, bool);

    void cancel(const Ice::LocalException&);
    void checkCanceled();

    void warning(const std::exception&) const;
    void warning() const;

    //
    // This virtual method is necessary for the communicator flush
    // batch requests implementation.
    //
    virtual IceInternal::InvocationObserver& getObserver()
    {
        return _observer;
    }

    const InstancePtr _instance;
    Ice::ConnectionPtr _cachedConnection;
    bool _sentSynchronously;
    bool _doneInSent;
    unsigned char _state;

#ifdef ICE_CPP11_MAPPING
    std::mutex _m;
    using Lock = std::lock_guard<std::mutex>;
#else
    IceUtil::Monitor<IceUtil::Mutex> _m;
    typedef IceUtil::Monitor<IceUtil::Mutex>::Lock Lock;
    Ice::LocalObjectPtr _cookie;
#endif

    IceInternal::UniquePtr<Ice::Exception> _ex;
    IceInternal::UniquePtr<Ice::LocalException> _cancellationException;

    InvocationObserver _observer;
    ObserverHelperT<Ice::Instrumentation::ChildInvocationObserver> _childObserver;

    Ice::OutputStream _os;
    Ice::InputStream _is;

    CancellationHandlerPtr _cancellationHandler;

    static const unsigned char OK;
    static const unsigned char Sent;
#ifndef ICE_CPP11_MAPPING
    static const unsigned char Done;
    static const unsigned char EndCalled;
#endif
};

//
// Base class for proxy based invocations. This class handles the
// retry for proxy invocations. It also ensures the child observer is
// correct notified of failures and make sure the retry task is
// correctly canceled when the invocation completes.
//
class ICE_API ProxyOutgoingAsyncBase : public OutgoingAsyncBase,
                                       public IceUtil::TimerTask
{
public:

    virtual AsyncStatus invokeRemote(const Ice::ConnectionIPtr&, bool, bool) = 0;
    virtual AsyncStatus invokeCollocated(CollocatedRequestHandler*) = 0;

    virtual bool exception(const Ice::Exception&);
    virtual void cancelable(const CancellationHandlerPtr&);

    void retryException(const Ice::Exception&);
    void retry();
    void abort(const Ice::Exception&);

#ifdef ICE_CPP11_MAPPING
    std::shared_ptr<ProxyOutgoingAsyncBase> shared_from_this()
    {
        return std::static_pointer_cast<ProxyOutgoingAsyncBase>(OutgoingAsyncBase::shared_from_this());
    }
#else
    virtual Ice::ObjectPrx getProxy() const;
    virtual Ice::CommunicatorPtr getCommunicator() const;
#endif

protected:

    ProxyOutgoingAsyncBase(const Ice::ObjectPrxPtr&);
    ~ProxyOutgoingAsyncBase();

    void invokeImpl(bool);
    bool sentImpl(bool);
    bool exceptionImpl(const Ice::Exception&);
    bool responseImpl(bool, bool);

    virtual void runTimerTask();

    const Ice::ObjectPrxPtr _proxy;
    RequestHandlerPtr _handler;
    Ice::OperationMode _mode;

private:

    int _cnt;
    bool _sent;
};

//
// Class for handling Slice operation invocations
//
class ICE_API OutgoingAsync : public ProxyOutgoingAsyncBase
{
public:

    OutgoingAsync(const Ice::ObjectPrxPtr&, bool);

    void prepare(const std::string&, Ice::OperationMode, const Ice::Context&);

    virtual bool sent();
    virtual bool response();

    virtual AsyncStatus invokeRemote(const Ice::ConnectionIPtr&, bool, bool);
    virtual AsyncStatus invokeCollocated(CollocatedRequestHandler*);

    void abort(const Ice::Exception&);
    void invoke(const std::string&);
#ifdef ICE_CPP11_MAPPING
    void invoke(const std::string&, Ice::OperationMode, Ice::FormatType, const Ice::Context&,
                std::function<void(Ice::OutputStream*)>);
    void throwUserException();
#endif

    Ice::OutputStream* startWriteParams(Ice::FormatType format)
    {
        _os.startEncapsulation(_encoding, format);
        return &_os;
    }
    void endWriteParams()
    {
        _os.endEncapsulation();
    }
    void writeEmptyParams()
    {
        _os.writeEmptyEncapsulation(_encoding);
    }
    void writeParamEncaps(const ::Ice::Byte* encaps, ::Ice::Int size)
    {
        if(size == 0)
        {
            _os.writeEmptyEncapsulation(_encoding);
        }
        else
        {
            _os.writeEncapsulation(encaps, size);
        }
    }

protected:

    const Ice::EncodingVersion _encoding;

#ifdef ICE_CPP11_MAPPING
    std::function<void(const ::Ice::UserException&)> _userException;
#endif

    bool _synchronous;
};

}

namespace IceInternal
{

#ifdef ICE_CPP11_MAPPING

class ICE_API LambdaInvoke : public virtual OutgoingAsyncCompletionCallback
{
public:

    LambdaInvoke(std::function<void(::std::exception_ptr)> exception, std::function<void(bool)> sent) :
        _exception(std::move(exception)), _sent(std::move(sent))
    {
    }

protected:

    virtual bool handleSent(bool, bool) override;
    virtual bool handleException(const Ice::Exception&) override;
    virtual bool handleResponse(bool) override;

    virtual void handleInvokeSent(bool, OutgoingAsyncBase*) const override;
    virtual void handleInvokeException(const Ice::Exception&, OutgoingAsyncBase*) const override;
    virtual void handleInvokeResponse(bool, OutgoingAsyncBase*) const override;

    std::function<void(::std::exception_ptr)> _exception;
    std::function<void(bool)> _sent;
    std::function<void(bool)> _response;
};

template<typename Promise>
class PromiseInvoke : public virtual OutgoingAsyncCompletionCallback
{
public:

    auto
    getFuture() -> decltype(std::declval<Promise>().get_future())
    {
        return _promise.get_future();
    }

protected:

    Promise _promise;
    std::function<void(bool)> _response;

private:

    virtual bool handleSent(bool, bool) override
    {
        return false;
    }

    virtual bool handleException(const Ice::Exception& ex) override
    {
        try
        {
            ex.ice_throw();
        }
        catch(const Ice::Exception&)
        {
            _promise.set_exception(std::current_exception());
        }
        return false;
    }

    virtual bool handleResponse(bool ok) override
    {
        _response(ok);
        return false;
    }

    virtual void handleInvokeSent(bool, OutgoingAsyncBase*) const override
    {
        assert(false);
    }

    virtual void handleInvokeException(const Ice::Exception&, OutgoingAsyncBase*) const override
    {
        assert(false);
    }

    virtual void handleInvokeResponse(bool, OutgoingAsyncBase*) const override
    {
        assert(false);
    }
};

template<typename T>
class OutgoingAsyncT : public OutgoingAsync
{
public:

    using OutgoingAsync::OutgoingAsync;

    void
    invoke(const std::string& operation,
           Ice::OperationMode mode,
           Ice::FormatType format,
           const Ice::Context& ctx,
           std::function<void(Ice::OutputStream*)> write,
           std::function<void(const Ice::UserException&)> userException)
    {
        _read = [](Ice::InputStream* stream)
        {
            T v;
            stream->read(v);
            return v;
        };
        _userException = std::move(userException);
        OutgoingAsync::invoke(operation, mode, format, ctx, std::move(write));
    }

    void
    invoke(const std::string& operation,
           Ice::OperationMode mode,
           Ice::FormatType format,
           const Ice::Context& ctx,
           std::function<void(Ice::OutputStream*)> write,
           std::function<void(const Ice::UserException&)> userException,
           std::function<T(Ice::InputStream*)> read)
    {
        _read = std::move(read);
        _userException = std::move(userException);
        OutgoingAsync::invoke(operation, mode, format, ctx, std::move(write));
    }

protected:

    std::function<T(Ice::InputStream*)> _read;
};

template<>
class OutgoingAsyncT<void> : public OutgoingAsync
{
public:

    using OutgoingAsync::OutgoingAsync;

    void
    invoke(const std::string& operation,
           Ice::OperationMode mode,
           Ice::FormatType format,
           const Ice::Context& ctx,
           std::function<void(Ice::OutputStream*)> write,
           std::function<void(const Ice::UserException&)> userException)
    {
        _userException = std::move(userException);
        OutgoingAsync::invoke(operation, mode, format, ctx, std::move(write));
    }
};

template<typename R>
class LambdaOutgoing : public OutgoingAsyncT<R>, public LambdaInvoke
{
public:

    LambdaOutgoing(const std::shared_ptr<Ice::ObjectPrx>& proxy,
                   std::function<void(R)> response,
                   std::function<void(::std::exception_ptr)> ex,
                   std::function<void(bool)> sent) :
        OutgoingAsyncT<R>(proxy, false), LambdaInvoke(std::move(ex), std::move(sent))
    {
        _response = [this, response](bool ok)
        {
            if(!ok)
            {
                this->throwUserException();
            }
            else if(response)
            {
                assert(this->_read);
                this->_is.startEncapsulation();
                R v = this->_read(&this->_is);
                this->_is.endEncapsulation();
                try
                {
                    response(std::move(v));
                }
                catch(...)
                {
                    throw std::current_exception();
                }
            }
        };
    }
};

template<>
class LambdaOutgoing<void> : public OutgoingAsyncT<void>, public LambdaInvoke
{
public:

    LambdaOutgoing(const std::shared_ptr<Ice::ObjectPrx>& proxy,
                   std::function<void()> response,
                   std::function<void(::std::exception_ptr)> ex,
                   std::function<void(bool)> sent) :
        OutgoingAsyncT<void>(proxy, false), LambdaInvoke(std::move(ex), std::move(sent))
    {
        _response = [this, response](bool ok)
        {
            if(!ok)
            {
                this->throwUserException();
            }
            else if(response)
            {
                if(!this->_is.b.empty())
                {
                    this->_is.skipEmptyEncapsulation();
                }

                try
                {
                    response();
                }
                catch(...)
                {
                    throw std::current_exception();
                }
            }
        };
    }
};

class CustomLambdaOutgoing : public OutgoingAsync, public LambdaInvoke
{
public:

    CustomLambdaOutgoing(const std::shared_ptr<Ice::ObjectPrx>& proxy,
                         std::function<void(Ice::InputStream*)> read,
                         std::function<void(::std::exception_ptr)> ex,
                         std::function<void(bool)> sent) :
        OutgoingAsync(proxy, false), LambdaInvoke(std::move(ex), std::move(sent))
    {
        _response = [this, read](bool ok)
        {
            if(!ok)
            {
                this->throwUserException();
            }
            else if(read)
            {
                //
                // Read and respond
                //
                read(&this->_is);
            }
        };
    }

    void
    invoke(const std::string& operation,
           Ice::OperationMode mode,
           Ice::FormatType format,
           const Ice::Context& ctx,
           std::function<void(Ice::OutputStream*)> write,
           std::function<void(const Ice::UserException&)> userException)
    {
        _userException = std::move(userException);
        OutgoingAsync::invoke(operation, mode, format, ctx, std::move(write));
    }
};

template<typename P, typename R>
class PromiseOutgoing : public OutgoingAsyncT<R>, public PromiseInvoke<P>
{
public:

    PromiseOutgoing(const std::shared_ptr<Ice::ObjectPrx>& proxy, bool sync) :
        OutgoingAsyncT<R>(proxy, sync)
    {
        this->_response = [this](bool ok)
        {
            if(ok)
            {
                assert(this->_read);
                this->_is.startEncapsulation();
                R v = this->_read(&this->_is);
                this->_is.endEncapsulation();
                this->_promise.set_value(v);
            }
            else
            {
                this->throwUserException();
            }
        };
    }
};

template<typename P>
class PromiseOutgoing<P, void> : public OutgoingAsyncT<void>, public PromiseInvoke<P>
{
public:

    PromiseOutgoing(const std::shared_ptr<Ice::ObjectPrx>& proxy, bool sync) :
        OutgoingAsyncT<void>(proxy, sync)
    {
        this->_response = [&](bool ok)
        {
            if(this->_is.b.empty())
            {
                //
                // If there's no response (oneway, batch-oneway proxies), we just set the promise
                // on completion without reading anything from the input stream. This is required for
                // batch invocations.
                //
                this->_promise.set_value();
            }
            else if(ok)
            {
                this->_is.skipEmptyEncapsulation();
                this->_promise.set_value();
            }
            else
            {
                this->throwUserException();
            }
        };
    }

    virtual bool handleSent(bool done, bool) override
    {
        if(done)
        {
            PromiseInvoke<P>::_promise.set_value();
        }
        return false;
    }
};

#else

//
// Base class for all callbacks.
//
class ICE_API CallbackBase : public IceUtil::Shared
{
public:

    virtual ~CallbackBase();

    void checkCallback(bool, bool);

    virtual void completed(const ::Ice::AsyncResultPtr&) const = 0;
    virtual IceUtil::Handle<CallbackBase> verify(const ::Ice::LocalObjectPtr&) = 0;
    virtual void sent(const ::Ice::AsyncResultPtr&) const = 0;
    virtual bool hasSentCallback() const = 0;
};
typedef IceUtil::Handle<CallbackBase> CallbackBasePtr;

//
// Base class for generic callbacks.
//
class ICE_API GenericCallbackBase : public virtual CallbackBase
{
public:

    virtual ~GenericCallbackBase();
};

//
// See comments in OutgoingAsync.cpp
//
extern ICE_API CallbackBasePtr dummyCallback;

//
// Generic callback template that requires the caller to down-cast the
// proxy and the cookie that are obtained from the AsyncResult.
//
template<class T>
class AsyncCallback : public GenericCallbackBase
{
public:

    typedef T callback_type;
    typedef IceUtil::Handle<T> TPtr;

    typedef void (T::*Callback)(const ::Ice::AsyncResultPtr&);

    AsyncCallback(const TPtr& instance, Callback cb, Callback sentcb = 0) :
        _callback(instance), _completed(cb), _sent(sentcb)
    {
        checkCallback(instance, cb != 0);
    }

    virtual void completed(const ::Ice::AsyncResultPtr& result) const
    {
        (_callback.get()->*_completed)(result);
    }

    virtual CallbackBasePtr verify(const ::Ice::LocalObjectPtr&)
    {
        return this; // Nothing to do, the cookie is not type-safe.
    }

    virtual void sent(const ::Ice::AsyncResultPtr& result) const
    {
        if(_sent)
        {
            (_callback.get()->*_sent)(result);
        }
    }

    virtual bool hasSentCallback() const
    {
        return _sent != 0;
    }

private:

    TPtr _callback;
    Callback _completed;
    Callback _sent;
};

class CallbackCompletion : public virtual OutgoingAsyncCompletionCallback
{
public:

    CallbackCompletion(const CallbackBasePtr& cb, const Ice::LocalObjectPtr& cookie) : _callback(cb)
    {
        if(!_callback)
        {
            throw IceUtil::IllegalArgumentException(__FILE__, __LINE__);
        }
        const_cast<CallbackBasePtr&>(_callback) = _callback->verify(cookie);
    }

    virtual bool handleSent(bool, bool alreadySent)
    {
        return _callback && _callback->hasSentCallback() && !alreadySent;
    }

    virtual bool handleException(const Ice::Exception&)
    {
        return _callback;
    }

    virtual bool handleResponse(bool)
    {
        return _callback;
    }

    virtual void handleInvokeSent(bool, OutgoingAsyncBase* outAsync) const
    {
        _callback->sent(outAsync);
    }

    virtual void handleInvokeException(const Ice::Exception&, OutgoingAsyncBase* outAsync) const
    {
        _callback->completed(outAsync);
    }

    virtual void handleInvokeResponse(bool, OutgoingAsyncBase* outAsync) const
    {
        _callback->completed(outAsync);
    }

private:

    const CallbackBasePtr _callback;
};

class CallbackOutgoing : public OutgoingAsync, public CallbackCompletion
{
public:

    CallbackOutgoing(const Ice::ObjectPrx& proxy,
                     const std::string& operation,
                     const CallbackBasePtr& cb,
                     const Ice::LocalObjectPtr& cookie,
                     bool sync) :
        OutgoingAsync(proxy, sync), CallbackCompletion(cb, cookie), _operation(operation)
    {
        _cookie = cookie;
    }

    virtual const std::string&
    getOperation() const
    {
        return _operation;
    }

private:

    const std::string& _operation;
};

#endif

}

#ifndef ICE_CPP11_MAPPING

namespace Ice
{

typedef IceUtil::Handle< ::IceInternal::GenericCallbackBase> CallbackPtr;

template<class T> CallbackPtr
newCallback(const IceUtil::Handle<T>& instance,
            void (T::*cb)(const AsyncResultPtr&),
            void (T::*sentcb)(const AsyncResultPtr&) = 0)
{
    return new ::IceInternal::AsyncCallback<T>(instance, cb, sentcb);
}

template<class T> CallbackPtr
newCallback(T* instance,
            void (T::*cb)(const AsyncResultPtr&),
            void (T::*sentcb)(const AsyncResultPtr&) = 0)
{
    return new ::IceInternal::AsyncCallback<T>(instance, cb, sentcb);
}

}

//
// Operation callbacks are specified in Proxy.h
//

#endif

#endif