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

#include <OSEdOptions.hh>

Inheritance diagram for OSEdOptions:
Inheritance graph
Collaboration diagram for OSEdOptions:
Collaboration graph

Public Member Functions

 OSEdOptions ()
 
virtual ~OSEdOptions ()
 
std::string editor () const
 
void setEditor (const std::string &editor)
 
virtual void loadState (const ObjectState *state)
 
ObjectStatesaveState () const
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 

Private Member Functions

 OSEdOptions (const OSEdOptions &)
 Copying not allowed. More...
 
OSEdOptionsoperator= (const OSEdOptions &)
 Assignment not allowed. More...
 

Private Attributes

std::string editor_
 Editor used to edit operation behavior files. More...
 

Detailed Description

Class that represents the OSEd options.

Options are stored in XML file.

Definition at line 46 of file OSEdOptions.hh.

Constructor & Destructor Documentation

◆ OSEdOptions() [1/2]

OSEdOptions::OSEdOptions ( )

Constructor.

Definition at line 44 of file OSEdOptions.cc.

44  : editor_("") {
45 }

◆ ~OSEdOptions()

OSEdOptions::~OSEdOptions ( )
virtual

Destructor.

Definition at line 50 of file OSEdOptions.cc.

50  {
51 }

◆ OSEdOptions() [2/2]

OSEdOptions::OSEdOptions ( const OSEdOptions )
private

Copying not allowed.

Member Function Documentation

◆ editor()

string OSEdOptions::editor ( ) const

Returns the editor.

Returns
The editor.

Definition at line 59 of file OSEdOptions.cc.

59  {
60  return editor_;
61 }

References editor_.

Referenced by saveState(), and setEditor().

◆ loadState()

void OSEdOptions::loadState ( const ObjectState state)
virtual

Loads the state from the object tree.

Parameters
stateThe to be loaded.

Implements Serializable.

Definition at line 79 of file OSEdOptions.cc.

79  {
80  try {
81  for (int i = 0; i < state->childCount(); i++) {
82  ObjectState* child = state->child(i);
83  if (child->name() == OSED_EDITOR) {
84  editor_ = child->stringValue();
85  }
86  }
87  } catch (const Exception& e) {
88  string method = "OSEdOptions::loadState()";
89  string msg = "Problems loading state: " + e.errorMessage();
90  throw ObjectStateLoadingException(__FILE__, __LINE__, method, msg);
91  }
92 }

References ObjectState::child(), ObjectState::childCount(), editor_, Exception::errorMessage(), ObjectState::name(), OSED_EDITOR, and ObjectState::stringValue().

Referenced by OSEd::OnInit().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.

◆ saveState()

ObjectState * OSEdOptions::saveState ( ) const
virtual

Saves the state of the options in ObjectState tree.

Returns
The created ObjectState tree.

Implements Serializable.

Definition at line 100 of file OSEdOptions.cc.

100  {
101  ObjectState* root = new ObjectState(OSED_CONF);
103  editor->setValue(editor_);
104  root->addChild(editor);
105  return root;
106 }

References ObjectState::addChild(), editor(), editor_, OSED_CONF, and OSED_EDITOR.

Referenced by OSEd::createDefaultOptions().

Here is the call graph for this function:

◆ setEditor()

void OSEdOptions::setEditor ( const std::string &  editor)

Sets the editor.

Parameters
editor.Editor to be set.

Definition at line 69 of file OSEdOptions.cc.

69  {
70  editor_ = editor;
71 }

References editor(), and editor_.

Referenced by OSEd::createDefaultOptions().

Here is the call graph for this function:

Member Data Documentation

◆ editor_

std::string OSEdOptions::editor_
private

Editor used to edit operation behavior files.

Definition at line 63 of file OSEdOptions.hh.

Referenced by editor(), loadState(), saveState(), and setEditor().


The documentation for this class was generated from the following files:
OSEdOptions::editor_
std::string editor_
Editor used to edit operation behavior files.
Definition: OSEdOptions.hh:63
ObjectStateLoadingException
Definition: Exception.hh:551
ObjectState
Definition: ObjectState.hh:59
OSED_CONF
const string OSED_CONF
Definition: OSEdOptions.cc:38
ObjectState::child
ObjectState * child(int index) const
Definition: ObjectState.cc:471
ObjectState::addChild
void addChild(ObjectState *child)
Definition: ObjectState.cc:376
ObjectState::childCount
int childCount() const
Exception
Definition: Exception.hh:54
ObjectState::name
std::string name() const
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
OSED_EDITOR
const string OSED_EDITOR
Definition: OSEdOptions.cc:39
ObjectState::stringValue
std::string stringValue() const
OSEdOptions::editor
std::string editor() const
Definition: OSEdOptions.cc:59