simulavr  1.1.0
tracecontrol.h
Go to the documentation of this file.
1 /*
2  ****************************************************************************
3  *
4  * simulavr - A simulator for the Atmel AVR family of microcontrollers.
5  * Copyright (C) 2001, 2002, 2003 Klaus Rudolph
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  ****************************************************************************
22  *
23  * $Id$
24  */
25 
26 #ifndef __TRACECONTROL__
27 #define __TRACECONTROL__
28 
29 #include <string>
30 
31 using namespace std;
32 
33 #include "externaltype.h"
34 #include "ui.h"
35 
37 {
38  protected:
40  std::string extName;
42 
43  public:
44  TraceControl(UserInterface *_ui, AvrDevice* _dev, const char *_extName, const char *baseWindow):
45  ui( _ui),
46  extName( _extName),
47  dev(_dev)
48  {
49  ostringstream os;
50  os << "create TraceControl " << _extName << " " << baseWindow << " " << endl;
51  ui->Write(os.str());
52  ui->AddExternalType(extName, this);
53  }
54 
55  void SetNewValueFromUi(const string& s)
56  {
57  if ( s == "1" )
58  {
59  dev->trace_on = 1;
60  }
61  else
62  {
63  dev->trace_on = 0;
64  }
65  }
66 };
67 
68 #endif
69 
Basic AVR device, contains the core functionality.
Definition: avrdevice.h:66
AvrDevice * dev
Definition: tracecontrol.h:41
STL namespace.
std::string extName
identifier for UI access
Definition: tracecontrol.h:40
TraceControl(UserInterface *_ui, AvrDevice *_dev, const char *_extName, const char *baseWindow)
Definition: tracecontrol.h:44
UserInterface * ui
ptr to UI
Definition: tracecontrol.h:39
int trace_on
Definition: avrdevice.h:90
void AddExternalType(const char *name, ExternalType *p)
Definition: ui.h:54
void Write(const std::string &s)
void SetNewValueFromUi(const string &s)
Definition: tracecontrol.h:55