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

#include <OSEdOptionsSerializer.hh>

Inheritance diagram for OSEdOptionsSerializer:
Inheritance graph
Collaboration diagram for OSEdOptionsSerializer:
Collaboration graph

Public Member Functions

 OSEdOptionsSerializer ()
 
virtual ~OSEdOptionsSerializer ()
 
virtual void writeState (const ObjectState *state)
 
virtual ObjectStatereadState ()
 
void setSourceFile (const std::string &fileName)
 
void setDestinationFile (const std::string &fileName)
 
void setSchemaFile (const std::string &fileName)
 
void setUseSchema (bool useSchema)
 
- Public Member Functions inherited from TCETools::Serializer
virtual ~Serializer ()
 

Private Member Functions

 OSEdOptionsSerializer (const OSEdOptionsSerializer &)
 Copying not allowed. More...
 
OSEdOptionsSerializeroperator= (const OSEdOptionsSerializer &)
 Assignment not allowed. More...
 

Private Attributes

XMLSerializer serializer_
 Instance of XMLSerializer. More...
 

Detailed Description

Constructs the ObjectState tree that represents the options of OSEd.

Definition at line 44 of file OSEdOptionsSerializer.hh.

Constructor & Destructor Documentation

◆ OSEdOptionsSerializer() [1/2]

OSEdOptionsSerializer::OSEdOptionsSerializer ( )

Constructor.

Definition at line 40 of file OSEdOptionsSerializer.cc.

40  : Serializer() {
41 }

◆ ~OSEdOptionsSerializer()

OSEdOptionsSerializer::~OSEdOptionsSerializer ( )
virtual

Destructor.

Definition at line 46 of file OSEdOptionsSerializer.cc.

46  {
47 }

◆ OSEdOptionsSerializer() [2/2]

OSEdOptionsSerializer::OSEdOptionsSerializer ( const OSEdOptionsSerializer )
private

Copying not allowed.

Member Function Documentation

◆ operator=()

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

Assignment not allowed.

◆ readState()

ObjectState * OSEdOptionsSerializer::readState ( )
virtual

Reads the options file and returns the corresponding ObjectState tree.

Returns
The read ObjectState tree.

Implements TCETools::Serializer.

Definition at line 71 of file OSEdOptionsSerializer.cc.

71  {
72  ObjectState* root = NULL;
73  try {
74  root = serializer_.readState();
75  } catch (const Exception& e) {
76  string method = "OSEdOptionsSerializer::readState()";
77  string msg = "Problems reading the state: " + e.errorMessage();
78  throw SerializerException(__FILE__, __LINE__, method, msg);
79  }
80  return root;
81 }

References Exception::errorMessage(), XMLSerializer::readState(), and serializer_.

Referenced by OSEd::OnInit().

Here is the call graph for this function:

◆ setDestinationFile()

void OSEdOptionsSerializer::setDestinationFile ( const std::string &  fileName)

Sets the destination file.

Parameters
fileNameThe name of the file.

Definition at line 99 of file OSEdOptionsSerializer.cc.

99  {
101 }

References serializer_, and XMLSerializer::setDestinationFile().

Referenced by OSEd::createDefaultOptions(), and OSEdOptionsDialog::onSave().

Here is the call graph for this function:

◆ setSchemaFile()

void OSEdOptionsSerializer::setSchemaFile ( const std::string &  fileName)

Sets the schema file.

Parameters
fileNameThe name of the file.

Definition at line 109 of file OSEdOptionsSerializer.cc.

109  {
110  serializer_.setSchemaFile(fileName);
111 }

References serializer_, and XMLSerializer::setSchemaFile().

Here is the call graph for this function:

◆ setSourceFile()

void OSEdOptionsSerializer::setSourceFile ( const std::string &  fileName)

Sets the source file.

Parameters
fileNameThe name of the file.

Definition at line 89 of file OSEdOptionsSerializer.cc.

89  {
90  serializer_.setSourceFile(fileName);
91 }

References serializer_, and XMLSerializer::setSourceFile().

Referenced by OSEd::OnInit().

Here is the call graph for this function:

◆ setUseSchema()

void OSEdOptionsSerializer::setUseSchema ( bool  useSchema)

Modifies the usage of schema file (yes/no).

Parameters
useSchemaTrue or false, depending on if schema should be used or not.

Definition at line 119 of file OSEdOptionsSerializer.cc.

119  {
120  serializer_.setUseSchema(useSchema);
121 }

References serializer_, and XMLSerializer::setUseSchema().

Here is the call graph for this function:

◆ writeState()

void OSEdOptionsSerializer::writeState ( const ObjectState state)
virtual

Writes the object state tree to XML file.

Parameters
stateState to be written.

Implements TCETools::Serializer.

Definition at line 55 of file OSEdOptionsSerializer.cc.

55  {
56  try {
57  serializer_.writeState(state);
58  } catch (const Exception& e) {
59  string method = "OSEdOptionsSerializer::writeState()";
60  string msg = "Problems writing the state: " + e.errorMessage();
61  throw SerializerException(__FILE__, __LINE__, method, msg);
62  }
63 }

References Exception::errorMessage(), serializer_, and XMLSerializer::writeState().

Referenced by OSEd::createDefaultOptions(), and OSEdOptionsDialog::onSave().

Here is the call graph for this function:

Member Data Documentation

◆ serializer_

XMLSerializer OSEdOptionsSerializer::serializer_
private

The documentation for this class was generated from the following files:
XMLSerializer::setSourceFile
void setSourceFile(const std::string &fileName)
Definition: XMLSerializer.cc:115
OSEdOptionsSerializer::serializer_
XMLSerializer serializer_
Instance of XMLSerializer.
Definition: OSEdOptionsSerializer.hh:64
ObjectState
Definition: ObjectState.hh:59
XMLSerializer::setSchemaFile
void setSchemaFile(const std::string &fileName)
Definition: XMLSerializer.cc:168
XMLSerializer::readState
virtual ObjectState * readState()
Definition: XMLSerializer.cc:200
XMLSerializer::setDestinationFile
void setDestinationFile(const std::string &fileName)
Definition: XMLSerializer.cc:142
TCETools::Serializer
Definition: Serializer.hh:45
SerializerException
Definition: Exception.hh:675
Exception
Definition: Exception.hh:54
XMLSerializer::setUseSchema
void setUseSchema(bool useSchema)
Definition: XMLSerializer.cc:179
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
XMLSerializer::writeState
virtual void writeState(const ObjectState *rootState)
Definition: XMLSerializer.cc:219