Ice 3.7 C++11 API Reference
Loading...
Searching...
No Matches
ExceptionHelpers.h
Go to the documentation of this file.
1//
2// Copyright (c) ZeroC, Inc. All rights reserved.
3//
4
5#ifndef ICE_EXCEPTION_HELPERS_H
6#define ICE_EXCEPTION_HELPERS_H
7
8#ifdef ICE_CPP11_MAPPING // C++11 mapping
9
10#include <Ice/InputStream.h>
11#include <Ice/OutputStream.h>
12
13namespace Ice
14{
15
16class LocalException;
17
22template<typename T, typename B> class LocalExceptionHelper : public IceUtil::ExceptionHelper<T, B>
23{
24public:
25
26 using IceUtil::ExceptionHelper<T, B>::ExceptionHelper;
27
28 virtual std::string ice_id() const override
29 {
30 return T::ice_staticId();
31 }
32};
33
38template<typename T, typename B> class UserExceptionHelper : public IceUtil::ExceptionHelper<T, B>
39{
40public:
41
42 using IceUtil::ExceptionHelper<T, B>::ExceptionHelper;
43
44 virtual std::string ice_id() const override
45 {
46 return T::ice_staticId();
47 }
48
49protected:
50
52 virtual void _writeImpl(Ice::OutputStream* os) const override
53 {
54 os->startSlice(T::ice_staticId(), -1, std::is_same<B, Ice::UserException>::value ? true : false);
55 Ice::StreamWriter<T, Ice::OutputStream>::write(os, static_cast<const T&>(*this));
56 os->endSlice();
57 B::_writeImpl(os);
58 }
59
60 virtual void _readImpl(Ice::InputStream* is) override
61 {
62 is->startSlice();
63 Ice::StreamReader<T, ::Ice::InputStream>::read(is, static_cast<T&>(*this));
64 is->endSlice();
65 B::_readImpl(is);
66 }
68};
69
70}
71
72#endif // C++11 mapping end
73
74#endif
Helper template for the implementation of Ice::Exception.
Definition Exception.h:128
Interface for input streams used to extract Slice types from a sequence of bytes.
Definition InputStream.h:50
std::string startSlice()
Reads the start of a value or exception slice.
Definition InputStream.h:547
void endSlice()
Indicates that the end of a value or exception slice has been reached.
Definition InputStream.h:556
Helper template for the implementation of Ice::LocalException.
Definition ExceptionHelpers.h:23
virtual std::string ice_id() const override
Definition ExceptionHelpers.h:28
Base class for all Ice run-time exceptions.
Definition Exception.h:29
Interface for output streams used to create a sequence of bytes from Slice types.
Definition OutputStream.h:28
void startSlice(const std::string &typeId, int compactId, bool last)
Writes the start of a value or exception slice.
Definition OutputStream.h:285
void endSlice()
Marks the end of a value or exception slice.
Definition OutputStream.h:294
Helper template for the implementation of Ice::UserException.
Definition ExceptionHelpers.h:39
virtual std::string ice_id() const override
Definition ExceptionHelpers.h:44
Definition BuiltinSequences.h:56