OpenASIP  2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
OSEd Class Reference

#include <OSEd.hh>

Inheritance diagram for OSEd:
Inheritance graph
Collaboration diagram for OSEd:
Collaboration graph

Public Member Functions

 OSEd ()
 
virtual ~OSEd ()
 
virtual bool OnInit ()
 
virtual int OnExit ()
 
OSEdMainFramemainFrame () const
 
OSEdOptionsoptions () const
 

Private Member Functions

 OSEd (const OSEd &)
 Copying not allowed. More...
 
OSEdoperator= (const OSEd &)
 Assignment not allowed. More...
 
void createDefaultOptions ()
 

Private Attributes

OSEdMainFramemainFrame_
 Main window of the application. More...
 
OSEdOptionsoptions_
 Options of the application. More...
 

Detailed Description

Main class for OSEd (Operation Set Editor).

Initializes the application.

Definition at line 47 of file OSEd.hh.

Constructor & Destructor Documentation

◆ OSEd() [1/2]

OSEd::OSEd ( )

Constructor.

Definition at line 62 of file OSEd.cc.

62  : mainFrame_(NULL), options_(NULL) {
63 }

◆ ~OSEd()

OSEd::~OSEd ( )
virtual

Destructor.

Definition at line 68 of file OSEd.cc.

68  {
69 }

◆ OSEd() [2/2]

OSEd::OSEd ( const OSEd )
private

Copying not allowed.

Member Function Documentation

◆ createDefaultOptions()

void OSEd::createDefaultOptions ( )
private

Creates the default options and writes them to the file.

Definition at line 163 of file OSEd.cc.

163  {
165  OSEdOptionsSerializer serializer;
166  string confFile =
168  serializer.setDestinationFile(confFile);
169  try {
170  serializer.writeState(options_->saveState());
171  } catch (const Exception& e) {
172  cerr << "Writing options failed: " << e.errorMessage() << endl;
173  }
174 }

References OSEdConstants::CONF_FILE_NAME, OSEdConstants::DEFAULT_EDITOR, Exception::errorMessage(), options_, OSEdOptions::saveState(), OSEdOptionsSerializer::setDestinationFile(), OSEdOptions::setEditor(), Environment::userConfPath(), and OSEdOptionsSerializer::writeState().

Referenced by OnInit().

Here is the call graph for this function:

◆ mainFrame()

OSEdMainFrame * OSEd::mainFrame ( ) const

Returns the main frame of the application.

Returns
The main frame of the application.

Definition at line 145 of file OSEd.cc.

145  {
146  return mainFrame_;
147 }

References mainFrame_.

◆ OnExit()

int OSEd::OnExit ( )
virtual

Deletes the application level dynamic objects not handled by wxWindows.

This function is called when application is about to exit.

Returns
0.

Definition at line 131 of file OSEd.cc.

131  {
134  delete options_;
135  options_ = NULL;
136  return 0;
137 }

References OSEdTextGenerator::destroy(), OperationContainer::destroy(), and options_.

Here is the call graph for this function:

◆ OnInit()

bool OSEd::OnInit ( )
virtual

Initializes the application.

Creates mainframe as well as reads the configure file.

Returns
True.

Definition at line 79 of file OSEd.cc.

79  {
80 
82 
83  mainFrame_ = new OSEdMainFrame(_T("Operation Set Editor"),
84  wxPoint(50, 50), wxSize(900, 500));
85 
87 
88  options_ = new OSEdOptions();
89  OSEdOptionsSerializer serializer;
90 
92  serializer.setSourceFile(confFile);
93 
94  try {
95  options_->loadState(serializer.readState());
96  } catch (const Exception& e) {
97  cerr << "Config file not found, default options will be used." << endl
98  << "OseD may use the editor in your $VISUAL"
99  << " environmental variable." << endl
100  << "If this points to some non-graphical editor, "
101  << "please change the editor from settings." << endl;
103  }
104 
106 
107  OSEdTreeView* treeView = mainFrame_->treeView();
108  vector<string> results = treeView->constructTree();
109  // if some errors occurred while buildin the tree view, error message is
110  // shown
111  if (results.size() > 0) {
113  ResultDialog result(mainFrame_, results, fmt.str());
114  result.ShowModal();
115  }
116 
117  mainFrame_->Show(true);
118  SetTopWindow(mainFrame_);
119 
120  return true;
121 }

References OSEdConstants::CONF_FILE_NAME, Environment::confPath(), OSEdTreeView::constructTree(), createDefaultOptions(), Application::initialize(), OSEdTextGenerator::instance(), OSEdOptions::loadState(), mainFrame_, options_, OSEdOptionsSerializer::readState(), OSEdOptionsSerializer::setSourceFile(), Texts::TextGenerator::text(), WxConversion::toCStringArray(), OSEdMainFrame::treeView(), OSEdTextGenerator::TXT_XML_RESULT_DIALOG_TITLE, and OSEdMainFrame::updateMenuBar().

Here is the call graph for this function:

◆ operator=()

OSEd& OSEd::operator= ( const OSEd )
private

Assignment not allowed.

◆ options()

OSEdOptions * OSEd::options ( ) const

Returns the options of the application.

Returns
The options of the application.

Definition at line 155 of file OSEd.cc.

155  {
156  return options_;
157 }

References options_.

Member Data Documentation

◆ mainFrame_

OSEdMainFrame* OSEd::mainFrame_
private

Main window of the application.

Definition at line 67 of file OSEd.hh.

Referenced by mainFrame(), and OnInit().

◆ options_

OSEdOptions* OSEd::options_
private

Options of the application.

Definition at line 69 of file OSEd.hh.

Referenced by createDefaultOptions(), OnExit(), OnInit(), and options().


The documentation for this class was generated from the following files:
OSEdOptions::setEditor
void setEditor(const std::string &editor)
Definition: OSEdOptions.cc:69
OSEdOptionsSerializer::writeState
virtual void writeState(const ObjectState *state)
Definition: OSEdOptionsSerializer.cc:55
OSEdOptions::saveState
ObjectState * saveState() const
Definition: OSEdOptions.cc:100
OSEdTextGenerator::TXT_XML_RESULT_DIALOG_TITLE
@ TXT_XML_RESULT_DIALOG_TITLE
XML result dialog title.
Definition: OSEdTextGenerator.hh:117
OSEdTextGenerator::destroy
static void destroy()
Definition: OSEdTextGenerator.cc:225
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
OSEdMainFrame::treeView
OSEdTreeView * treeView() const
Definition: OSEdMainFrame.cc:241
Environment::userConfPath
static TCEString userConfPath(const std::string &fileName)
Definition: Environment.cc:303
OSEdOptionsSerializer::readState
virtual ObjectState * readState()
Definition: OSEdOptionsSerializer.cc:71
OSEdTreeView
Definition: OSEdTreeView.hh:54
OSEdConstants::DEFAULT_EDITOR
static const std::string DEFAULT_EDITOR
Default editor name.
Definition: OSEdConstants.hh:85
OperationContainer::destroy
static void destroy()
Definition: OperationContainer.cc:280
ResultDialog
Definition: ResultDialog.hh:44
OSEdOptionsSerializer::setDestinationFile
void setDestinationFile(const std::string &fileName)
Definition: OSEdOptionsSerializer.cc:99
OSEdOptionsSerializer
Definition: OSEdOptionsSerializer.hh:44
Exception
Definition: Exception.hh:54
OSEd::mainFrame_
OSEdMainFrame * mainFrame_
Main window of the application.
Definition: OSEd.hh:67
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
OSEdMainFrame
Definition: OSEdMainFrame.hh:49
Environment::confPath
static TCEString confPath(const std::string &fileName)
Definition: Environment.cc:277
OSEdOptions::loadState
virtual void loadState(const ObjectState *state)
Definition: OSEdOptions.cc:79
OSEd::options_
OSEdOptions * options_
Options of the application.
Definition: OSEd.hh:69
Application::initialize
static void initialize()
Definition: Application.cc:99
OSEdOptionsSerializer::setSourceFile
void setSourceFile(const std::string &fileName)
Definition: OSEdOptionsSerializer.cc:89
OSEdTextGenerator::instance
static OSEdTextGenerator & instance()
Definition: OSEdTextGenerator.cc:214
OSEdTextGenerator
Definition: OSEdTextGenerator.hh:42
OSEdTreeView::constructTree
std::vector< std::string > constructTree()
Definition: OSEdTreeView.cc:90
OSEdOptions
Definition: OSEdOptions.hh:46
OSEdMainFrame::updateMenuBar
void updateMenuBar()
Definition: OSEdMainFrame.cc:279
OSEdConstants::CONF_FILE_NAME
static const std::string CONF_FILE_NAME
Configuration file name.
Definition: OSEdConstants.hh:78
OSEd::createDefaultOptions
void createDefaultOptions()
Definition: OSEd.cc:163
WxConversion::toCStringArray
static char ** toCStringArray(size_t elements, wxChar **source)
Definition: WxConversion.cc:123