]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmnStreamStdout.h
MFV r276759: libpcap 1.6.2.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmnStreamStdout.h
1 //===-- MICmnStreamStdout.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 //++
11 // File:                MICmnStreamStdout.h
12 //
13 // Overview:    CMICmnStreamStdout interface.
14 //
15 // Environment: Compilers:      Visual C++ 12.
16 //                                                      gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
17 //                              Libraries:      See MIReadmetxt. 
18 //
19 // Copyright:   None.
20 //--
21
22 #pragma once
23
24 // In-house headers:
25 #include "MIUtilString.h"
26 #include "MICmnBase.h"
27 #include "MIUtilThreadBaseStd.h"
28 #include "MIUtilSingletonBase.h"
29
30 //++ ============================================================================
31 // Details:     MI common code class. The MI driver requires this object. 
32 //                      CMICmnStreamStdout sets up and tears downs stdout for the driver.
33 //                      
34 //                      Singleton class.
35 // Gotchas:     None.
36 // Authors:     Illya Rudkin 12/02/2014.
37 // Changes:     None.
38 //--
39 class CMICmnStreamStdout
40 :       public CMICmnBase
41 ,       public MI::ISingleton< CMICmnStreamStdout >
42 {
43         friend class MI::ISingleton< CMICmnStreamStdout >;
44
45 // Statics:
46 public:
47         static bool     TextToStdout( const CMIUtilString & vrTxt );
48
49 // Methods:
50 public:
51         bool    Initialize( void );
52         bool    Shutdown( void );
53         //
54         bool    Lock( void );                                                                           
55         bool    Unlock( void );                                                                         
56         bool    Write( const CMIUtilString & vText, const bool vbSendToLog = true );
57         bool    WriteMIResponse( const CMIUtilString & vText, const bool vbSendToLog = true );
58
59 // Methods:
60 private:
61         /* ctor */      CMICmnStreamStdout( void );
62         /* ctor */      CMICmnStreamStdout( const CMICmnStreamStdout & );
63         void            operator=( const CMICmnStreamStdout & );
64         //
65         bool    WritePriv( const CMIUtilString & vText, const CMIUtilString & vTxtForLogFile, const bool vbSendToLog = true );
66         
67 // Overridden:
68 private:
69         // From CMICmnBase
70         /* dtor */ virtual ~CMICmnStreamStdout( void );
71
72 // Attributes:
73 private:
74         CMIUtilThreadMutex m_mutex;     // Mutex object for sync during writing to stream
75 };