1//===-- Baton.h -------------------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef lldb_Baton_h_
11#define lldb_Baton_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17#include "lldb/lldb-public.h"
18
19namespace lldb_private {
20
21//----------------------------------------------------------------------
22/// @class Baton Baton.h "lldb/Core/Baton.h"
23/// @brief A class designed to wrap callback batons so they can cleanup
24///        any acquired resources
25///
26/// This class is designed to be used by any objects that have a
27/// callback function that takes a baton where the baton might need to
28/// free/delete/close itself.
29///
30/// The default behavior is to not free anything. Subclasses can
31/// free any needed resources in their destructors.
32//----------------------------------------------------------------------
33class Baton
34{
35public:
36	explicit Baton(void *p) :
37        m_data (p)
38    {
39    }
40
41	virtual
42    ~Baton()
43    {
44        // The default destructor for a baton does NOT attempt to clean up
45        // anything in m_baton
46    }
47
48    virtual void
49    GetDescription (Stream *s, lldb::DescriptionLevel level) const;
50
51	void *m_data;  // Leave baton public for easy access
52
53private:
54	//------------------------------------------------------------------
55	// For Baton only
56	//------------------------------------------------------------------
57    DISALLOW_COPY_AND_ASSIGN (Baton);
58};
59
60} // namespace lldb_private
61
62#endif	// lldb_Baton_h_
63