00001 /** @file 00002 00003 A brief file description 00004 00005 @section license License 00006 00007 Licensed to the Apache Software Foundation (ASF) under one 00008 or more contributor license agreements. See the NOTICE file 00009 distributed with this work for additional information 00010 regarding copyright ownership. The ASF licenses this file 00011 to you under the Apache License, Version 2.0 (the 00012 "License"); you may not use this file except in compliance 00013 with the License. You may obtain a copy of the License at 00014 00015 http://www.apache.org/licenses/LICENSE-2.0 00016 00017 Unless required by applicable law or agreed to in writing, software 00018 distributed under the License is distributed on an "AS IS" BASIS, 00019 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 See the License for the specific language governing permissions and 00021 limitations under the License. 00022 */ 00023 00024 # if ! defined(TS_EXCEPTION_HEADER) 00025 # define TS_EXCEPTION_HEADER 00026 00027 /** @file 00028 Apache Traffic Server Exceptions. 00029 */ 00030 00031 # include <stddef.h> 00032 # include <unistd.h> 00033 00034 namespace ts { 00035 /** Base class for ATS exception. 00036 Clients should subclass as appropriate. This is intended to carry 00037 pre-allocated text along so that it can be thrown without any 00038 addditional memory allocation. 00039 */ 00040 class Exception { 00041 public: 00042 /// Default constructor. 00043 Exception(); 00044 /// Construct with alternate @a text. 00045 Exception( 00046 const char* text ///< Alternate text for exception. 00047 ); 00048 00049 static char const* const DEFAULT_TEXT; 00050 protected: 00051 char const* m_text; 00052 }; 00053 00054 // ---------------------------------------------------------- 00055 // Inline implementations. 00056 00057 inline Exception::Exception() : m_text(DEFAULT_TEXT) { } 00058 inline Exception::Exception(char const* text) : m_text(text) { } 00059 } 00060 00061 # endif // TS_EXCEPTION_HEADER